1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt < %s -sroa -S | FileCheck %s 3target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n8:16:32:64" 4 5@a = external global i16, align 1 6 7define void @f2() { 8; CHECK-LABEL: @f2( 9; CHECK-NEXT: entry: 10; CHECK-NEXT: br i1 undef, label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] 11; CHECK: if.then: 12; CHECK-NEXT: br label [[CLEANUP:%.*]] 13; CHECK: cleanup: 14; CHECK-NEXT: [[G_0_SROA_SPECULATE_LOAD_CLEANUP:%.*]] = load i16, i16* @a, align 1 15; CHECK-NEXT: switch i32 2, label [[CLEANUP7:%.*]] [ 16; CHECK-NEXT: i32 0, label [[LBL1:%.*]] 17; CHECK-NEXT: i32 2, label [[LBL1]] 18; CHECK-NEXT: ] 19; CHECK: if.else: 20; CHECK-NEXT: br label [[LBL1]] 21; CHECK: lbl1: 22; CHECK-NEXT: [[G_0_SROA_SPECULATED:%.*]] = phi i16 [ [[G_0_SROA_SPECULATE_LOAD_CLEANUP]], [[CLEANUP]] ], [ [[G_0_SROA_SPECULATE_LOAD_CLEANUP]], [[CLEANUP]] ], [ undef, [[IF_ELSE]] ] 23; CHECK-NEXT: unreachable 24; CHECK: cleanup7: 25; CHECK-NEXT: ret void 26; 27entry: 28 %e = alloca i16, align 1 29 br i1 undef, label %if.then, label %if.else 30 31if.then: ; preds = %entry 32 br label %cleanup 33 34cleanup: ; preds = %if.then 35 switch i32 2, label %cleanup7 [ 36 i32 0, label %lbl1 37 i32 2, label %lbl1 38 ] 39 40if.else: ; preds = %entry 41 br label %lbl1 42 43lbl1: ; preds = %if.else, %cleanup, %cleanup 44 %g.0 = phi i16* [ @a, %cleanup ], [ @a, %cleanup ], [ %e, %if.else ] 45 %0 = load i16, i16* %g.0, align 1 46 unreachable 47 48cleanup7: ; preds = %cleanup 49 ret void 50} 51 52