@@ -193,9 +193,11 @@ static bool isStrictSubset(const VariantMatchInfo &VMI0,
193
193
return true ;
194
194
}
195
195
196
- static int isVariantApplicableInContextHelper (
197
- const VariantMatchInfo &VMI, const OMPContext &Ctx,
198
- SmallVectorImpl<unsigned > *ConstructMatches, bool DeviceSetOnly) {
196
+ static int
197
+ isVariantApplicableInContextHelper (const VariantMatchInfo &VMI,
198
+ const OMPContext &Ctx,
199
+ SmallVectorImpl<unsigned > *ConstructMatches,
200
+ bool DeviceOrImplementationSetOnly) {
199
201
200
202
// The match kind determines if we need to match all traits, any of the
201
203
// traits, or none of the traits for it to be an applicable context.
@@ -245,8 +247,10 @@ static int isVariantApplicableInContextHelper(
245
247
246
248
for (unsigned Bit : VMI.RequiredTraits .set_bits ()) {
247
249
TraitProperty Property = TraitProperty (Bit);
248
- if (DeviceSetOnly &&
249
- getOpenMPContextTraitSetForProperty (Property) != TraitSet::device)
250
+ if (DeviceOrImplementationSetOnly &&
251
+ getOpenMPContextTraitSetForProperty (Property) != TraitSet::device &&
252
+ getOpenMPContextTraitSetForProperty (Property) !=
253
+ TraitSet::implementation)
250
254
continue ;
251
255
252
256
// So far all extensions are handled elsewhere, we skip them here as they
@@ -272,7 +276,7 @@ static int isVariantApplicableInContextHelper(
272
276
return *Result;
273
277
}
274
278
275
- if (!DeviceSetOnly ) {
279
+ if (!DeviceOrImplementationSetOnly ) {
276
280
// We could use isSubset here but we also want to record the match
277
281
// locations.
278
282
unsigned ConstructIdx = 0 , NoConstructTraits = Ctx.ConstructTraits .size ();
@@ -315,11 +319,11 @@ static int isVariantApplicableInContextHelper(
315
319
return true ;
316
320
}
317
321
318
- bool llvm::omp::isVariantApplicableInContext (const VariantMatchInfo &VMI,
319
- const OMPContext &Ctx,
320
- bool DeviceSetOnly ) {
322
+ bool llvm::omp::isVariantApplicableInContext (
323
+ const VariantMatchInfo &VMI, const OMPContext &Ctx,
324
+ bool DeviceOrImplementationSetOnly ) {
321
325
return isVariantApplicableInContextHelper (
322
- VMI, Ctx, /* ConstructMatches */ nullptr , DeviceSetOnly );
326
+ VMI, Ctx, /* ConstructMatches */ nullptr , DeviceOrImplementationSetOnly );
323
327
}
324
328
325
329
static APInt getVariantMatchScore (const VariantMatchInfo &VMI,
@@ -418,8 +422,9 @@ int llvm::omp::getBestVariantMatchForContext(
418
422
419
423
SmallVector<unsigned , 8 > ConstructMatches;
420
424
// If the variant is not applicable its not the best.
421
- if (!isVariantApplicableInContextHelper (VMI, Ctx, &ConstructMatches,
422
- /* DeviceSetOnly */ false ))
425
+ if (!isVariantApplicableInContextHelper (
426
+ VMI, Ctx, &ConstructMatches,
427
+ /* DeviceOrImplementationSetOnly */ false ))
423
428
continue ;
424
429
// Check if its clearly not the best.
425
430
APInt Score = getVariantMatchScore (VMI, Ctx, ConstructMatches);
0 commit comments