[PATCH] D42663: [DSE] make sure memory is not modified before partial store merging (PR36129)
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 30 05:55:46 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL323759: [DSE] make sure memory is not modified before partial store merging (PR36129) (authored by spatel, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D42663?vs=131880&id=131953#toc
Repository:
rL LLVM
https://reviews.llvm.org/D42663
Files:
llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
llvm/trunk/test/Transforms/DeadStoreElimination/merge-stores.ll
Index: llvm/trunk/test/Transforms/DeadStoreElimination/merge-stores.ll
===================================================================
--- llvm/trunk/test/Transforms/DeadStoreElimination/merge-stores.ll
+++ llvm/trunk/test/Transforms/DeadStoreElimination/merge-stores.ll
@@ -186,12 +186,14 @@
ret void
}
-; FIXME: We can't eliminate the last store because P and Q may alias.
+; We can't eliminate the last store because P and Q may alias.
define void @PR36129(i32* %P, i32* %Q) {
; CHECK-LABEL: @PR36129(
-; CHECK-NEXT: store i32 3, i32* [[P:%.*]]
+; CHECK-NEXT: store i32 1, i32* [[P:%.*]]
+; CHECK-NEXT: [[P2:%.*]] = bitcast i32* [[P]] to i8*
; CHECK-NEXT: store i32 2, i32* [[Q:%.*]]
+; CHECK-NEXT: store i8 3, i8* [[P2]]
; CHECK-NEXT: ret void
;
store i32 1, i32* %P
Index: llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -1172,7 +1172,8 @@
auto *Earlier = dyn_cast<StoreInst>(DepWrite);
auto *Later = dyn_cast<StoreInst>(Inst);
if (Earlier && isa<ConstantInt>(Earlier->getValueOperand()) &&
- Later && isa<ConstantInt>(Later->getValueOperand())) {
+ Later && isa<ConstantInt>(Later->getValueOperand()) &&
+ memoryIsNotModifiedBetween(Earlier, Later, AA)) {
// If the store we find is:
// a) partially overwritten by the store to 'Loc'
// b) the later store is fully contained in the earlier one and
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42663.131953.patch
Type: text/x-patch
Size: 1662 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180130/91d515f3/attachment.bin>
More information about the llvm-commits
mailing list