[LLVMdev] How to use LLVM optimizations with clang
Abdul Wahid Memon
engrwahidmemon at gmail.com
Thu Jun 7 13:39:58 PDT 2012
Thanks alot Chad for quick response. Does this means that, we can not
use LLVM optimizations except O1, O2, O3, O4 and unroll-loops with
clang?
One more thing I would like to know that If I want to process multiple
modules with opt at the same time like
opt -adce *.bc
then how is it possible with opt in one go, if I process all the
bytecode files within Makefile.
Thanks.
Shahzad
On Thu, Jun 7, 2012 at 9:22 PM, Chad Rosier <mcrosier at apple.com> wrote:
>
> On Jun 7, 2012, at 10:59 AM, Abdul Wahid Memon wrote:
>
>> Hello everyone
>>
>> I am trying to use some LLVM optimizations like -die or -adce. Is it
>> possible to use them along clang?
>>
>> Or is there a way where these optimization can be passed on to "opt"
>> tool through clang, if opt is being used by clang behind the scenes?
>>
>
> No, opt only works on llvm IR/bitcode. You can generate it like this:
> clang -c foo.c -emit-llvm -o foo.bc
> or
> clang -S foo.c -emit-llvm -o foo.ll
>
> Then you can run the optimization(s):
> opt -adce foo.bc -o foo-adce.bc
>
> Then you can compile using clang
> clang -c foo-adce.bc -o foo-adce.o
>
> Chad
>
>> Thanks alot
>>
>> Regards
>>
>> Shahzad
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
More information about the llvm-dev
mailing list