git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120325
91177308-0d34-0410-b5e6-
96231b3b80d8
&BB);
}
- // If not a definite must-alias dependency, ignore it.
- if (!InstDep.isDef())
+ // If not a definite must-alias store dependency, ignore it. If this is a
+ // load from the same pointer, we don't want to transform load+store into
+ // a noop.
+ if (!InstDep.isDef() || !isa<StoreInst>(InstDep.getInst()))
continue;
}
; CHECK: @test2
; CHECK-NEXT: store i32 20
}
+
+
+; PR8677
+@g = global i32 1
+
+define i32 @test3(i32* %g_addr) nounwind {
+; CHECK: @test3
+; CHEcK: load i32* %g_addr
+ %g_value = load i32* %g_addr, align 4
+ store i32 -1, i32* @g, align 4
+ store i32 %g_value, i32* %g_addr, align 4
+ %tmp3 = load i32* @g, align 4
+ ret i32 %tmp3
+}