1 ; RUN: llc -mtriple=x86_64-apple-macosx -mcpu=nocona -verify-machineinstrs < %s | FileCheck %s 2 3 ; After tail duplication, two copies in an early exit BB can be cancelled out. 4 ; rdar://10640363 5 define i32 @t1(i32 %a, i32 %b) nounwind { 6 entry: 7 ; CHECK-LABEL: t1: 8 ; CHECK: je [[LABEL:.*BB.*]] 9 %cmp1 = icmp eq i32 %b, 0 10 br i1 %cmp1, label %while.end, label %while.body 11 12 ; CHECK: [[LABEL]]: 13 ; CHECK-NOT: mov 14 ; CHECK: ret 15 16 while.body: ; preds = %entry, %while.body 17 %a.addr.03 = phi i32 [ %b.addr.02, %while.body ], [ %a, %entry ] 18 %b.addr.02 = phi i32 [ %rem, %while.body ], [ %b, %entry ] 19 %rem = srem i32 %a.addr.03, %b.addr.02 20 %cmp = icmp eq i32 %rem, 0 21 br i1 %cmp, label %while.end, label %while.body 22 23 while.end: ; preds = %while.body, %entry 24 %a.addr.0.lcssa = phi i32 [ %a, %entry ], [ %b.addr.02, %while.body ] 25 ret i32 %a.addr.0.lcssa 26 } 27 28 ; Two movdqa (from phi-elimination) in the entry BB cancels out. 29 ; rdar://10428165 30 define <8 x i16> @t2(<8 x i16> %T0, <8 x i16> %T1) nounwind readnone { 31 entry: 32 ; CHECK-LABEL: t2: 33 ; CHECK-NOT: movdqa 34 %tmp8 = shufflevector <8 x i16> %T0, <8 x i16> %T1, <8 x i32> < i32 undef, i32 undef, i32 7, i32 2, i32 8, i32 undef, i32 undef , i32 undef > 35 ret <8 x i16> %tmp8 36 } 37 38 define i32 @t3(i64 %a, i64 %b) nounwind { 39 entry: 40 ; CHECK-LABEL: t3: 41 ; CHECK: je [[LABEL:.*BB.*]] 42 %cmp1 = icmp eq i64 %b, 0 43 br i1 %cmp1, label %while.end, label %while.body 44 45 ; CHECK: [[LABEL]]: 46 ; CHECK-NOT: mov 47 ; CHECK: ret 48 49 while.body: ; preds = %entry, %while.body 50 %a.addr.03 = phi i64 [ %b.addr.02, %while.body ], [ %a, %entry ] 51 %b.addr.02 = phi i64 [ %rem, %while.body ], [ %b, %entry ] 52 %rem = srem i64 %a.addr.03, %b.addr.02 53 %cmp = icmp eq i64 %rem, 0 54 br i1 %cmp, label %while.end, label %while.body 55 56 while.end: ; preds = %while.body, %entry 57 %a.addr.0.lcssa = phi i64 [ %a, %entry ], [ %b.addr.02, %while.body ] 58 %t = trunc i64 %a.addr.0.lcssa to i32 59 ret i32 %t 60 } 61