[PATCH] D57401: [DAGCombiner] fold add/sub with bool operand based on target's boolean contents

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 29 10:51:06 PST 2019


spatel created this revision.
spatel added reviewers: efriedma, lebedev.ri, RKSimon.
Herald added subscribers: jsji, javed.absar, nemanjai, mcrosier.

I noticed that we are missing this canonicalization in IR:
rL352515 <https://reviews.llvm.org/rL352515>
...and then realized that we don't get this right in SDAG either, so this has to be fixed first regardless of what we choose to do in IR.

The existing fold was limited to scalars and using the wrong predicate to guard the transform. We have a boolean contents TLI query that can be used to decide which direction to fold.

This may eventually lead back to the problems/question in:
https://bugs.llvm.org/show_bug.cgi?id=40486
...but it makes no difference to that yet.


https://reviews.llvm.org/D57401

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/AArch64/bool-ext-inc.ll
  test/CodeGen/PowerPC/bool-math.ll
  test/CodeGen/PowerPC/select_const.ll
  test/CodeGen/PowerPC/signbit-shift.ll
  test/CodeGen/X86/bool-ext-inc.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57401.184121.patch
Type: text/x-patch
Size: 5372 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190129/b02d2e57/attachment.bin>


More information about the llvm-commits mailing list