1; RUN: llc -mtriple i386-unknown-freebsd10.0 -march=x86 --relocation-model=pic %s -o -
2
3; PR16979
4
5target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128"
6target triple = "i386-unknown-freebsd10.0"
7
8@state = internal unnamed_addr global i32 0, align 4
9
10; Function Attrs: nounwind sspreq
11define void @set_state(i32 %s) #0 {
12entry:
13  store i32 %s, i32* @state, align 4
14  ret void
15}
16
17; Function Attrs: nounwind sspreq
18define void @zero_char(i8* nocapture %p) #0 {
19entry:
20  store i8 0, i8* %p, align 1
21  tail call void @g(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0) #2
22  ret void
23}
24
25declare void @g(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) #1
26
27; Function Attrs: nounwind sspreq
28define void @do_something(i32 %i) #0 {
29entry:
30  %data = alloca [8 x i8], align 1
31  %0 = load i32* @state, align 4
32  %cmp = icmp eq i32 %0, 0
33  br i1 %cmp, label %if.then, label %if.else
34
35if.then:                                          ; preds = %entry
36  tail call fastcc void @send_int(i32 0)
37  br label %if.end
38
39if.else:                                          ; preds = %entry
40  tail call fastcc void @send_int(i32 %i)
41  %arrayidx = getelementptr inbounds [8 x i8]* %data, i32 0, i32 0
42  call void @zero_char(i8* %arrayidx)
43  br label %if.end
44
45if.end:                                           ; preds = %if.else, %if.then
46  ret void
47}
48
49; Function Attrs: nounwind sspreq
50define internal fastcc void @send_int(i32 %p) #0 {
51entry:
52  tail call void @f(i32 %p) #2
53  tail call void @g(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0) #2
54  ret void
55}
56
57declare void @f(i32) #1
58
59attributes #0 = { nounwind sspreq "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
60attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
61attributes #2 = { nounwind }
62