[llvm-bugs] [Bug 29103] New: Probability of taking branch when checking for NaN is too high

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 23 08:29:23 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=29103

            Bug ID: 29103
           Summary: Probability of taking branch when checking for NaN is
                    too high
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Global Analyses
          Assignee: unassignedbugs at nondot.org
          Reporter: amehsan at ca.ibm.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Currently when we have a check to find if a FP value is NaN, the probability of
the path taken, when the input is NaN is 3/8. 

If we reduce this probability to something smaller (I tried a value slightly
less than 5%), that will allow that basic blocks to be placed differently and
we will get a higher number of fall throughs (assuming NaNs are really rare).

One place that this matters, is in std::sqrt, where the result will be NaN if
the input is negative. I was looking at a FP code with many calls to std::sqrt,
and realized this.

Currently the function below is where these branch probabilities are decided:
bool BranchProbabilityInfo::calcFloatingPointHeuristics(const BasicBlock *BB)

-- 
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/20160823/fffa2c95/attachment.html>


More information about the llvm-bugs mailing list