<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>*********************************************************************************</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>*********************************************************************************<br></div><div><br></div><div>Thanks,</div><div>Peizhao</div><div><br></div></div>