This is an archive of the discontinued LLVM Phabricator instance.

CommandFlags.h/llc: Move StopAfter/StartBefore options to llc.
ClosedPublic

Authored by MatzeB on Aug 1 2016, 7:38 PM.

Details

Summary

I am mainly looking for confirmation that the gold plugin doesn't need -stop-after/-start-after in this review!

Move those two options to llc:

The options in CommandFlags.h are shared by dsymutil, gold, llc,
llvm-dwp, llvm-lto, llvm-mc, lto, opt.

-stop-after/-start-after only affect codegen passes however only gold and llc
actually create codegen passes and I believe these flags to be only
useful for users of llc. For the other tools they are just highly
confusing: -stop-after claims to "Stop compilation after a specific
pass" which is not true in the context of the "opt" tool.

Diff Detail

Repository
rL LLVM

Event Timeline

MatzeB updated this revision to Diff 66426.Aug 1 2016, 7:38 PM
MatzeB retitled this revision from to CommandFlags.h/llc: Move StopAfter/StartBefore options to llc..
MatzeB updated this object.
MatzeB added reviewers: nlewycky, tejohnson.
MatzeB set the repository for this revision to rL LLVM.
MatzeB added a subscriber: llvm-commits.

I am mainly looking for confirmation that the gold plugin doesn't need -stop-after/-start-after in this review!

I just realized that I can answer my own question: neither StartAfter nor StopAfter are used in gold-plugin.cpp so they can't have any effect in the gold plugin.

tejohnson edited edge metadata.Aug 2 2016, 11:37 AM

I am mainly looking for confirmation that the gold plugin doesn't need -stop-after/-start-after in this review!

I just realized that I can answer my own question: neither StartAfter nor StopAfter are used in gold-plugin.cpp so they can't have any effect in the gold plugin.

Sorry for the delayed response. I'm not personally familiar with -stop-after and -start-after. However, the gold-plugin will pass along any unrecognized options to the LLVM backend. So presumably a gold plugin user could specify them like -Wl,-plugin-opt,-start-after=pass-name.

I assume they are useful for debugging? Are they currently also supported for clang? E.g. clang -O2 -mllvm -start-after=pass-name ...?

I am mainly looking for confirmation that the gold plugin doesn't need -stop-after/-start-after in this review!

I just realized that I can answer my own question: neither StartAfter nor StopAfter are used in gold-plugin.cpp so they can't have any effect in the gold plugin.

Sorry for the delayed response. I'm not personally familiar with -stop-after and -start-after. However, the gold-plugin will pass along any unrecognized options to the LLVM backend. So presumably a gold plugin user could specify them like -Wl,-plugin-opt,-start-after=pass-name.

I assume they are useful for debugging? Are they currently also supported for clang? E.g. clang -O2 -mllvm -start-after=pass-name ...?

Yes they are used for debugging, but as I just realized in my second comment the only place that actually reads the cl::opts is llc.cpp, so they are available in the gold plugin but will not have any effect. Same with clang. Seems like an accident that the cl::opt ended up in CommandFlags.h.

I am mainly looking for confirmation that the gold plugin doesn't need -stop-after/-start-after in this review!

I just realized that I can answer my own question: neither StartAfter nor StopAfter are used in gold-plugin.cpp so they can't have any effect in the gold plugin.

Sorry for the delayed response. I'm not personally familiar with -stop-after and -start-after. However, the gold-plugin will pass along any unrecognized options to the LLVM backend. So presumably a gold plugin user could specify them like -Wl,-plugin-opt,-start-after=pass-name.

I assume they are useful for debugging? Are they currently also supported for clang? E.g. clang -O2 -mllvm -start-after=pass-name ...?

Yes they are used for debugging, but as I just realized in my second comment the only place that actually reads the cl::opts is llc.cpp, so they are available in the gold plugin but will not have any effect. Same with clang. Seems like an accident that the cl::opt ended up in CommandFlags.h.

I see. In that case they should be in llc.cpp. But since the support for them is wired all the way through CodeGen, *should* it be supported for debugging via clang and gold-plugin?

MatzeB added a comment.Aug 2 2016, 2:10 PM

I am mainly looking for confirmation that the gold plugin doesn't need -stop-after/-start-after in this review!

I just realized that I can answer my own question: neither StartAfter nor StopAfter are used in gold-plugin.cpp so they can't have any effect in the gold plugin.

Sorry for the delayed response. I'm not personally familiar with -stop-after and -start-after. However, the gold-plugin will pass along any unrecognized options to the LLVM backend. So presumably a gold plugin user could specify them like -Wl,-plugin-opt,-start-after=pass-name.

I assume they are useful for debugging? Are they currently also supported for clang? E.g. clang -O2 -mllvm -start-after=pass-name ...?

Yes they are used for debugging, but as I just realized in my second comment the only place that actually reads the cl::opts is llc.cpp, so they are available in the gold plugin but will not have any effect. Same with clang. Seems like an accident that the cl::opt ended up in CommandFlags.h.

I see. In that case they should be in llc.cpp. But since the support for them is wired all the way through CodeGen, *should* it be supported for debugging via clang and gold-plugin?

I guess there is a point to be made to move the option from llc.cpp to CodeGen/TargetPassConfig.cpp instead. But I guess there is no reason not to do the easier move to llc.cpp right now? We can do the move to TargetPassConfig.cpp another time in another patch. (I just wanted to get this done as a cleanup before I add -start-before/-stop-before flags because I need that for a test...).

tejohnson accepted this revision.Aug 2 2016, 2:23 PM
tejohnson edited edge metadata.

Ok that seems reasonable, the move makes sense given the current option handling. It makes the current handling clearer.

This revision is now accepted and ready to land.Aug 2 2016, 2:23 PM
This revision was automatically updated to reflect the committed changes.