[clang] [Clang] Prevent null pointer dereferences in SVE tuple functions (PR #94267)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 24 01:39:54 PDT 2024
================
@@ -10226,7 +10229,7 @@ Value *CodeGenFunction::EmitSVETupleCreate(const SVETypeFlags &TypeFlags,
ArrayRef<Value *> Ops) {
assert(TypeFlags.isTupleCreate() && "Expects TypleFlag isTupleCreate");
- auto *SrcTy = dyn_cast<llvm::ScalableVectorType>(Ops[0]->getType());
+ auto *SrcTy = cast<llvm::ScalableVectorType>(Ops[0]->getType());
----------------
CarolineConcatto wrote:
I believe we should have some consistency in here between EmitSVETupleSetOrGet and EmitSVETupleCreate.
Or both we do :
auto *SrcTy/SingleVecTy) = cast<llvm::ScalableVectorType>
or
auto *SrcTy/SingleVecTy) = dyn_cast<llvm::ScalableVectorType>(
if (!ScrTy/SingleVecTy))
return
Maybe is fine to cast directly to ScalableVectorType. I can see this being done is the other EmitSVE.
https://github.com/llvm/llvm-project/pull/94267
More information about the cfe-commits
mailing list