[flang-commits] [clang] [flang] [llvm] [OpenMP][clang][flang] Compare each tied context selector with all th… (PR #233905)

via flang-commits flang-commits at lists.llvm.org
Tue Oct 20 18:47:12 PDT 2026


================
@@ -414,22 +413,21 @@ int llvm::omp::getBestVariantMatchForContext(
     APInt Score = getVariantMatchScore(VMI, Ctx, ConstructMatches);
     if (Score.ult(BestScore))
       continue;
-    // Equal score need subset checks.
-    if (Score.eq(BestScore)) {
-      // Strict subset are never best.
-      if (isStrictSubset(VMI, *BestVMI))
-        continue;
-      // Same score and the current best is no strict subset so we keep it.
-      if (!isStrictSubset(*BestVMI, VMI))
-        continue;
+    if (Score.ugt(BestScore)) {
+      BestScore = Score;
+      BestVMIIdxs.clear();
     }
-    // New best found.
-    BestVMI = &VMI;
-    BestVMIIdx = u;
-    BestScore = Score;
+    BestVMIIdxs.push_back(u);
----------------
MattPD wrote:

Could we detect an overflowing score total here? With [this input](https://clang.godbolt.org/z/d17EhGaz6), the head selects the lower-scored `low` instead of `high`. The parent crashes instead.

https://github.com/llvm/llvm-project/pull/233905


More information about the flang-commits mailing list