================
@@ -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:
On my host, the reported 240-clause input now compiles in about 1.2 s.
Compiling [an input with alternating `kind(host)` and `kind(cpu)`
selectors](https://flang.godbolt.org/z/qjzc4r9eK) takes 3.434 s with
`38d7ac0c3bc7`, versus 1.360 s with the original base `918b725cab35`. Placing
its superset clauses first reduces the `38d7ac0c3bc7` compilation time to 1.303
s. Could we also time this input when we evaluate
https://github.com/llvm/llvm-project/pull/231676?
https://github.com/llvm/llvm-project/pull/233905
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits