[PATCH] D110867: X86InstrInfo: Support immediates that are +1/-1 different in optimizeCompareInstr
Matthias Braun via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 30 11:19:43 PDT 2021
MatzeB created this revision.
MatzeB added reviewers: RKSimon, craig.topper, nikic, manmanren.
Herald added subscribers: wenlei, pengfei, hiraditya, mcrosier.
MatzeB requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This extends `optimizeCompareInstr` to re-use previous comparison results if the previous comparison was with an immediate that was 1 bigger or smaller when this is possible by switching between `>=/>`, `</<=`, ...
Motivation: This case is not rare in practice as 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`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D110867
Files:
llvm/lib/Target/X86/X86InstrInfo.cpp
llvm/lib/Target/X86/X86InstrInfo.h
llvm/test/CodeGen/X86/jump_sign.ll
llvm/test/CodeGen/X86/optimize-compare.mir
llvm/test/CodeGen/X86/peep-test-5.ll
llvm/test/CodeGen/X86/use-cr-result-of-dom-icmp-st.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110867.376294.patch
Type: text/x-patch
Size: 18951 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210930/9b2662f2/attachment.bin>
More information about the llvm-commits
mailing list