2 ; RUN: opt -mcpu=z13 -S -passes=loop-simplifycfg -enable-loop-simplifycfg-term-folding -verify-memoryssa 2>&1 < %s | FileCheck %s
3 target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
5 @global = external dso_local local_unnamed_addr global i8, align 2
6 @global.1 = external dso_local local_unnamed_addr global i32, align 4
7 @global.2 = external dso_local local_unnamed_addr global i32, align 4
8 @global.3 = external dso_local local_unnamed_addr global i16, align 2
9 @global.4 = external dso_local local_unnamed_addr global i32, align 4
11 ; CHECK-LABEL: @test_01(
13 define internal fastcc void @test_01() unnamed_addr {
15 %tmp = load i32, ptr @global.2, align 4
16 %tmp1 = icmp eq i32 %tmp, 0
17 br i1 %tmp1, label %bb3, label %bb2
25 bb4: ; preds = %bb6, %bb3
26 br i1 true, label %bb5, label %bb6
29 store i16 0, ptr @global.3, align 2
32 bb6: ; preds = %bb5, %bb4
35 bb7: ; preds = %bb7, %bb2
36 %tmp8 = phi i32 [ 1, %bb7 ], [ 0, %bb2 ]
37 %tmp9 = icmp eq i32 %tmp8, 0
38 br i1 %tmp9, label %bb7, label %bb10
43 bb11: ; preds = %bb13, %bb10
44 %tmp12 = icmp ult i32 %tmp, 6
45 br i1 %tmp12, label %bb13, label %bb14
48 store i32 0, ptr @global.1, align 4
55 @global.5 = external dso_local local_unnamed_addr global i16, align 2
57 declare dso_local void @spam() local_unnamed_addr
59 declare dso_local void @blam() local_unnamed_addr
61 declare dso_local i64 @quux.1() local_unnamed_addr
63 declare dso_local void @bar() local_unnamed_addr
65 ; CHECK-LABEL: @test_02(
67 define dso_local void @test_02(i8 signext %arg) local_unnamed_addr {
71 bb1: ; preds = %bb16, %bb
72 %tmp = phi i8 [ %arg, %bb ], [ %tmp17, %bb16 ]
73 %tmp2 = load i16, ptr @global.5, align 2
74 %tmp3 = icmp ugt i16 %tmp2, 56
75 br i1 %tmp3, label %bb4, label %bb18
78 %tmp5 = tail call i64 @quux.1()
79 %tmp6 = icmp eq i64 %tmp5, 0
80 br i1 %tmp6, label %bb13, label %bb7
85 bb8: ; preds = %bb8, %bb7
86 %tmp9 = phi i32 [ 26, %bb7 ], [ %tmp10, %bb8 ]
88 %tmp10 = add nsw i32 %tmp9, -1
89 %tmp11 = icmp eq i32 %tmp10, 12
90 br i1 %tmp11, label %bb12, label %bb8
93 br i1 false, label %bb14, label %bb16
96 tail call void @spam()
99 bb14: ; preds = %bb13, %bb12
100 %tmp15 = phi i8 [ -23, %bb12 ], [ %tmp, %bb13 ]
101 tail call void @blam()
104 bb16: ; preds = %bb14, %bb12
105 %tmp17 = phi i8 [ %tmp15, %bb14 ], [ -23, %bb12 ]