[PATCH] D93191: [DAGCombine][PowerPC] Fold select_cc constants when comparing zero into trivial ops

Kai Luo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 13 21:41:31 PST 2020


lkail created this revision.
lkail added reviewers: RKSimon, spatel, steven.zhang, jsji, PowerPC.
Herald added subscribers: shchenz, kbarton, hiraditya, nemanjai.
lkail requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Fold `select_cc x, 0, const0, const1, lt` into `sub (z, and ((sra x, sizeof(x)-1), z - y))`, see https://alive2.llvm.org/ce/z/jqcf8t. Since this optz is not always profitable, so I add a target hook in this patch. I'm not sure it's appropriate to do so in `DAGCombiner`, since it looks ad-hoc.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93191

Files:
  llvm/include/llvm/CodeGen/TargetLowering.h
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/lib/Target/PowerPC/PPCISelLowering.h
  llvm/test/CodeGen/PowerPC/select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93191.311484.patch
Type: text/x-patch
Size: 7089 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201214/f57cfc1f/attachment.bin>


More information about the llvm-commits mailing list