[llvm] [InstCombine] Use InstSimplify in FoldOpIntoSelect (PR #116073)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 13 16:43:07 PST 2024


================
@@ -1715,9 +1708,10 @@ Instruction *InstCombinerImpl::FoldOpIntoSelect(Instruction &Op, SelectInst *SI,
     }
   }
 
-  // Make sure that one of the select arms constant folds successfully.
-  Value *NewTV = constantFoldOperationIntoSelectOperand(Op, SI, /*IsTrueArm*/ true);
-  Value *NewFV = constantFoldOperationIntoSelectOperand(Op, SI, /*IsTrueArm*/ false);
+  // Make sure that one of the select arms folds successfully.
+  Value *NewTV = simplifyOperationIntoSelectOperand(Op, SI, /*IsTrueArm*/ true);
+  Value *NewFV =
+      simplifyOperationIntoSelectOperand(Op, SI, /*IsTrueArm*/ false);
----------------
dtcxzyw wrote:

```suggestion
      simplifyOperationIntoSelectOperand(Op, SI, /*IsTrueArm=*/false);
```

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


More information about the llvm-commits mailing list