[PATCH] D158291: [PoC][WIP] Add an AArch64 specific pass for loop idiom recognition

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 8 10:28:13 PDT 2023


craig.topper added inline comments.


================
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;
----------------
david-arm wrote:
> 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.
Isn’t it always safe to drop the flags if needed?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158291/new/

https://reviews.llvm.org/D158291



More information about the llvm-commits mailing list