================
@@ -313,16 +333,27 @@ bool llvm::omp::isVariantApplicableInContext(
static APInt getVariantMatchScore(const VariantMatchInfo &VMI,
const OMPContext &Ctx,
SmallVectorImpl<unsigned> &ConstructMatches)
{
- APInt Score(64, 1);
+ APInt Score(1, 1);
+
+ // A sum of valid scores can exceed the width of any individual score.
+ // Retain all active bits and allow one more bit for each addition's carry.
+ auto AddScore = [&](const APInt &Value) {
+ unsigned Width = std::max(Score.getActiveBits(), Value.getActiveBits()) +
1;
+ Score = Score.zextOrTrunc(Width);
+ Score += Value.zextOrTrunc(Width);
+ };
+ auto AddPowerOfTwo = [&](unsigned Exponent) {
+ AddScore(APInt::getOneBitSet(Exponent + 1, Exponent));
+ };
- unsigned NoConstructTraits = VMI.ConstructTraits.size();
+ unsigned NoConstructTraits = Ctx.ConstructTraits.size();
----------------
MattPD wrote:
Fixed by https://github.com/llvm/llvm-project/pull/224431: With the outer
PARALLEL, `check_target` calls `scored_variant` at 7f8fa534, as at the merge
base.
https://github.com/llvm/llvm-project/pull/219014
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits