Skip to content

Commit 5ace973

Browse files
committed
[VPlan] Use correct constructor when cloning VPWidenIntrinsicRecipe without underlying CallInst
I noticed this when working on a patch downstream, and I don't think this is an issue upstream yet. But if a VPWidenIntrinsicRecipe is created without an underlying CallInst, e.g. in createEVLRecipe, it will crash if you try to clone it because it assumes the CallInst always exists. This fixes it by using the CallInst-less constructor in this case.
1 parent f218cd2 commit 5ace973

File tree

1 file changed

+5
-2
lines changed
  • llvm/lib/Transforms/Vectorize

1 file changed

+5
-2
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,8 +1347,11 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
13471347
~VPWidenIntrinsicRecipe() override = default;
13481348

13491349
VPWidenIntrinsicRecipe *clone() override {
1350-
return new VPWidenIntrinsicRecipe(*cast<CallInst>(getUnderlyingValue()),
1351-
VectorIntrinsicID, {op_begin(), op_end()},
1350+
if (Value *CI = getUnderlyingValue())
1351+
return new VPWidenIntrinsicRecipe(*cast<CallInst>(CI), VectorIntrinsicID,
1352+
{op_begin(), op_end()}, ResultTy,
1353+
getDebugLoc());
1354+
return new VPWidenIntrinsicRecipe(VectorIntrinsicID, {op_begin(), op_end()},
13521355
ResultTy, getDebugLoc());
13531356
}
13541357

0 commit comments

Comments
 (0)