[PATCH] D98905: [SystemZ] Reuse known zeros/ones after zero-extension of i1.
Jonas Paulsson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 9 04:59:21 PDT 2021
jonpa updated this revision to Diff 336398.
jonpa added a comment.
Patch improved:
- Avoid transforming single-use loads - it is probably better to do a compare with memory.
- Add an AssertZext node on the reused register so that it is known that this is an i1.
- Avoid some cases where i32 setcc is zero-extended.
- Option to try single user only
Benchmarking (also showing the sibling patch "ISelCleanup.cpp"):
master <> SETCC (DAG patch)
lhi : 225040 220226 -4814
lghi : 445603 443127 -2476
lr : 61869 62835 +966
lgr : 853946 854446 +500
...
master <> SETCC (DAG patch), no multiple users
lhi : 225040 221382 -3658
lghi : 445603 443220 -2383
lgr : 853946 854483 +537
lr : 61869 62170 +301
...
master <> ISelCleanup pass
lhi : 225040 220233 -4807
lghi : 445603 443111 -2492
lr : 61869 62836 +967
lgr : 853946 854446 +500
...
master <> ISelCleanup pass, no multiple users
lhi : 225040 221740 -3300
lghi : 445603 443562 -2041
lgr : 853946 854384 +438
lr : 61869 61961 +92
...
Static improvements above show reduced number of immediate loads and some extra register moves. Limiting to only the cases of one user of compare operand gives less new register moves, but still some... (not sure why).
This patch is now closer to the ISelCleanup pass in the output differences above.
Measurements (quick nightly run):
Not much changes - have seen some 1% improvements but also some regressions.
Xalancbmk:
Z14: regresses with a couple of percent except with "IselCleanup, no multiple users", which is the least aggressive change.
Z15: improves with one percent with multiple users, regresses with one percent with no multiple users. Random effect, it seems...
Deepsjeng, Z15: regresses with "DAG patch", but only with "no multiple users", which indicates some random effect since that is a lesser change than with "multiple users"...
The only version so far that has no regressions on both machines (and is if anything a very slight improvement) is the last one "IselCleanup, no multiple users".
Conclusions:
- There seems to be no clear direct benchmark improvement, although there are a few thousand less immediate loads. This is probably because the immediate loads should generally be invisible on the OOO machine.
- The patches are non-trivial so it seems perhaps difficult to motivate them given these measurements.
Remaining ideas:
- Perhaps the ISelCleanup code could be used as a basis to use with the PeepholeOptimizer. I will try that next.
- Maybe look into more in detail where the remaining extra register moves come from.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98905/new/
https://reviews.llvm.org/D98905
Files:
llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
llvm/lib/Target/SystemZ/SystemZISelLowering.h
llvm/test/CodeGen/SystemZ/setcc-05.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98905.336398.patch
Type: text/x-patch
Size: 11108 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210409/d6b81543/attachment.bin>
More information about the llvm-commits
mailing list