1 ;; X's live range extends beyond the shift, so the register allocator
2 ;; cannot coalesce it with Y. Because of this, a copy needs to be
3 ;; emitted before the shift to save the register value before it is
4 ;; clobbered. However, this copy is not needed if the register
5 ;; allocator turns the shift into an LEA. This also occurs for ADD.
7 ; Check that the shift gets turned into an LEA.
8 ; RUN: llc < %s -mcpu=generic -mtriple=x86_64-apple-darwin | FileCheck %s
10 @G = external global i32
12 define i32 @test1(i32 %X) nounwind {
17 store volatile i32 %Z, i32* @G
22 ; The second add should not be transformed to leal nor should it be
23 ; commutted (which would require inserting a copy).
24 define i32 @test2(i32 inreg %a, i32 inreg %b, i32 %c, i32 %d) nounwind {
33 %add3 = add i32 %add, %c
34 %add5 = add i32 %add3, %d
39 define i64 @test3(i64 %x) nounwind readnone ssp {
42 ; CHECK: leaq (%rdi,%rdi), %rax