[llvm-dev] opt - replicating multiple passes from -O3 -debug-pass=Executions

Chad Verbowski via llvm-dev llvm-dev at lists.llvm.org
Tue Aug 11 10:14:34 PDT 2020


Update: Comparing the -print-before-all and -print-after-all for -O3 and
the run with the flags, I see a difference starting with the 7th (of 8)
"*** IR Dump After Simplify the CFG ***" which I assume is the -simplifycfg
flag.

Is there any known reason -simplifycfg would behave differently if the
pipeline of passes up to this point  are identical (order and their input
and output)?

Thanks.


On Mon, Aug 10, 2020 at 10:42 PM Chad Verbowski <chad at verbowski.com> wrote:

> Hello,
>
> I am trying to replicate the output from opt -O3 foo.bc -o foo.opt.bc by
> specifying the individual passes instead of the -O3 flag.
>
> Looking at the passes from opt -O3 foo.bc -o foo.bc
> -debug-pass=Executions  it seems there are two passes being run. When I run
> the flags indicated for the two passes specified in the 'Pass Arguments:'
> as two sequential opt processes or a single opt process with the
> concatenated flags  I get a different binary result compared to the O3 run.
> (Note I had to remove the -targetpassconfig flag and
> add -spec-exec-only-if-divergent-target to the second pass to get my run to
> match O3's second pass.)
>
> Comparing the -debug-pass=Executions from my runs with the O3 run, it
> seems the first pass in my run has additional 'TargetLibrary Information',
> 'Target Pass Configuration' and the 'Module Pass Manager' entries compared
> to O3 (copied below). My output shows the 'Pass Arguments:' line has
> automatically added  -targetpassconfig -verify -writebitcode, and the
> -targetlibinfo flag was moved to the start.
>
> Is there a way I can address these differences to enable replicating the
> -O3 first and second passes using opt flags?
>
> Thanks for considering this,
>
> -Chad
>
> (Opt -O3 first pass) Pass Arguments:  -tti -tbaa -scoped-noalias
> -assumption-cache-tracker -targetlibinfo -verify -ee-instrument
> -simplifycfg -domtree -sroa -early-cse -lower-expect
> Target Transform Information
> Type-Based Alias Analysis
> Scoped NoAlias Alias Analysis
> Assumption Cache Tracker
> Target Library Information
>   FunctionPass Manager
>     Module Verifier
>     Instrument function entry/exit with calls to e.g. mcount() (pre
> inlining)
>     Simplify the CFG
>     Dominator Tree Construction
>     SROA
>     Early CSE
>     Lower 'expect' Intrinsics
>
> (My Run): opt in.bc -o out.bc -debug-pass=Executions  -tti -tbaa
> -scoped-noalias -assumption-cache-tracker -targetlibinfo -verify
> -ee-instrument -simplifycfg -domtree -sroa -early-cse -lower-expect
>
> Pass Arguments: * -targetlibinfo* -tti *-targetpassconfig* -tbaa
> -scoped-noalias -assumption-cache-tracker -verify -ee-instrument
> -simplifycfg -domtree -sroa -early-cse -lower-expect *-verify
> -write-bitcode*
> *Target Library Information*
> Target Transform Information
> Target Pass Configuration
> Type-Based Alias Analysis
> Scoped NoAlias Alias Analysis
> Assumption Cache Tracker
>   *ModulePass Manager*
>     FunctionPass Manager
>       Module Verifier
>       Instrument function entry/exit with calls to e.g. mcount() (pre
> inlining)
>       Simplify the CFG
>       Dominator Tree Construction
>       SROA
>       Early CSE
>       Lower 'expect' Intrinsics
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200811/e3c4322b/attachment.html>


More information about the llvm-dev mailing list