blob: 8db1936bc20ea6557785cae31262074a84e7da73 [file] [log] [blame]
Chris Lattnerbeac75d2010-09-05 02:18:34 +00001; RUN: llc < %s -fast-isel -mtriple=i386-apple-darwin | FileCheck %s
Evan Cheng373d50a2008-09-04 06:18:33 +00002
3@src = external global i32
4
Chris Lattnerbeac75d2010-09-05 02:18:34 +00005; rdar://6653118
Evan Cheng373d50a2008-09-04 06:18:33 +00006define i32 @loadgv() nounwind {
7entry:
8 %0 = load i32* @src, align 4
9 %1 = load i32* @src, align 4
10 %2 = add i32 %0, %1
Evan Cheng59fbc802008-09-09 01:26:59 +000011 store i32 %2, i32* @src
Evan Cheng373d50a2008-09-04 06:18:33 +000012 ret i32 %2
Chris Lattnerbeac75d2010-09-05 02:18:34 +000013; 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
Evan Cheng373d50a2008-09-04 06:18:33 +000021}
Evan Cheng59fbc802008-09-09 01:26:59 +000022
23%stuff = type { i32 (...)** }
24@LotsStuff = external constant [4 x i32 (...)*]
25
26define void @t(%stuff* %this) nounwind {
27entry:
28 store i32 (...)** getelementptr ([4 x i32 (...)*]* @LotsStuff, i32 0, i32 2), i32 (...)*** null, align 4
29 ret void
Chris Lattnerbeac75d2010-09-05 02:18:34 +000030; CHECK: _t:
31; CHECK: movl $0, %eax
32; CHECK: movl L_LotsStuff$non_lazy_ptr, %ecx
33
Evan Cheng59fbc802008-09-09 01:26:59 +000034}