[PATCH] D37019: Add select simplifications

Michael Berg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 22 12:57:35 PDT 2017


mcberg2017 created this revision.

In these cases, two selects have constant selectable operands for
both the true and false components and have the same conditional expression.
We then create two arithmetic operations of the same type and feed a final
select operation using the result of the true arithmetic for the true operand
and the result of the false arithmetic for the false operand and reuse the original
conditionl expression. The arithmetic operations are naturally folded as a 
consequence, leaving only the newly formed select to replace the old arithmetic operation.


https://reviews.llvm.org/D37019

Files:
  lib/Transforms/InstCombine/InstCombineAddSub.cpp
  lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
  test/Transforms/InstCombine/select_arithmetic_01.ll
  test/Transforms/InstCombine/select_arithmetic_02.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37019.112210.patch
Type: text/x-patch
Size: 6110 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170822/47b96991/attachment.bin>


More information about the llvm-commits mailing list