[PATCH] D68280: [LoopDataPrefetch] Move prefetch to dominating position of two accesses

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 1 09:34:21 PDT 2019


jonpa created this revision.
jonpa added reviewers: uweigand, hfinkel, anemet, jfb.
Herald added a subscriber: dexonsmith.

I found that the LBM benchmark benefits significantly if enabling (stores) prefetching on the hot loop with '-mllvm -min-prefetch-stride=128 -mllvm -loop-prefetch-writes' on SystemZ. I then observed that the same memory addresses are accessed on different paths in different iterations. Currently, the LoopDataPrefetch pass emits one prefetch and then skips adding another one for the next close/identical access without taking this into consideration. I therefore tried the idea of making sure that the one prefetch actually dominates both accesses by moving it if necessary. For what I can see now on SystemZ at least, this patch gives yet another 7-8% of improvement on LBM (matching gcc)...

Is this generally a good idea? The prefetch distance heuristic may get slightly thrown off by this in some bigger loops, I guess.


https://reviews.llvm.org/D68280

Files:
  lib/Transforms/Scalar/LoopDataPrefetch.cpp
  test/CodeGen/SystemZ/prefetch-03.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68280.222638.patch
Type: text/x-patch
Size: 7550 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191001/3b750f8d/attachment.bin>


More information about the llvm-commits mailing list