forked from OSchip/llvm-project
[DSE,MSSA] Delete instructions after printing it.
Also enables a now-passing test case, that exposed a crash caused by the wrong order.
This commit is contained in:
parent
cb8a0ba829
commit
8c61f13a0f
|
@ -1945,9 +1945,9 @@ bool eliminateDeadStoresMemorySSA(Function &F, AliasAnalysis &AA,
|
|||
// Check if we're storing a value that we just loaded.
|
||||
if (auto *Load = dyn_cast<LoadInst>(SI->getOperand(0))) {
|
||||
if (storeIsNoop(MSSA, Load, KillingDef)) {
|
||||
State.deleteDeadInstruction(SI);
|
||||
LLVM_DEBUG(dbgs() << "DSE: Remove Dead Store:\n DEAD: " << *SI
|
||||
<< '\n');
|
||||
State.deleteDeadInstruction(SI);
|
||||
NumNoopStores++;
|
||||
MadeChange = true;
|
||||
continue;
|
||||
|
|
|
@ -11,16 +11,6 @@ target triple = "x86_64-apple-macosx10.7.0"
|
|||
@x = common global i32 0, align 4
|
||||
@y = common global i32 0, align 4
|
||||
|
||||
; DSE no-op unordered atomic store (allowed)
|
||||
define void @test6() {
|
||||
; CHECK-LABEL: test6
|
||||
; CHECK-NOT: store
|
||||
; CHECK: ret void
|
||||
%x = load atomic i32, i32* @x unordered, align 4
|
||||
store atomic i32 %x, i32* @x unordered, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; DSE across monotonic load (allowed as long as the eliminated store isUnordered)
|
||||
define i32 @test9() {
|
||||
; CHECK-LABEL: test9
|
||||
|
|
|
@ -42,6 +42,16 @@ define void @test5() {
|
|||
ret void
|
||||
}
|
||||
|
||||
; DSE no-op unordered atomic store (allowed)
|
||||
define void @test6() {
|
||||
; CHECK-LABEL: test6
|
||||
; CHECK-NOT: store
|
||||
; CHECK: ret void
|
||||
%x = load atomic i32, i32* @x unordered, align 4
|
||||
store atomic i32 %x, i32* @x unordered, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; DSE seq_cst store (be conservative; DSE doesn't have infrastructure
|
||||
; to reason about atomic operations).
|
||||
define void @test7() {
|
||||
|
|
Loading…
Reference in New Issue