[llvm] 8c61f13 - [DSE,MSSA] Delete instructions after printing it.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 15 08:02:05 PDT 2020
Author: Florian Hahn
Date: 2020-06-15T16:01:36+01:00
New Revision: 8c61f13a0f7cb4078b3dd4481c89b48fe4a50f77
URL: https://github.com/llvm/llvm-project/commit/8c61f13a0f7cb4078b3dd4481c89b48fe4a50f77
DIFF: https://github.com/llvm/llvm-project/commit/8c61f13a0f7cb4078b3dd4481c89b48fe4a50f77.diff
LOG: [DSE,MSSA] Delete instructions after printing it.
Also enables a now-passing test case, that exposed a crash caused by the
wrong order.
Added:
Modified:
llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
llvm/test/Transforms/DeadStoreElimination/MSSA/atomic-todo.ll
llvm/test/Transforms/DeadStoreElimination/MSSA/atomic.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index 45b7814b8f9b..2b77d0615bbe 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -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;
diff --git a/llvm/test/Transforms/DeadStoreElimination/MSSA/atomic-todo.ll b/llvm/test/Transforms/DeadStoreElimination/MSSA/atomic-todo.ll
index 2a1fbde23958..d27ac812fc20 100644
--- a/llvm/test/Transforms/DeadStoreElimination/MSSA/atomic-todo.ll
+++ b/llvm/test/Transforms/DeadStoreElimination/MSSA/atomic-todo.ll
@@ -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
diff --git a/llvm/test/Transforms/DeadStoreElimination/MSSA/atomic.ll b/llvm/test/Transforms/DeadStoreElimination/MSSA/atomic.ll
index 8a4515388f2d..73f6dd3e188b 100644
--- a/llvm/test/Transforms/DeadStoreElimination/MSSA/atomic.ll
+++ b/llvm/test/Transforms/DeadStoreElimination/MSSA/atomic.ll
@@ -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() {
More information about the llvm-commits
mailing list