[llvm] [InstCombine] Create new instructions instead of in-place operand replacement (PR #115988)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 28 08:06:21 PDT 2026


================
@@ -4098,11 +4107,8 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
     Value *Arg = II->getArgOperand(0);
     Value *Vect;
 
-    if (Value *NewOp =
-            simplifyReductionOperand(Arg, /*CanReorderLanes=*/true)) {
-      replaceUse(II->getOperandUse(0), NewOp);
-      return II;
-    }
+    if (Value *NewOp = simplifyReductionOperand(Arg, /*CanReorderLanes=*/true))
+      return replaceOperand(*II, 0, NewOp);
----------------
dtcxzyw wrote:

`simplifyReductionOperand` only changes the order of elements. I'll clean up the changes.

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


More information about the llvm-commits mailing list