get Optimization Level options

Hi All,

I want to use Optimization Level options in tailDuplicate() API from TailDuplicator.cpp file to restrict splice() function.

With -Oz option this splice() API is duplicating the RET instruction in predecessor blocks.

Could anyone please give your suggestions to get OPTLevel Options(which object will carry OptLevel Options in this stage?) in this level.

Thanks & Regards,

Ramakota Reddy.

Hi Ramakota,

With -Oz option this splice() API is duplicating the RET instruction in predecessor blocks.

-Oz is handled slightly differently from the numeric options. It gets
attached to the function as an attribute that you can check for with
Function::optForMinSize.

Could anyone please give your suggestions to get OPTLevel Options(which object will carry OptLevel Options in this stage?) in this level.

This looks like it's known by the PassManagerBuilder and given to the
constructor of any pass that needs it. Mostly it just configures what
passes are run at all though.

Cheers.

Tim.

Thanks a lot Tim for your suggestions.

With Regards,
Ramakota.