Skip to content

Commit 379c49d

Browse files
authored
Merge branch 'main' into container-rewrite
2 parents 7ddb314 + a5af621 commit 379c49d

File tree

415 files changed

+20079
-11471
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

415 files changed

+20079
-11471
lines changed

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,6 @@ concurrency:
3333
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
3434
cancel-in-progress: true
3535

36-
37-
env:
38-
# LLVM POST-BRANCH bump version
39-
# LLVM POST-BRANCH add compiler test for ToT - 1, e.g. "Clang 17"
40-
# LLVM RELEASE bump remove compiler ToT - 3, e.g. "Clang 15"
41-
LLVM_HEAD_VERSION: "19" # Used compiler, update POST-BRANCH.
42-
LLVM_PREVIOUS_VERSION: "18"
43-
LLVM_OLDEST_VERSION: "17"
44-
GCC_STABLE_VERSION: "13"
45-
LLVM_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer-19"
46-
CLANG_CRASH_DIAGNOSTICS_DIR: "crash_diagnostics"
47-
4836
jobs:
4937
stage1:
5038
if: github.repository_owner == 'llvm'

bolt/unittests/Core/MCPlusBuilder.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,14 @@ INSTANTIATE_TEST_SUITE_P(AArch64, MCPlusBuilderTester,
9090
::testing::Values(Triple::aarch64));
9191

