stores, fix and add a testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120363
91177308-0d34-0410-b5e6-
96231b3b80d8
if (StoreInst *SI = dyn_cast<StoreInst>(Inst)) {
if (LoadInst *DepLoad = dyn_cast<LoadInst>(InstDep.getInst())) {
if (SI->getPointerOperand() == DepLoad->getPointerOperand() &&
- SI->getOperand(0) == DepLoad) {
+ SI->getOperand(0) == DepLoad && !SI->isVolatile()) {
// DeleteDeadInstruction can delete the current instruction. Save BBI
// in case we need it.
WeakVH NextInst(BBI);
%tmp3 = load i32* @g, align 4
ret i32 %tmp3
}
+
+
+define void @test4(i32* %Q) {
+ %a = load i32* %Q
+ volatile store i32 %a, i32* %Q
+ ret void
+; CHECK: @test4
+; CHECK-NEXT: load i32
+; CHECK-NEXT: volatile store
+; CHECK-NEXT: ret void
+}
+
+define void @test5(i32* %Q) {
+ %a = volatile load i32* %Q
+ store i32 %a, i32* %Q
+ ret void
+; CHECK: @test5
+; CHECK-NEXT: volatile load
+; CHECK-NEXT: ret void
+}