[LLVMbugs] [Bug 16483] New: instcombine incorrectly turns unsigned pointer comparision into signed comparison

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 28 08:17:12 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16483

            Bug ID: 16483
           Summary: instcombine incorrectly turns unsigned pointer
                    comparision into signed comparison
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: richard at xmos.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

If I give instcombine the following IR:

define i1 @f([1 x i8]* %a, [1 x i8]* %b) {
  %c = getelementptr [1 x i8]* %a, i32 0, i32 0
  %d = getelementptr [1 x i8]* %b, i32 0, i32 0
  %cmp = icmp ult i8* %c, %d
  ret i1 %cmp
}

opt -instcombine turns it into:

define i1 @f([1 x i8]* %a, [1 x i8]* %b) {
  %cmp = icmp slt [1 x i8]* %a, %b
  ret i1 %cmp
}

i.e it has turned an unsigned pointer comparision into a signed comparision
that will give different results with some inputs.

-- 
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/20130628/afc27721/attachment.html>


More information about the llvm-bugs mailing list