// 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;
@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
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() {