Skip to content

Commit 002d984

Browse files
committed
Update comments and unit test
1 parent a94a734 commit 002d984

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ static cl::opt<bool>
165165
OptimizeMemorySSA("dse-optimize-memoryssa", cl::init(true), cl::Hidden,
166166
cl::desc("Allow DSE to optimize memory accesses."));
167167

168+
// TODO: turn on and remove this flag.
168169
static cl::opt<bool> EnableInitializesImprovement(
169170
"enable-dse-initializes-attr-improvement", cl::init(false), cl::Hidden,
170171
cl::desc("Enable the initializes attr improvement in DSE"));
@@ -2364,6 +2365,9 @@ DSEState::eliminateDeadDefs(const MemoryLocationWrapper &KillingLocWrapper) {
23642365
}
23652366
continue;
23662367
}
2368+
// We cannot apply the initializes attribute to DeadAccess/DeadDef.
2369+
// It would incorrectly consider a call instruction as redundant store
2370+
// and remove this call instruction.
23672371
MemoryDefWrapper DeadDefWrapper(
23682372
cast<MemoryDef>(DeadAccess),
23692373
getLocForInst(cast<MemoryDef>(DeadAccess)->getMemoryInst(),

llvm/test/Transforms/DeadStoreElimination/inter-procedural.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2-
; RUN: opt < %s -aa-pipeline=basic-aa -passes=function-attrs,dse -enable-dse-initializes-attr-improvement -S | FileCheck %s
2+
; RUN: opt < %s -passes=dse -enable-dse-initializes-attr-improvement -S | FileCheck %s
33

44
declare void @p1_write_only(ptr nocapture noundef writeonly initializes((0, 2)) dead_on_unwind)
55
declare void @p1_write_then_read(ptr nocapture noundef initializes((0, 2)) dead_on_unwind)

0 commit comments

Comments
 (0)