Revert. This isn't the correct way to go.
authorBill Wendling <isanbard@gmail.com>
Thu, 15 Jul 2010 23:42:21 +0000 (23:42 +0000)
committerBill Wendling <isanbard@gmail.com>
Thu, 15 Jul 2010 23:42:21 +0000 (23:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108478 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
test/CodeGen/PowerPC/2008-01-25-EmptyFunction.ll
test/CodeGen/X86/2008-01-25-EmptyFunction.ll

index 1fa887c69e0e8b615edb494e47b80a9a99ba5545..458e865a6b3c804c1470007f934031941415a777 100644 (file)
@@ -796,7 +796,6 @@ void SelectionDAGBuilder::visit(unsigned Opcode, const User &I) {
 #define HANDLE_INST(NUM, OPCODE, CLASS) \
     case Instruction::OPCODE: visit##OPCODE((CLASS&)I); break;
 #include "llvm/Instruction.def"
-#undef HANDLE_INST
   }
 
   // Assign the ordering to the freshly created DAG nodes.
@@ -2195,19 +2194,6 @@ void SelectionDAGBuilder::visitIndirectBr(const IndirectBrInst &I) {
                           getValue(I.getAddress())));
 }
 
-void SelectionDAGBuilder::visitUnreachable(const UnreachableInst &I) {
-  // If the function consists of a single "unreachable" instruction, emit a
-  // "trap". This prevents the back-ends from generating empty functions or
-  // functions which have a prologue, but no epilogue.
-  const BasicBlock *BB = I.getParent();
-  const Function *F = BB->getParent();
-
-  if (F->size() == 1 && BB->size() == 1 &&
-      isa<UnreachableInst>(BB->getTerminator()))
-      DAG.setRoot(DAG.getNode(ISD::TRAP, getCurDebugLoc(),
-                              MVT::Other, getRoot()));
-}
-
 void SelectionDAGBuilder::visitFSub(const User &I) {
   // -0.0 - X --> fneg
   const Type *Ty = I.getType();
index 86216375a5e2c551044298c2eaed76ba6f6a7f76..46733d6db124162d4dd4bf87ac5d8a85fe62039e 100644 (file)
@@ -385,7 +385,7 @@ private:
   void visitBr(const BranchInst &I);
   void visitSwitch(const SwitchInst &I);
   void visitIndirectBr(const IndirectBrInst &I);
-  void visitUnreachable(const UnreachableInst &I);
+  void visitUnreachable(const UnreachableInst &I) { /* noop */ }
 
   // Helpers for visitSwitch
   bool handleSmallSwitchRange(CaseRec& CR,
index ba59309ec2b8f21e6877078ae3fe2b7a6654f669..db2ab877ff7d22d032cdbadd8e9d5941241ba8eb 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llc < %s -march=ppc32 | grep trap
+; RUN: llc < %s -march=ppc32 | grep nop
 target triple = "powerpc-apple-darwin8"
 
 
index 4baa294fb88d3681e3e389637a0bdbe9e7760107..b936686798f03121bec85a109992231a66fa44de 100644 (file)
@@ -1,17 +1,8 @@
-; RUN: llc < %s -march=x86 | FileCheck -check-prefix=NO-FP %s
-; RUN: llc < %s -march=x86 -disable-fp-elim | FileCheck -check-prefix=FP %s
+; RUN: llc < %s -march=x86 | grep nop
 target triple = "i686-apple-darwin8"
 
-define void @func1() noreturn nounwind  {
-entry:
-; NO-FP: ud2
-        unreachable
-}
 
-define void @func2() noreturn nounwind  {
+define void @bork() noreturn nounwind  {
 entry:
-; FP: pushl %ebp
-; FP: movl %esp, %ebp
-; FP: ud2
         unreachable
 }