[LLVMdev] Non-deterministic behavior when using LoopInfo pass in LLVM
Raphael Ernani Rodrigues
raphael at dcc.ufmg.br
Mon Oct 28 17:42:53 PDT 2013
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>
More information about the llvm-dev
mailing list