Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9e2f73f
[libc] Add printf error handling (with fixes #2) (#166517)
mleleszi Nov 5, 2025
e79528f
[TLI] Add basic support for nextafter/nexttoward libcalls (#166250)
sivakusayan Nov 5, 2025
0502314
[bazel] Fix bazel build (#166641)
PeimingLiu Nov 5, 2025
c3b2849
[libc] Allow openat and creat to return fd 0. (#166466)
jtstogel Nov 5, 2025
0c0b0ea
[SPARC] Mark branches as being expensive in early Niagara CPUs (#166489)
koachan Nov 5, 2025
5e46103
[LIR][profcheck] Reuse the loop's exit condition profile (#164523)
mtrofin Nov 5, 2025
5da2c09
[X86][ISel] Fix VPTERNLOG matching ensuring the InnerOp is logicOp (#…
yichi170 Nov 5, 2025
c1ca4a5
[VPlan] Strip redundant code in VPTransformState::get (NFC) (#166145)
artagnon Nov 5, 2025
b0b4616
[VPlan] Handle single-scalar conds in VPWidenSelectRecipe. (#165506)
fhahn Nov 5, 2025
521bafc
[LLDB] Fix typo
adrian-prantl Nov 5, 2025
81dede8
[libc] Return errno from OFD failure paths in fcntl. (#166252)
jtstogel Nov 5, 2025
ac547a5
Analysis: Add RuntimeLibcall analysis pass (#165196)
arsenm Nov 5, 2025
9fc8ddd
[VPlan] Move code narrowing ops feeding an interleave group to helper…
fhahn Nov 5, 2025
2d51705
[webkit.UncountedLambdaCapturesChecker] Assertion failure with corout…
rniwa Nov 5, 2025
597cd76
Revert "[libc] Return errno from OFD failure paths in fcntl." (#166658)
jtstogel Nov 5, 2025
efe8573
[LV] Add extra tests for narrowing interleave groups with op chains.
fhahn Nov 5, 2025
1ff0098
[profcheck] Exclude Instrumentation tests (for now) (#166659)
mtrofin Nov 5, 2025
46c9489
[GlobalISel] Add `G_EXTRACT_VECTOR_ELT` for `computeKnownBits` (#164825)
mooori Nov 5, 2025
d18b796
[clang-doc] remove FullName from serialization (#166595)
evelez7 Nov 5, 2025
3b010c9
[Clang] Add elementwise ldexp builtin function (#166296)
wenju-he Nov 5, 2025
050cbd2
[CodeGen] Allow negative frame indicies in Register class. (#164459)
mgudim Nov 5, 2025
3665e76
[gn build] Port 050cbd297ba4
llvmgnsyncbot Nov 5, 2025
8321eaa
[gn build] Port ac547a532a91
llvmgnsyncbot Nov 5, 2025
d584d00
[lldb] Introduce SBFrameList for lazy frame iteration (#166651)
medismailben Nov 6, 2025
158dfe9
[gn build] Port d584d00ed250
llvmgnsyncbot Nov 6, 2025
d2b43ff
[AIX] unsupport gcc triple test case on aix NFC (#166408)
madanial0 Nov 6, 2025
bd9030e
[debugserver] Move constants into TaskPortForProcessID (NFC) (#166670)
JDevlieghere Nov 6, 2025
1262dce
Add support for ref.func to AsmParser/MC (#163326)
QuantumSegfault Nov 6, 2025
47e4501
[flang][acc] Lower zero modifier for Copyout clause (#166660)
nvptm Nov 6, 2025
e04f278
merge main into amd-staging
z1-cciauto Nov 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion clang-tools-extra/clang-doc/JSONGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,6 @@ static void insertArray(Object &Obj, json::Value &Array, StringRef Key) {
static void serializeInfo(const RecordInfo &I, json::Object &Obj,
const std::optional<StringRef> &RepositoryUrl) {
serializeCommonAttributes(I, Obj, RepositoryUrl);
Obj["FullName"] = I.FullName;
Obj["TagType"] = getTagType(I.TagType);
Obj["IsTypedef"] = I.IsTypeDef;
Obj["MangledName"] = I.MangledName;
Expand Down
8 changes: 0 additions & 8 deletions clang-tools-extra/clang-doc/Representation.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,6 @@ struct FunctionInfo : public SymbolInfo {
// (AS_public = 0, AS_protected = 1, AS_private = 2, AS_none = 3)
AccessSpecifier Access = AccessSpecifier::AS_public;

// Full qualified name of this function, including namespaces and template
// specializations.
SmallString<16> FullName;

// Function Prototype
SmallString<256> Prototype;

Expand All @@ -460,10 +456,6 @@ struct RecordInfo : public SymbolInfo {
// Type of this record (struct, class, union, interface).
TagTypeKind TagType = TagTypeKind::Struct;

// Full qualified name of this record, including namespaces and template
// specializations.
SmallString<16> FullName;

// When present, this record is a template or specialization.
std::optional<TemplateInfo> Template;

Expand Down
50 changes: 0 additions & 50 deletions clang-tools-extra/clang-doc/Serialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,55 +178,6 @@ static llvm::SmallString<16> getTypeAlias(const TypeAliasDecl *Alias) {
return Result;
}

// extract full syntax for record declaration
static llvm::SmallString<16> getRecordPrototype(const CXXRecordDecl *CXXRD) {
llvm::SmallString<16> Result;
LangOptions LangOpts;
PrintingPolicy Policy(LangOpts);
Policy.SuppressTagKeyword = false;
Policy.FullyQualifiedName = true;
Policy.IncludeNewlines = false;
llvm::raw_svector_ostream OS(Result);
if (const auto *TD = CXXRD->getDescribedClassTemplate()) {
OS << "template <";
bool FirstParam = true;
for (const auto *Param : *TD->getTemplateParameters()) {
if (!FirstParam)
OS << ", ";
Param->print(OS, Policy);
FirstParam = false;
}
OS << ">\n";
}

if (CXXRD->isStruct())
OS << "struct ";
else if (CXXRD->isClass())
OS << "class ";
else if (CXXRD->isUnion())
OS << "union ";

OS << CXXRD->getNameAsString();

// We need to make sure we have a good enough declaration to check. In the
// case where the class is a forward declaration, we'll fail assertions in
// DeclCXX.
if (CXXRD->isCompleteDefinition() && CXXRD->getNumBases() > 0) {
OS << " : ";
bool FirstBase = true;
for (const auto &Base : CXXRD->bases()) {
if (!FirstBase)
OS << ", ";
if (Base.isVirtual())
OS << "virtual ";
OS << getAccessSpelling(Base.getAccessSpecifier()) << " ";
OS << Base.getType().getAsString(Policy);
FirstBase = false;
}
}
return Result;
}

// A function to extract the appropriate relative path for a given info's
// documentation. The path returned is a composite of the parent namespaces.
//
Expand Down Expand Up @@ -1033,7 +984,6 @@ emitInfo(const RecordDecl *D, const FullComment *FC, Location Loc,
parseFields(*RI, D, PublicOnly);

if (const auto *C = dyn_cast<CXXRecordDecl>(D)) {
RI->FullName = getRecordPrototype(C);
if (const TypedefNameDecl *TD = C->getTypedefNameForAnonDecl()) {
RI->Name = TD->getNameAsString();
RI->IsTypeDef = true;
Expand Down
2 changes: 0 additions & 2 deletions clang-tools-extra/test/clang-doc/json/class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ struct MyClass {
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ],
// COM: FIXME: FullName is not emitted correctly.
// CHECK-NEXT: "FullName": "",
// CHECK-NEXT: "HasEnums": true,
// CHECK-NEXT: "HasPublicFunctions": true,
// CHECK-NEXT: "HasPublicMembers": true,
Expand Down
4 changes: 0 additions & 4 deletions clang-tools-extra/unittests/clang-doc/JSONGeneratorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ static std::unique_ptr<Generator> getJSONGenerator() {
TEST(JSONGeneratorTest, emitRecordJSON) {
RecordInfo I;
I.Name = "Foo";
// FIXME: FullName is not emitted correctly.
I.FullName = "";
I.IsTypeDef = false;
I.Namespace.emplace_back(EmptySID, "GlobalNamespace", InfoType::IT_namespace);
I.Path = "GlobalNamespace";
Expand Down Expand Up @@ -64,7 +62,6 @@ TEST(JSONGeneratorTest, emitRecordJSON) {
{
"Access": "public",
"End": true,
"FullName": "",
"HasPublicFunctions": true,
"HasPublicMembers": true,
"InfoType": "record",
Expand Down Expand Up @@ -115,7 +112,6 @@ TEST(JSONGeneratorTest, emitRecordJSON) {
"USR": "0000000000000000000000000000000000000000"
}
],
"FullName": "",
"HasEnums": true,
"HasPublicFunctions": true,
"HasRecords": true,
Expand Down
2 changes: 2 additions & 0 deletions clang/docs/LanguageExtensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,8 @@ of different sizes and signs is forbidden in binary and ternary builtins.
T __builtin_elementwise_exp(T x) returns the base-e exponential, e^x, of the specified value floating point types
T __builtin_elementwise_exp2(T x) returns the base-2 exponential, 2^x, of the specified value floating point types
T __builtin_elementwise_exp10(T x) returns the base-10 exponential, 10^x, of the specified value floating point types
T __builtin_elementwise_ldexp(T x, IntT y) returns the product of x and 2 raised to the power y. T: floating point types,
y must be an integer type matching the shape of x. IntT: integer types

T __builtin_elementwise_sqrt(T x) return the square root of a floating-point number floating point types
T __builtin_elementwise_roundeven(T x) round x to the nearest integer value in floating point format, floating point types
Expand Down
2 changes: 2 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ C23 Feature Support

Non-comprehensive list of changes in this release
-------------------------------------------------
- Added ``__builtin_elementwise_ldexp``.

- Added ``__builtin_elementwise_fshl`` and ``__builtin_elementwise_fshr``.

- ``__builtin_elementwise_abs`` can now be used in constant expression.
Expand Down
6 changes: 6 additions & 0 deletions clang/include/clang/Basic/Builtins.td
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,12 @@ def ElementwiseExp10 : Builtin {
let Prototype = "void(...)";
}

def ElementwiseLdexp : Builtin {
let Spellings = ["__builtin_elementwise_ldexp"];
let Attributes = [NoThrow, Const, CustomTypeChecking];
let Prototype = "void(...)";
}

def ElementwiseFloor : Builtin {
let Spellings = ["__builtin_elementwise_floor"];
let Attributes = [NoThrow, Const, CustomTypeChecking];
Expand Down
6 changes: 6 additions & 0 deletions clang/lib/CodeGen/CGBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3992,6 +3992,12 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
case Builtin::BI__builtin_elementwise_exp10:
return RValue::get(emitBuiltinWithOneOverloadedType<1>(
*this, E, Intrinsic::exp10, "elt.exp10"));
case Builtin::BI__builtin_elementwise_ldexp: {
Value *Src = EmitScalarExpr(E->getArg(0));
Value *Exp = EmitScalarExpr(E->getArg(1));
Value *Result = Builder.CreateLdexp(Src, Exp, {}, "elt.ldexp");
return RValue::get(Result);
}
case Builtin::BI__builtin_elementwise_log:
return RValue::get(emitBuiltinWithOneOverloadedType<1>(
*this, E, Intrinsic::log, "elt.log"));
Expand Down
64 changes: 52 additions & 12 deletions clang/lib/Sema/SemaChecking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2609,6 +2609,18 @@ static ExprResult BuiltinInvoke(Sema &S, CallExpr *TheCall) {
Args.drop_front(), TheCall->getRParenLoc());
}

// Performs a similar job to Sema::UsualUnaryConversions, but without any
// implicit promotion of integral/enumeration types.
static ExprResult BuiltinVectorMathConversions(Sema &S, Expr *E) {
// First, convert to an r-value.
ExprResult Res = S.DefaultFunctionArrayLvalueConversion(E);
if (Res.isInvalid())
return ExprError();

// Promote floating-point types.
return S.UsualUnaryFPConversions(Res.get());
}

ExprResult
Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
CallExpr *TheCall) {
Expand Down Expand Up @@ -3273,6 +3285,46 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
return ExprError();
break;

case Builtin::BI__builtin_elementwise_ldexp: {
if (checkArgCount(TheCall, 2))
return ExprError();

ExprResult A = BuiltinVectorMathConversions(*this, TheCall->getArg(0));
if (A.isInvalid())
return ExprError();
QualType TyA = A.get()->getType();
if (checkMathBuiltinElementType(*this, A.get()->getBeginLoc(), TyA,
EltwiseBuiltinArgTyRestriction::FloatTy, 1))
return ExprError();

ExprResult Exp = UsualUnaryConversions(TheCall->getArg(1));
if (Exp.isInvalid())
return ExprError();
QualType TyExp = Exp.get()->getType();
if (checkMathBuiltinElementType(*this, Exp.get()->getBeginLoc(), TyExp,
EltwiseBuiltinArgTyRestriction::IntegerTy,
2))
return ExprError();

// Check the two arguments are either scalars or vectors of equal length.
const auto *Vec0 = TyA->getAs<VectorType>();
const auto *Vec1 = TyExp->getAs<VectorType>();
unsigned Arg0Length = Vec0 ? Vec0->getNumElements() : 0;
unsigned Arg1Length = Vec1 ? Vec1->getNumElements() : 0;
if (Arg0Length != Arg1Length) {
Diag(Exp.get()->getBeginLoc(),
diag::err_typecheck_vector_lengths_not_equal)
<< TyA << TyExp << A.get()->getSourceRange()
<< Exp.get()->getSourceRange();
return ExprError();
}

TheCall->setArg(0, A.get());
TheCall->setArg(1, Exp.get());
TheCall->setType(TyA);
break;
}

// These builtins restrict the element type to floating point
// types only, and take in two arguments.
case Builtin::BI__builtin_elementwise_minnum:
Expand Down Expand Up @@ -15994,18 +16046,6 @@ void Sema::CheckAddressOfPackedMember(Expr *rhs) {
_2, _3, _4));
}

// Performs a similar job to Sema::UsualUnaryConversions, but without any
// implicit promotion of integral/enumeration types.
static ExprResult BuiltinVectorMathConversions(Sema &S, Expr *E) {
// First, convert to an r-value.
ExprResult Res = S.DefaultFunctionArrayLvalueConversion(E);
if (Res.isInvalid())
return ExprError();

// Promote floating-point types.
return S.UsualUnaryFPConversions(Res.get());
}

bool Sema::PrepareBuiltinElementwiseMathOneArgCall(
CallExpr *TheCall, EltwiseBuiltinArgTyRestriction ArgTyRestr) {
if (checkArgCount(TheCall, 1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,10 @@ class TrivialFunctionAnalysisVisitor
return WithCachedResult(CS, [&]() { return VisitChildren(CS); });
}

bool VisitCoroutineBodyStmt(const CoroutineBodyStmt *CBS) {
return WithCachedResult(CBS, [&]() { return VisitChildren(CBS); });
}

bool VisitReturnStmt(const ReturnStmt *RS) {
// A return statement is allowed as long as the return value is trivial.
if (auto *RV = RS->getRetValue())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=webkit.UncountedLambdaCapturesChecker -std=c++20 -verify %s
// expected-no-diagnostics

template<typename Arg>
void foo(Arg&& arg)
{
[&]{
co_await [&](auto&&... args) {
}(arg);
}();
}
31 changes: 31 additions & 0 deletions clang/test/CodeGen/builtins-elementwise-math.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ typedef half half2 __attribute__((ext_vector_type(2)));
typedef float float2 __attribute__((ext_vector_type(2)));
typedef float float4 __attribute__((ext_vector_type(4)));
typedef short int si8 __attribute__((ext_vector_type(8)));
typedef int int4 __attribute__((ext_vector_type(4)));
typedef unsigned int u4 __attribute__((ext_vector_type(4)));
typedef double double2 __attribute__((ext_vector_type(2)));
typedef double double3 __attribute__((ext_vector_type(3)));
Expand Down Expand Up @@ -729,6 +730,36 @@ void test_builtin_elementwise_exp10(float f1, float f2, double d1, double d2,
vf2 = __builtin_elementwise_exp10(vf1);
}

void test_builtin_elementwise_ldexp(float f1, float f2, double d1, double d2,
float4 vf1, float4 vf2, int i1, int4 vi1, short s1, long l1) {
// CHECK-LABEL: define void @test_builtin_elementwise_ldexp(
// CHECK: [[F1:%.+]] = load float, ptr %f1.addr, align 4
// CHECK: [[I1:%.+]] = load i32, ptr %i1.addr, align 4
// CHECK-NEXT: call float @llvm.ldexp.f32.i32(float [[F1]], i32 [[I1]])
f2 = __builtin_elementwise_ldexp(f1, i1);

// CHECK: [[F2:%.+]] = load float, ptr %f1.addr, align 4
// CHECK: [[S1:%.+]] = load i16, ptr %s1.addr, align 2
// CHECK: [[Ext1:%.+]] = sext i16 [[S1]] to i32
// CHECK-NEXT: call float @llvm.ldexp.f32.i32(float [[F2]], i32 [[Ext1]])
f2 = __builtin_elementwise_ldexp(f1, s1);

// CHECK: [[F3:%.+]] = load float, ptr %f1.addr, align 4
// CHECK: [[L1:%.+]] = load i64, ptr %l1.addr, align 8
// CHECK-NEXT: call float @llvm.ldexp.f32.i64(float [[F3]], i64 [[L1]])
f2 = __builtin_elementwise_ldexp(f1, l1);

// CHECK: [[D1:%.+]] = load double, ptr %d1.addr, align 8
// CHECK: [[I2:%.+]] = load i32, ptr %i1.addr, align 4
// CHECK-NEXT: call double @llvm.ldexp.f64.i32(double [[D1]], i32 [[I2]])
d2 = __builtin_elementwise_ldexp(d1, i1);

// CHECK: [[VF1:%.+]] = load <4 x float>, ptr %vf1.addr, align 16
// CHECK: [[VI1:%.+]] = load <4 x i32>, ptr %vi1.addr, align 16
// CHECK-NEXT: call <4 x float> @llvm.ldexp.v4f32.v4i32(<4 x float> [[VF1]], <4 x i32> [[VI1]])
vf2 = __builtin_elementwise_ldexp(vf1, vi1);
}

void test_builtin_elementwise_floor(float f1, float f2, double d1, double d2,
float4 vf1, float4 vf2) {
// CHECK-LABEL: define void @test_builtin_elementwise_floor(
Expand Down
36 changes: 36 additions & 0 deletions clang/test/Sema/builtins-elementwise-math.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,42 @@ void test_builtin_elementwise_exp10(int i, float f, double d, float4 v, int3 iv,
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}}
}

void test_builtin_elementwise_ldexp(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {

struct Foo s = __builtin_elementwise_ldexp(f, i);
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}

f = __builtin_elementwise_ldexp();
// expected-error@-1 {{too few arguments to function call, expected 2, have 0}}

f = __builtin_elementwise_ldexp(f);
// expected-error@-1 {{too few arguments to function call, expected 2, have 1}}

f = __builtin_elementwise_ldexp(f, i, i);
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}}

f = __builtin_elementwise_ldexp(i, i);
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}}

f = __builtin_elementwise_ldexp(f, f);
// expected-error@-1 {{2nd argument must be a scalar or vector of integer types (was 'float')}}

f = __builtin_elementwise_ldexp(v, iv);
// expected-error@-1 {{vector operands do not have the same number of elements ('float4' (vector of 4 'float' values) and 'int3' (vector of 3 'int' values))}}

v = __builtin_elementwise_ldexp(v, i);
// expected-error@-1 {{vector operands do not have the same number of elements ('float4' (vector of 4 'float' values) and 'int')}}

v = __builtin_elementwise_ldexp(f, iv);
// expected-error@-1 {{vector operands do not have the same number of elements ('float' and 'int3' (vector of 3 'int' values))}}

f = __builtin_elementwise_ldexp(u, i);
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}}

f = __builtin_elementwise_ldexp(uv, i);
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}}
}

void test_builtin_elementwise_floor(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {

struct Foo s = __builtin_elementwise_floor(f);
Expand Down
4 changes: 2 additions & 2 deletions flang/lib/Lower/OpenACC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3106,8 +3106,8 @@ static Op createComputeOp(
genDataOperandOperationsWithModifier<mlir::acc::CreateOp,
Fortran::parser::AccClause::Copyout>(
copyoutClause, converter, semanticsContext, stmtCtx,
Fortran::parser::AccDataModifier::Modifier::ReadOnly,
dataClauseOperands, mlir::acc::DataClause::acc_copyout,
Fortran::parser::AccDataModifier::Modifier::Zero, dataClauseOperands,
mlir::acc::DataClause::acc_copyout,
mlir::acc::DataClause::acc_copyout_zero, async, asyncDeviceTypes,
asyncOnlyDeviceTypes, /*setDeclareAttr=*/false,
&dataOperandSymbolPairs);
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Driver/gcc-triple.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
!! UNSUPPORTED: system-windows
!! UNSUPPORTED: system-windows, system-aix

!! Test that --gcc-triple option is working as expected.

Expand Down
Loading