1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -sroa -S | FileCheck %s
3 target 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"
5 @a = external global i16, align 1
10 ; CHECK-NEXT: br i1 undef, label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
12 ; CHECK-NEXT: br label [[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]]
20 ; CHECK-NEXT: br label [[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
25 ; CHECK-NEXT: ret void
28 %e = alloca i16, align 1
29 br i1 undef, label %if.then, label %if.else
31 if.then: ; preds = %entry
34 cleanup: ; preds = %if.then
35 switch i32 2, label %cleanup7 [
40 if.else: ; preds = %entry
43 lbl1: ; 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
48 cleanup7: ; preds = %cleanup