Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -fast-isel -mtriple=i386-apple-darwin | FileCheck %s
      2 
      3 @src = external global i32
      4 
      5 ; rdar://6653118
      6 define i32 @loadgv() nounwind {
      7 entry:
      8 	%0 = load i32* @src, align 4
      9 	%1 = load i32* @src, align 4
     10         %2 = add i32 %0, %1
     11         store i32 %2, i32* @src
     12 	ret i32 %2
     13 ; This should fold one of the loads into the add.
     14 ; CHECK: loadgv:
     15 ; CHECK: 	movl	L_src$non_lazy_ptr, %ecx
     16 ; CHECK: 	movl	(%ecx), %eax
     17 ; CHECK: 	addl	(%ecx), %eax
     18 ; CHECK: 	movl	%eax, (%ecx)
     19 ; CHECK: 	ret
     20 
     21 }
     22 
     23 %stuff = type { i32 (...)** }
     24 @LotsStuff = external constant [4 x i32 (...)*]
     25 
     26 define void @t(%stuff* %this) nounwind {
     27 entry:
     28 	store i32 (...)** getelementptr ([4 x i32 (...)*]* @LotsStuff, i32 0, i32 2), i32 (...)*** null, align 4
     29 	ret void
     30 ; CHECK: _t:
     31 ; CHECK:	movl	$0, %eax
     32 ; CHECK:	movl	L_LotsStuff$non_lazy_ptr, %ecx
     33 
     34 }
     35