Chad Verbowski via llvm-dev
2020-Aug-05 00:19 UTC
[llvm-dev] llc -O2 vs. llc -O3 --> same debug-pass=Executions but output.obj differs?
Hello, I'm trying to minimize the processing time for llc -O3 by using a three step compilation process of 1. llc input.bc -stopafter=targetlibinfo -o input.mir 2. llc -run-pass={....min passes...} input.mir -o opt.mir 3. llc -startafter=machine-opt-remark-emitter -filetype=obj opt.mir -o final.obj Examining the passes produced by llc for O1,O2,O3 I compared (with XXX {1,2,3}): llc input.bc -filetype=obj -OXXX -o XXXfinal.obj -debug-pass=Executions This showed the passes were identical for O1,O2,O3 yet the .obj produced was different for O3 versus O1 and O2 (which were the same). Does anyone happen to know why O3 is different, I'm wondering if this is caused by some other llc flag unrelated to the passes which appear to be the same looking at -debug-pass=Executions. Thanks for considering this, -Chad -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200804/0f6b7484/attachment.html>
Mehdi AMINI via llvm-dev
2020-Aug-05 01:57 UTC
[llvm-dev] llc -O2 vs. llc -O3 --> same debug-pass=Executions but output.obj differs?
Hi, On Tue, Aug 4, 2020 at 5:19 PM Chad Verbowski via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hello, > > I'm trying to minimize the processing time for llc -O3 by using a three > step compilation process of > > 1. llc input.bc -stopafter=targetlibinfo -o input.mir > 2. llc -run-pass={....min passes...} input.mir -o opt.mir > 3. llc -startafter=machine-opt-remark-emitter -filetype=obj opt.mir -o > final.obj > > > Examining the passes produced by llc for O1,O2,O3 I compared (with XXX > {1,2,3}): > > llc input.bc -filetype=obj -OXXX -o XXXfinal.obj -debug-pass=Executions > > > This showed the passes were identical for O1,O2,O3 yet the .obj produced > was different for O3 versus O1 and O2 (which were the same). > > Does anyone happen to know why O3 is different, I'm wondering if this is > caused by some other llc flag unrelated to the passes which appear to be > the same looking at -debug-pass=Executions. >The opt flag (-O0 -> -O3) are impacting more than the list of passes, it would also impact some threshold for some optimizations for example (both for opt and llc). For example in the backend here as branch on O3: https://github.com/llvm/llvm-project/blob/master/llvm/lib/CodeGen/MachineBlockPlacement.cpp#L3330 -- Mehdi> > Thanks for considering this, > > -Chad > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200804/cfd74970/attachment.html>
Chad Verbowski via llvm-dev
2020-Aug-05 18:06 UTC
[llvm-dev] llc -O2 vs. llc -O3 --> same debug-pass=Executions but output.obj differs?
Thank you! For my code at least, adding -tail-dup-placement-aggressive-threshold=4 makes the output match O3. I understand this is fragile though as there could be other spots in the code doing something special for O3, and perhaps not exposing the equivalent flag. I really appreciate your help, -Chad On Tue, Aug 4, 2020 at 6:58 PM Mehdi AMINI <joker.eph at gmail.com> wrote:> Hi, > > > On Tue, Aug 4, 2020 at 5:19 PM Chad Verbowski via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> Hello, >> >> I'm trying to minimize the processing time for llc -O3 by using a three >> step compilation process of >> >> 1. llc input.bc -stopafter=targetlibinfo -o input.mir >> 2. llc -run-pass={....min passes...} input.mir -o opt.mir >> 3. llc -startafter=machine-opt-remark-emitter -filetype=obj opt.mir -o >> final.obj >> >> >> Examining the passes produced by llc for O1,O2,O3 I compared (with XXX >> {1,2,3}): >> >> llc input.bc -filetype=obj -OXXX -o XXXfinal.obj -debug-pass=Executions >> >> >> This showed the passes were identical for O1,O2,O3 yet the .obj produced >> was different for O3 versus O1 and O2 (which were the same). >> >> Does anyone happen to know why O3 is different, I'm wondering if this is >> caused by some other llc flag unrelated to the passes which appear to be >> the same looking at -debug-pass=Executions. >> > > The opt flag (-O0 -> -O3) are impacting more than the list of passes, it > would also impact some threshold for some optimizations for example (both > for opt and llc). > > For example in the backend here as branch on O3: > https://github.com/llvm/llvm-project/blob/master/llvm/lib/CodeGen/MachineBlockPlacement.cpp#L3330 > > -- > Mehdi > > > >> >> Thanks for considering this, >> >> -Chad >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200805/e1575c66/attachment.html>