[LLVMdev] How to use LLVM optimizations with clang

Duncan Sands baldrick at free.fr
Tue Jun 12 04:38:51 PDT 2012


Hi,

> I executed the following command line
>
> llc -O3 comb.ll.bc -debug-pass=Arguments
>
> and got
>
> Pass Arguments:  -targetdata -targetpassconfig -no-aa -tbaa
> -targetlibinfo -basicaa -collector-metadata -machinemoduleinfo
> -machine-branch-prob -preverify -domtree -verify -loops -loop-simplify
> -scalar-evolution -loop-simplify -iv-users -loop-reduce -gc-lowering
> -unreachableblockelim -codegenprepare -stack-protector -preverify
> -domtree -verify -loops -branch-prob -expand-isel-pseudos
> -tailduplication -opt-phis -localstackalloc -dead-mi-elimination
> -machinedomtree -machine-loops -machinelicm -machine-cse -machine-sink
> -peephole-opts -unreachable-mbb-elimination -livevars
> -phi-node-elimination -twoaddressinstruction -processimpdefs
> -slotindexes -liveintervals -livedebugvars -simple-register-coalescing
> -calcspillweights -livestacks -virtregmap -edge-bundles
> -spill-code-placement -stack-slot-coloring -machinelicm -edge-bundles
> -prologepilog -branch-folder -tailduplication -machine-cp
> -postrapseudos -machinedomtree -machine-loops -post-RA-sched
> -gc-analysis -machine-block-freq -block-placement2 -machinedomtree
> -machine-loops
>
> Now, how can I specify these optimization manually along with llc like
> we did with opt tool?

you can't.

Ciao, Duncan.

>
> Regards
>
> Shahzad
>
> On Tue, Jun 12, 2012 at 1:23 PM, Duncan Sands<baldrick at free.fr>  wrote:
>> Hi,
>>
>>
>> On 12/06/12 13:09, Abdul Wahid Memon wrote:
>>>
>>> Thanks alot. How can we view those optimization which are enabled when we
>>> do
>>>
>>> llc -O3 comb.ll
>>
>>
>> llc -O3 comb.ll -debug-pass=Arguments
>>
>>
>>>
>>> Are these the same as the ones produced by the following command line
>>
>>
>> no, as I mentioned before they are of a completely different nature
>> to the optimizations that opt does.
>>
>> Ciao, Duncan.
>>
>>
>>>
>>> llvm-as<    /dev/null | opt -O3 -disable-output -debug-pass=Arguments
>>>
>>> Regards
>>>
>>> Shahzad
>>>
>>> On Tue, Jun 12, 2012 at 1:01 PM, Duncan Sands<baldrick at free.fr>    wrote:
>>>>>
>>>>> Yes. But how exactly code generation (optimized one) be done without
>>>>> clang. Is it possible that we can specify those optimization
>>>>> (individual ones instead of standard ones like -O3) some how when
>>>>> generating code as is done by clang or llc?
>>>>
>>>>
>>>>
>>>> llc comb.ll
>>>> gcc -o comb comb.s
>>>>
>>>> Variants:
>>>>   llc -O0 comb.ll
>>>>   llc -O3 comb.ll
>>>> etc
>>>>
>>>> Note that the codegen level optimizations done by llc have nothing to do
>>>> with
>>>> the IR level optimizations of the kind performed by opt.
>>>>
>>>> Ciao, Duncan.
>>
>>




More information about the llvm-dev mailing list