aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Lau <luke@igalia.com>2025-04-28 10:08:45 +0800
committerGitHub <noreply@github.com>2025-04-28 10:08:45 +0800
commit92c3af7c3e3163254cdd84b135ce87de9886be94 (patch)
tree3f1712d39d187df5effe460df587890d4d4ae362
parent185ba025dadcefd7185f4d88bc94e5e75e010530 (diff)
downloadllvm-92c3af7c3e3163254cdd84b135ce87de9886be94.zip
llvm-92c3af7c3e3163254cdd84b135ce87de9886be94.tar.gz
llvm-92c3af7c3e3163254cdd84b135ce87de9886be94.tar.bz2
[VPlan] Use correct constructor when cloning VPWidenIntrinsicRecipe without underlying CallInst (#137493)
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.
-rw-r--r--llvm/lib/Transforms/Vectorize/VPlan.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 2826a1a..147ca5b 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -1351,8 +1351,11 @@ public:
~VPWidenIntrinsicRecipe() override = default;
VPWidenIntrinsicRecipe *clone() override {
- return new VPWidenIntrinsicRecipe(*cast<CallInst>(getUnderlyingValue()),
- VectorIntrinsicID, {op_begin(), op_end()},
+ if (Value *CI = getUnderlyingValue())
+ return new VPWidenIntrinsicRecipe(*cast<CallInst>(CI), VectorIntrinsicID,
+ {op_begin(), op_end()}, ResultTy,
+ getDebugLoc());
+ return new VPWidenIntrinsicRecipe(VectorIntrinsicID, {op_begin(), op_end()},
ResultTy, getDebugLoc());
}