[test] Add tests for opt passes pipelines for O0, O2, O3, and Os.


[test] Add tests for opt passes pipelines for O0, O2, O3, and Os.


mzolotukhinMar 21 2018, 3:17 PM
rL328159: [test] Add tests for llc passes pipelines.

Event Timeline

Hi Michael,

The opt-O0-pipeline.ll test you added is failing for me. Would you mind helping me figure out what is going wrong? The pass structure I'm seeing is:

Target Library Information
Target Transform Information
Target Pass Configuration
Assumption Cache Tracker
Profile summary info
  ModulePass Manager
    Force set function attributes
    CallGraph Construction
    Call Graph SCC Pass Manager
      Inliner for always_inline functions
    A No-Op Barrier Pass
    FunctionPass Manager
      Module Verifier
    Bitcode Writer

There is a No-Op Barrier Pass in my pipeline. I believe this is due to the following code in PassManagerBuilder:

// FIXME: The BarrierNoopPass is a HACK! The inliner pass above implicitly
// creates a CGSCC pass manager, but we don't want to add extensions into
// that pass manager. To prevent this we insert a no-op module pass to reset
// the pass manager to get the same behavior as EP_OptimizerLast in non-O0
// builds. The function merging pass is
if (MergeFunctions)
else if (GlobalExtensionsNotEmpty() || !Extensions.empty())

I'm compiling Polly with my toolchain, so maybe that's what is causing the barrier pass to be inserted? Any ideas?

Hi Matthew,

I’d suggest changing the test so that it works in your case too. I’ve seen some slight differences dependent on the configuration and I think that there is not much criminal in making the test slightly less strict. E.g. you could replace
; CHECK-NEXT: Inliner for always_inline functions
; CHECK-NEXT: FunctionPass Manager

; CHECK-NEXT: Inliner for always_inline functions
; A No-Op Barrier Pass
; CHECK: FunctionPass Manager

By adding a new line for “A No-Op Barrier Pass” we’ll account for your case, don’t break my case, and also in a way document that it’s possible to have or not to have this pass.


Sounds good! I'll update the test. Thanks!