@@ -193,9 +193,11 @@ static bool isStrictSubset(const VariantMatchInfo &VMI0,
193193 return true ;
194194}
195195
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) {
199201
200202 // The match kind determines if we need to match all traits, any of the
201203 // traits, or none of the traits for it to be an applicable context.
@@ -245,8 +247,10 @@ static int isVariantApplicableInContextHelper(
245247
246248 for (unsigned Bit : VMI.RequiredTraits .set_bits ()) {
247249 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)
250254 continue ;
251255
252256 // So far all extensions are handled elsewhere, we skip them here as they
@@ -272,7 +276,7 @@ static int isVariantApplicableInContextHelper(
272276 return *Result;
273277 }
274278
275- if (!DeviceSetOnly ) {
279+ if (!DeviceOrImplementationSetOnly ) {
276280 // We could use isSubset here but we also want to record the match
277281 // locations.
278282 unsigned ConstructIdx = 0 , NoConstructTraits = Ctx.ConstructTraits .size ();
@@ -315,11 +319,11 @@ static int isVariantApplicableInContextHelper(
315319 return true ;
316320}
317321
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 ) {
321325 return isVariantApplicableInContextHelper (
322- VMI, Ctx, /* ConstructMatches */ nullptr , DeviceSetOnly );
326+ VMI, Ctx, /* ConstructMatches */ nullptr , DeviceOrImplementationSetOnly );
323327}
324328
325329static APInt getVariantMatchScore (const VariantMatchInfo &VMI,
@@ -418,8 +422,9 @@ int llvm::omp::getBestVariantMatchForContext(
418422
419423 SmallVector<unsigned , 8 > ConstructMatches;
420424 // 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 ))
423428 continue ;
424429 // Check if its clearly not the best.
425430 APInt Score = getVariantMatchScore (VMI, Ctx, ConstructMatches);
0 commit comments