Getting ADCE to interact well with unreachable instructions seems like a nontrivial
authorChris Lattner <sabre@nondot.org>
Sun, 17 Oct 2004 23:45:06 +0000 (23:45 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 17 Oct 2004 23:45:06 +0000 (23:45 +0000)
exercise that I'm not interested in tackling right now.  Just punt and treat them
like unwind's.

This 'fixes' test/Regression/Transforms/ADCE/unreachable-function.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17106 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/ADCE.cpp

index e1f228d6fab70e799c827b31d8b66a25d014f767..22b4c347dcb4a2dafe7699ab78d68cbd7b5dbb01 100644 (file)
@@ -233,8 +233,9 @@ bool ADCE::doADCE() {
           markInstructionLive(I);
         }
       } else if (I->mayWriteToMemory() || isa<ReturnInst>(I) ||
-                 isa<UnwindInst>(I)) {
-        // Unreachable instructions are not marked intrinsically live here.
+                 isa<UnwindInst>(I) || isa<UnreachableInst>(I)) {
+        // FIXME: Unreachable instructions should not be marked intrinsically
+        // live here.
        markInstructionLive(I);
       } else if (isInstructionTriviallyDead(I)) {
         // Remove the instruction from it's basic block...