[llvm] [VPlan] Add scalar-type-infer assert for casts (NFC) (PR #222258)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 00:30:44 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Ramkumar Ramachandra (artagnon)

<details>
<summary>Changes</summary>

Casts require the ResultTy to be passed: add an assert to computeScalarTypeForInstruction to guard against incorrect usage.

---
Full diff: https://github.com/llvm/llvm-project/pull/222258.diff


1 Files Affected:

- (modified) llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp (+2) 


``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 02ea01880ff4a..1a6119b22c9d3 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -578,6 +578,8 @@ Type *llvm::computeScalarTypeForInstruction(unsigned Opcode,
   case Instruction::Call:
     return getCalledFunction(Operands)->getReturnType();
   default:
+    if (Instruction::isCast(Opcode))
+      llvm_unreachable("type must be passed explicitly");
     break;
   }
 

``````````

</details>


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


More information about the llvm-commits mailing list