9292
TEST_P(MCPlusBuilderTester, AliasX0) {
93-
uint64_t AliasesX0[] = {AArch64::W0, AArch64::W0_HI,
94-
AArch64::X0, AArch64::W0_W1,
93+
uint64_t AliasesX0[] = {AArch64::W0, AArch64::X0, AArch64::W0_W1,
9594
AArch64::X0_X1, AArch64::X0_X1_X2_X3_X4_X5_X6_X7};
9695
size_t AliasesX0Count = sizeof(AliasesX0) / sizeof(*AliasesX0);
9796
testRegAliases(Triple::aarch64, AArch64::X0, AliasesX0, AliasesX0Count);
9897
}
9998

10099
TEST_P(MCPlusBuilderTester, AliasSmallerX0) {
101-
uint64_t AliasesX0[] = {AArch64::W0, AArch64::W0_HI, AArch64::X0};
100+
uint64_t AliasesX0[] = {AArch64::W0, AArch64::X0};
102101
size_t AliasesX0Count = sizeof(AliasesX0) / sizeof(*AliasesX0);
103102
testRegAliases(Triple::aarch64, AArch64::X0, AliasesX0, AliasesX0Count, true);
104103
}

clang/Maintainers.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,15 @@ Thread Safety Analysis
176176
| aaron.puchert\@sap.com (email), aaronpuchert (GitHub), aaronpuchert (Discourse)
177177
178178

179+
Function Effect Analysis
180+
~~~~~~~~~~~~~~~~~~~~~~~~
181+
| Doug Wyatt
182+
| dwyatt\@apple.com (email), dougsonos (GitHub), dougsonos (Discourse)
183+
184+
| Sirraide
185+
| aeternalmail\@gmail.com (email), Sirraide (GitHub), Ætérnal (Discord), Sirraide (Discourse)
186+
187+
179188
Tools
180189
-----
181190
These maintainers are responsible for user-facing tools under the Clang

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,7 @@ RISC-V Support
852852
^^^^^^^^^^^^^^
853853

854854
- The option ``-mcmodel=large`` for the large code model is supported.
855+
- Bump RVV intrinsic to version 1.0, the spec: https://github.com/riscv-non-isa/rvv-intrinsic-doc/releases/tag/v1.0.0-rc4
855856

856857
CUDA/HIP Language Changes
857858
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/Builtins.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4750,6 +4750,12 @@ def HLSLAny : LangBuiltin<"HLSL_LANG"> {
47504750
let Prototype = "bool(...)";
47514751
}
47524752

4753+
def HLSLAsDouble : LangBuiltin<"HLSL_LANG"> {
4754+
let Spellings = ["__builtin_hlsl_asdouble"];
4755+
let Attributes = [NoThrow, Const];
4756+
let Prototype = "void(...)";
4757+
}
4758+
47534759
def HLSLWaveActiveAnyTrue : LangBuiltin<"HLSL_LANG"> {
47544760
let Spellings = ["__builtin_hlsl_wave_active_any_true"];
47554761
let Attributes = [NoThrow, Const];

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,13 @@ TARGET_BUILTIN(__builtin_amdgcn_smfmac_f32_16x16x128_bf8_bf8, "V4fV4iV8iV4fiIiIi
454454
TARGET_BUILTIN(__builtin_amdgcn_smfmac_f32_16x16x128_bf8_fp8, "V4fV4iV8iV4fiIiIi", "nc", "gfx950-insts")
455455
TARGET_BUILTIN(__builtin_amdgcn_smfmac_f32_16x16x128_fp8_bf8, "V4fV4iV8iV4fiIiIi", "nc", "gfx950-insts")
456456
TARGET_BUILTIN(__builtin_amdgcn_smfmac_f32_16x16x128_fp8_fp8, "V4fV4iV8iV4fiIiIi", "nc", "gfx950-insts")
457+
TARGET_BUILTIN(__builtin_amdgcn_smfmac_f32_32x32x64_bf8_bf8, "V16fV4iV8iV16fiIiIi", "nc", "gfx950-insts")
458+
TARGET_BUILTIN(__builtin_amdgcn_smfmac_f32_32x32x64_bf8_fp8, "V16fV4iV8iV16fiIiIi", "nc", "gfx950-insts")
459+
TARGET_BUILTIN(__builtin_amdgcn_smfmac_f32_32x32x64_fp8_bf8, "V16fV4iV8iV16fiIiIi", "nc", "gfx950-insts")
460+
TARGET_BUILTIN(__builtin_amdgcn_smfmac_f32_32x32x64_fp8_fp8, "V16fV4iV8iV16fiIiIi", "nc", "gfx950-insts")
461+
462+
TARGET_BUILTIN(__builtin_amdgcn_permlane16_swap, "V2UiUiUiIbIb", "nc", "permlane16-swap")
463+
TARGET_BUILTIN(__builtin_amdgcn_permlane32_swap, "V2UiUiUiIbIb", "nc", "permlane32-swap")
457464

458465
//===----------------------------------------------------------------------===//
459466
// GFX12+ only builtins.

clang/include/clang/Driver/Options.td

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5888,12 +5888,24 @@ def target : Joined<["--"], "target=">, Flags<[NoXarchOption]>,
58885888
def darwin_target_variant : Separate<["-"], "darwin-target-variant">,
58895889
Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption]>,
58905890
HelpText<"Generate code for an additional runtime variant of the deployment target">;
5891+
5892+
//===----------------------------------------------------------------------===//
5893+
// Print CPU info options (clang, clang-cl, flang)
5894+
//===----------------------------------------------------------------------===//
5895+
5896+
let Visibility = [ClangOption, CC1Option, CLOption, FlangOption, FC1Option] in {
5897+
58915898
def print_supported_cpus : Flag<["-", "--"], "print-supported-cpus">,
58925899
Group<CompileOnly_Group>,
5893-
Visibility<[ClangOption, CC1Option, CLOption]>,
5894-
HelpText<"Print supported cpu models for the given target (if target is not specified,"
5895-
" it will print the supported cpus for the default target)">,
5900+
HelpText<"Print supported cpu models for the given target (if target is not "
5901+
"specified,it will print the supported cpus for the default target)">,
58965902
MarshallingInfoFlag<FrontendOpts<"PrintSupportedCPUs">>;
5903+
5904+
def : Flag<["-"], "mcpu=help">, Alias<print_supported_cpus>;
5905+
def : Flag<["-"], "mtune=help">, Alias<print_supported_cpus>;
5906+
5907+
} // let Visibility = [ClangOption, CC1Option, CLOption, FlangOption, FC1Option]
5908+
58975909
def print_supported_extensions : Flag<["-", "--"], "print-supported-extensions">,
58985910
Visibility<[ClangOption, CC1Option, CLOption]>,
58995911
HelpText<"Print supported -march extensions (RISC-V, AArch64 and ARM only)">,
@@ -5903,8 +5915,6 @@ def print_enabled_extensions : Flag<["-", "--"], "print-enabled-extensions">,
59035915
HelpText<"Print the extensions enabled by the given target and -march/-mcpu options."
59045916
" (AArch64 and RISC-V only)">,
59055917
MarshallingInfoFlag<FrontendOpts<"PrintEnabledExtensions">>;
5906-
def : Flag<["-"], "mcpu=help">, Alias<print_supported_cpus>;
5907-
def : Flag<["-"], "mtune=help">, Alias<print_supported_cpus>;
59085918
def time : Flag<["-"], "time">,
59095919
HelpText<"Time individual commands">;
59105920
def traditional_cpp : Flag<["-", "--"], "traditional-cpp">,

clang/lib/Basic/Targets/RISCV.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ void RISCVTargetInfo::getTargetDefines(const LangOptions &Opts,
218218

219219
if (ISAInfo->hasExtension("zve32x")) {
220220
Builder.defineMacro("__riscv_vector");
221-
// Currently we support the v0.12 RISC-V V intrinsics.
222-
Builder.defineMacro("__riscv_v_intrinsic", Twine(getVersionValue(0, 12)));
221+
// Currently we support the v1.0 RISC-V V intrinsics.
222+
Builder.defineMacro("__riscv_v_intrinsic", Twine(getVersionValue(1, 0)));
223223
}
224224

225225
auto VScale = getVScaleRange(Opts);

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,41 @@ static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) {
209209
return LastInst;
210210
}
211211

212+
Value *handleAsDoubleBuiltin(CodeGenFunction &CGF, const CallExpr *E) {
213+
assert((E->getArg(0)->getType()->hasUnsignedIntegerRepresentation() &&
214+
E->getArg(1)->getType()->hasUnsignedIntegerRepresentation()) &&
215+
"asdouble operands types mismatch");
216+
Value *OpLowBits = CGF.EmitScalarExpr(E->getArg(0));
217+
Value *OpHighBits = CGF.EmitScalarExpr(E->getArg(1));
218+
219+
llvm::Type *ResultType = CGF.DoubleTy;
220+
int N = 1;
221+
if (auto *VTy = E->getArg(0)->getType()->getAs<clang::VectorType>()) {
222+
N = VTy->getNumElements();
223+
ResultType = llvm::FixedVectorType::get(CGF.DoubleTy, N);
224+
}
225+
226+
if (CGF.CGM.getTarget().getTriple().isDXIL())
227+
return CGF.Builder.CreateIntrinsic(
228+
/*ReturnType=*/ResultType, Intrinsic::dx_asdouble,
229+
ArrayRef<Value *>{OpLowBits, OpHighBits}, nullptr, "hlsl.asdouble");
230+
231+
if (!E->getArg(0)->getType()->isVectorType()) {
232+
OpLowBits = CGF.Builder.CreateVectorSplat(1, OpLowBits);
233+
OpHighBits = CGF.Builder.CreateVectorSplat(1, OpHighBits);
234+
}
235+
236+
llvm::SmallVector<int> Mask;
237+
for (int i = 0; i < N; i++) {
238+
Mask.push_back(i);
239+
Mask.push_back(i + N);
240+
}
241+
242+
Value *BitVec = CGF.Builder.CreateShuffleVector(OpLowBits, OpHighBits, Mask);
243+
244+
return CGF.Builder.CreateBitCast(BitVec, ResultType);
245+
}
246+
212247
/// getBuiltinLibFunction - Given a builtin id for a function like
213248
/// "__builtin_fabsf", return a Function* for "fabsf".
214249
llvm::Constant *CodeGenModule::getBuiltinLibFunction(const FunctionDecl *FD,
@@ -19023,6 +19058,8 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
1902319058
CGM.getHLSLRuntime().getAnyIntrinsic(), ArrayRef<Value *>{Op0}, nullptr,
1902419059
"hlsl.any");
1902519060
}
19061+
case Builtin::BI__builtin_hlsl_asdouble:
19062+
return handleAsDoubleBuiltin(*this, E);
1902619063
case Builtin::BI__builtin_hlsl_elementwise_clamp: {
1902719064
Value *OpX = EmitScalarExpr(E->getArg(0));
1902819065
Value *OpMin = EmitScalarExpr(E->getArg(1));
@@ -20163,6 +20200,32 @@ Value *CodeGenFunction::EmitAMDGPUBuiltinExpr(unsigned BuiltinID,
2016320200
CGM.getIntrinsic(Intrinsic::amdgcn_s_sendmsg_rtn, {ResultType});
2016420201
return Builder.CreateCall(F, {Arg});
2016520202
}
20203+
case AMDGPU::BI__builtin_amdgcn_permlane16_swap:
20204+
case AMDGPU::BI__builtin_amdgcn_permlane32_swap: {
20205+
// Because builtin types are limited, and the intrinsic uses a struct/pair
20206+
// output, marshal the pair-of-i32 to <2 x i32>.
20207+
Value *VDstOld = EmitScalarExpr(E->getArg(0));
20208+
Value *VSrcOld = EmitScalarExpr(E->getArg(1));
20209+
Value *FI = EmitScalarExpr(E->getArg(2));
20210+
Value *BoundCtrl = EmitScalarExpr(E->getArg(3));
20211+
Function *F =
20212+
CGM.getIntrinsic(BuiltinID == AMDGPU::BI__builtin_amdgcn_permlane16_swap
20213+
? Intrinsic::amdgcn_permlane16_swap
20214+
: Intrinsic::amdgcn_permlane32_swap);
20215+
llvm::CallInst *Call =
20216+
Builder.CreateCall(F, {VDstOld, VSrcOld, FI, BoundCtrl});
20217+
20218+
llvm::Value *Elt0 = Builder.CreateExtractValue(Call, 0);
20219+
llvm::Value *Elt1 = Builder.CreateExtractValue(Call, 1);
20220+
20221+
llvm::Type *ResultType = ConvertType(E->getType());
20222+
20223+
llvm::Value *Insert0 = Builder.CreateInsertElement(
20224+
llvm::PoisonValue::get(ResultType), Elt0, UINT64_C(0));
20225+
llvm::Value *AsVector =
20226+
Builder.CreateInsertElement(Insert0, Elt1, UINT64_C(1));
20227+
return AsVector;
20228+
}
2016620229
case AMDGPU::BI__builtin_amdgcn_make_buffer_rsrc:
2016720230
return emitBuiltinWithOneOverloadedType<4>(
2016820231
*this, E, Intrinsic::amdgcn_make_buffer_rsrc);

clang/lib/Driver/Driver.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4417,7 +4417,8 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
44174417

44184418
// Use the -mcpu=? flag as the dummy input to cc1.
44194419
Actions.clear();
4420-
Action *InputAc = C.MakeAction<InputAction>(*A, types::TY_C);
4420+
Action *InputAc = C.MakeAction<InputAction>(
4421+
*A, IsFlangMode() ? types::TY_Fortran : types::TY_C);
44214422
Actions.push_back(
44224423
C.MakeAction<PrecompileJobAction>(InputAc, types::TY_Nothing));
44234424
for (auto &I : Inputs)
@@ -6621,8 +6622,8 @@ bool Driver::ShouldUseFlangCompiler(const JobAction &JA) const {
66216622
return false;
66226623

66236624
// And say "no" if this is not a kind of action flang understands.
6624-
if (!isa<PreprocessJobAction>(JA) && !isa<CompileJobAction>(JA) &&
6625-
!isa<BackendJobAction>(JA))
6625+
if (!isa<PreprocessJobAction>(JA) && !isa<PrecompileJobAction>(JA) &&
6626+
!isa<CompileJobAction>(JA) && !isa<BackendJobAction>(JA))
66266627
return false;
66276628

66286629
return true;

clang/lib/Driver/ToolChains/Cuda.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -856,8 +856,9 @@ void CudaToolChain::addClangTargetOptions(
856856
DeviceOffloadingKind == Action::OFK_Cuda) &&
857857
"Only OpenMP or CUDA offloading kinds are supported for NVIDIA GPUs.");
858858

859-
CC1Args.append(
860-
{"-fcuda-is-device", "-mllvm", "-enable-memcpyopt-without-libcalls"});
859+
CC1Args.append({"-fcuda-is-device", "-mllvm",
860+
"-enable-memcpyopt-without-libcalls",
861+
"-fno-threadsafe-statics"});
861862

862863
// Unsized function arguments used for variadics were introduced in CUDA-9.0
863864
// We still do not support generating code that actually uses variadic

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,9 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
747747
}
748748
} else if (isa<AssembleJobAction>(JA)) {
749749
CmdArgs.push_back("-emit-obj");
750+
} else if (isa<PrecompileJobAction>(JA)) {
751+
// The precompile job action is only needed for options such as -mcpu=help.
752+
// Those will already have been handled by the fc1 driver.
750753
} else {
751754
assert(false && "Unexpected action class for Flang tool.");
752755
}
@@ -911,8 +914,6 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
911914
CmdArgs.push_back(Output.getFilename());
912915
}
913916

