[PATCH] D53236: [SelectionDAG] swap select_cc operands to enable folding

Alexandros Lamprineas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 12 18:40:08 PDT 2018


labrinea created this revision.
labrinea added reviewers: llvm-commits, bogner.
Herald added a reviewer: javed.absar.

The DAGCombiner tries to SimplifySelectCC as follows:
`select_cc(x, y, 16, 0, cc) -> shl(zext(set_cc(x, y, cc)), 4)`
It can't cope with the situation of reordered operands:
`select_cc(x, y, 0, 16, cc) `
In that case we just need to swap the operands and invert the Condition Code:
`select_cc(x, y, 16, 0, ~cc) `


https://reviews.llvm.org/D53236

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/AArch64/select_cc.ll
  test/CodeGen/Thumb/branchless-cmp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53236.169531.patch
Type: text/x-patch
Size: 3267 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181013/cb00fe72/attachment.bin>


More information about the llvm-commits mailing list