[PATCH] D142535: [DAGCombine] Fold redundant select
Sam Parker via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 25 06:09:31 PST 2023
samparker created this revision.
samparker added reviewers: RKSimon, craig.topper.
Herald added subscribers: luke, pmatos, asb, armkevincheng, sjarus, eric-k256, frasercrmck, ecnelises, luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, jgravelle-google, sbc100, dschuff.
Herald added a project: All.
samparker requested review of this revision.
Herald added subscribers: pcwang-thead, MaskRay, aheejin.
Herald added a project: LLVM.
If a chain of two selects share a true/false value and are controlled by two setcc nodes, that are never both true, we can fold away one of the selects. The setcc check is currently limited to seteq with a constant. So, the following
(select (setcc X, const0, eq), Y,
(select (setcc X, const1, eq), Z, Y))
Can be combined to:
select (setcc X, const1, eq) Z, Y
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D142535
Files:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/RISCV/fpclamptosat_vec.ll
llvm/test/CodeGen/WebAssembly/fpclamptosat.ll
llvm/test/CodeGen/WebAssembly/fpclamptosat_vec.ll
llvm/test/CodeGen/X86/fpclamptosat_vec.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142535.492082.patch
Type: text/x-patch
Size: 11899 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230125/a71218b9/attachment-0001.bin>
More information about the llvm-commits
mailing list