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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 28 07:49:10 PDT 2026


================
@@ -923,6 +923,15 @@ static CallInst *canonicalizeConstantArg0ToArg1(CallInst &Call) {
   if (isa<Constant>(Arg0) && !isa<Constant>(Arg1)) {
     Call.setArgOperand(0, Arg1);
     Call.setArgOperand(1, Arg0);
+    auto CallAttr = Call.getAttributes();
+    auto LHSAttr = CallAttr.getParamAttrs(0);
+    auto RHSAttr = CallAttr.getParamAttrs(1);
----------------
nikic wrote:

```suggestion
    AttributeList CallAttr = Call.getAttributes();
    AttributeSet LHSAttr = CallAttr.getParamAttrs(0);
    AttributeSet RHSAttr = CallAttr.getParamAttrs(1);
```

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


More information about the llvm-commits mailing list