[PATCH] D113300: [SelectionDAG] Merge FoldConstantVectorArithmetic into FoldConstantArithmetic

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 5 10:46:31 PDT 2021


RKSimon created this revision.
RKSimon added reviewers: spatel, lebedev.ri, justice_adams, craig.topper.
Herald added subscribers: 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, asb, hiraditya.
RKSimon requested review of this revision.
Herald added a subscriber: MaskRay.
Herald added a project: LLVM.

This patch merges FoldConstantVectorArithmetic back into FoldConstantArithmetic.

Like FoldConstantVectorArithmetic we now handle vector ops with any operand count, but we currently still only handle binops for scalar types - this can be improved in future patches - in particular some common unary/trinary ops still have poor constant folding.

There's one change in functionality causing test changes - FoldConstantVectorArithmetic bails early if the build/splat vector isn't all constant (with some undefs) elements, but FoldConstantArithmetic doesn't - it instead attempts to fold the scalar nodes and bails if they fail to regenerate a constant/undef result, allowing some additional identity/undef patterns to be handled.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113300

Files:
  llvm/include/llvm/CodeGen/SelectionDAG.h
  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/test/CodeGen/RISCV/urem-seteq-illegal-types.ll
  llvm/test/CodeGen/X86/vselect-constants.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113300.385127.patch
Type: text/x-patch
Size: 16214 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211105/59895b74/attachment.bin>


More information about the llvm-commits mailing list