This patch solely moves convert operation between SVE predicate pattern
and element count into two small functions. It's pre-commit patch for optimize
pture with known sve register width.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | ||
---|---|---|
18027 | You're removing the unreachable here. Perhaps it's worth adding an assert: assert(PgPattern && "Unexpected element count for SVE predicate") | |
18058 | Maybe we should leave this TODO here as I think it still applies? | |
llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h | ||
457 | I think that using both inline and static keywords here causes clang-tidy to think it's unused. Can you just use the inline keyword here instead? | |
457 | I think this breaks case style rules - perhaps this should be named something like getNumElementsFromSVEPredPattern? | |
492 | Same comments as above. |
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | ||
---|---|---|
18031 | This'll need to be validated as with the original code. | |
18058–18060 | I think this is an important comment that should remain within getPredicateForFixedLengthVector. See comment on D108706. | |
llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h | ||
457 | I'm not a fan of the names of these functions as ElementCount has an existing meaning within LLVM and these function are not really honouring it. Perhaps getSVEPredicatePatternAsFixedLength/getSVEPredicatePatternForFixedLength? Or something of similar ilk. Can you add a function comment that makes it explicit that zero is returned for the case where no translation is possible. | |
470–471 | Is there an LLVM coding style policy here? For example is setting MinNumElts and breaking preferred over just using return. | |
498–499 | Same "return" comment as above. |
llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h | ||
---|---|---|
470–471 | I checked https://llvm.org/docs/CodingStandards.html, There is no rules for switch cases. |
llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h | ||
---|---|---|
470–471 | OK, I guess that's fine, but returning without breaks maybe does look nicer and more compact (it kills off 8 lines of code)? It's also more consistent with the default case that does return early. i.e. switch (Pattern) { default: return 0; case AArch64SVEPredPattern::vl1: ... return Pattern; ... } I don't feel too strongly about it though. :) |
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp | ||
---|---|---|
655 | As a bit of extra tidying perhaps merge this MinNumElts > NumElts with the new if (!MinNumElts). |
You're removing the unreachable here. Perhaps it's worth adding an assert: