1; RUN: llc < %s -O3 -march=x86-64 |FileCheck %s
2define i64 @foo(i1 %z, i192* %p, i192* %q)
3{
4; If const 128 is hoisted to a variable, then in basic block L_val2 we would
5; have %lshr2 = lshr i192 %data2, %const, and the definition of %const would
6; be in another basic block. As a result, a very inefficient code might be
7; produced. Here we check that this doesn't occur.
8entry:
9  %data1 = load i192, i192* %p, align 8
10  %lshr1 = lshr i192 %data1, 128
11  %val1  = trunc i192 %lshr1 to i64
12  br i1 %z, label %End, label %L_val2
13
14; CHECK: movq    16(%rdx), %rax
15; CHECK-NEXT: retq
16L_val2:
17  %data2 = load i192, i192* %q, align 8
18  %lshr2 = lshr i192 %data2, 128
19  %val2  = trunc i192 %lshr2 to i64
20  br label %End
21
22End:
23  %p1 = phi i64 [%val1,%entry], [%val2,%L_val2]
24  ret i64 %p1
25}
26