This is an archive of the discontinued LLVM Phabricator instance.

[PM] Add some internal options for testing out the new PM.
AbandonedPublic

Authored by silvas on Jul 2 2016, 9:06 PM.

Details

Reviewers
davidxl
hfinkel
Summary

These are internal developer options and so just use report_fatal_error
if an invalid pass pipeline is specified.

This is heavily derived from the code in LLD, but there are a couple
tiny differences that make it hard to share.
We can rip this out once we integrate the new PM into the main
compilation path of course.

I have been using this to build test-suite with the new PM using D21921.
I can successfully build and run test-suite with e.g. the following pipeline:

CMAKE_C_FLAGS:STRING=-Xclang "-middle-end-passes=module(function(sroa,instcombine,simplify-cfg),globaldce,globalopt,deadargelim,function(sroa,instcombine,simplify-cfg),require<profile-summary>,require<targetlibinfo>,cgscc(prune-eh,inline,function-attrs,argpromotion,function(instcombine,simplify-cfg,instcombine,jump-threading,simplify-cfg)))" -Xclang -middle-end-aa-pipeline=basic-aa,scoped-noalias-aa,type-based-aa,globals-aa

I encourage others to try out the new PM and report any bugs!
I've already been bitten by https://llvm.org/bugs/show_bug.cgi?id=28400 in a couple ways!

Diff Detail

Event Timeline

silvas updated this revision to Diff 62615.Jul 2 2016, 9:06 PM
silvas retitled this revision from to [PM] Add some internal options for testing out the new PM..
silvas updated this object.
silvas added reviewers: hfinkel, davidxl.
silvas added a subscriber: llvm-commits.
davidxl added inline comments.Jul 2 2016, 11:30 PM
include/clang/Driver/CC1Options.td
160

Why not removing 'new' ? Eventually newpm will become pm anyway.

162–163

same here

lib/CodeGen/BackendUtil.cpp
761

Outline this into its own helper method ?

silvas updated this revision to Diff 62643.Jul 3 2016, 5:50 PM

Update for David's comments.

silvas updated this revision to Diff 62644.Jul 3 2016, 5:59 PM
silvas marked 3 inline comments as done.

Fix a thinko that broke *all* the clang IRGen tests. Oops.

silvas updated this revision to Diff 62645.Jul 3 2016, 6:06 PM
silvas updated this object.

Slight cleanup.

silvas updated this revision to Diff 62646.Jul 3 2016, 6:15 PM

Change variable name.

silvas added a comment.Jul 8 2016, 7:29 PM

Submit a reply that I had left in an "unsubmitted" state for some reason.

include/clang/Driver/CC1Options.td
160

I was originally thinking that these would be deleted once we have the new PM hooked up, but after thinking about it this is generally useful functionality for developers.

Uh, so this was sent to llvm-commits, but it really should go to cfe-commits. ;] Not sure if you want to start a fresh thread or what.

Actually add cfe-commits. Oops.

Thanks to Chandler for pointing out I had added llvm-commits instead.

I'd like someone more active on the Clang side to comment about this, but here is my 2 cents...

It seems like it'd be nice to not populate or run or otherwise build up the legacy pass managers when using this option. I guess I would expect something to more split early between the two pipelines, and then merge back before doing codegen.

I'm also somewhat hesitant with the '-middle-end-...' naming, but not sure what would work better. We don't have anything even comparable with the legacy PM, so maybe just "-llvm-custom-passes" or something similar?

silvas updated this revision to Diff 64420.Jul 18 2016, 4:43 PM

Rebase after r275507.

silvas abandoned this revision.Mar 25 2020, 6:29 PM