[LLVMbugs] [Bug 10194] New: Bug in opt -std-compile-opts: invalid conversion of ugt to sgt

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jun 25 09:37:25 PDT 2011


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

           Summary: Bug in opt -std-compile-opts: invalid conversion of
                    ugt to sgt
           Product: new-bugs
           Version: 2.9
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: bprosnitz at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=6772)
 --> (http://llvm.org/bugs/attachment.cgi?id=6772)
Bytecode before opt

If opt (with -std-compile-opts) is run on the following program which exits
with a code 1

define zeroext i32 @test(i8* noalias %in, i64 %inlen) nounwind noinline {
entry:
  %0 = getelementptr inbounds i8* %in, i64 %inlen ; <i8*> [#uses=1]
  %1 = icmp ult i8* %in, %0                       ; <i1> [#uses=1]
  br i1 %1, label %return, label %retfalse

retfalse:                                         ; preds = %entry
  ret i32 0

return:                                           ; preds = %entry
  ret i32 1
}

define i32 @main() nounwind {
entry:
  %0 = alloca i8, i32 8                           ; <i8*> [#uses=9]
  %1 = call i32 @test(i8* %0, i64 -9223372036854775808) ; <i8> [#uses=1]
  ret i32 %1
}

it generates a different program, that exits with a code 0:

define zeroext i32 @test(i8* noalias %in, i64 %inlen) nounwind noinline {
entry:
  %0 = icmp sgt i64 %inlen, 0
  br i1 %0, label %return, label %retfalse

retfalse:                                         ; preds = %entry
  ret i32 0

return:                                           ; preds = %entry
  ret i32 1
}

define i32 @main() nounwind {
entry:
  %0 = alloca [8 x i8], align 1
  %.sub = getelementptr inbounds [8 x i8]* %0, i64 0, i64 0
  %1 = call i32 @test(i8* %.sub, i64 -9223372036854775808)
  ret i32 %1
}

I reduced the operations in -std-compile-opts which cause this issue to a
minimal set of flags that still cause it:
opt  -instcombine -inline -scalarrepl -instcombine -indvars

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list