[PATCH] D132657: [DSE] Eliminate noop store even through has clobbering between LoadI and StoreI
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 21 02:12:32 PDT 2022
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1872
+ if (auto *CurrentStoreI =
+ dyn_cast<StoreInst>(CurrentDef->getMemoryInst()))
+ // Check alignment to ensure load or store does not access at an
----------------
This should use dyn_cast_or_null to account for liveOnEntry defs. Please add a test case like this, that currently crashes:
```
define void @test(i1 %c, ptr %p, ptr noalias %q) {
entry:
br i1 %c, label %if, label %join
if:
store i8 0, ptr %q, align 1
br label %join
join:
%v = load i8, ptr %q, align 1
store i8 0, ptr %p, align 1
store i8 %v, ptr %q, align 1
ret void
}
```
================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1875
+ // offset.
+ if (CurrentStoreI->getOperand(0) == LoadI &&
+ std::min(CurrentStoreI->getAlign(), LoadI->getAlign()) >=
----------------
nit: Prefer `getValueOperand()`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132657/new/
https://reviews.llvm.org/D132657
More information about the llvm-commits
mailing list