[llvm] [CGP]: Optimize mul.overflow. (PR #148343)

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 17 02:30:52 PST 2025


================
@@ -6389,6 +6395,184 @@ bool CodeGenPrepare::optimizeGatherScatterInst(Instruction *MemoryInst,
   return true;
 }
 
+// This is a helper for CodeGenPrepare::optimizeMulWithOverflow.
+// Check the pattern we are interested in where there are maximum 2 uses
+// of the intrinsic which are the extract instructions.
+static bool matchOverflowPattern(Instruction *&I, ExtractValueInst *&MulExtract,
+                                 ExtractValueInst *&OverflowExtract) {
+  if (I->getNumUses() > 2)
----------------
aengelke wrote:

hasNUsesOrMore

https://github.com/llvm/llvm-project/pull/148343


More information about the llvm-commits mailing list