[PATCH] D113442: [InstCombine] Enable fold select into operand for FAdd, FMul, and FSub.

Huihui Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 8 16:27:23 PST 2021


huihuiz created this revision.
huihuiz added reviewers: lebedev.ri, spatel, efriedma, nikic, RKSimon.
huihuiz added a project: LLVM.
Herald added subscribers: dmgreen, hiraditya.
huihuiz requested review of this revision.

For FAdd, FMul, and FSub, fold select into one of the operands to enable
further optimizations, i.e., floating-point reduction detection.

Turn code:

  %C = fadd %A, %B
  %D = select %cond, %C, %A

into:

  %C = select %cond, %B, -0.000000e+00
  %D = fadd %A, %C


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113442

Files:
  llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
  llvm/test/Transforms/InstCombine/select-binop-cmp.ll
  llvm/test/Transforms/LoopVectorize/ARM/mve-selectandorcost.ll
  llvm/test/Transforms/LoopVectorize/reduction-inloop-pred.ll
  llvm/test/Transforms/LoopVectorize/reduction-inloop.ll
  llvm/test/Transforms/PhaseOrdering/AArch64/hoisting-sinking-required-for-vectorization.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113442.385653.patch
Type: text/x-patch
Size: 21758 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211109/526c20eb/attachment.bin>


More information about the llvm-commits mailing list