flang-compiler/flang

How to implement passes of flang -O1(or -O3) using opt?

zzhang77 opened this issue · 1 comments

Currently, I am trying to mimic the O1 process of flang using opt, because I would like to disable some passes (vectorization passes and loop unrolling). And opt might be possible to implement O1 process without those passes.

I tried something like this
flang -O0 test.f90 -S -o test.ll

opt -sroa -early-cse -simplifycfg -instcombine -libcalls-shrinkwrap -simplifycfg -reassociate -loop-instsimplify -loop-simplifycfg -licm -loop-rotate -licm -simple-loop-unswitch -bdce -instcombine -simplifycfg -instcombine test.ll -S -o test-after.ll

But I'm not sure whether it is done correctly.
Any suggestions are welcomed. Thanks!

Why don't you look into LLVM's pass pipeline, and disable the passes you don't need (by adding options)?