[PATCH] D25476: GVN-hoist: fix store past load dependence analysis (PR30216, PR30499)

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 11 08:47:00 PDT 2016


Can you just expose a version of static bool
instructionClobbersQuery(MemoryDef *MD, MemoryUse *MU, const
MemoryLocOrCall &UseMLOC, AliasAnalysis &AA) {

That takes the mloc from the memory use?

IE
STH like:

bool  MemorySSA::defClobbersUse(MemoryDef *MD, MemoryUse *MU) {
   return instructionClobbersQuery(MD, MU, MemoryLocOrCall(MU), MSSA->AA);
}


On Tue, Oct 11, 2016 at 8:30 AM, Sebastian Pop <sebpop at gmail.com> wrote:

> sebpop created this revision.
> sebpop added a reviewer: dberlin.
> sebpop added subscribers: george.burgess.iv, llvm-commits.
>
> This is a refreshed version of a patch that was reverted: it fixes
> the problems reported in both PR30216 and PR30499, and
> contains all the test-cases from both bugs.
>
> To hoist stores past loads, we used to search for potential
> conflicting loads on the hoisting path by following a MemorySSA
> def-def link from the store to be hoisted to the previous
> defining memory access, and from there we followed the def-use
> chains to all the uses that occur on the hoisting path. The
> problem is that the def-def link may point to a store that does
> not alias with the store to be hoisted, and so the loads that are
> walked may not alias with the store to be hoisted, and even as in
> the testcase of PR30216, the loads that may alias with the store
> to be hoisted are not visited.
>
> The current patch visits all loads on the path from the store to
> be hoisted to the hoisting position and uses the alias analysis
> to ask whether the store may alias the load. I was not able to
> use the MemorySSA functionality to ask for whether load and
> store are clobbered: I'm not sure which function to call, so I
> used a call to AA->isNoAlias().
>
> Store past store is still working as before using a MemorySSA
> query: I added an extra test to pr30216.ll to make sure store
> past store does not regress.
>
> Tested on x86_64-linux with check and a test-suite run.
>
>
> https://reviews.llvm.org/D25476
>
> Files:
>   llvm/lib/Transforms/Scalar/GVNHoist.cpp
>   llvm/test/Transforms/GVNHoist/pr30216.ll
>   llvm/test/Transforms/GVNHoist/pr30499.ll
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161011/27270d4b/attachment.html>


More information about the llvm-commits mailing list