Skip to content

Commit dfae717

Browse files
committed
GlobalISel: Fix maxScalarIf predicate check
The std::function itself was tested, not the result of the actual query. It seems like there should be a warning for this. Inline the check to avoid this.
1 parent 4637daa commit dfae717

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,10 @@ class LegalizeRuleSet {
864864
return actionIf(
865865
LegalizeAction::NarrowScalar,
866866
[=](const LegalityQuery &Query) {
867-
return scalarWiderThan(TypeIdx, Ty.getSizeInBits()) && Predicate(Query);
867+
const LLT QueryTy = Query.Types[TypeIdx];
868+
return QueryTy.isScalar() &&
869+
QueryTy.getSizeInBits() > Ty.getSizeInBits() &&
870+
Predicate(Query);
868871
},
869872
changeElementTo(typeIdx(TypeIdx), Ty));
870873
}

0 commit comments

Comments
 (0)