fix PR8602, a bug in an assertion: a volatile store *of* a pointer
authorChris Lattner <sabre@nondot.org>
Sun, 19 Dec 2010 05:51:54 +0000 (05:51 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 19 Dec 2010 05:51:54 +0000 (05:51 +0000)
does not make the alias set for that pointer volatile, just stores
*to* the pointer.

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

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

index 3a6604357d440dea8f61cde5df5c3fc487f130d4..46fffccb3ac044b05cacd12312dfc0bbfad46684 100644 (file)
@@ -691,8 +691,8 @@ void LICM::PromoteAliasSet(AliasSet &AS) {
       if (isa<LoadInst>(Use))
         assert(!cast<LoadInst>(Use)->isVolatile() && "AST broken");
       else if (isa<StoreInst>(Use)) {
-        assert(!cast<StoreInst>(Use)->isVolatile() && "AST broken");
         if (Use->getOperand(0) == ASIV) return;
+        assert(!cast<StoreInst>(Use)->isVolatile() && "AST broken");
       } else
         return; // Not a load or store.
       
index 88be5c41ccc5a3ca241178c0b2d727399646abeb..ff7fa0b19a8206949ecd551b860ccc05cda3dce5 100644 (file)
@@ -59,3 +59,16 @@ for.end:                                          ; preds = %for.cond, %entry
 }
 
 declare i32* @test3helper(i32*)
+
+
+; PR8602
+@g_47 = external global i32, align 4
+
+define void @test4() noreturn nounwind {
+  br label %1
+
+; <label>:1                                       ; preds = %1, %0
+  volatile store i32* @g_47, i32** undef, align 8
+  store i32 undef, i32* @g_47, align 4
+  br label %1
+}