[PATCH] D106607: [x86] improve CMOV codegen by hoisting add

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 22 15:15:53 PDT 2021


spatel created this revision.
spatel added reviewers: lebedev.ri, RKSimon, pengfei, craig.topper.
Herald added subscribers: hiraditya, mcrosier.
spatel requested review of this revision.
Herald added a project: LLVM.

This is not the transform direction we want in general, but by the time we have a CMOV, we've already tried everything else that could be better.
The transform increases the uses of the other add operand, but that is safe according to Alive2:
https://alive2.llvm.org/ce/z/Yn6p-A

We could probably extend this to other binops (not just add), but this is the motivating pattern discussed in:
https://llvm.org/PR51069

The test with i8 shows a missed fold because there's a trunc sitting in front of the add. I haven't checked to see what it would take to get that case.


https://reviews.llvm.org/D106607

Files:
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/add-cmov.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106607.360992.patch
Type: text/x-patch
Size: 4122 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210722/0424ccd8/attachment.bin>


More information about the llvm-commits mailing list