[PATCH] D158291: [PoC][WIP] Add an AArch64 specific pass for loop idiom recognition
David Sherwood via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 8 01:17:21 PDT 2023
david-arm added a comment.
Hi @craig.topper, thanks again for the review comments! I'll take a look at your comments regarding blocks being in the loop and see if there is a problem or not. It's possible that the canonical form of a loop allows us to make certain assumptions, but I'll double check.
================
Comment at: llvm/lib/Target/AArch64/AArch64LoopIdiomRecognize.cpp:274
+ // Don't replace the loop if the add has a wrap flag.
+ if (Index->hasNoSignedWrap() || Index->hasNoUnsignedWrap())
+ return false;
----------------
craig.topper wrote:
> why is this needed?
There is no fundamental reason why the checks are needed, but it made the vector implementation of the mismatch algorithm simpler since we didn't have to worry about poison during signed or unsigned overflow. For the cases we were interested in (unsigned 32-bit addition in C) there were no nsw or nuw flags so we thought for now we'd restrict it to just these cases.
It probably makes sense to relax this restriction in future, but it will require carefully rewriting the vectorised implementation to be safe with regards poison/overflow, and ensuring there are no performance regressions for the loops we care about.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158291/new/
https://reviews.llvm.org/D158291
More information about the llvm-commits
mailing list