Raphael Ernani Rodrigues
2013-Oct-29 00:42 UTC
[LLVMdev] Non-deterministic behavior when using LoopInfo pass in LLVM
Hello, I'm having a little problem with passes that use LoopInfo. Their statistics aren't the same when I execute the same pass multiple times in the same program. After some investigation, I've found out that LoopInfo is the root of the problem. I wrote a little pass that counts the loop headers (number of basic blocks for which LoopInfo.isLoopHeader(BB) is true). I've picked one of the programs in the LLVM test suite benchmarks and in three consecutive tests the number of loop headers was different. Does anybody know if this behavior is correct? If so, I would like to know the logic behind this pass. Thanks, Raphael Ernani P.S.: Here is the output (a similar variation occurs when I run my pass without -mem2reg, -instnamer, and -break-crit-edges): raphael at ubuntu:~/llvm-3.3/projects/test-suite/SingleSource/Benchmarks/Stanford/Output$ opt -mem2reg -instnamer -break-crit-edges -load MyModule.so -my-counter -stats Oscar.linked.rbc -f >/dev/null ===-------------------------------------------------------------------------== ... Statistics Collected ... ===-------------------------------------------------------------------------== 12 NaturalLoopAnalysis - Number of Loop Headers 8 break-crit-edges - Number of blocks inserted 23 mem2reg - Number of PHI nodes inserted 38 mem2reg - Number of alloca's promoted 20 mem2reg - Number of alloca's promoted with a single store raphael at ubuntu:~/llvm-3.3/projects/test-suite/SingleSource/Benchmarks/Stanford/Output$ opt -mem2reg -instnamer -break-crit-edges -load MyModule.so -my-counter -stats Oscar.linked.rbc -f >/dev/null ===-------------------------------------------------------------------------== ... Statistics Collected ... ===-------------------------------------------------------------------------== 13 NaturalLoopAnalysis - Number of Loop Headers 8 break-crit-edges - Number of blocks inserted 23 mem2reg - Number of PHI nodes inserted 38 mem2reg - Number of alloca's promoted 20 mem2reg - Number of alloca's promoted with a single store raphael at ubuntu:~/llvm-3.3/projects/test-suite/SingleSource/Benchmarks/Stanford/Output$ opt -mem2reg -instnamer -break-crit-edges -load MyModule.so -my-counter -stats Oscar.linked.rbc -f >/dev/null ===-------------------------------------------------------------------------== ... Statistics Collected ... ===-------------------------------------------------------------------------== 11 NaturalLoopAnalysis - Number of Loop Headers 8 break-crit-edges - Number of blocks inserted 23 mem2reg - Number of PHI nodes inserted 38 mem2reg - Number of alloca's promoted 20 mem2reg - Number of alloca's promoted with a single store -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131028/ccccb715/attachment.html>
Eric Christopher
2013-Oct-29 00:51 UTC
[LLVMdev] Non-deterministic behavior when using LoopInfo pass in LLVM
This should definitely not happen on the same bitcode using the same binaries and compile flags. Please file a bug and attach the bitcode if you can? Thanks. -eric On Mon, Oct 28, 2013 at 5:42 PM, Raphael Ernani Rodrigues < raphael at dcc.ufmg.br> wrote:> Hello, > > I'm having a little problem with passes that use LoopInfo. Their > statistics aren't the same when I execute the same pass multiple times in > the same program. > > After some investigation, I've found out that LoopInfo is the root of the > problem. > > I wrote a little pass that counts the loop headers (number of basic blocks > for which LoopInfo.isLoopHeader(BB) is true). I've picked one of the > programs in the LLVM test suite benchmarks and in three consecutive tests > the number of loop headers was different. > > Does anybody know if this behavior is correct? If so, I would like to know > the logic behind this pass. > > Thanks, > > Raphael Ernani > > > P.S.: Here is the output (a similar variation occurs when I run my pass > without -mem2reg, -instnamer, and -break-crit-edges): > > raphael at ubuntu:~/llvm-3.3/projects/test-suite/SingleSource/Benchmarks/Stanford/Output$ > opt -mem2reg -instnamer -break-crit-edges -load MyModule.so -my-counter > -stats Oscar.linked.rbc -f >/dev/null > > ===-------------------------------------------------------------------------==> ... Statistics Collected ... > > ===-------------------------------------------------------------------------==> > 12 NaturalLoopAnalysis - Number of Loop Headers > 8 break-crit-edges - Number of blocks inserted > 23 mem2reg - Number of PHI nodes inserted > 38 mem2reg - Number of alloca's promoted > 20 mem2reg - Number of alloca's promoted with a single store > > raphael at ubuntu:~/llvm-3.3/projects/test-suite/SingleSource/Benchmarks/Stanford/Output$ > opt -mem2reg -instnamer -break-crit-edges -load MyModule.so > -my-counter -stats Oscar.linked.rbc -f >/dev/null > > ===-------------------------------------------------------------------------==> ... Statistics Collected ... > > ===-------------------------------------------------------------------------==> > 13 NaturalLoopAnalysis - Number of Loop Headers > 8 break-crit-edges - Number of blocks inserted > 23 mem2reg - Number of PHI nodes inserted > 38 mem2reg - Number of alloca's promoted > 20 mem2reg - Number of alloca's promoted with a single store > > raphael at ubuntu:~/llvm-3.3/projects/test-suite/SingleSource/Benchmarks/Stanford/Output$ > opt -mem2reg -instnamer -break-crit-edges -load MyModule.so > -my-counter -stats Oscar.linked.rbc -f >/dev/null > > ===-------------------------------------------------------------------------==> ... Statistics Collected ... > > ===-------------------------------------------------------------------------==> > 11 NaturalLoopAnalysis - Number of Loop Headers > 8 break-crit-edges - Number of blocks inserted > 23 mem2reg - Number of PHI nodes inserted > 38 mem2reg - Number of alloca's promoted > 20 mem2reg - Number of alloca's promoted with a single store > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131028/489be52a/attachment.html>