[PATCH] D145772: [Instcombine] Canonicalize all <=> patterns to (a>b)-(a<b)

chenglin.bi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 10 01:19:27 PST 2023


bcl5980 created this revision.
bcl5980 added reviewers: nikic, RKSimon, reames, spatel, arsenm.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
bcl5980 requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

Even though this canonicalization increases one instruction, it helps to generate better backend code.
And in D143373 <https://reviews.llvm.org/D143373> we have a combination on the pattern add (zext, sext). So canonicalize all select patterns to add(zext, sext).

Alive2 proof:
https://alive2.llvm.org/ce/z/RB6EEe
https://alive2.llvm.org/ce/z/EFZTwV
https://alive2.llvm.org/ce/z/ooqz8R

Fix: https://github.com/llvm/llvm-project/issues/60012


https://reviews.llvm.org/D145772

Files:
  llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
  llvm/test/Transforms/InstCombine/select-select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145772.504052.patch
Type: text/x-patch
Size: 20619 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230310/ba35c1c9/attachment.bin>


More information about the llvm-commits mailing list