This is an archive of the discontinued LLVM Phabricator instance.

[PM] Port ArgumentPromotion to the new pass manager.
AbandonedPublic

Authored by chandlerc on Jan 30 2017, 4:30 AM.

Details

Reviewers
davide
Summary

This requires teaching the LazyCallGraph how to replace functions in the
graph in-place, but otherwise is a fairly direct port of the existing
logic.

The one interesting thing is that LCG can handle much more directly
making this update which allows us to just skip the hooks in the core
argument promotion logic used by the old PM. This is largely a function
of not tracking call instructions and instead tracking the actual edges
in the graph at an abstract level.

Note that this isn't quite ready to submit yet. It exposes a crash in the
inliner that I'm still investigating. But the code seems reasonable enough and
I have both unittesting for the LCG change and direct testing of argpromote.

Event Timeline

chandlerc created this revision.Jan 30 2017, 4:30 AM
davide edited edge metadata.Jan 30 2017, 7:07 AM

I have one high level comment about the tests (it's not your fault but I think it's a good time to recover). I assume you tried to bootstrap and the testsuite with this change and it's clean.

include/llvm/Analysis/LazyCallGraph.h
234

s/tranfsormations/transformations/

lib/Transforms/IPO/ArgumentPromotion.cpp
1081 ↗(On Diff #86267)

s/updat e/update/

test/Transforms/ArgumentPromotion/aggregate-promote.ll
2–4 ↗(On Diff #86267)

Ugh for tests still using grep. If you're fine with that, I would rather do the following:

  1. Convert them to FileCheck
  2. Expand the output so that they don't accidentally test the wrong thing
  3. Make sure the output between old and new PM matches.

Maybe I'm being overcautious here, but I've been bitten already by cases where the output didn't quite match (and was hiding bugs).

chandlerc updated this revision to Diff 86504.Jan 31 2017, 3:09 PM

Strip this down to the just the LazyCallGraph enhancement.

The core ArgumentPromotion change needs to wait for more LCG improvements that
I can effectively separate.

I will also deal with the grep-based tests when dealing with the pass itself.

chandlerc abandoned this revision.Feb 6 2017, 1:21 AM

Marking that this is dead. I'll be sending out a fresh series of patches that take us in a different (and IMO much better) direction for argpromote...