[PATCH] D10059: New alias analysis for static global variables

Chandler Carruth chandlerc at gmail.com
Tue Jul 14 00:11:40 PDT 2015


chandlerc added a comment.

FWIW, this is just a minor part of GlobalsModRef factored out.

I think that if we want something like this, we should break apart GlobalsModRef rather than duplicating its code here and fixing relatively minor aspects of it.

However, this pattern has all of the problems that GlobalsModRef has (see my recent llvmdev mails). I don't think there is any way to make it sound and reasonable.

Sam, your approach works, but violates the fundamental contract when queried by function passes -- it examines the state of other functions. It also has significant compile time costs than I'm not sure we really should be imposing on LLVM.

I think the right way to get this kind of stuff into LLVM is:

1. Get the pass manager into decent shape
2. Add a constraint about function passes not invalidating some conservative analysis of how globals are escaped and/or captured.
3. Use the above constraint for IP analysis and a conservative and sound local analysis (either forwards like capture tracking or backwards like GetUnderlyingObject) which definitively identifies when one of the memory locations in an alias query comes from outside the function (and thus an escaped memory location).

I'm not even sure we want this, as it sounds expensive and brittle... but it would at least be reasonable relative to the current examples of GlobalsModRef or this pass...


http://reviews.llvm.org/D10059







More information about the llvm-commits mailing list