[PATCH] D120513: [DAGCombiner] Don't expand (neg (abs x)) if the abs has an additional user.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 24 12:47:18 PST 2022


craig.topper created this revision.
craig.topper added reviewers: spatel, RKSimon.
Herald added subscribers: frasercrmck, ecnelises, luismarques, apazos, sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
craig.topper requested review of this revision.
Herald added subscribers: pcwang-thead, MaskRay.
Herald added a project: LLVM.

If the types aren't legal, the expansions may get type legalized in a
different way preventing code sharing. If the type is legal, we will
share some instructions between the two expansions, but we will need an
extra register.

Since we don't appear to fold (neg (sub A, B)) if the sub has an
additional user, I think it makes sense not to expand NABS.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120513

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/test/CodeGen/RISCV/neg-abs.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120513.411216.patch
Type: text/x-patch
Size: 7605 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220224/024d269e/attachment.bin>


More information about the llvm-commits mailing list