1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -basic-aa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7 | FileCheck %s
4 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
5 target triple = "x86_64-apple-macosx10.8.0"
7 %struct.DState = type { i32, i32 }
9 @b = common global %struct.DState zeroinitializer, align 4
10 @d = common global i32 0, align 4
11 @c = common global i32 0, align 4
12 @a = common global i32 0, align 4
13 @e = common global i32 0, align 4
18 ; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* getelementptr inbounds (%struct.DState, %struct.DState* @b, i32 0, i32 0), align 4
19 ; CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* getelementptr inbounds (%struct.DState, %struct.DState* @b, i32 0, i32 1), align 4
20 ; CHECK-NEXT: [[TMP2:%.*]] = load i32, i32* @d, align 4
21 ; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[TMP2]], 0
22 ; CHECK-NEXT: br i1 [[COND]], label [[SW_BB:%.*]], label [[SAVE_STATE_AND_RETURN:%.*]]
24 ; CHECK-NEXT: [[TMP3:%.*]] = load i32, i32* @c, align 4
25 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[TMP3]], 7
26 ; CHECK-NEXT: store i32 [[AND]], i32* @a, align 4
27 ; CHECK-NEXT: switch i32 [[AND]], label [[IF_END:%.*]] [
28 ; CHECK-NEXT: i32 7, label [[SAVE_STATE_AND_RETURN]]
29 ; CHECK-NEXT: i32 0, label [[SAVE_STATE_AND_RETURN]]
32 ; CHECK-NEXT: br label [[SAVE_STATE_AND_RETURN]]
33 ; CHECK: save_state_and_return:
34 ; CHECK-NEXT: [[T_0:%.*]] = phi i32 [ 0, [[IF_END]] ], [ [[TMP0]], [[ENTRY:%.*]] ], [ [[TMP0]], [[SW_BB]] ], [ [[TMP0]], [[SW_BB]] ]
35 ; CHECK-NEXT: [[F_0:%.*]] = phi i32 [ 0, [[IF_END]] ], [ [[TMP1]], [[ENTRY]] ], [ 0, [[SW_BB]] ], [ 0, [[SW_BB]] ]
36 ; CHECK-NEXT: store i32 [[T_0]], i32* getelementptr inbounds (%struct.DState, %struct.DState* @b, i32 0, i32 0), align 4
37 ; CHECK-NEXT: store i32 [[F_0]], i32* getelementptr inbounds (%struct.DState, %struct.DState* @b, i32 0, i32 1), align 4
38 ; CHECK-NEXT: ret i32 undef
41 %0 = load i32, i32* getelementptr inbounds (%struct.DState, %struct.DState* @b, i32 0, i32 0), align 4
42 %1 = load i32, i32* getelementptr inbounds (%struct.DState, %struct.DState* @b, i32 0, i32 1), align 4
43 %2 = load i32, i32* @d, align 4
44 %cond = icmp eq i32 %2, 0
45 br i1 %cond, label %sw.bb, label %save_state_and_return
47 sw.bb: ; preds = %entry
48 %3 = load i32, i32* @c, align 4
50 store i32 %and, i32* @a, align 4
51 switch i32 %and, label %if.end [
52 i32 7, label %save_state_and_return
53 i32 0, label %save_state_and_return
56 if.end: ; preds = %sw.bb
57 br label %save_state_and_return
59 save_state_and_return: ; preds = %sw.bb, %sw.bb, %if.end, %entry
60 %t.0 = phi i32 [ 0, %if.end ], [ %0, %entry ], [ %0, %sw.bb ], [ %0, %sw.bb ]
61 %f.0 = phi i32 [ 0, %if.end ], [ %1, %entry ], [ 0, %sw.bb ], [ 0, %sw.bb ]
62 store i32 %t.0, i32* getelementptr inbounds (%struct.DState, %struct.DState* @b, i32 0, i32 0), align 4
63 store i32 %f.0, i32* getelementptr inbounds (%struct.DState, %struct.DState* @b, i32 0, i32 1), align 4