[llvm-bugs] [Bug 26746] New: InstructionSimplify turns 0.0 to -0.0

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Feb 25 22:52:30 PST 2016


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

            Bug ID: 26746
           Summary: InstructionSimplify turns 0.0 to -0.0
           Product: new-bugs
           Version: 3.7
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: davemm at cs.rutgers.edu
                CC: llvm-bugs at lists.llvm.org,
                    santosh.nagarakatte at gmail.com
    Classification: Unclassified

Given this input:

define float @foo(float %x) #0 {
entry:
  %a = fsub float -0.0, %x
  %b = fsub float 0.0, %a
  ret float %b
}


opt -instcombine produces

define float @foo(float %x) #0 {
entry:
  ret float %x
}


If %x = -0.0, the original function returns 0.0, but the optimized function
returns -0.0.


I believe this is the relevant code, from lib/Analysis/InstructionSimplify.cpp:

  // fsub 0, (fsub -0.0, X) ==> X
  Value *X;
  if (match(Op0, m_AnyZero())) {
    if (match(Op1, m_FSub(m_NegZero(), m_Value(X)))) // this clause
      return X;
    if (FMF.noSignedZeros() && match(Op1, m_FSub(m_AnyZero(), m_Value(X))))
      return X;
  }

-- 
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/20160226/c7a0ad95/attachment.html>


More information about the llvm-bugs mailing list