blob: 982284b64f6630c4232d87d7618e6a70a5a1372d [file] [log] [blame]
Francis Visoiu Mistrihb7cef812019-01-14 10:55:55 +00001; RUN: llc < %s -march=mipsel -mcpu=mips32 -fast-isel -frame-pointer=all -relocation-model=pic < %s
Simon Dardis8ca1cbc2016-11-16 11:29:07 +00002
3; Test that negative array access don't crash constant synthesis when fast isel
4; generates negative offsets.
5
6define i16 @test() {
7 %a = alloca [4 x i16], align 4
8 %arrayidx = getelementptr inbounds [4 x i16], [4 x i16]* %a, i32 0, i32 -2
9 %b = load i16, i16* %arrayidx, align 2
10 ret i16 %b
11}
12
13define void @test2() {
14 %a = alloca [4 x i16], align 4
15 %arrayidx = getelementptr inbounds [4 x i16], [4 x i16]* %a, i32 0, i32 -2
16 store i16 2, i16* %arrayidx, align 2
17 ret void
18}