@@ -116,13 +116,13 @@ INITIALIZE_PASS_END(
116
116
false , false )
117
117
118
118
#if LLVM_VERSION > MIN_VERSION
119
- StringRef InstrumentParallel::getPassName () const {
120
- return PassName;
121
- }
119
+ StringRef InstrumentParallel::getPassName () const {
120
+ return PassName;
121
+ }
122
122
#else
123
- const char *InstrumentParallel::getPassName () const {
124
- return PassName.c_str ();
125
- }
123
+ const char *InstrumentParallel::getPassName () const {
124
+ return PassName.c_str ();
125
+ }
126
126
#endif
127
127
128
128
void InstrumentParallel::getAnalysisUsage (AnalysisUsage &AU) const {
@@ -174,7 +174,7 @@ bool InstrumentParallel::runOnFunction(Function &F) {
174
174
// }
175
175
Constant *suppression_str_const =
176
176
ConstantDataArray::getString (M->getContext (),
177
- " called_from_lib:libomp.*\n thread:^__kmp_create_worker$\n " , true );
177
+ " called_from_lib:libomp.*\n thread:^__kmp_create_worker$\n " , true );
178
178
GlobalVariable* suppression_str =
179
179
new GlobalVariable (*M,
180
180
suppression_str_const->getType (),
@@ -185,8 +185,15 @@ bool InstrumentParallel::runOnFunction(Function &F) {
185
185
suppression_str->setUnnamedAddr (GlobalValue::UnnamedAddr::Global);
186
186
suppression_str->setAlignment (1 );
187
187
IRBuilder<> IRB (M->getContext ());
188
+ #if LLVM_VERSION >= 90
189
+ Function* __tsan_default_suppressions = Function::Create (FunctionType::get (IRB.getInt8PtrTy (), false ),
190
+ Function::ExternalLinkage,
191
+ " __tsan_default_suppressions" ,
192
+ M);
193
+ #else
188
194
Function* __tsan_default_suppressions = cast<Function>(M->getOrInsertFunction (" __tsan_default_suppressions" ,
189
- IRB.getInt8PtrTy ()));
195
+ IRB.getInt8PtrTy ()));
196
+ #endif
190
197
__tsan_default_suppressions->setCallingConv (CallingConv::C);
191
198
__tsan_default_suppressions->addFnAttr (Attribute::NoInline);
192
199
__tsan_default_suppressions->addFnAttr (Attribute::NoUnwind);
@@ -201,9 +208,15 @@ bool InstrumentParallel::runOnFunction(Function &F) {
201
208
202
209
#if LLVM_VERSION >= 40
203
210
IRBuilder<> IRB2 (M->getContext ());
211
+ #if LLVM_VERSION >= 90
212
+ FunctionCallee constant = M->getOrInsertFunction (" __archer_get_omp_status" ,
213
+ IRB2.getInt32Ty ());
214
+ Function* __archer_get_omp_status = dyn_cast<Function>(constant.getCallee ());
215
+ #else
204
216
Constant* constant = M->getOrInsertFunction (" __archer_get_omp_status" ,
205
- IRB2.getInt32Ty ());
217
+ IRB2.getInt32Ty ());
206
218
Function* __archer_get_omp_status = cast<Function>(constant);
219
+ #endif
207
220
__archer_get_omp_status->setCallingConv (CallingConv::C);
208
221
BasicBlock* block2 = BasicBlock::Create (M->getContext (), " entry" , __archer_get_omp_status);
209
222
IRBuilder<> builder2 (block2);
0 commit comments