[clang] [Clang][FIX] Fix type qualifiers on vector builtins (PR #160185)
John McCall via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 25 13:11:33 PDT 2025
================
@@ -2288,16 +2303,23 @@ static ExprResult BuiltinMaskedLoad(Sema &S, CallExpr *TheCall) {
Expr *MaskArg = TheCall->getArg(0);
Expr *PtrArg = TheCall->getArg(1);
- if (CheckMaskedBuiltinArgs(S, MaskArg, PtrArg, 2))
+ if (CheckMaskedBuiltinArgs(S, MaskArg, PtrArg, 2, /*AllowConst=*/true,
+ TheCall->getBuiltinCallee() ==
+ Builtin::BI__builtin_masked_load))
return ExprError();
QualType MaskTy = MaskArg->getType();
QualType PtrTy = PtrArg->getType();
QualType PointeeTy = PtrTy->getPointeeType();
const VectorType *MaskVecTy = MaskTy->getAs<VectorType>();
- QualType RetTy =
- S.Context.getExtVectorType(PointeeTy, MaskVecTy->getNumElements());
+ QualType RetTy = S.Context.getExtVectorType(PointeeTy.getUnqualifiedType(),
+ MaskVecTy->getNumElements());
+ Qualifiers Qs = PointeeTy.getQualifiers();
+ Qs.removeConst();
+ if (Qs.hasAddressSpace())
+ RetTy = S.Context.getQualifiedType(RetTy, Qs);
----------------
rjmccall wrote:
The return type is just an r-value and shouldn't have any qualifiers.
https://github.com/llvm/llvm-project/pull/160185
More information about the cfe-commits
mailing list