Skip to content

Commit 7b727a8

Browse files
committed
Rename EmitLLVUsed flag and remove unnecessary global variable.
1 parent 1146e82 commit 7b727a8

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class OpenMPIRBuilderConfig {
101101
std::optional<bool> IsGPU;
102102

103103
/// Flag for specifying if LLVMUsed information should be emitted.
104-
std::optional<bool> EmitLLVMUsed;
104+
std::optional<bool> EmitLLVMUsedMetaInfo;
105105

106106
/// Flag for specifying if offloading is mandatory.
107107
std::optional<bool> OpenMPOffloadMandatory;
@@ -176,7 +176,7 @@ class OpenMPIRBuilderConfig {
176176

177177
void setIsTargetDevice(bool Value) { IsTargetDevice = Value; }
178178
void setIsGPU(bool Value) { IsGPU = Value; }
179-
void setEmitLLVMUsed(bool Value = true) { EmitLLVMUsed = Value; }
179+
void setEmitLLVMUsed(bool Value = true) { EmitLLVMUsedMetaInfo = Value; }
180180
void setOpenMPOffloadMandatory(bool Value) { OpenMPOffloadMandatory = Value; }
181181
void setFirstSeparator(StringRef FS) { FirstSeparator = FS; }
182182
void setSeparator(StringRef S) { Separator = S; }

llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ static bool isValidWorkshareLoopScheduleType(OMPScheduleType SchedType) {
145145
}
146146
#endif
147147

148-
Function *GLOBAL_ReductionFunc = nullptr;
149-
150148
static const omp::GV &getGridValue(const Triple &T, Function *Kernel) {
151149
if (T.isAMDGPU()) {
152150
StringRef Features =
@@ -795,7 +793,7 @@ void OpenMPIRBuilder::finalize(Function *Fn) {
795793
if (!OffloadInfoManager.empty())
796794
createOffloadEntriesAndInfoMetadata(ErrorReportFn);
797795

798-
if (Config.EmitLLVMUsed) {
796+
if (Config.EmitLLVMUsedMetaInfo.value_or(false)) {
799797
std::vector<WeakTrackingVH> LLVMCompilerUsed = {
800798
M.getGlobalVariable("__openmp_nvptx_data_transfer_temporary_storage")};
801799
emitUsed("llvm.compiler.used", LLVMCompilerUsed);
@@ -3338,15 +3336,11 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createReductionsGPU(
33383336
FuncAttrs = FuncAttrs.addFnAttributes(Ctx, AttrBldr);
33393337

33403338
Function *ReductionFunc = nullptr;
3341-
if (GLOBAL_ReductionFunc) {
3342-
ReductionFunc = GLOBAL_ReductionFunc;
3343-
} else {
3344-
CodeGenIP = Builder.saveIP();
3345-
ReductionFunc = createReductionFunction(
3346-
Builder.GetInsertBlock()->getParent()->getName(), ReductionInfos,
3347-
ReductionGenCBKind, FuncAttrs);
3348-
Builder.restoreIP(CodeGenIP);
3349-
}
3339+
CodeGenIP = Builder.saveIP();
3340+
ReductionFunc =
3341+
createReductionFunction(Builder.GetInsertBlock()->getParent()->getName(),
3342+
ReductionInfos, ReductionGenCBKind, FuncAttrs);
3343+
Builder.restoreIP(CodeGenIP);
33503344

33513345
// Set the grid value in the config needed for lowering later on
33523346
if (GridValue.has_value())

0 commit comments

Comments
 (0)