[PATCH] D91589: [DAGCombiner] Fold (sext (not i1 x)) -> (add (zext i1 x), -1)

Layton Kifer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 26 11:31:42 PST 2020


laytonio updated this revision to Diff 307908.
laytonio added a comment.

Use isBitwiseNot
Avoid folding cases where (not i1 x) can already be folded

Switch to only matching sign extends from scalar i1s. This is what the X86 backend is currently doing. I don't believe this transform is always better for vector types as it requires materializing an all ones vector.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91589/new/

https://reviews.llvm.org/D91589

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/AArch64/select_const.ll
  llvm/test/CodeGen/ARM/select_const.ll
  llvm/test/CodeGen/PowerPC/select_const.ll
  llvm/test/CodeGen/RISCV/sext-zext-trunc.ll
  llvm/test/CodeGen/SystemZ/sext-zext.ll
  llvm/test/CodeGen/X86/pr44140.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91589.307908.patch
Type: text/x-patch
Size: 10869 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201126/737d6ac0/attachment.bin>


More information about the llvm-commits mailing list