[llvm] [InstCombine] Simplify multi use cast of Phi with constant inputs (PR #186621)

Andreas Jonson via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 14 13:33:20 PDT 2026


================
@@ -237,7 +237,13 @@ Instruction *InstCombinerImpl::commonCastTransforms(CastInst &CI) {
     // legal type.
     if (!Src->getType()->isIntegerTy() || !CI.getType()->isIntegerTy() ||
         shouldChangeType(CI.getSrcTy(), CI.getType()))
-      if (Instruction *NV = foldOpIntoPhi(CI, PN))
+      if (Instruction *NV = foldOpIntoPhi(
+              CI, PN,
+              /*AllowMultipleUses=*/
----------------
andjo403 wrote:

possible to set AllowMultipleUses to true as there is a check in foldOpIntoPhi that only allow multi use of the instruction if all inputs is simplified but maybe wast compile time?

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


More information about the llvm-commits mailing list