• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mcpu=cortex-a8 < %s
2; rdar://problem/10137436: sqlite3 miscompile
3;
4; CHECK: subs
5; CHECK: cmp
6; CHECK: it
7
8target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32"
9target triple = "thumbv7-apple-ios4.0.0"
10
11declare i8* @__memset_chk(i8*, i32, i32, i32) nounwind
12
13define hidden fastcc i32 @sqlite3VdbeExec(i32* %p) nounwind {
14entry:
15  br label %sqlite3VarintLen.exit7424
16
17sqlite3VarintLen.exit7424:                        ; preds = %do.body.i7423
18  br label %do.body.i
19
20do.body.i:                                        ; preds = %do.body.i, %sqlite3VarintLen.exit7424
21  br i1 undef, label %do.body.i, label %sqlite3VarintLen.exit
22
23sqlite3VarintLen.exit:                            ; preds = %do.body.i
24  %sub2322 = add i64 undef, undef
25  br i1 undef, label %too_big, label %if.end2327
26
27if.end2327:                                       ; preds = %sqlite3VarintLen.exit
28  br i1 undef, label %if.end2341, label %no_mem
29
30if.end2341:                                       ; preds = %if.end2327
31  br label %for.body2355
32
33for.body2355:                                     ; preds = %for.body2355, %if.end2341
34  %add2366 = add nsw i32 undef, undef
35  br i1 undef, label %for.body2377, label %for.body2355
36
37for.body2377:                                     ; preds = %for.body2355
38  %conv23836154 = zext i32 %add2366 to i64
39  %sub2384 = sub i64 %sub2322, %conv23836154
40  %conv2385 = trunc i64 %sub2384 to i32
41  %len.0.i = select i1 undef, i32 %conv2385, i32 undef
42  %sub.i7384 = sub nsw i32 %len.0.i, 0
43  %call.i.i7385 = call i8* @__memset_chk(i8* undef, i32 0, i32 %sub.i7384, i32 undef) nounwind
44  unreachable
45
46too_big:                                          ; preds = %sqlite3VarintLen.exit
47  unreachable
48
49no_mem:                                           ; preds = %if.end2327, %for.body, %entry.no_mem_crit_edge
50  unreachable
51
52sqlite3ErrStr.exit:                               ; preds = %if.then82
53  unreachable
54}
55