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

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 01:58:20 PDT 2026


Author: Ramkumar Ramachandra
Date: 2026-09-09T09:58:14+01:00
New Revision: 1770693262b32d2216d7224fd412d78ab07e1bfa

URL: https://github.com/llvm/llvm-project/commit/1770693262b32d2216d7224fd412d78ab07e1bfa
DIFF: https://github.com/llvm/llvm-project/commit/1770693262b32d2216d7224fd412d78ab07e1bfa.diff

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

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

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Removed: 
    


################################################################################
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;
   }
 


        


More information about the llvm-commits mailing list