• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -S -instcombine | FileCheck %s
2; rdar://problem/9267970
3; ideally this test will run on a 32-bit host
4; must not discard GEPs that might overflow at runtime (aren't inbounds)
5
6define i32 @main(i32 %argc) {
7entry:
8    %tmp1 = add i32 %argc, -2
9    %tmp2 = add i32 %argc, 1879048192
10    %p = alloca i8
11; CHECK: getelementptr
12    %p1 = getelementptr i8, i8* %p, i32 %tmp1
13; CHECK: getelementptr
14    %p2 = getelementptr i8, i8* %p, i32 %tmp2
15    %cmp = icmp ult i8* %p1, %p2
16    br i1 %cmp, label %bbtrue, label %bbfalse
17bbtrue:          ; preds = %entry
18    ret i32 -1
19bbfalse:         ; preds = %entry
20    ret i32 0
21}
22