[PATCH] D68281: [LoopDataPrefetch] Don't prefetch past a known total trip count

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 3 02:29:07 PDT 2019


jonpa added a comment.

I noticed that the output of Loop Strength Reduce differs with this simple patch, and the diff includes actual instructions and opcodes, and this is when LoopDataPrefetch does not emit any prefetches.

It seems that the call SE->getSmallConstantTripCount(L) changes data structures so that when LSR is later run it outputs different code in the preheader of the loop:

  master <> patched
  <     %xtraiter144 = and i64 %1, 3
  17a17,19
  >     %2 = trunc i64 %1 to i8
  >     %3 = trunc i8 %2 to i2
  >     %4 = zext i2 %3 to i64

I am not sure exactly why or what should be done. However, if I remove the AU.addPreserved<ScalarEvolutionWrapperPass>(); from LoopDataPrefetch, then this problem disappears.


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

https://reviews.llvm.org/D68281





More information about the llvm-commits mailing list