Evan Cheng | 01b623c | 2012-02-20 23:28:17 +0000 | [diff] [blame] | 1 | ; RUN: llc -mtriple=x86_64-apple-macosx -mcpu=nocona < %s | FileCheck %s |
Evan Cheng | 977679d | 2012-01-07 03:02:36 +0000 | [diff] [blame] | 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: t1: |
Chandler Carruth | 9e67db4 | 2012-04-16 13:49:17 +0000 | [diff] [blame^] | 8 | ; CHECK: je [[LABEL:.*BB.*]] |
Evan Cheng | 977679d | 2012-01-07 03:02:36 +0000 | [diff] [blame] | 9 | %cmp1 = icmp eq i32 %b, 0 |
| 10 | br i1 %cmp1, label %while.end, label %while.body |
| 11 | |
Chandler Carruth | 9e67db4 | 2012-04-16 13:49:17 +0000 | [diff] [blame^] | 12 | ; CHECK: [[LABEL]]: |
Evan Cheng | 977679d | 2012-01-07 03:02:36 +0000 | [diff] [blame] | 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: 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 | } |