The function fixReduction used to assert/crash for scalable vector when
a vector reduce could be done with a smaller vector.
This patch removes this assertion as it is safe to use scalable vector for
vector reduce and truncate.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
The fix looks good thanks! Just a minor comment about the test ...
llvm/test/Transforms/LoopVectorize/sve-reduction-inloop.ll | ||
---|---|---|
12 ↗ | (On Diff #340369) | Hi @CarolineConcatto, I presume this is a truncation of the PHI value? If possible I think it might be nice to have CHECK lines for the PHI values to see them being truncated. I think that ZEXT1 and ZEXT2 will also be the incoming values for the PHI node too. |
llvm/test/Transforms/LoopVectorize/sve-reduction-inloop.ll | ||
---|---|---|
12 ↗ | (On Diff #340369) | Hey @david-arm, |
LGTM! Thanks for updating the tests - I think it's a stronger test now with the PHIs and makes it clearer what's going on. :)
llvm/test/Transforms/LoopVectorize/sve-reduction-inloop.ll | ||
---|---|---|
10 ↗ | (On Diff #340561) | nit: Maybe here and in the PHI below it's good to show where TMP34 and TMP36 come from too, i.e. instead of {{%.*}} you can just write vector.body. |
14 ↗ | (On Diff #340561) | nit: It's up to you, but if you prefer a smaller set of CHECK lines you can probably kill off lines TMP21 to TMP25 and just have simple CHECK lines for the loads, i.e. ; CHECK: [[WIDE_LOAD:%.*]] = load <vscale x 8 x i8>, <vscale x 8 x i8>* and lower down ; CHECK; [[WIDE_LOAD2:%.*]] = load <vscale x 8 x i8>, <vscale x 8 x i8>* |
Hi @david-arm,
I have addressed your comments.
I also moved the test to AArch64 folder. I believe is the correct folder for it.
Carol
llvm/test/Transforms/LoopVectorize/AArch64/sve-reduction-inloop.ll | ||
---|---|---|
2 ↗ | (On Diff #341875) | Can this test be target independent by using -force-target-supports-scalable-vectors or does it contain any AArch64 cost-modeling? |
41 ↗ | (On Diff #341875) | might be helpful to use a nicer name for the loop block to make the test a bit easier to parse, maybe %loop? Same for ._crit_edge, perhaps %exit? |
LGTM! Thanks for making the changes. :)
llvm/test/Transforms/LoopVectorize/AArch64/sve-reduction-inloop.ll | ||
---|---|---|
15 ↗ | (On Diff #341875) | nit: I think you can also just remove lines TMP22-24 as they're unused now. |
-Update the test to use -force-target-supports-scalable-vectors
-Move and rename test to scalable-reduction-inloop.ll
-Remove unnecessary checks
llvm/test/Transforms/LoopVectorize/AArch64/sve-reduction-inloop.ll | ||
---|---|---|
2 ↗ | (On Diff #341875) | Thank you @fhahn for that. |
15 ↗ | (On Diff #341875) | Thank you @david-arm, |
41 ↗ | (On Diff #341875) | Hey @fhahn thank you for your input, |
LGTM! Thanks for making the changes - seems like all review comments have been addressed. :)
Thanks for the updates! LGTM
llvm/test/Transforms/LoopVectorize/AArch64/sve-reduction-inloop.ll | ||
---|---|---|
41 ↗ | (On Diff #341875) | Thanks for improving it! |