[PATCH] D143646: [RISCV] Return false from shouldFormOverflowOp

Liao Chunyu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 9 06:45:15 PST 2023


liaolucy created this revision.
liaolucy added reviewers: craig.topper, asb, reames.
Herald added subscribers: luke, VincentWu, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, arichardson.
Herald added a project: All.
liaolucy requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

This is related to the discussion in D142071 <https://reviews.llvm.org/D142071>. It can solve the regression in D142071 <https://reviews.llvm.org/D142071>.

I tested llvm/tests/Transforms/CodeGenPrepare/X86/overflow-intrinsics.ll, no new regression.

Usually MathUsed is Add->hasNUsesOrMore(2), for optbranch_64, the add just has two uses. 
MathUsed is true. If we could check these use must come from the same BB, perhaps MathUsed could be false.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143646

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.h


Index: llvm/lib/Target/RISCV/RISCVISelLowering.h
===================================================================
--- llvm/lib/Target/RISCV/RISCVISelLowering.h
+++ llvm/lib/Target/RISCV/RISCVISelLowering.h
@@ -477,6 +477,11 @@
   EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context,
                          EVT VT) const override;
 
+  bool shouldFormOverflowOp(unsigned Opcode, EVT VT,
+                            bool MathUsed) const override {
+    return TargetLowering::shouldFormOverflowOp(Opcode, VT, false);
+  }
+
   bool convertSetCCLogicToBitwiseLogic(EVT VT) const override {
     return VT.isScalarInteger();
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143646.496111.patch
Type: text/x-patch
Size: 647 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230209/e8136018/attachment.bin>


More information about the llvm-commits mailing list