1; RUN: llc -march=hexagon -O2 -disable-cgp < %s
2; REQUIRES: asserts
3;
4; Tail duplication can ignore subregister information on PHI nodes, and as
5; a result, generate COPY instructions between registers of different classes.
6; This could lead to HexagonInstrInfo::copyPhysReg aborting on an unhandled
7; src/dst combination.
8;
9define i32 @foo(i32 %x, i64 %y) nounwind {
10entry:
11  %a = icmp slt i32 %x, 0
12  %lo = trunc i64 %y to i32
13  br i1 %a, label %next, label %tail
14tail:
15  br label %join
16next:
17  %c = icmp eq i32 %x, 0
18  br i1 %c, label %b1, label %tail
19b1:
20  %t1 = lshr i64 %y, 32
21  %hi = trunc i64 %t1 to i32
22  br label %join
23join:
24  %val = phi i32 [ %hi, %b1 ], [ %lo, %tail ]
25  ret i32 %val
26}
27
28
29