1; REQUIRES: asserts 2; RUN: opt -mcpu=z13 -S -loop-simplifycfg -enable-mssa-loop-dependency -enable-loop-simplifycfg-term-folding -verify-memoryssa 2>&1 < %s | FileCheck %s 3target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64" 4 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 10 11; CHECK-LABEL: @test_01( 12 13define internal fastcc void @test_01() unnamed_addr { 14bb: 15 %tmp = load i32, i32* @global.2, align 4 16 %tmp1 = icmp eq i32 %tmp, 0 17 br i1 %tmp1, label %bb3, label %bb2 18 19bb2: ; preds = %bb 20 br label %bb7 21 22bb3: ; preds = %bb 23 br label %bb4 24 25bb4: ; preds = %bb6, %bb3 26 br i1 true, label %bb5, label %bb6 27 28bb5: ; preds = %bb4 29 store i16 0, i16* @global.3, align 2 30 br label %bb6 31 32bb6: ; preds = %bb5, %bb4 33 br label %bb4 34 35bb7: ; 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 39 40bb10: ; preds = %bb7 41 br label %bb11 42 43bb11: ; preds = %bb13, %bb10 44 %tmp12 = icmp ult i32 %tmp, 6 45 br i1 %tmp12, label %bb13, label %bb14 46 47bb13: ; preds = %bb11 48 store i32 0, i32* @global.1, align 4 49 br label %bb11 50 51bb14: ; preds = %bb11 52 ret void 53} 54 55@global.5 = external dso_local local_unnamed_addr global i16, align 2 56 57declare dso_local void @spam() local_unnamed_addr 58 59declare dso_local void @blam() local_unnamed_addr 60 61declare dso_local i64 @quux.1() local_unnamed_addr 62 63declare dso_local void @bar() local_unnamed_addr 64 65; CHECK-LABEL: @test_02( 66 67define dso_local void @test_02(i8 signext %arg) local_unnamed_addr { 68bb: 69 br label %bb1 70 71bb1: ; preds = %bb16, %bb 72 %tmp = phi i8 [ %arg, %bb ], [ %tmp17, %bb16 ] 73 %tmp2 = load i16, i16* @global.5, align 2 74 %tmp3 = icmp ugt i16 %tmp2, 56 75 br i1 %tmp3, label %bb4, label %bb18 76 77bb4: ; preds = %bb1 78 %tmp5 = tail call i64 @quux.1() 79 %tmp6 = icmp eq i64 %tmp5, 0 80 br i1 %tmp6, label %bb13, label %bb7 81 82bb7: ; preds = %bb4 83 br label %bb8 84 85bb8: ; preds = %bb8, %bb7 86 %tmp9 = phi i32 [ 26, %bb7 ], [ %tmp10, %bb8 ] 87 tail call void @bar() 88 %tmp10 = add nsw i32 %tmp9, -1 89 %tmp11 = icmp eq i32 %tmp10, 12 90 br i1 %tmp11, label %bb12, label %bb8 91 92bb12: ; preds = %bb8 93 br i1 false, label %bb14, label %bb16 94 95bb13: ; preds = %bb4 96 tail call void @spam() 97 br label %bb14 98 99bb14: ; preds = %bb13, %bb12 100 %tmp15 = phi i8 [ -23, %bb12 ], [ %tmp, %bb13 ] 101 tail call void @blam() 102 br label %bb16 103 104bb16: ; preds = %bb14, %bb12 105 %tmp17 = phi i8 [ %tmp15, %bb14 ], [ -23, %bb12 ] 106 br label %bb1 107 108bb18: ; preds = %bb1 109 ret void 110} 111