914-
assert(Input.isFilename() && "Invalid input.");
915-
916917
if (Args.getLastArg(options::OPT_save_temps_EQ))
917918
Args.AddLastArg(CmdArgs, options::OPT_save_temps_EQ);
918919

@@ -932,7 +933,18 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
932933
}
933934
}
934935

935-
CmdArgs.push_back(Input.getFilename());
936+
// The input could be Ty_Nothing when "querying" options such as -mcpu=help
937+
// are used.
938+
ArrayRef<InputInfo> FrontendInputs = Input;
939+
if (Input.isNothing())
940+
FrontendInputs = {};
941+
942+
for (const InputInfo &Input : FrontendInputs) {
943+
if (Input.isFilename())
944+
CmdArgs.push_back(Input.getFilename());
945+
else
946+
Input.getInputArg().renderAsInput(Args, CmdArgs);
947+
}
936948

937949
const char *Exec = Args.MakeArgString(D.GetProgramPath("flang", TC));
938950
C.addCommand(std::make_unique<Command>(JA, *this,

clang/lib/Driver/ToolChains/HIPAMD.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ void HIPAMDToolChain::addClangTargetOptions(
238238
assert(DeviceOffloadingKind == Action::OFK_HIP &&
239239
"Only HIP offloading kinds are supported for GPUs.");
240240

241-
CC1Args.push_back("-fcuda-is-device");
241+
CC1Args.append({"-fcuda-is-device", "-fno-threadsafe-statics"});
242242

243243
if (!DriverArgs.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc,
244244
false))

clang/lib/Headers/hlsl/hlsl_intrinsics.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,24 @@ bool any(double3);
361361
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_any)
362362
bool any(double4);
363363

364+
//===----------------------------------------------------------------------===//
365+
// asdouble builtins
366+
//===----------------------------------------------------------------------===//
367+
368+
/// \fn double asdouble(uint LowBits, uint HighBits)
369+
/// \brief Reinterprets a cast value (two 32-bit values) into a double.
370+
/// \param LowBits The low 32-bit pattern of the input value.
371+
/// \param HighBits The high 32-bit pattern of the input value.
372+
373+
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_asdouble)
374+
double asdouble(uint, uint);
375+
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_asdouble)
376+
double2 asdouble(uint2, uint2);
377+
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_asdouble)
378+
double3 asdouble(uint3, uint3);
379+
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_asdouble)
380+
double4 asdouble(uint4, uint4);
381+
364382
//===----------------------------------------------------------------------===//
365383
// asfloat builtins
366384
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)