1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-- -x86-asm-syntax=intel | FileCheck %s
3
4;; X's live range extends beyond the shift, so the register allocator
5;; cannot coalesce it with Y.  Because of this, a copy needs to be
6;; emitted before the shift to save the register value before it is
7;; clobbered.  However, this copy is not needed if the register
8;; allocator turns the shift into an LEA.  This also occurs for ADD.
9
10; Check that the shift gets turned into an LEA.
11
12@G = external dso_local global i32                ; <i32*> [#uses=1]
13
14define i32 @test1(i32 %X) {
15; CHECK-LABEL: test1:
16; CHECK:       # %bb.0:
17; CHECK-NEXT:    mov eax, dword ptr [esp + 4]
18; CHECK-NEXT:    lea ecx, [4*eax]
19; CHECK-NEXT:    mov dword ptr [G], ecx
20; CHECK-NEXT:    ret
21        %Z = shl i32 %X, 2              ; <i32> [#uses=1]
22        store volatile i32 %Z, i32* @G
23        ret i32 %X
24}
25
26