[PATCH] D67612: [UnrolledInstAnalyzer] Use MSSA to find stored values outside of loop.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 16 12:20:35 PDT 2019


fhahn added a comment.

In D67612#1671613 <https://reviews.llvm.org/D67612#1671613>, @asbirlea wrote:

> In D67612#1671599 <https://reviews.llvm.org/D67612#1671599>, @fhahn wrote:
>
> > The idea here is to check stores before the loop and use the store to determine the loaded value in a specific loop iteration. We only do that if we can determine a base pointer + constant offset for a certain loop iteration.
>
>
> This is the part I do not understand. It looks like the `LoadInst` is considered "free" and not marked towards the cost of the unroll if there is a store with the same base pointer + offset.
>  Is that always the case? If there is an interfering MemoryAccess between the two (the walker's answer), then the `LoadInst` is not free. 
>  I'm not that familiar with the code here, so feel free to correct me if I misunderstood.


It is probably more me not being as familiar with the MemorySSA API. I thought def_chain() would include all memory defs, that could clobber the load, in reverse order. With that in mind, if we hit a non-store or cannot compute the base pointer & offset, we exit. We probably also need another check to make sure we do not miss base pointers that alias. Does that make sense?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67612





More information about the llvm-commits mailing list