Skip to content

Commit 88c2003

Browse files
committed
Add support for VLA data-sharing OperandBundles
Closes llvm#4
1 parent 27d45f4 commit 88c2003

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed

llvm/include/llvm/IR/LLVMContext.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,12 @@ class LLVMContext {
114114
OB_funclet = 1, // "funclet"
115115
OB_gc_transition = 2, // "gc-transition"
116116
// OmpSs IDs
117-
OB_oss_shared = 3, // "oss_shared"
118-
OB_oss_private = 4, // "oss_private"
119-
OB_oss_firstprivate = 5, // "oss_firstprivate"
117+
OB_oss_shared = 3, // "oss_shared"
118+
OB_oss_shared_vla = 4, // "oss_shared_vla"
119+
OB_oss_private = 5, // "oss_private"
120+
OB_oss_private_vla = 6, // "oss_private_vla"
121+
OB_oss_firstprivate = 7, // "oss_firstprivate"
122+
OB_oss_firstprivate_vla = 8, // "oss_firstprivate_vla"
120123
};
121124

122125
/// getMDKindID - Return a unique non-zero ID for the specified metadata kind.

llvm/lib/Analysis/OmpSsRegionAnalysis.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,17 @@ static void getValueFromOperandBundlesWithID(const IntrinsicInst *I,
127127
}
128128
}
129129

130+
// Gather Value list from each OperandBundle Id.
131+
static void getValueListFromOperandBundlesWithID(const IntrinsicInst *I,
132+
SetVector<Value *> &Values,
133+
uint32_t Id) {
134+
SmallVector<OperandBundleDef, 4> OpBundles;
135+
getOperandBundlesAsDefsWithID(I, OpBundles, Id);
136+
for (OperandBundleDef &OBDef : OpBundles) {
137+
Values.insert(OBDef.input_begin(), OBDef.input_end());
138+
}
139+
}
140+
130141
void OmpSsRegionAnalysisPass::getTaskFunctionUsesInfo(
131142
Function &F, DominatorTree &DT, TaskFunctionInfo &FuncInfo,
132143
TaskFunctionAnalysisInfo &FuncAnalysisInfo,
@@ -167,6 +178,13 @@ void OmpSsRegionAnalysisPass::getTaskFunctionUsesInfo(
167178
getValueFromOperandBundlesWithID(II, T.Info.DSAInfo.Firstprivate,
168179
LLVMContext::OB_oss_firstprivate);
169180

181+
getValueListFromOperandBundlesWithID(II, T.Info.DSAInfo.Shared,
182+
LLVMContext::OB_oss_shared_vla);
183+
getValueListFromOperandBundlesWithID(II, T.Info.DSAInfo.Private,
184+
LLVMContext::OB_oss_private_vla);
185+
getValueListFromOperandBundlesWithID(II, T.Info.DSAInfo.Firstprivate,
186+
LLVMContext::OB_oss_firstprivate_vla);
187+
170188
Stack.push_back(T);
171189
} else if (II->getIntrinsicID() == Intrinsic::directive_region_exit) {
172190
if (Stack.empty())

llvm/lib/IR/LLVMContext.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,30 @@ LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl(*this)) {
9191
"oss_shared operand bundle id drifted!");
9292
(void)OSSSharedEntry;
9393

94+
auto *OSSSharedVLAEntry = pImpl->getOrInsertBundleTag("QUAL.OSS.SHARED.VLA");
95+
assert(OSSSharedVLAEntry->second == LLVMContext::OB_oss_shared_vla &&
96+
"oss_shared_vla operand bundle id drifted!");
97+
(void)OSSSharedVLAEntry;
98+
9499
auto *OSSPrivateEntry = pImpl->getOrInsertBundleTag("QUAL.OSS.PRIVATE");
95100
assert(OSSPrivateEntry->second == LLVMContext::OB_oss_private &&
96101
"oss_private operand bundle id drifted!");
97102
(void)OSSPrivateEntry;
98103

104+
auto *OSSPrivateVLAEntry = pImpl->getOrInsertBundleTag("QUAL.OSS.PRIVATE.VLA");
105+
assert(OSSPrivateVLAEntry->second == LLVMContext::OB_oss_private_vla &&
106+
"oss_private_vla operand bundle id drifted!");
107+
(void)OSSPrivateVLAEntry;
108+
99109
auto *OSSFirstPrivateEntry = pImpl->getOrInsertBundleTag("QUAL.OSS.FIRSTPRIVATE");
100110
assert(OSSFirstPrivateEntry->second == LLVMContext::OB_oss_firstprivate &&
101111
"oss_firstprivate operand bundle id drifted!");
102112
(void)OSSFirstPrivateEntry;
113+
114+
auto *OSSFirstPrivateVLAEntry = pImpl->getOrInsertBundleTag("QUAL.OSS.FIRSTPRIVATE.VLA");
115+
assert(OSSFirstPrivateVLAEntry->second == LLVMContext::OB_oss_firstprivate_vla &&
116+
"oss_firstprivate_vla operand bundle id drifted!");
117+
(void)OSSFirstPrivateVLAEntry;
103118
// END OmpSs IDs
104119

105120
SyncScope::ID SingleThreadSSID =

0 commit comments

Comments
 (0)