Skip to content

Commit 3425023

Browse files
committed
Merge from 'main' to 'sycl-web' (intel#63)
CONFLICT (content): Merge conflict in clang/lib/Driver/ToolChains/Clang.cpp
2 parents 67ab1cd + 98c2128 commit 3425023

File tree

243 files changed

+11657
-3328
lines changed

Some content is hidden

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

243 files changed

+11657
-3328
lines changed

clang/include/clang/Basic/LangOptions.h

+6
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,12 @@ class LangOptions : public LangOptionsBase {
337337
/// host code generation.
338338
std::string OMPHostIRFile;
339339

340+
/// The user provided compilation unit ID, if non-empty. This is used to
341+
/// externalize static variables which is needed to support accessing static
342+
/// device variables in host code for single source offloading languages
343+
/// like CUDA/HIP.
344+
std::string CUID;
345+
340346
/// Indicates whether the front-end is explicitly told that the
341347
/// input is a header file (i.e. -x c-header).
342348
bool IsHeaderFile = false;

clang/include/clang/Driver/Action.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,18 @@ class Action {
223223

224224
class InputAction : public Action {
225225
const llvm::opt::Arg &Input;
226-
226+
std::string Id;
227227
virtual void anchor();
228228

229229
public:
230-
InputAction(const llvm::opt::Arg &Input, types::ID Type);
230+
InputAction(const llvm::opt::Arg &Input, types::ID Type,
231+
StringRef Id = StringRef());
231232

232233
const llvm::opt::Arg &getInputArg() const { return Input; }
233234

235+
void setId(StringRef _Id) { Id = _Id.str(); }
236+
StringRef getId() const { return Id; }
237+
234238
static bool classof(const Action *A) {
235239
return A->getKind() == InputClass;
236240
}

clang/include/clang/Driver/Options.td

+12
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,18 @@ def gpu_max_threads_per_block_EQ : Joined<["--"], "gpu-max-threads-per-block=">,
950950
def gpu_instrument_lib_EQ : Joined<["--"], "gpu-instrument-lib=">,
951951
HelpText<"Instrument device library for HIP, which is a LLVM bitcode containing "
952952
"__cyg_profile_func_enter and __cyg_profile_func_exit">;
953+
def cuid_EQ : Joined<["-"], "cuid=">, Flags<[CC1Option]>,
954+
HelpText<"An ID for compilation unit, which should be the same for the same "
955+
"compilation unit but different for different compilation units. "
956+
"It is used to externalize device-side static variables for single "
957+
"source offloading languages CUDA and HIP so that they can be "
958+
"accessed by the host code of the same compilation unit.">;
959+
def fuse_cuid_EQ : Joined<["-"], "fuse-cuid=">,
960+
HelpText<"Method to generate ID's for compilation units for single source "
961+
"offloading languages CUDA and HIP: 'hash' (ID's generated by hashing "
962+
"file path and command line options) | 'random' (ID's generated as "
963+
"random numbers) | 'none' (disabled). Default is 'hash'. This option "
964+
"will be overriden by option '-cuid=[ID]' if it is specified." >;
953965
def libomptarget_nvptx_bc_path_EQ : Joined<["--"], "libomptarget-nvptx-bc-path=">, Group<i_Group>,
954966
HelpText<"Path to libomptarget-nvptx bitcode library">;
955967
def dD : Flag<["-"], "dD">, Group<d_Group>, Flags<[CC1Option]>,

clang/include/clang/Serialization/ASTReader.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -1543,7 +1543,11 @@ class ASTReader
15431543
/// The client can handle an AST file that cannot load because it's
15441544
/// compiled configuration doesn't match that of the context it was
15451545
/// loaded into.
1546-
ARR_ConfigurationMismatch = 0x8
1546+
ARR_ConfigurationMismatch = 0x8,
1547+
1548+
/// If a module file is marked with errors treat it as out-of-date so the
1549+
/// caller can rebuild it.
1550+
ARR_TreatModuleWithErrorsAsOutOfDate = 0x10
15471551
};
15481552

15491553
/// Load the AST file designated by the given file name.

clang/lib/AST/ExprConstant.cpp

+16-7
Original file line numberDiff line numberDiff line change
@@ -3497,8 +3497,8 @@ static bool diagnoseMutableFields(EvalInfo &Info, const Expr *E, AccessKinds AK,
34973497
static bool lifetimeStartedInEvaluation(EvalInfo &Info,
34983498
APValue::LValueBase Base,
34993499
bool MutableSubobject = false) {
3500-
// A temporary we created.
3501-
if (Base.getCallIndex())
3500+
// A temporary or transient heap allocation we created.
3501+
if (Base.getCallIndex() || Base.is<DynamicAllocLValue>())
35023502
return true;
35033503

35043504
switch (Info.IsEvaluatingDecl) {
@@ -14804,11 +14804,14 @@ bool Expr::EvaluateAsLValue(EvalResult &Result, const ASTContext &Ctx,
1480414804

1480514805
static bool EvaluateDestruction(const ASTContext &Ctx, APValue::LValueBase Base,
1480614806
APValue DestroyedValue, QualType Type,
14807-
SourceLocation Loc, Expr::EvalStatus &EStatus) {
14808-
EvalInfo Info(Ctx, EStatus, EvalInfo::EM_ConstantExpression);
14807+
SourceLocation Loc, Expr::EvalStatus &EStatus,
14808+
bool IsConstantDestruction) {
14809+
EvalInfo Info(Ctx, EStatus,
14810+
IsConstantDestruction ? EvalInfo::EM_ConstantExpression
14811+
: EvalInfo::EM_ConstantFold);
1480914812
Info.setEvaluatingDecl(Base, DestroyedValue,
1481014813
EvalInfo::EvaluatingDeclKind::Dtor);
14811-
Info.InConstantContext = true;
14814+
Info.InConstantContext = IsConstantDestruction;
1481214815

1481314816
LValue LVal;
1481414817
LVal.set(Base);
@@ -14862,7 +14865,8 @@ bool Expr::EvaluateAsConstantExpr(EvalResult &Result, const ASTContext &Ctx,
1486214865
// If this is a class template argument, it's required to have constant
1486314866
// destruction too.
1486414867
if (Kind == ConstantExprKind::ClassTemplateArgument &&
14865-
(!EvaluateDestruction(Ctx, Base, Result.Val, T, getBeginLoc(), Result) ||
14868+
(!EvaluateDestruction(Ctx, Base, Result.Val, T, getBeginLoc(), Result,
14869+
true) ||
1486614870
Result.HasSideEffects)) {
1486714871
// FIXME: Prefix a note to indicate that the problem is lack of constant
1486814872
// destruction.
@@ -14928,6 +14932,10 @@ bool VarDecl::evaluateDestruction(
1492814932
Expr::EvalStatus EStatus;
1492914933
EStatus.Diag = &Notes;
1493014934

14935+
// Only treat the destruction as constant destruction if we formally have
14936+
// constant initialization (or are usable in a constant expression).
14937+
bool IsConstantDestruction = hasConstantInitialization();
14938+
1493114939
// Make a copy of the value for the destructor to mutate, if we know it.
1493214940
// Otherwise, treat the value as default-initialized; if the destructor works
1493314941
// anyway, then the destruction is constant (and must be essentially empty).
@@ -14938,7 +14946,8 @@ bool VarDecl::evaluateDestruction(
1493814946
return false;
1493914947

1494014948
if (!EvaluateDestruction(getASTContext(), this, std::move(DestroyedValue),
14941-
getType(), getLocation(), EStatus) ||
14949+
getType(), getLocation(), EStatus,
14950+
IsConstantDestruction) ||
1494214951
EStatus.HasSideEffects)
1494314952
return false;
1494414953

clang/lib/CodeGen/ItaniumCXXABI.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -2472,7 +2472,10 @@ void ItaniumCXXABI::EmitGuardedInit(CodeGenFunction &CGF,
24722472
CGF.EmitNounwindRuntimeCall(getGuardReleaseFn(CGM, guardPtrTy),
24732473
guardAddr.getPointer());
24742474
} else {
2475-
Builder.CreateStore(llvm::ConstantInt::get(guardTy, 1), guardAddr);
2475+
// Store 1 into the first byte of the guard variable after initialization is
2476+
// complete.
2477+
Builder.CreateStore(llvm::ConstantInt::get(CGM.Int8Ty, 1),
2478+
Builder.CreateElementBitCast(guardAddr, CGM.Int8Ty));
24762479
}
24772480

24782481
CGF.EmitBlock(EndBlock);

clang/lib/Driver/Action.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ StringRef Action::GetOffloadKindName(OffloadKind Kind) {
188188

189189
void InputAction::anchor() {}
190190

191-
InputAction::InputAction(const Arg &_Input, types::ID _Type)
192-
: Action(InputClass, _Type), Input(_Input) {}
191+
InputAction::InputAction(const Arg &_Input, types::ID _Type, StringRef _Id)
192+
: Action(InputClass, _Type), Input(_Input), Id(_Id.str()) {}
193193

194194
void BindArchAction::anchor() {}
195195

clang/lib/Driver/Driver.cpp

+48-1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
#include "llvm/Support/FileSystem.h"
7979
#include "llvm/Support/FormatVariadic.h"
8080
#include "llvm/Support/Host.h"
81+
#include "llvm/Support/MD5.h"
8182
#include "llvm/Support/Path.h"
8283
#include "llvm/Support/PrettyStackTrace.h"
8384
#include "llvm/Support/Process.h"
@@ -2960,6 +2961,14 @@ class OffloadingActionBuilder final {
29602961
/// Default GPU architecture if there's no one specified.
29612962
CudaArch DefaultCudaArch = CudaArch::UNKNOWN;
29622963

2964+
/// Method to generate compilation unit ID specified by option
2965+
/// '-fuse-cuid='.
2966+
enum UseCUIDKind { CUID_Hash, CUID_Random, CUID_None, CUID_Invalid };
2967+
UseCUIDKind UseCUID = CUID_Hash;
2968+
2969+
/// Compilation unit ID specified by option '-cuid='.
2970+
StringRef FixedCUID;
2971+
29632972
public:
29642973
CudaActionBuilderBase(Compilation &C, DerivedArgList &Args,
29652974
const Driver::InputList &Inputs,
@@ -2996,9 +3005,32 @@ class OffloadingActionBuilder final {
29963005
// Replicate inputs for each GPU architecture.
29973006
auto Ty = IA->getType() == types::TY_HIP ? types::TY_HIP_DEVICE
29983007
: types::TY_CUDA_DEVICE;
3008+
std::string CUID = FixedCUID.str();
3009+
if (CUID.empty()) {
3010+
if (UseCUID == CUID_Random)
3011+
CUID = llvm::utohexstr(llvm::sys::Process::GetRandomNumber(),
3012+
/*LowerCase=*/true);
3013+
else if (UseCUID == CUID_Hash) {
3014+
llvm::MD5 Hasher;
3015+
llvm::MD5::MD5Result Hash;
3016+
SmallString<256> RealPath;
3017+
llvm::sys::fs::real_path(IA->getInputArg().getValue(), RealPath,
3018+
/*expand_tilde=*/true);
3019+
Hasher.update(RealPath);
3020+
for (auto *A : Args) {
3021+
if (A->getOption().matches(options::OPT_INPUT))
3022+
continue;
3023+
Hasher.update(A->getAsString(Args));
3024+
}
3025+
Hasher.final(Hash);
3026+
CUID = llvm::utohexstr(Hash.low(), /*LowerCase=*/true);
3027+
}
3028+
}
3029+
IA->setId(CUID);
3030+
29993031
for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I) {
30003032
CudaDeviceActions.push_back(
3001-
C.MakeAction<InputAction>(IA->getInputArg(), Ty));
3033+
C.MakeAction<InputAction>(IA->getInputArg(), Ty, IA->getId()));
30023034
}
30033035

30043036
return ABRT_Success;
@@ -3121,6 +3153,21 @@ class OffloadingActionBuilder final {
31213153
options::OPT_cuda_device_only);
31223154
EmitLLVM = Args.getLastArg(options::OPT_emit_llvm);
31233155
EmitAsm = Args.getLastArg(options::OPT_S);
3156+
FixedCUID = Args.getLastArgValue(options::OPT_cuid_EQ);
3157+
if (Arg *A = Args.getLastArg(options::OPT_fuse_cuid_EQ)) {
3158+
StringRef UseCUIDStr = A->getValue();
3159+
UseCUID = llvm::StringSwitch<UseCUIDKind>(UseCUIDStr)
3160+
.Case("hash", CUID_Hash)
3161+
.Case("random", CUID_Random)
3162+
.Case("none", CUID_None)
3163+
.Default(CUID_Invalid);
3164+
if (UseCUID == CUID_Invalid) {
3165+
C.getDriver().Diag(diag::err_drv_invalid_value)
3166+
<< A->getAsString(Args) << UseCUIDStr;
3167+
C.setContainsError();
3168+
return true;
3169+
}
3170+
}
31243171

31253172
// Collect all cuda_gpu_arch parameters, removing duplicates.
31263173
std::set<StringRef> GpuArchs;

clang/lib/Driver/ToolChains/Clang.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -5875,6 +5875,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
58755875
}
58765876

58775877
if (IsCuda || IsHIP) {
5878+
if (Args.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc, false))
5879+
CmdArgs.push_back("-fgpu-rdc");
58785880
if (Args.hasFlag(options::OPT_fgpu_defer_diag,
58795881
options::OPT_fno_gpu_defer_diag, false))
58805882
CmdArgs.push_back("-fgpu-defer-diag");
@@ -6577,6 +6579,18 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
65776579
CmdArgs.push_back("-D__ENABLE_USM_ADDR_SPACE__");
65786580
}
65796581

6582+
if (IsCuda || IsHIP) {
6583+
// Determine the original source input.
6584+
const Action *SourceAction = &JA;
6585+
while (SourceAction->getKind() != Action::InputClass) {
6586+
assert(!SourceAction->getInputs().empty() && "unexpected root action!");
6587+
SourceAction = SourceAction->getInputs()[0];
6588+
}
6589+
auto CUID = cast<InputAction>(SourceAction)->getId();
6590+
if (!CUID.empty())
6591+
CmdArgs.push_back(Args.MakeArgString(Twine("-cuid=") + Twine(CUID)));
6592+
}
6593+
65806594
if (IsHIP)
65816595
CmdArgs.push_back("-fcuda-allow-variadic-functions");
65826596

clang/lib/Driver/ToolChains/Cuda.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -690,10 +690,6 @@ void CudaToolChain::addClangTargetOptions(
690690
if (DriverArgs.hasFlag(options::OPT_fcuda_approx_transcendentals,
691691
options::OPT_fno_cuda_approx_transcendentals, false))
692692
CC1Args.push_back("-fcuda-approx-transcendentals");
693-
694-
if (DriverArgs.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc,
695-
false))
696-
CC1Args.push_back("-fgpu-rdc");
697693
}
698694

699695
if (DeviceOffloadingKind == Action::OFK_SYCL) {

clang/lib/Driver/ToolChains/HIP.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,8 @@ void HIPToolChain::addClangTargetOptions(
261261
options::OPT_fno_cuda_approx_transcendentals, false))
262262
CC1Args.push_back("-fcuda-approx-transcendentals");
263263

264-
if (DriverArgs.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc,
265-
false))
266-
CC1Args.push_back("-fgpu-rdc");
267-
else
264+
if (!DriverArgs.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc,
265+
false))
268266
CC1Args.append({"-mllvm", "-amdgpu-internalize-symbols"});
269267

270268
StringRef MaxThreadsPerBlock =

clang/lib/Frontend/CompilerInstance.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,10 @@ compileModuleImpl(CompilerInstance &ImportingInstance, SourceLocation ImportLoc,
11461146
// module generation thread crashed.
11471147
Instance.clearOutputFiles(/*EraseFiles=*/true);
11481148

1149-
return !Instance.getDiagnostics().hasErrorOccurred();
1149+
// If \p AllowPCMWithCompilerErrors is set return 'success' even if errors
1150+
// occurred.
1151+
return !Instance.getDiagnostics().hasErrorOccurred() ||
1152+
Instance.getFrontendOpts().AllowPCMWithCompilerErrors;
11501153
}
11511154

11521155
static const FileEntry *getPublicModuleMap(const FileEntry *File,
@@ -1699,7 +1702,8 @@ ModuleLoadResult CompilerInstance::findOrCompileModuleAndReadAST(
16991702
// Try to load the module file. If we are not trying to load from the
17001703
// module cache, we don't know how to rebuild modules.
17011704
unsigned ARRFlags = Source == MS_ModuleCache
1702-
? ASTReader::ARR_OutOfDate | ASTReader::ARR_Missing
1705+
? ASTReader::ARR_OutOfDate | ASTReader::ARR_Missing |
1706+
ASTReader::ARR_TreatModuleWithErrorsAsOutOfDate
17031707
: Source == MS_PrebuiltModulePath
17041708
? 0
17051709
: ASTReader::ARR_ConfigurationMismatch;

clang/lib/Frontend/CompilerInvocation.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -2771,6 +2771,11 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
27712771
}
27722772
}
27732773

2774+
2775+
if (auto *A = Args.getLastArg(OPT_cuid_EQ)) {
2776+
Opts.CUID = std::string(A->getValue());
2777+
}
2778+
27742779
if (Opts.ObjC) {
27752780
if (Arg *arg = Args.getLastArg(OPT_fobjc_runtime_EQ)) {
27762781
StringRef value = arg->getValue();

clang/lib/Serialization/ASTReader.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -2751,8 +2751,9 @@ ASTReader::ReadControlBlock(ModuleFile &F,
27512751

27522752
bool hasErrors = Record[6];
27532753
if (hasErrors && !DisableValidation) {
2754-
// Always rebuild modules from the cache on an error
2755-
if (F.Kind == MK_ImplicitModule)
2754+
// If requested by the caller, mark modules on error as out-of-date.
2755+
if (F.Kind == MK_ImplicitModule &&
2756+
(ClientLoadCapabilities & ARR_TreatModuleWithErrorsAsOutOfDate))
27562757
return OutOfDate;
27572758

27582759
if (!AllowASTWithCompilerErrors) {

clang/test/CodeGenCXX/aix-static-init-temp-spec-and-inline-var.cpp

+8-5
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ template <>
4444
A<int> A<int>::instance = bar();
4545
} // namespace test2
4646

47+
// CHECK: @_ZGVN5test12t2E = linkonce_odr global i64 0, align 8
48+
// CHECK: @_ZGVN5test21AIvE8instanceE = weak_odr global i64 0, align 8
49+
// CHECK: @_ZGVN5test12t1IiEE = linkonce_odr global i64 0, align 8
4750
// CHECK: @llvm.global_ctors = appending global [4 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @__cxx_global_var_init.1, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @__cxx_global_var_init.2, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @__cxx_global_var_init.4, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I__, i8* null }]
4851
// CHECK: @llvm.global_dtors = appending global [4 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @__finalize__ZN5test12t2E, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @__finalize__ZN5test21AIvE8instanceE, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @__finalize__ZN5test12t1IiEE, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__D_a, i8* null }]
4952

@@ -77,7 +80,7 @@ A<int> A<int>::instance = bar();
7780

7881
// CHECK: define internal void @__cxx_global_var_init.1() [[ATTR:#[0-9]+]] {
7982
// CHECK: entry:
80-
// CHECK: %0 = load atomic i8, i8* bitcast (i64* @_ZGVN5test12t2E to i8*) acquire
83+
// CHECK: %0 = load atomic i8, i8* bitcast (i64* @_ZGVN5test12t2E to i8*) acquire, align 8
8184
// CHECK: %guard.uninitialized = icmp eq i8 %0, 0
8285
// CHECK: br i1 %guard.uninitialized, label %init.check, label %init.end
8386

@@ -119,14 +122,14 @@ A<int> A<int>::instance = bar();
119122

120123
// CHECK: define internal void @__cxx_global_var_init.2() [[ATTR:#[0-9]+]] {
121124
// CHECK: entry:
122-
// CHECK: %0 = load i8, i8* bitcast (i64* @_ZGVN5test21AIvE8instanceE to i8*)
125+
// CHECK: %0 = load i8, i8* bitcast (i64* @_ZGVN5test21AIvE8instanceE to i8*), align 8
123126
// CHECK: %guard.uninitialized = icmp eq i8 %0, 0
124127
// CHECK: br i1 %guard.uninitialized, label %init.check, label %init.end
125128

126129
// CHECK: init.check:
127130
// CHECK: call void @_ZN5test21AIvEC1Ev(%"struct.test2::A"* {{[^,]*}} @_ZN5test21AIvE8instanceE)
128131
// CHECK: %1 = call i32 @atexit(void ()* @__dtor__ZN5test21AIvE8instanceE)
129-
// CHECK: store i64 1, i64* @_ZGVN5test21AIvE8instanceE
132+
// CHECK: store i8 1, i8* bitcast (i64* @_ZGVN5test21AIvE8instanceE to i8*), align 8
130133
// CHECK: br label %init.end
131134

132135
// CHECK: init.end:
@@ -182,15 +185,15 @@ A<int> A<int>::instance = bar();
182185

183186
// CHECK: define internal void @__cxx_global_var_init.4() [[ATTR:#[0-9]+]] {
184187
// CHECK: entry:
185-
// CHECK: %0 = load i8, i8* bitcast (i64* @_ZGVN5test12t1IiEE to i8*)
188+
// CHECK: %0 = load i8, i8* bitcast (i64* @_ZGVN5test12t1IiEE to i8*), align 8
186189
// CHECK: %guard.uninitialized = icmp eq i8 %0, 0
187190
// CHECK: br i1 %guard.uninitialized, label %init.check, label %init.end
188191

189192
// CHECK: init.check:
190193
// CHECK32: call void @_ZN5test15Test1C1Ei(%"struct.test1::Test1"* {{[^,]*}} @_ZN5test12t1IiEE, i32 2)
191194
// CHECK64: call void @_ZN5test15Test1C1Ei(%"struct.test1::Test1"* {{[^,]*}} @_ZN5test12t1IiEE, i32 signext 2)
192195
// CHECK: %1 = call i32 @atexit(void ()* @__dtor__ZN5test12t1IiEE)
193-
// CHECK: store i64 1, i64* @_ZGVN5test12t1IiEE
196+
// CHECK: store i8 1, i8* bitcast (i64* @_ZGVN5test12t1IiEE to i8*), align 8
194197
// CHECK: br label %init.end
195198

196199
// CHECK: init.end:

clang/test/CodeGenCXX/aix-static-init.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ namespace test4 {
3838
}
3939
} // namespace test4
4040

41+
// CHECK: @_ZGVZN5test41fEvE11staticLocal = internal global i64 0, align 8
4142
// CHECK: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I__, i8* null }]
4243
// CHECK: @llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__D_a, i8* null }]
4344

@@ -135,7 +136,7 @@ namespace test4 {
135136

136137
// CHECK: define void @_ZN5test41fEv() [[ATTR:#[0-9]+]] {
137138
// CHECK: entry:
138-
// CHECK: %0 = load atomic i8, i8* bitcast (i64* @_ZGVZN5test41fEvE11staticLocal to i8*) acquire
139+
// CHECK: %0 = load atomic i8, i8* bitcast (i64* @_ZGVZN5test41fEvE11staticLocal to i8*) acquire, align 8
139140
// CHECK: %guard.uninitialized = icmp eq i8 %0, 0
140141
// CHECK: br i1 %guard.uninitialized, label %init.check, label %init.end
141142

0 commit comments

Comments
 (0)