aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
diff options
context:
space:
mode:
authorMatthias Braun <matthiasb@fb.com>2021-09-27 17:57:22 -0700
committerMatthias Braun <matthiasb@fb.com>2021-10-28 10:33:56 -0700
commite2c7ee0743592e39274e28dbe0d0c213ba342317 (patch)
treefdd0059b62ab09fe7a1480a16ceac32a2fc6bdd8 /llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
parent97a1570d8c31dc3bff12dd77b1ee824e1872bb69 (diff)
downloadllvm-e2c7ee0743592e39274e28dbe0d0c213ba342317.zip
llvm-e2c7ee0743592e39274e28dbe0d0c213ba342317.tar.gz
llvm-e2c7ee0743592e39274e28dbe0d0c213ba342317.tar.bz2
X86InstrInfo: Support immediates that are +1/-1 different in optimizeCompareInstr
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 'llvm/lib/CodeGen/TwoAddressInstructionPass.cpp')
0 files changed, 0 insertions, 0 deletions