[LLVMdev] Make "llvmc -opt" call "opt" for .ll files

Kaelyn Uhrain kaelyn.alexi at gmail.com
Mon Feb 14 16:22:10 PST 2011


Without this patch, opt is never called for llvm-assembly (.ll) files
when "-opt" is passed to llvmc:

$ llvmc -clang -v test.ll
llc -f -O2 test.ll -o /tmp/llvm_gvO2nK/test.s
as /tmp/llvm_gvO2nK/test.s -o /tmp/llvm_gvO2nK/test.o
llvm-ld -native -disable-internalize /tmp/llvm_gvO2nK/test.o -o a.out

$ llvmc -clang -opt -v test.ll
llc -f -O2 test.ll -o /tmp/llvm_2xiL86/test.s
as /tmp/llvm_2xiL86/test.s -o /tmp/llvm_2xiL86/test.o
llvm-ld -native -disable-internalize /tmp/llvm_2xiL86/test.o -o a.out

This patch makes a small change to tools/llvmc/src/Base.td so that
"-opt" is honored for .ll files.  Invoking llvmc with this patch
results in:

$ llvmc -clang -v test.ll
llc -O2 test.ll -o /tmp/llvm_nbnJRg/test.s
as /tmp/llvm_nbnJRg/test.s -o /tmp/llvm_nbnJRg/test.o
llvm-ld -native -disable-internalize /tmp/llvm_nbnJRg/test.o -o a.out

$ llvmc -clang -opt -v test.ll
llvm-as test.ll -o /tmp/llvm_OoIRlO/test.bc
opt -f -O2 /tmp/llvm_OoIRlO/test.bc -o /tmp/llvm_OoIRlO/test.bc-GHASUE
llc -O2 /tmp/llvm_OoIRlO/test.bc-GHASUE -o /tmp/llvm_OoIRlO/test.s
as /tmp/llvm_OoIRlO/test.s -o /tmp/llvm_OoIRlO/test.o
llvm-ld -native -disable-internalize /tmp/llvm_OoIRlO/test.o -o a.out
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm-opt-ll.diff
Type: text/x-patch
Size: 647 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110214/888ca705/attachment.bin>


More information about the llvm-dev mailing list