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: unassignedb...@nondot.org
          Reporter: dav...@cs.rutgers.edu
                CC: llvm-bugs@lists.llvm.org,
                    santosh.nagaraka...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to