1; RUN: opt -S -simplifycfg < %s -mtriple=x86_64-apple-darwin12.0.0 | FileCheck %s 2; rdar://17887153 3target datalayout = "e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" 4target triple = "x86_64-apple-darwin12.0.0" 5 6; When we have a covered lookup table, make sure we don't delete PHINodes that 7; are cached in PHIs. 8; CHECK-LABEL: @test 9; CHECK: entry: 10; CHECK-NEXT: sub i3 %arg, -4 11; CHECK-NEXT: zext i3 %switch.tableidx to i4 12; CHECK-NEXT: getelementptr inbounds [8 x i64], [8 x i64]* @switch.table, i32 0, i4 %switch.tableidx.zext 13; CHECK-NEXT: load i64, i64* %switch.gep 14; CHECK-NEXT: add i64 15; CHECK-NEXT: ret i64 16define i64 @test(i3 %arg) { 17entry: 18 switch i3 %arg, label %Default [ 19 i3 -2, label %Label6 20 i3 1, label %Label1 21 i3 2, label %Label2 22 i3 3, label %Label3 23 i3 -4, label %Label4 24 i3 -3, label %Label5 25 ] 26 27Default: 28 %v1 = phi i64 [ 7, %Label6 ], [ 11, %Label5 ], [ 6, %Label4 ], [ 13, %Label3 ], [ 9, %Label2 ], [ 15, %Label1 ], [ 8, %entry ] 29 %v2 = phi i64 [ 0, %Label6 ], [ 0, %Label5 ], [ 0, %Label4 ], [ 0, %Label3 ], [ 0, %Label2 ], [ 0, %Label1 ], [ 0, %entry ] 30 %v3 = add i64 %v1, %v2 31 ret i64 %v3 32 33Label1: 34 br label %Default 35 36Label2: 37 br label %Default 38 39Label3: 40 br label %Default 41 42Label4: 43 br label %Default 44 45Label5: 46 br label %Default 47 48Label6: 49 br label %Default 50} 51