[PATCH] D159328: [InstCombine][WIP] Don't canonicalize select of bools if it costs an instruction

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 31 18:29:31 PDT 2023


goldstein.w.n created this revision.
goldstein.w.n added reviewers: nikic, RKSimon.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
goldstein.w.n requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Proofs for new transforms: https://alive2.llvm.org/ce/z/j9o0D3

We current canonicalize `true` to the TrueVal operand and `false` to
the FalseVal operand in selects. This makes recognizing LogicalAnd /
LogicalOr patterns easier but often costs an instruction.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159328

Files:
  llvm/lib/Transforms/InstCombine/InstCombineInternal.h
  llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
  llvm/test/Transforms/InstCombine/branch.ll
  llvm/test/Transforms/InstCombine/icmp-select.ll
  llvm/test/Transforms/InstCombine/icmp-with-selects.ll
  llvm/test/Transforms/InstCombine/nested-select.ll
  llvm/test/Transforms/InstCombine/not.ll
  llvm/test/Transforms/InstCombine/select-and-or.ll
  llvm/test/Transforms/InstCombine/select-bitext.ll
  llvm/test/Transforms/InstCombine/select-safe-transforms.ll
  llvm/test/Transforms/InstCombine/select.ll
  llvm/test/Transforms/InstCombine/sink-not-into-logical-and.ll
  llvm/test/Transforms/InstCombine/sink-not-into-logical-or.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159328.555224.patch
Type: text/x-patch
Size: 33027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230901/dfc66f2a/attachment.bin>


More information about the llvm-commits mailing list