[PATCH] D137159: [LoopVectorize] Introduce CanSinkMemoryInstrs to isFixedOrderRecurrence

Peter Waller via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 2 03:37:03 PDT 2022


peterwaller-arm added a comment.

This is my first gambit, and I'm relatively new to making changes to LoopVectorize. Please don't hold back if this is the wrong approach, I'm happy to put legwork in to finding the right route to making this work.



================
Comment at: llvm/lib/Analysis/IVDescriptors.cpp:970
+  // memory instructions can be sunk past it.
+  bool CanSinkMemoryInstrs = MDR->getDependency(Previous).isNonLocal();
+
----------------
This condition is fairly weak and I think it might be possible to make more specific queries.

At the moment my understanding is that this should allow sinking of memory instructions if it can be shown that the `Previous` value doesn't depend on anything above it in the block.

Perhaps `isFixedOrderRecurrence` could handle more cases if `TryToPushSinkCandidate` could consider specifically whether `Previous` depends on the `SinkCandidate`. I'm hesitating because I don't want to accidentally introduce an expensive query.

I'd appreciate input on whether using the memory dependence checker here is appropriate before I consider making this more general.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137159



More information about the llvm-commits mailing list