diff options
author | Matthias Braun <matthiasb@fb.com> | 2021-09-27 17:57:22 -0700 |
---|---|---|
committer | Matthias Braun <matthiasb@fb.com> | 2021-11-03 14:12:23 -0700 |
commit | 847a6807332b13f43704327c2d30103ec0347c77 (patch) | |
tree | 3580560d675721190b1eb5b2edb107f95e046170 /clang/lib/Frontend/InitPreprocessor.cpp | |
parent | 870fc844d11e3e7b75bf62858953e08df1b1d94c (diff) | |
download | llvm-847a6807332b13f43704327c2d30103ec0347c77.zip llvm-847a6807332b13f43704327c2d30103ec0347c77.tar.gz llvm-847a6807332b13f43704327c2d30103ec0347c77.tar.bz2 |
X86InstrInfo: Support immediates that are +1/-1 different in optimizeCompareInstr
This is a re-commit of e2c7ee0743592e39274e28dbe0d0c213ba342317 which
was reverted in a2a58d91e82db38fbdf88cc317dcb3753d79d492. This includes
a fix to consistently check for EFLAGS being live-out. See phabricator
review.
Original Summary:
This extends `optimizeCompareInstr` to re-use previous comparison
results if the previous comparison was with an immediate that was 1
bigger or smaller. Example:
CMP x, 13
...
CMP x, 12 ; can be removed if we change the SETg
SETg ... ; x > 12 changed to `SETge` (x >= 13) removing CMP
Motivation: This often happens because SelectionDAG canonicalization
tends to add/subtract 1 often when optimizing for fallthrough blocks.
Example for `x > C` the fallthrough optimization switches true/false
blocks with `!(x > C)` --> `x <= C` and canonicalization turns this into
`x < C + 1`.
Differential Revision: https://reviews.llvm.org/D110867
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
0 files changed, 0 insertions, 0 deletions