[clang] [clang] Restrict use of scalar types in vector builtins (PR #119423)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 8 14:33:50 PST 2025
================
@@ -14585,11 +14585,18 @@ void Sema::CheckAddressOfPackedMember(Expr *rhs) {
_2, _3, _4));
}
+static ExprResult UsualUnaryConversionsNoPromoteInt(Sema &S, Expr *E) {
+ // Don't promote integer types
+ if (QualType Ty = E->getType(); S.getASTContext().isPromotableIntegerType(Ty))
+ return S.DefaultFunctionArrayLvalueConversion(E);
+ return S.UsualUnaryConversions(E);
----------------
efriedma-quic wrote:
It's a little weird that the resulting type can be larger than what integer promotion would produce (without this patch, `struct S { long l : 4; }; S s; static_assert(sizeof(__builtin_elementwise_abs(s.l)) == 4);`). But maybe that's fine.
https://github.com/llvm/llvm-project/pull/119423
More information about the cfe-commits
mailing list