1; RUN: llc -march=x86-64 < %s -disable-fp-elim | FileCheck %s
2
3; This test is checking that we don't crash and we don't incorrectly fold
4; a large displacement and a frame index into a single lea.
5; <rdar://problem/9763308>
6
7declare void @bar([39 x i8]*)
8define i32 @f(i64 %a, i64 %b) nounwind readnone {
9entry:
10  %stack_main = alloca [39 x i8]
11  call void @bar([39 x i8]* %stack_main)
12  %tmp6 = add i64 %a, -2147483647
13  %.sum = add i64 %tmp6, %b
14  %tmp8 = getelementptr inbounds [39 x i8], [39 x i8]* %stack_main, i64 0, i64 %.sum
15  %tmp9 = load i8, i8* %tmp8, align 1
16  %tmp10 = sext i8 %tmp9 to i32
17  ret i32 %tmp10
18}
19; CHECK-LABEL: f:
20; CHECK: movsbl	-2147483647
21