Ryan Taylor
2013-Mar-13 00:13 UTC
[LLVMdev] Different results using -emit-llvm and llc together than just using -S?
Why would the generated assembly results for a piece of code be different if I did this: clang -S -emit-llvm sample.c -o sample.ll llc sample.ll -o sample.s then if I did this: clang -S sample.c -o sample.s Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130312/5fc1a52a/attachment.html>
Anton Korobeynikov
2013-Mar-13 09:28 UTC
[LLVMdev] Different results using -emit-llvm and llc together than just using -S?
llc and clang have different set of defaults. E.g. llc defaults to frame pointer elimination, etc. On Wed, Mar 13, 2013 at 4:13 AM, Ryan Taylor <ryta1203 at gmail.com> wrote:> Why would the generated assembly results for a piece of code be different if > I did this: > > clang -S -emit-llvm sample.c -o sample.ll > llc sample.ll -o sample.s > > then if I did this: > > clang -S sample.c -o sample.s > > Thanks. > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
Duncan Sands
2013-Mar-13 09:33 UTC
[LLVMdev] Different results using -emit-llvm and llc together than just using -S?
Hi Ryan, On 13/03/13 01:13, Ryan Taylor wrote:> Why would the generated assembly results for a piece of code be different if I > did this: > > clang -S -emit-llvm sample.c -o sample.ll > llc sample.ll -o sample.s > > then if I did this: > > clang -S sample.c -o sample.sbecause clang passes all kinds of options to llc that are not the llc defaults. For example, by default llc targets your local processor while I don't think clang does. Ciao, Duncan.
Nick Lewycky
2013-Mar-13 09:53 UTC
[LLVMdev] Different results using -emit-llvm and llc together than just using -S?
Ryan Taylor wrote:> Why would the generated assembly results for a piece of code be > different if I did this: > > clang -S -emit-llvm sample.c -o sample.ll > llc sample.ll -o sample.s > > then if I did this: > > clang -S sample.c -o sample.sFor one example, 'llc' defaults to -O2 but clang defaults to -O0. In general, clang sets up the equivalent of an opt|llc run with a slew of flags passed in. Also, note that clang -O0 is not the same as clang -O2 -mllvm -disable-llvm-optzns, as clang chooses to emit more code which may prove useful to the optimizer, but would only waste time at -O0. Nick
Ryan Taylor
2013-Mar-13 15:42 UTC
[LLVMdev] Different results using -emit-llvm and llc together than just using -S?
Understood; however, I see the same change/difference when calling llc -O0? Are there any other differences between calling these separately? Or does llc not take -O levels? On Wed, Mar 13, 2013 at 3:53 AM, Nick Lewycky <nicholas at mxc.ca> wrote:> Ryan Taylor wrote: > >> Why would the generated assembly results for a piece of code be >> different if I did this: >> >> clang -S -emit-llvm sample.c -o sample.ll >> llc sample.ll -o sample.s >> >> then if I did this: >> >> clang -S sample.c -o sample.s >> > > For one example, 'llc' defaults to -O2 but clang defaults to -O0. In > general, clang sets up the equivalent of an opt|llc run with a slew of > flags passed in. Also, note that clang -O0 is not the same as clang -O2 > -mllvm -disable-llvm-optzns, as clang chooses to emit more code which may > prove useful to the optimizer, but would only waste time at -O0. > > Nick >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130313/2702bb53/attachment.html>
Ryan Taylor
2013-Mar-13 16:23 UTC
[LLVMdev] Different results using -emit-llvm and llc together than just using -S?
Anton, Is this true even at -O0? Thanks. On Wed, Mar 13, 2013 at 3:28 AM, Anton Korobeynikov <anton at korobeynikov.info> wrote:> llc and clang have different set of defaults. > > E.g. llc defaults to frame pointer elimination, etc. > > On Wed, Mar 13, 2013 at 4:13 AM, Ryan Taylor <ryta1203 at gmail.com> wrote: > > Why would the generated assembly results for a piece of code be > different if > > I did this: > > > > clang -S -emit-llvm sample.c -o sample.ll > > llc sample.ll -o sample.s > > > > then if I did this: > > > > clang -S sample.c -o sample.s > > > > Thanks. > > > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > > > -- > With best regards, Anton Korobeynikov > Faculty of Mathematics and Mechanics, Saint Petersburg State University >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130313/2a0b8cfd/attachment.html>
Apparently Analagous Threads
- [LLVMdev] Different results using -emit-llvm and llc together than just using -S?
- [LLVMdev] Different results using -emit-llvm and llc together than just using -S?
- [LLVMdev] Different results using -emit-llvm and llc together than just using -S?
- [LLVMdev] clang promoting local to global
- Definitive list of optimisations at each optimisation level