This patch adds
- New arguments to getMinPrefetchStride() to let the target decide on a per-loop basis if software prefetching should be done even with a stride within the limit of the hw prefetcher.
- New TTI hook enableWritePrefetching() to let a target do write prefetching by default (defaults to false).
LoopDataPrefetch:
- A search through the whole loop to gather information before emitting any prefetches. This way the target can get information via new arguments to getMinPrefetchStride() and emit prefetches more selectively. Collected information includes: Does the loop have a call, how many memory accesses, how many of them are strided, how many prefetches will cover them. This is NFC to before as long as the target does not change its definition of getMinPrefetchStride().
- If a previous access to the same exact address was 'read', and the current one is 'write', make it a 'write' prefetch.
- If two accesses that are covered by the same prefetch do not dominate each other, put the prefetch in a block that dominates both of them.
- If a ConstantMaxTripCount is less than ItersAhead, then skip the loop.
SystemZ:
- increase the distance of prefetching (to meet the hot lbm loop with prefetching 9 iterations ahead).
- enable write prefetching by default.
- emit sw prefetching for any stride according to new heuristics in getMinPrefetchStride(), which includes lbm.
- Do we need a test to test getMinPrefetchStride()?
I am confused with the description of NumPrefetches. It looks like its passed the number of different memory accesses in the loop. "Number of prefetches needed for the strided accesses." sounds like hardware requirement, but its passed a property of the code. Can you clarify?