[PATCH] D89647: [DSE] Use walker to skip noalias stores between current & clobber def.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 18 10:09:19 PDT 2020
fhahn created this revision.
fhahn added reviewers: asbirlea, george.burgess.iv, zoecarver.
Herald added subscribers: pengfei, dexonsmith, hiraditya.
Herald added a project: LLVM.
fhahn requested review of this revision.
Instead of getting the defining access we should be able to use
getClobberingMemoryAccess to skip non-aliasing MemoryDefs. No additional
checks should be needed, because we only remove the starting def if it
matches the defining access of the load. All we need to worry about is
that there are no (may)alias stores between the starting def and the
load and getClobberingMemoryAccess should guarantee that.
Partly fixes PR47887.
This improves the number of redundant stores removed in some cases
(numbers below for MultiSource, SPEC2000, SPEC2006 on X86 with -flto
-O3).
Same hash: 226 (filtered out)
Remaining: 11
Metric: dse.NumRedundantStores
Program base patch1 diff
test-suite...:: External/Povray/povray.test 1.00 5.00 400.0%
test-suite...chmarks/MallocBench/gs/gs.test 1.00 3.00 200.0%
test-suite...0/253.perlbmk/253.perlbmk.test 21.00 37.00 76.2%
test-suite...0.perlbench/400.perlbench.test 24.00 37.00 54.2%
test-suite.../Applications/SPASS/SPASS.test 3.00 4.00 33.3%
test-suite...006/453.povray/453.povray.test 15.00 18.00 20.0%
test-suite...T2006/445.gobmk/445.gobmk.test 27.00 29.00 7.4%
test-suite.../CINT2006/403.gcc/403.gcc.test 136.00 137.00 0.7%
test-suite.../CINT2000/176.gcc/176.gcc.test 6.00 6.00 0.0%
test-suite.../Benchmarks/Bullet/bullet.test NaN 3.00 nan%
test-suite.../Benchmarks/Ptrdist/bc/bc.test NaN 1.00 nan%
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D89647
Files:
llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
llvm/test/Transforms/DeadStoreElimination/MSSA/noop-stores.ll
Index: llvm/test/Transforms/DeadStoreElimination/MSSA/noop-stores.ll
===================================================================
--- llvm/test/Transforms/DeadStoreElimination/MSSA/noop-stores.ll
+++ llvm/test/Transforms/DeadStoreElimination/MSSA/noop-stores.ll
@@ -15,7 +15,6 @@
define void @test_load_volatile(i32* %Q) {
; CHECK-LABEL: @test_load_volatile(
; CHECK-NEXT: [[A:%.*]] = load volatile i32, i32* [[Q:%.*]], align 4
-; CHECK-NEXT: store i32 [[A]], i32* [[Q]], align 4
; CHECK-NEXT: ret void
;
%a = load volatile i32, i32* %Q
@@ -284,9 +283,7 @@
define void @test_noalias_store_between_load_and_store(i32* noalias %x, i32* noalias %y) {
; CHECK-LABEL: @test_noalias_store_between_load_and_store(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[LV:%.*]] = load i32, i32* [[X:%.*]], align 4
; CHECK-NEXT: store i32 0, i32* [[Y:%.*]], align 4
-; CHECK-NEXT: store i32 [[LV]], i32* [[X]], align 4
; CHECK-NEXT: ret void
;
entry:
Index: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -2417,7 +2417,8 @@
// adding them to a worklist. Bail when we run into a memory def that
// does not match LoadAccess.
SetVector<MemoryAccess *> ToCheck;
- MemoryAccess *Current = Def->getDefiningAccess();
+ MemoryAccess *Current =
+ MSSA.getWalker()->getClobberingMemoryAccess(Def);
// We don't want to bail when we run into the store memory def. But,
// the phi access may point to it. So, pretend like we've already
// checked it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89647.298880.patch
Type: text/x-patch
Size: 1725 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201018/6e71ab11/attachment.bin>
More information about the llvm-commits
mailing list