[llvm] [VPlan] Extend tryToFoldLiveIns to fold binary intrinsics (PR #161703)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 2 12:17:22 PDT 2025


================
@@ -956,6 +975,15 @@ static Value *tryToFoldLiveIns(const VPRecipeBase &R, unsigned Opcode,
   }
 
   InstSimplifyFolder Folder(DL);
+  if (OpcodeOrIID.first) {
+    if (R.getNumOperands() != 2)
+      return nullptr;
+    unsigned ID = OpcodeOrIID.second;
+    return Folder.FoldBinaryIntrinsic(
+        ID, Ops[0], Ops[1], TypeInfo.inferScalarType(R.getVPSingleValue()),
+        R.getUnderlyingInstr());
----------------
fhahn wrote:

Hmm, is there a way to avoid passing the underlying instruction here? It might not be available, and ideally should not be used here

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


More information about the llvm-commits mailing list