forked from OSchip/llvm-project
my previous patch would cause us to start deleting some volatile
stores, fix and add a testcase. llvm-svn: 120363
This commit is contained in:
parent
49408cef39
commit
c3c754f750
|
@ -222,7 +222,7 @@ bool DSE::runOnBasicBlock(BasicBlock &BB) {
|
|||
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);
|
||||
|
|
|
@ -34,3 +34,23 @@ define i32 @test3(i32* %g_addr) nounwind {
|
|||
%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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue