diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp index 981765a995a0..2cff343d915c 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp @@ -2642,7 +2642,7 @@ void VPPredInstPHIRecipe::execute(VPTransformState &State) { if (vputils::onlyFirstLaneUsed(this) && !State.Lane->isFirstLane()) return; - Type *PredInstType = getOperand(0)->getUnderlyingValue()->getType(); + Type *PredInstType = State.TypeAnalysis.inferScalarType(getOperand(0)); PHINode *Phi = State.Builder.CreatePHI(PredInstType, 2); Phi->addIncoming(PoisonValue::get(ScalarPredInst->getType()), PredicatingBB);