Skip to content

Commit d1033e3

Browse files
committed
[OpenMP] Disable ICV deduction by default.
This is not tested well and needs to be revisited in the future.
1 parent a817842 commit d1033e3

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

llvm/lib/Transforms/IPO/OpenMPOpt.cpp

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ static cl::opt<bool>
7171
cl::desc("Disable function internalization."),
7272
cl::Hidden, cl::init(false));
7373

74+
static cl::opt<bool> DeduceICVValues("openmp-deduce-icv-values",
75+
cl::init(false), cl::Hidden);
7476
static cl::opt<bool> PrintICVValues("openmp-print-icv-values", cl::init(false),
7577
cl::Hidden);
7678
static cl::opt<bool> PrintOpenMPKernels("openmp-print-gpu-kernels",
@@ -4806,24 +4808,26 @@ void OpenMPOpt::registerAAs(bool IsModulePass) {
48064808
}
48074809

48084810
// Create CallSite AA for all Getters.
4809-
for (int Idx = 0; Idx < OMPInfoCache.ICVs.size() - 1; ++Idx) {
4810-
auto ICVInfo = OMPInfoCache.ICVs[static_cast<InternalControlVar>(Idx)];
4811+
if (DeduceICVValues) {
4812+
for (int Idx = 0; Idx < OMPInfoCache.ICVs.size() - 1; ++Idx) {
4813+
auto ICVInfo = OMPInfoCache.ICVs[static_cast<InternalControlVar>(Idx)];
48114814

4812-
auto &GetterRFI = OMPInfoCache.RFIs[ICVInfo.Getter];
4815+
auto &GetterRFI = OMPInfoCache.RFIs[ICVInfo.Getter];
48134816

4814-
auto CreateAA = [&](Use &U, Function &Caller) {
4815-
CallInst *CI = OpenMPOpt::getCallIfRegularCall(U, &GetterRFI);
4816-
if (!CI)
4817-
return false;
4817+
auto CreateAA = [&](Use &U, Function &Caller) {
4818+
CallInst *CI = OpenMPOpt::getCallIfRegularCall(U, &GetterRFI);
4819+
if (!CI)
4820+
return false;
48184821

4819-
auto &CB = cast<CallBase>(*CI);
4822+
auto &CB = cast<CallBase>(*CI);
48204823

4821-
IRPosition CBPos = IRPosition::callsite_function(CB);
4822-
A.getOrCreateAAFor<AAICVTracker>(CBPos);
4823-
return false;
4824-
};
4824+
IRPosition CBPos = IRPosition::callsite_function(CB);
4825+
A.getOrCreateAAFor<AAICVTracker>(CBPos);
4826+
return false;
4827+
};
48254828

4826-
GetterRFI.foreachUse(SCC, CreateAA);
4829+
GetterRFI.foreachUse(SCC, CreateAA);
4830+
}
48274831
}
48284832
auto &GlobalizationRFI = OMPInfoCache.RFIs[OMPRTL___kmpc_alloc_shared];
48294833
auto CreateAA = [&](Use &U, Function &F) {

llvm/test/Transforms/OpenMP/icv_tracking.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
2-
; RUN: opt -S -passes=openmp-opt < %s | FileCheck %s
2+
; RUN: opt -S -openmp-deduce-icv-values -passes=openmp-opt < %s | FileCheck %s
33

44
%struct.ident_t = type { i32, i32, i32, i32, ptr }
55

0 commit comments

Comments
 (0)