[LLVMbugs] [Bug 23038] New: float2int miscompile

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 26 18:51:25 PDT 2015


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

            Bug ID: 23038
           Summary: float2int miscompile
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 14106
  --> https://llvm.org/bugs/attachment.cgi?id=14106&action=edit
C testcase

opt -float2int transforms this:

define i32 @test(i8 %call) {
  %conv1 = sitofp i8 %call to float
  %mul = fmul float %conv1, -3.000000e+00
  %conv2 = fptosi float %mul to i8
  %conv3 = sext i8 %conv2 to i32
  ret i32 %conv3
}

into this:

define i32 @test(i8 %call) {
  %1 = sext i8 %call to i32
  %mul1 = mul i32 %1, 0  ;; XXX nope
  %2 = trunc i32 %mul1 to i8
  %conv3 = sext i8 %2 to i32
  ret i32 %conv3
}

See attached .cc testcase that fails with "clang -O2 -fno-inline" (by printing
"0 -27 0" when it should print "-27 -27 1").

-- 
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/20150327/8e28eae1/attachment.html>


More information about the llvm-bugs mailing list