1 ; RUN: opt -mtriple=s390x-linux-gnu -mcpu=z13 -enable-mssa-loop-dependency -verify-memoryssa -sroa -globalopt -functionattrs -simplifycfg -licm -loop-unswitch %s -S | FileCheck %s
4 target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
5 target triple = "s390x-ibm-linux"
7 @0 = internal global i32 -9, align 4
8 @1 = internal global i64 9, align 8
9 @g_1042 = external dso_local global [5 x i16], align 2
11 ; CHECK-LABEL: @main()
12 ; Function Attrs: nounwind
13 define dso_local void @main() #0 {
18 ; Function Attrs: argmemonly nounwind
19 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
21 ; Function Attrs: nounwind
22 define dso_local void @func_1() #0 {
23 %1 = alloca i32*, align 8
24 %2 = call signext i32 @func_2()
25 %3 = icmp ne i32 %2, 0
26 br i1 %3, label %4, label %9
28 ; <label>:4: ; preds = %0
29 %5 = load i16, i16* getelementptr inbounds ([5 x i16], [5 x i16]* @g_1042, i64 0, i64 0), align 2, !tbaa !1
30 %6 = zext i16 %5 to i64
31 %7 = load i64, i64* @1, align 8, !tbaa !5
33 store i64 %8, i64* @1, align 8, !tbaa !5
34 call void @llvm.lifetime.end.p0i8(i64 4, i8* undef) #2
37 ; <label>:9: ; preds = %0
38 store i32* @0, i32** %1, align 8, !tbaa !7
41 ; <label>:10: ; preds = %23, %9
42 %11 = load i64, i64* @1, align 8, !tbaa !5
43 %12 = icmp eq i64 %11, 65535
44 br i1 %12, label %13, label %14
46 ; <label>:13: ; preds = %10
47 store i32* null, i32** %1, align 8, !tbaa !7
50 ; <label>:14: ; preds = %13, %10
51 %15 = load i32*, i32** %1, align 8, !tbaa !7
52 %16 = load i32, i32* %15, align 4, !tbaa !9
53 %17 = trunc i32 %16 to i16
54 %18 = call signext i16 @safe_sub_func_int16_t_s_s(i16 signext %17)
55 %19 = sext i16 %18 to i32
56 %20 = icmp ne i32 %19, 0
57 br i1 %20, label %23, label %21
59 ; <label>:21: ; preds = %14
60 %22 = load volatile i8, i8* null, align 1, !tbaa !11
63 ; <label>:23: ; preds = %21, %14
67 ; Function Attrs: nounwind
68 declare dso_local signext i32 @func_2() #0
70 ; Function Attrs: nounwind
71 define dso_local void @safe_sub_func_uint8_t_u_u() #0 {
75 ; Function Attrs: nounwind
76 define dso_local void @safe_add_func_int64_t_s_s() #0 {
80 ; Function Attrs: nounwind
81 define dso_local void @safe_rshift_func_int16_t_s_u() #0 {
85 ; Function Attrs: nounwind
86 define dso_local void @safe_div_func_uint8_t_u_u() #0 {
90 ; Function Attrs: nounwind
91 define dso_local void @safe_mul_func_uint16_t_u_u() #0 {
95 ; Function Attrs: nounwind
96 define dso_local void @safe_mul_func_int16_t_s_s() #0 {
100 ; Function Attrs: nounwind
101 define dso_local void @safe_div_func_int32_t_s_s() #0 {
105 ; Function Attrs: nounwind
106 define dso_local signext i16 @safe_sub_func_int16_t_s_s(i16 signext) #0 {
107 %2 = alloca i16, align 2
108 store i16 %0, i16* %2, align 2, !tbaa !1
109 %3 = load i16, i16* %2, align 2, !tbaa !1
110 %4 = sext i16 %3 to i32
111 %5 = sub nsw i32 %4, 0
112 %6 = trunc i32 %5 to i16
116 ; Function Attrs: nounwind
117 define dso_local void @safe_add_func_uint16_t_u_u() #0 {
121 ; Function Attrs: nounwind
122 define dso_local void @safe_div_func_int8_t_s_s() #0 {
126 ; Function Attrs: nounwind
127 define dso_local void @safe_add_func_int16_t_s_s() #0 {
131 ; Function Attrs: nounwind
132 define dso_local void @safe_add_func_uint8_t_u_u() #0 {
136 attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="z13" "target-features"="+transactional-execution,+vector" "unsafe-fp-math"="false" "use-soft-float"="false" }
137 attributes #1 = { argmemonly nounwind }
138 attributes #2 = { nounwind }
142 !0 = !{!"clang version 8.0.0 (http://llvm.org/git/clang.git 7cda4756fc9713d98fd3513b8df172700f267bad) (http://llvm.org/git/llvm.git 199c0d32e96b646bd8cf6beeaf0f99f8a434b56a)"}
143 !1 = !{!2, !2, i64 0}
144 !2 = !{!"short", !3, i64 0}
145 !3 = !{!"omnipotent char", !4, i64 0}
146 !4 = !{!"Simple C/C++ TBAA"}
147 !5 = !{!6, !6, i64 0}
148 !6 = !{!"long", !3, i64 0}
149 !7 = !{!8, !8, i64 0}
150 !8 = !{!"any pointer", !3, i64 0}
151 !9 = !{!10, !10, i64 0}
152 !10 = !{!"int", !3, i64 0}
153 !11 = !{!3, !3, i64 0}