[llvm] [InstCombine][NFC] Use CreateAssumption instead of CreateCall (PR #195862)

Nikolas Klauser via llvm-commits llvm-commits at lists.llvm.org
Tue May 5 07:32:11 PDT 2026


================
@@ -3627,21 +3627,16 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
     // Canonicalize assume(a && b) -> assume(a); assume(b);
     // Note: New assumption intrinsics created here are registered by
     // the InstCombineIRInserter object.
-    FunctionType *AssumeIntrinsicTy = II->getFunctionType();
-    Value *AssumeIntrinsic = II->getCalledOperand();
-    Value *A, *B;
-    if (match(IIOperand, m_LogicalAnd(m_Value(A), m_Value(B)))) {
-      Builder.CreateCall(AssumeIntrinsicTy, AssumeIntrinsic, A, OpBundles,
-                         II->getName());
-      Builder.CreateCall(AssumeIntrinsicTy, AssumeIntrinsic, B, II->getName());
+    if (Value *A, *B; match(IIOperand, m_LogicalAnd(m_Value(A), m_Value(B)))) {
----------------
philnik777 wrote:

I've moved it to avoid having ~100 LoC between the declaration and use below, which I found incredibly hard to read. This was the simplest version to limit the scope.
Are you against the decrease in scope in general, or do you just not like that I declare them inside the `if`?

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


More information about the llvm-commits mailing list