This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Support disabling expensive combines in opt
ClosedPublic

Authored by nikic on Jan 16 2020, 12:07 PM.

Details

Summary

Currently, there is no way to disable ExpensiveCombines when doing a standalone opt -instcombine run, as that's the default, and the opt option can currently only be used to force enable, not to force disable. The only way to disable expensive combines is via -O1 or -O2, but that of course also runs the rest of the kitchen sink...

Noticed while looking into https://bugs.llvm.org/show_bug.cgi?id=44541. Another issue I noticed is that NewPM always enables expensive combines, whiles legacy PM on does so at -O3. Anyone know whether that was an intentional choice or an oversight?

Diff Detail

Event Timeline

nikic created this revision.Jan 16 2020, 12:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 16 2020, 12:07 PM
spatel accepted this revision.Jan 16 2020, 12:45 PM

LGTM

For the new PM question, I assume that's an oversight. I haven't looked too much into the new PM, but I have noticed other possible mistakes there. Eg, it seems like that's running the SpeculativeExecutionPass on all targets?
https://github.com/llvm/llvm-project/blob/53b68e676faf208b4a8f817e9bd4ddd522cc6006/llvm/lib/Passes/PassBuilder.cpp#L427

vs:

https://github.com/llvm/llvm-project/blob/53b68e676faf208b4a8f817e9bd4ddd522cc6006/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp#L342

This revision is now accepted and ready to land.Jan 16 2020, 12:45 PM
This revision was automatically updated to reflect the committed changes.