The Exit instruction passed in for checking if it's an ordered reduction need not be
an FPAdd operation. We need to bail out at that point instead of
assuming it is an FPAdd (and hence has two operands). See added testcase.
It crashes without the patch because the Exit instruction is a phi with
exactly one operand.
This latent bug was exposed by 95346ba which added support for
multi-exit loops for vectorization.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/test/Transforms/LoopVectorize/fp-reduction-crash.ll | ||
---|---|---|
2 | This is to show that the failure only occurs in assertions enabled mode. It will not fail in any other mode. To put it differently, if I first landed this testcase alone, it will succeed in non-assertion enabled mode and it isn't clear what the problem is (since we cannot add XFAIL). |
llvm/test/Transforms/LoopVectorize/fp-reduction-crash.ll | ||
---|---|---|
2 | Can you add check lines to make sure the IR is transformed as expected? That way, we do not need to rely on the asserting causing the test to crash. |
llvm/test/Transforms/LoopVectorize/fp-reduction-crash.ll | ||
---|---|---|
2 | actually, can the test be added to the file already containing order reduction tests, with a comment explaining what it checks? That will help make maintaining it easier. |
llvm/test/Transforms/LoopVectorize/fp-reduction-crash.ll | ||
---|---|---|
2 | The reason it doesn't cause any failure in non-assertion mode is that this just checks and bails out without doing vectorization. The bail out was too late. That was the only reason this crash occurred. |
llvm/test/Transforms/LoopVectorize/fp-reduction-crash.ll | ||
---|---|---|
2 |
Sounds good to me, thanks! |
nit: I don't think REQUIRES: asserts is necessary for this test?