<div dir="ltr">From my experience, I could not get llc to generate working object file. I just used clang on llvm IR to do that.<div><br></div><div>Regards,</div><div>Kevin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 1, 2017 at 11:54 AM, Peizhao Ou via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi everyone,<div><br></div><div>I am currently testing out a combination of IR->IR passes with opt to benchmark how they affect performance. The source code works fine if simply use the clang (-O0/-O3) to directly compile to object files and link them. However, when I use opt with a select set of passes and then use llc to compile them to binary, the compiled binary is wrong.</div><div><br></div><div>That makes me wonder if there are any IR->IR passes that are indispensable and they are to guarantee the semantics?</div><div><br></div><div>Here's my workflow just in case:<br></div><div>******************************<wbr>******************************<wbr>*********************</div><div>1. Compile the source code to unoptimized IRs:</div><div>clang -c -emit-llvm -O0 test.c -o test.bc</div><div>2. Run opt with a set of IR->IR passes, e.g.,</div><div>opt -simplifycfg -sroa -inferattrs -globalopt -instcombine -simplifycfg -prune-eh -inline -tailcallelim -simplifycfg -loop-simplify -lcssa -loop-rotate -licm -gvn -verify test.bc -o test.bc</div><div>3. Run llc with -O0:</div><div>llc -file-type=obj test.bc -o test.o</div><div>4. Last link all the object files:</div><div>clang -O0 test1.o test2.o -o test</div><div>******************************<wbr>******************************<wbr>*********************<br></div><div><br></div><div>Thanks,</div><div>Peizhao</div><div><br></div></div>
<br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>