[PATCH] D103700: [LV] Fix bug when unrolling (only) a loop with non-latch exit
Gil Rapaport via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 17 10:10:37 PDT 2021
gilr added a comment.
In D103700#2813906 <https://reviews.llvm.org/D103700#2813906>, @reames wrote:
> @Ayal If I'm understanding you even partially correctly, it sounds like you're raising a code quality issue. That is, we may generate a dead epilogue loop (e.g. with a condition statically known to result in the epilogue being untaken, but emitted as a condition) when we didn't need to. Is that correct?
No, the emitted code in this case would be explicitly leaving some iterations to the epilogue even if the trip count is a multiple of the unroll factor. So the epilogue is alive and will not be optimized away later.
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:1567
return true;
return InterleaveInfo.requiresScalarEpilogue();
}
----------------
>To have `Cost->requiresScalarEpilogue()` fully convey this logic, one could directly pass it VF
That seems like the simplest way to both fix the bug and avoid pessimizing the unroll-only case, i.e.:
```
return VF.isVector() && InterleaveInfo.requiresScalarEpilogue();
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103700/new/
https://reviews.llvm.org/D103700
More information about the llvm-commits
mailing list