Skip to content

[AutoBump] Merge with 8f41d28d (Feb 19) (56) #600

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 25 commits into
base: bump_to_3430bc31
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0cc7381
[SandboxVec][Scheduler] Don't insert scheduled instrs into the ready …
vporpo Feb 19, 2025
02c9dae
[HLSL] Add support to lookup a ResourceBindingInfo from its use (#126…
V-FEXrt Feb 19, 2025
738f3a1
[gn build] Port 02c9dae81497
llvmgnsyncbot Feb 19, 2025
e10ac5f
[SandboxVec][NFC] Fix unused variable warning in test
vporpo Feb 19, 2025
61cfa53
[compiler-rt][asan] Re-enable forkpty test on AArch64 (NFC) (#127667)
c-rhodes Feb 19, 2025
2207e3e
[libc++] Set feature-test macro `__cpp_lib_atomic_float` (#127559)
frederick-vs-ja Feb 19, 2025
b2659ca
[InstCombine] Propagate flags in `foldSelectICmpAndBinOp` (#127437)
dtcxzyw Feb 19, 2025
da47a80
[PGO][test] Specify exact match for check labels (#117376)
ken-matsui Feb 19, 2025
b100c50
[lld][WebAssembly] Fix warnings in test. NFC (#127714)
sbc100 Feb 19, 2025
f6d74af
[clang][X86] Only define __CET__ macro for X86 targets (#127616)
mylai-mtk Feb 19, 2025
715edd7
[HLSL] Allow arrays to copy-initialize (#127557)
llvm-beanz Feb 19, 2025
6662fe3
[X86] Add missing vNbf16 handling in X86CallingConv.td file (#127102)
mikolaj-pirog Feb 19, 2025
aed9f11
[AMDGPU] Handle lowering addrspace casts from LDS to FLAT address in …
skc7 Feb 19, 2025
22d65d8
AMDGPU: Teach isOperandLegal about SALU literal restrictions (#127626)
arsenm Feb 19, 2025
27e6561
[Sparc] Use MCRegister. NFC
topperc Feb 19, 2025
8187caf
[NFC][AMDGPU] Pre-commit a test case of checking register coalescer o…
shiltian Feb 19, 2025
6c39ee7
[Driver][MSVC] Pass profile file to lld-link via -lto-sample-profile …
tianleliu Feb 19, 2025
8b284dc
[mlir] Fix FunctionOpInterface impl for external func (#124693)
ZenithalHourlyRate Feb 19, 2025
960b80c
[ELF] Improve INPUT_SECTION_FLAGS test
MaskRay Feb 19, 2025
a44284c
[AMDGPU] Add `isAsCheapAsAMove` for `v_pk_mov_b32` (#127632)
shiltian Feb 19, 2025
fb39445
[RISCV][VLOPT] Add vfsqrt/vfrsqrt7 instruction to isSupportInstr (#12…
LiqinWeng Feb 19, 2025
1c02c8f
[clang] fix use after free in clang/tools/c-index-test/c-index-test.c…
metaflow Feb 19, 2025
6b67aac
[mlir:python] Improve `mlir_(attribute|type|value)_subclass` for `nan…
ingomueller-net Feb 19, 2025
8f41d28
[c-index-test] Fix warnings
kazutakahirata Feb 19, 2025
e4a6379
[AutoBump] Merge with 8f41d28d (Feb 19)
jorickert Jun 18, 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
4 changes: 4 additions & 0 deletions clang/lib/Basic/Targets/X86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,10 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts,

if (HasFloat128)
Builder.defineMacro("__SIZEOF_FLOAT128__", "16");

if (Opts.CFProtectionReturn || Opts.CFProtectionBranch)
Builder.defineMacro("__CET__", Twine{(Opts.CFProtectionReturn << 1) |
Opts.CFProtectionBranch});
}

bool X86TargetInfo::isValidFeatureName(StringRef Name) const {
Expand Down
5 changes: 5 additions & 0 deletions clang/lib/Driver/ToolChains/MSVC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
}
}

if (C.getDriver().isUsingLTO()) {
if (Arg *A = tools::getLastProfileSampleUseArg(Args))
CmdArgs.push_back(Args.MakeArgString(std::string("-lto-sample-profile:") +
A->getValue()));
}
Args.AddAllArgValues(CmdArgs, options::OPT__SLASH_link);

// Control Flow Guard checks
Expand Down
11 changes: 0 additions & 11 deletions clang/lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4776,17 +4776,6 @@ static bool ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
}
}

// Add the __CET__ macro if a CFProtection option is set.
if (const Arg *A = Args.getLastArg(OPT_fcf_protection_EQ)) {
StringRef Name = A->getValue();
if (Name == "branch")
Opts.addMacroDef("__CET__=1");
else if (Name == "return")
Opts.addMacroDef("__CET__=2");
else if (Name == "full")
Opts.addMacroDef("__CET__=3");
}

// Add macros from the command line.
for (const auto *A : Args.filtered(OPT_D, OPT_U)) {
if (A->getOption().matches(OPT_D))
Expand Down
87 changes: 54 additions & 33 deletions clang/lib/Sema/SemaCast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ namespace {
void CheckStaticCast();
void CheckDynamicCast();
void CheckCXXCStyleCast(bool FunctionalCast, bool ListInitialization);
bool CheckHLSLCStyleCast(CheckedConversionKind CCK);
void CheckCStyleCast();
void CheckBuiltinBitCast();
void CheckAddrspaceCast();
Expand Down Expand Up @@ -2776,39 +2777,9 @@ void CastOperation::CheckCXXCStyleCast(bool FunctionalStyle,
CheckedConversionKind CCK = FunctionalStyle
? CheckedConversionKind::FunctionalCast
: CheckedConversionKind::CStyleCast;

QualType SrcTy = SrcExpr.get()->getType();
// This case should not trigger on regular vector cast, vector truncation
if (Self.getLangOpts().HLSL &&
Self.HLSL().CanPerformElementwiseCast(SrcExpr.get(), DestType)) {
if (SrcTy->isConstantArrayType())
SrcExpr = Self.ImpCastExprToType(
SrcExpr.get(), Self.Context.getArrayParameterType(SrcTy),
CK_HLSLArrayRValue, VK_PRValue, nullptr, CCK);
Kind = CK_HLSLElementwiseCast;
return;
}

// This case should not trigger on regular vector splat
// If the relative order of this and the HLSLElementWise cast checks
// are changed, it might change which cast handles what in a few cases
if (Self.getLangOpts().HLSL &&
Self.HLSL().CanPerformAggregateSplatCast(SrcExpr.get(), DestType)) {
const VectorType *VT = SrcTy->getAs<VectorType>();
// change splat from vec1 case to splat from scalar
if (VT && VT->getNumElements() == 1)
SrcExpr = Self.ImpCastExprToType(
SrcExpr.get(), VT->getElementType(), CK_HLSLVectorTruncation,
SrcExpr.get()->getValueKind(), nullptr, CCK);
// Inserting a scalar cast here allows for a simplified codegen in
// the case the destTy is a vector
if (const VectorType *DVT = DestType->getAs<VectorType>())
SrcExpr = Self.ImpCastExprToType(
SrcExpr.get(), DVT->getElementType(),
Self.PrepareScalarCast(SrcExpr, DVT->getElementType()),
SrcExpr.get()->getValueKind(), nullptr, CCK);
Kind = CK_HLSLAggregateSplatCast;
return;
if (Self.getLangOpts().HLSL) {
if (CheckHLSLCStyleCast(CCK))
return;
}

if (ValueKind == VK_PRValue && !DestType->isRecordType() &&
Expand Down Expand Up @@ -2927,6 +2898,56 @@ void CastOperation::CheckCXXCStyleCast(bool FunctionalStyle,
}
}

// CheckHLSLCStyleCast - Returns `true` ihe cast is handled or errored as an
// HLSL-specific cast. Returns false if the cast should be checked as a CXX
// C-Style cast.
bool CastOperation::CheckHLSLCStyleCast(CheckedConversionKind CCK) {
assert(Self.getLangOpts().HLSL && "Must be HLSL!");
QualType SrcTy = SrcExpr.get()->getType();
// HLSL has several unique forms of C-style casts which support aggregate to
// aggregate casting.
// This case should not trigger on regular vector cast, vector truncation
if (Self.HLSL().CanPerformElementwiseCast(SrcExpr.get(), DestType)) {
if (SrcTy->isConstantArrayType())
SrcExpr = Self.ImpCastExprToType(
SrcExpr.get(), Self.Context.getArrayParameterType(SrcTy),
CK_HLSLArrayRValue, VK_PRValue, nullptr, CCK);
Kind = CK_HLSLElementwiseCast;
return true;
}

// This case should not trigger on regular vector splat
// If the relative order of this and the HLSLElementWise cast checks
// are changed, it might change which cast handles what in a few cases
if (Self.HLSL().CanPerformAggregateSplatCast(SrcExpr.get(), DestType)) {
const VectorType *VT = SrcTy->getAs<VectorType>();
// change splat from vec1 case to splat from scalar
if (VT && VT->getNumElements() == 1)
SrcExpr = Self.ImpCastExprToType(
SrcExpr.get(), VT->getElementType(), CK_HLSLVectorTruncation,
SrcExpr.get()->getValueKind(), nullptr, CCK);
// Inserting a scalar cast here allows for a simplified codegen in
// the case the destTy is a vector
if (const VectorType *DVT = DestType->getAs<VectorType>())
SrcExpr = Self.ImpCastExprToType(
SrcExpr.get(), DVT->getElementType(),
Self.PrepareScalarCast(SrcExpr, DVT->getElementType()),
SrcExpr.get()->getValueKind(), nullptr, CCK);
Kind = CK_HLSLAggregateSplatCast;
return true;
}

// If the destination is an array, we've exhausted the valid HLSL casts, so we
// should emit a dignostic and stop processing.
if (DestType->isArrayType()) {
Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_generic)
<< 4 << SrcTy << DestType;
SrcExpr = ExprError();
return true;
}
return false;
}

/// DiagnoseBadFunctionCast - Warn whenever a function call is cast to a
/// non-matching type. Such as enum function call to int, int call to
/// pointer; etc. Cast to 'void' is an exception.
Expand Down
12 changes: 12 additions & 0 deletions clang/lib/Sema/SemaInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6585,6 +6585,18 @@ void InitializationSequence::InitializeFrom(Sema &S,
}
}

if (S.getLangOpts().HLSL && Initializer && isa<ConstantArrayType>(DestAT)) {
QualType SrcType = Entity.getType();
if (SrcType->isArrayParameterType())
SrcType =
cast<ArrayParameterType>(SrcType)->getConstantArrayType(Context);
if (S.Context.hasSameUnqualifiedType(DestType, SrcType)) {
TryArrayCopy(S, Kind, Entity, Initializer, DestType, *this,
TreatUnavailableAsInvalid);
return;
}
}

// Some kinds of initialization permit an array to be initialized from
// another array of the same type, and perform elementwise initialization.
if (Initializer && isa<ConstantArrayType>(DestAT) &&
Expand Down
3 changes: 3 additions & 0 deletions clang/test/Driver/cl-link.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,6 @@
// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /Tc%s -fuse-ld=lld -### -fsanitize=address 2>&1 | FileCheck --check-prefix=INFER-LLD %s
// INFER-LLD: lld-link
// INFER-LLD-NOT: INFERASANLIBS

// RUN: %clang_cl --target=x86_64-unknown-windows-msvc /Tc%s -flto -fuse-ld=lld -### -fprofile-sample-use=%S/Inputs/file.prof 2>&1 | FileCheck -check-prefix=CHECK-SAMPLE-PROFILE %s
// CHECK-SAMPLE-PROFILE: "-lto-sample-profile:{{.*}}/file.prof"
2 changes: 2 additions & 0 deletions clang/test/Preprocessor/riscv-cf-protection-return.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,7 @@
// RUN: -menable-experimental-extensions -fcf-protection=full -E -dM %s -o - \
// RUN: | FileCheck --check-prefixes=SHSTK-MACRO %s

// SHSTK-MACRO-NOT: __CET__
// SHSTK-MACRO: __riscv_shadow_stack 1{{$}}
// SHSTK-MACRO-NOT: __CET__
// NO-MACRO-NOT: __riscv_shadow_stack
34 changes: 34 additions & 0 deletions clang/test/SemaHLSL/Language/AssignArray.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library %s -ast-dump | FileCheck %s

typedef vector<int,4> int8[2];

export void fn(int8 A) {
int8 a = {A};
// CHECK-LABEL: VarDecl {{.*}} b 'int8':'vector<int, 4>[2]' cinit
// CHECK-NEXT: ArrayInitLoopExpr {{.*}} 'int8':'vector<int, 4>[2]'
// CHECK-NEXT: OpaqueValueExpr {{.*}} 'int8':'vector<int, 4>[2]' lvalue
// CHECK-NEXT: DeclRefExpr {{.*}} 'int8':'vector<int, 4>[2]' lvalue Var {{.*}} 'a' 'int8':'vector<int, 4>[2]'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'vector<int, 4>' <LValueToRValue>
// CHECK-NEXT: ArraySubscriptExpr {{.*}} 'vector<int, 4>' lvalue
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'vector<int, 4> *' <ArrayToPointerDecay>
// CHECK-NEXT: OpaqueValueExpr {{.*}} 'int8':'vector<int, 4>[2]' lvalue
// CHECK-NEXT: DeclRefExpr {{.*}} 'int8':'vector<int, 4>[2]' lvalue Var {{.*}} 'a' 'int8':'vector<int, 4>[2]'
// CHECK-NEXT: ArrayInitIndexExpr {{.*}} 'unsigned long'
int8 b = a;

// CHECK-LABEL: VarDecl {{.*}} c 'int8':'vector<int, 4>[2]' cinit
// CHECK-NEXT: ArrayInitLoopExpr {{.*}} 'int8':'vector<int, 4>[2]'
// CHECK-NEXT: OpaqueValueExpr {{.*}} 'vector<int, 4>[2]' lvalue
// CHECK-NEXT: DeclRefExpr {{.*}} 'vector<int, 4>[2]' lvalue ParmVar {{.*}} 'A' 'vector<int, 4>[2]'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'vector<int, 4>' <LValueToRValue>
// CHECK-NEXT: ArraySubscriptExpr {{.*}} 'vector<int, 4>' lvalue
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'vector<int, 4> *' <ArrayToPointerDecay>
// CHECK-NEXT: OpaqueValueExpr {{.*}} 'vector<int, 4>[2]' lvalue
// CHECK-NEXT: DeclRefExpr {{.*}} 'vector<int, 4>[2]' lvalue ParmVar {{.*}} 'A' 'vector<int, 4>[2]'
// CHECK-NEXT: ArrayInitIndexExpr {{.*}} 'unsigned long'
int8 c = A;
}




2 changes: 1 addition & 1 deletion clang/test/SemaHLSL/Language/ElementwiseCast-errors.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export void cantCast() {
int A[3] = {1,2,3};
int B[4] = {1,2,3,4};
B = (int[4])A;
// expected-error@-1 {{C-style cast from 'int *' to 'int[4]' is not allowed}}
// expected-error@-1 {{C-style cast from 'int[3]' to 'int[4]' is not allowed}}
}

struct S {
Expand Down
55 changes: 36 additions & 19 deletions clang/tools/c-index-test/c-index-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1213,28 +1213,36 @@ static void PrintCursor(CXCursor Cursor, const char *CommentSchemaFile) {
}
}

static const char* GetCursorSource(CXCursor Cursor) {
static CXString createCXString(const char *CS) {
CXString Str;
Str.data = (const void *)CS;
Str.private_flags = 0;
return Str;
}

static CXString duplicateCXString(const char *CS) {
CXString Str;
Str.data = strdup(CS);
Str.private_flags = 1; // CXS_Malloc
return Str;
}

static CXString GetCursorSource(CXCursor Cursor) {
CXSourceLocation Loc = clang_getCursorLocation(Cursor);
CXString source;
CXFile file;
const char *b;
CXString result;
clang_getExpansionLocation(Loc, &file, 0, 0, 0);
source = clang_getFileName(file);
if (!clang_getCString(source)) {
clang_disposeString(source);
return "<invalid loc>";
}
else {
const char *b = basename(clang_getCString(source));
clang_disposeString(source);
return b;
return createCXString("<invalid loc>");
}
}

static CXString createCXString(const char *CS) {
CXString Str;
Str.data = (const void *) CS;
Str.private_flags = 0;
return Str;
b = basename(clang_getCString(source));
result = duplicateCXString(b);
clang_disposeString(source);
return result;
}

/******************************************************************************/
Expand Down Expand Up @@ -1357,9 +1365,12 @@ enum CXChildVisitResult FilteredPrintingVisitor(CXCursor Cursor,
if (!Data->Filter || (Cursor.kind == *(enum CXCursorKind *)Data->Filter)) {
CXSourceLocation Loc = clang_getCursorLocation(Cursor);
unsigned line, column;
CXString source;
clang_getFileLocation(Loc, 0, &line, &column, 0);
printf("// %s: %s:%d:%d: ", FileCheckPrefix,
GetCursorSource(Cursor), line, column);
source = GetCursorSource(Cursor);
printf("// %s: %s:%d:%d: ", FileCheckPrefix, clang_getCString(source), line,
column);
clang_disposeString(source);
PrintCursor(Cursor, Data->CommentSchemaFile);
PrintCursorExtent(Cursor);
if (clang_isDeclaration(Cursor.kind)) {
Expand Down Expand Up @@ -1428,8 +1439,10 @@ static enum CXChildVisitResult FunctionScanVisitor(CXCursor Cursor,
if (Ref.kind == CXCursor_NoDeclFound) {
/* Nothing found here; that's fine. */
} else if (Ref.kind != CXCursor_FunctionDecl) {
printf("// %s: %s:%d:%d: ", FileCheckPrefix, GetCursorSource(Ref),
curLine, curColumn);
CXString CursorSource = GetCursorSource(Ref);
printf("// %s: %s:%d:%d: ", FileCheckPrefix,
clang_getCString(CursorSource), curLine, curColumn);
clang_disposeString(CursorSource);
PrintCursor(Ref, Data->CommentSchemaFile);
printf("\n");
}
Expand All @@ -1451,11 +1464,15 @@ enum CXChildVisitResult USRVisitor(CXCursor C, CXCursor parent,
if (!Data->Filter || (C.kind == *(enum CXCursorKind *)Data->Filter)) {
CXString USR = clang_getCursorUSR(C);
const char *cstr = clang_getCString(USR);
CXString CursorSource;
if (!cstr || cstr[0] == '\0') {
clang_disposeString(USR);
return CXChildVisit_Recurse;
}
printf("// %s: %s %s", FileCheckPrefix, GetCursorSource(C), cstr);
CursorSource = GetCursorSource(C);
printf("// %s: %s %s", FileCheckPrefix, clang_getCString(CursorSource),
cstr);
clang_disposeString(CursorSource);

PrintCursorExtent(C);
printf("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// Ignore leaks as this is not the point of test, but HWASAN repors one here.
// RUN: %env_tool_opts=detect_leaks=0 %run %t | FileCheck %s

// REQUIRES: stable-runtime
// XFAIL: android && asan

// No libutil.
Expand Down
2 changes: 1 addition & 1 deletion libcxx/docs/FeatureTestMacroTable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_atomic_flag_test`` ``201907L``
---------------------------------------------------------- -----------------
``__cpp_lib_atomic_float`` *unimplemented*
``__cpp_lib_atomic_float`` ``201711L``
---------------------------------------------------------- -----------------
``__cpp_lib_atomic_lock_free_type_aliases`` ``201907L``
---------------------------------------------------------- -----------------
Expand Down
2 changes: 1 addition & 1 deletion libcxx/docs/Status/Cxx20Papers.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"`P0463R1 <https://wg21.link/P0463R1>`__","Endian just Endian","2017-07 (Toronto)","|Complete|","7",""
"`P0674R1 <https://wg21.link/P0674R1>`__","Extending make_shared to Support Arrays","2017-07 (Toronto)","|Complete|","15",""
"","","","","",""
"`P0020R6 <https://wg21.link/P0020R6>`__","Floating Point Atomic","2017-11 (Albuquerque)","|Complete|","18",""
"`P0020R6 <https://wg21.link/P0020R6>`__","Floating Point Atomic","2017-11 (Albuquerque)","|Complete|","18","The feature-test macro was not set until LLVM 20."
"`P0053R7 <https://wg21.link/P0053R7>`__","C++ Synchronized Buffered Ostream","2017-11 (Albuquerque)","|Complete|","18",""
"`P0202R3 <https://wg21.link/P0202R3>`__","Add constexpr modifiers to functions in <algorithm> and <utility> Headers","2017-11 (Albuquerque)","|Complete|","12",""
"`P0415R1 <https://wg21.link/P0415R1>`__","Constexpr for ``std::complex``\ ","2017-11 (Albuquerque)","|Complete|","16",""
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/version
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_array_constexpr 201811L
# define __cpp_lib_assume_aligned 201811L
# define __cpp_lib_atomic_flag_test 201907L
// # define __cpp_lib_atomic_float 201711L
# define __cpp_lib_atomic_float 201711L
# define __cpp_lib_atomic_lock_free_type_aliases 201907L
# define __cpp_lib_atomic_ref 201806L
// # define __cpp_lib_atomic_shared_ptr 201711L
Expand Down
Loading