Optimization Record

I want to know all the optimization applied by the passes.

I found two options in clang

  1. -fsave-optimization-record 2. -Rpass-analysis=…

However, they have nothing to do with the interaction btw IR files(.ll)
Is there any tool that records all optimizations on IR file?

Hi,

I want to know all the optimization applied by the passes.

I found two options in clang
1. -fsave-optimization-record 2. -Rpass-analysis=...

However, they have nothing to do with the interaction btw IR files(.ll)
Is there any tool that records all optimizations on IR file?

Are you looking for a way to save all optimization remarks/records when using ‘opt’? I think passing `-pass-remarks-output=foo.yaml` should do the trick and create a YAML file with the optimization remarks.

There also are additional flags to selectively print remarks:

* -pass-remarks=‘pass-name’ …. Print optimization remarks for pass-name
* -pass-remarks-missed=‘pass-name’ …. Print missed optimization remarks for pass-name
* -pass-remarks-analysis=‘pass-name’ …. Print analysis optimization remarks for pass-name

pass-name can also be a regular expression for the above.

Cheers,
Florian

Thank you.
It seems that -pass-remarks records the behavior of some passes. gvn, licm, etc.

How can I detect the basic blocks that are modified when one pass is applied?
I want to avoid adding some methods to all transform passes.

Best regards,
Sooyeon

2019년 11월 27일 (수) 오후 6:01, Florian Hahn <florian_hahn@apple.com>님이 작성:

I don’t think this is possible at the moment. IIRC the current implementation of optimization remarks uses debug locations do display the source location of a remark.

It might make sense to add support for using the basic block/instruction in the IR as location when emitting remarks from opt directly without debug locations. It should not be too hard to add, in case you are interested in looking into implementing such a feature!

Cheers,
Florian