================
@@ -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);
}
- return BestVMIIdx;
+ // A strict subset of another tied variant is never best; otherwise the first
+ // one wins.
+ for (unsigned Idx : BestVMIIdxs)
+ if (llvm::none_of(BestVMIIdxs, [&](unsigned OtherIdx) {
----------------
MattPD wrote:
Could Flang avoid rescanning the full tied set for each runtime alternative?
Compile times for [this 240-clause
input](https://flang.godbolt.org/z/vs8d5eszd), measured on one host, are 3.287
s on head versus 1.255 s on parent. With the `kind(host)` clauses first, the
times are 1.180 s on head and 1.239 s on parent.
https://github.com/llvm/llvm-project/pull/233905
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits