[llvm] [CGP]: Optimize mul.overflow. (PR #148343)
Hassnaa Hamdi via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 10 20:12:49 PDT 2025
================
@@ -6403,6 +6409,229 @@ bool CodeGenPrepare::optimizeGatherScatterInst(Instruction *MemoryInst,
return true;
}
+// Rewrite the umul_with_overflow intrinsic by checking if both of the
+// operands' value range is within the legal type. If so, we can optimize the
+// multiplication algorithm. This code is supposed to be written during the step
+// of type legalization, but given that we need to reconstruct the IR which is
+// not doable there, we do it here.
+bool CodeGenPrepare::optimizeUMulWithOverflow(Instruction *I) {
+ // Enable this optimization only for aarch64.
+ if (!TLI->getTargetMachine().getTargetTriple().isAArch64())
+ return false;
----------------
hassnaaHamdi wrote:
Why? There is already a check testing if the target requires expanding the type, and if the new type is legal.
https://github.com/llvm/llvm-project/pull/148343
More information about the llvm-commits
mailing list