fix PR8067, an over-aggressive assertion in LICM.
authorChris Lattner <sabre@nondot.org>
Mon, 6 Sep 2010 05:11:24 +0000 (05:11 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 6 Sep 2010 05:11:24 +0000 (05:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113146 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LICM.cpp
test/Transforms/LICM/crash.ll

index 4cab33b30dc5750e382a640cdb1097c03d4812dd..0db7ba771b4c56ccf0f191dc55abe8b96dc99609 100644 (file)
@@ -681,10 +681,10 @@ void LICM::PromoteAliasSet(AliasSet &AS) {
       // it.
       if (isa<LoadInst>(Use))
         assert(!cast<LoadInst>(Use)->isVolatile() && "AST broken");
-      else if (isa<StoreInst>(Use))
-        assert(!cast<StoreInst>(Use)->isVolatile() && 
-               Use->getOperand(0) != ASIV && "AST broken");
-      else
+      else if (isa<StoreInst>(Use)) {
+        assert(!cast<StoreInst>(Use)->isVolatile() && "AST broken");
+        if (Use->getOperand(0) == ASIV) return;
+      else
         return; // Not a load or store.
       
       if (!GuaranteedToExecute)
index 325f250bd584982ce5d4064d328f7da1e9c8fc1e..d0b6d78db1a79b04dff44fd94f4abc654f8fa093 100644 (file)
@@ -25,3 +25,17 @@ for.cond.for.end10_crit_edge:                     ; preds = %for.cond
 for.end10:                                        ; preds = %for.cond.for.end10_crit_edge, %entry
   ret void
 }
+
+; PR8067
+@g_8 = external global i32, align 4
+
+define void @test2() noreturn nounwind ssp {
+entry:
+  br label %for.body
+
+for.body:                                         ; preds = %for.body, %entry
+  %tmp7 = load i32* @g_8, align 4
+  store i32* @g_8, i32** undef, align 16
+  store i32 undef, i32* @g_8, align 4
+  br label %for.body
+}