This is an archive of the discontinued LLVM Phabricator instance.

Add AliasAnalysis as preserved for a bunch of transforms
AbandonedPublic

Authored by jmolloy on Sep 1 2015, 6:41 AM.

Details

Reviewers
None
Summary

AliasAnalysis must be preserved by definition. But most passes don't inform the pass manager of this, so it invalidates non-Immutable alias passes.

Drive-by add addPreserved<AliasAnalysis>() to all passes in Scalar/ and InstCombine/.

Chandler, I think you said you were going to look at some PassManager trick for this... but I assume that didn't come to anything and this patch isn't invasive anyway.

This allows us to turn on GlobalsModRef by default and it actually be useful.

Diff Detail

Repository
rL LLVM

Event Timeline

jmolloy updated this revision to Diff 33685.Sep 1 2015, 6:41 AM
jmolloy retitled this revision from to Add AliasAnalysis as preserved for a bunch of transforms.
jmolloy updated this object.
jmolloy added a reviewer: chandlerc.
jmolloy set the repository for this revision to rL LLVM.
jmolloy added a subscriber: llvm-commits.
hfinkel added a subscriber: hfinkel.Sep 1 2015, 8:02 AM

This allows us to turn on GlobalsModRef by default and it actually be useful.

Could we preserve GMR specifically? That seems much safer than preserving anything that might ever call itself an aliasing analysis.

chandlerc edited edge metadata.Sep 1 2015, 9:20 AM
chandlerc added a subscriber: chandlerc.

Regarding the original patch, I don't think we should go there. Mostly
because BasicAA really shouldn't be preserved by everything. Right now,
BasicAA continually re-queries for domtree and loopinfo, which is super
slow but allows it to be "OK" when those passes get invalidated. It really
should be a function analysis that is preserved by the things that preserve
domtree and loopinfo. This is what my big AA restructure actually does.

Personally, I'd like to get the AA restructure into place before we change
the preserved sets of these things because my patch was specifically
designed with the current set of preserved semantics. But that's a somewhat
selfish desire. ;] If my big AA restructure isn't going to land any time
soon, then I don't want to hold things up.

Regarding Hal's suggestion.... I don't 100% know if it would work. The
analysis group stuff is... very tricky. I *think* it would work, but I'm
not 100% certain. I am 100% certain that after my restructure, that is
essentially the correct thing to do. Specifically, every pass which only
makes *conservative* changes to the call graph (ie, deleting call edges,
not adding them) should preserve GMR. Which should be essentially
everything but other module passes that could potentially restructure the
call graph in some significant way.

-Chandler

jmolloy abandoned this revision.Apr 27 2016, 7:27 AM