1; RUN: opt -S -basicaa -licm < %s | FileCheck %s 2; 3; Manually validate LCSSA form is preserved even after SSAUpdater is used to 4; promote things in the loop bodies. 5 6target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 7target triple = "x86_64-unknown-linux-gnu" 8 9@x = common global i32 0, align 4 10@y = common global i32 0, align 4 11 12define void @PR18688() { 13; CHECK-LABEL: @PR18688( 14 15entry: 16 br i1 undef, label %return, label %outer.preheader 17 18outer.preheader: 19 br label %outer.header 20; CHECK: outer.preheader: 21; CHECK: br label %outer.header 22 23outer.header: 24 store i32 0, i32* @x, align 4 25 br i1 undef, label %outer.latch, label %inner.preheader 26; CHECK: outer.header: 27; CHECK-NEXT: br i1 undef, label %outer.latch, label %inner.preheader 28 29inner.preheader: 30 br label %inner.header 31; CHECK: inner.preheader: 32; CHECK-NEXT: br label %inner.header 33 34inner.header: 35 br i1 undef, label %inner.body.rhs, label %inner.latch 36; CHECK: inner.header: 37; CHECK-NEXT: %[[PHI0:[^,]+]] = phi i32 [ %{{[^,]+}}, %inner.latch ], [ 0, %inner.preheader ] 38; CHECK-NEXT: br i1 undef, label %inner.body.rhs, label %inner.latch 39 40inner.body.rhs: 41 store i32 0, i32* @x, align 4 42 br label %inner.latch 43; CHECK: inner.body.rhs: 44; CHECK-NEXT: br label %inner.latch 45 46inner.latch: 47 %y_val = load i32, i32* @y, align 4 48 %icmp = icmp eq i32 %y_val, 0 49 br i1 %icmp, label %inner.exit, label %inner.header 50; CHECK: inner.latch: 51; CHECK-NEXT: %[[PHI1:[^,]+]] = phi i32 [ 0, %inner.body.rhs ], [ %[[PHI0]], %inner.header ] 52; CHECK-NEXT: br i1 %{{[^,]+}}, label %inner.exit, label %inner.header 53 54inner.exit: 55 br label %outer.latch 56; CHECK: inner.exit: 57; CHECK-NEXT: %[[INNER_LCSSA:[^,]+]] = phi i32 [ %[[PHI1]], %inner.latch ] 58; CHECK-NEXT: br label %outer.latch 59 60outer.latch: 61 br i1 undef, label %outer.exit, label %outer.header 62; CHECK: outer.latch: 63; CHECK-NEXT: %[[PHI2:[^,]+]] = phi i32 [ %[[INNER_LCSSA]], %inner.exit ], [ 0, %outer.header ] 64; CHECK-NEXT: br i1 {{.*}}, label %outer.exit, label %outer.header 65 66outer.exit: 67 br label %return 68; CHECK: outer.exit: 69; CHECK-NEXT: %[[OUTER_LCSSA:[^,]+]] = phi i32 [ %[[PHI2]], %outer.latch ] 70; CHECK-NEXT: store i32 %[[OUTER_LCSSA]] 71; CHECK-NEXT: br label %return 72 73return: 74 ret void 75} 76 77