[LLVMbugs] [Bug 18705] New: BranchProbabilityInfo is not using the right heuristics inside loops

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Feb 2 21:30:19 PST 2014


            Bug ID: 18705
           Summary: BranchProbabilityInfo is not using the right
                    heuristics inside loops
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Global Analyses
          Assignee: unassignedbugs at nondot.org
          Reporter: bob.wilson at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The BranchProbabilityInfo analysis applies a series of heuristics to determine
branch weights. In cases when multiple heuristics could apply, it uses the
first one. The LoopBranchHeuristics are the 4th of 8 heuristics that it tries.
The calcLoopBranchHeuristics function starts like this:

  Loop *L = LI->getLoopFor(BB);
  if (!L)
    return false;

That is the only "return false" in the function. I.E., any basic block inside a
loop will be handled by this heuristic, and we will never even try using any of
the later heuristics inside a loop. Worse, the "InEdges" (anything that is
neither an exit nor a back edge) are always handled by dividing the loop weight
by the number of InEdge successors, which seems unlikely to be the right thing
to do in many cases.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140203/ae828438/attachment.html>

More information about the llvm-bugs mailing list