blob: 909966f19038c17a5aea83950f07dcd431210f8d [file] [log] [blame]
Dan Gohman3c7d3082009-09-11 18:01:28 +00001; RUN: opt < %s -scalarrepl -instcombine -S | not grep alloca
Chris Lattnerb2290a12009-02-03 07:08:57 +00002; PR3466
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003
Tanya Lattner307f46e2008-03-18 04:14:37 +00004define i32 @test() {
5 %X = alloca [4 x i32] ; <[4 x i32]*> [#uses=1]
6 ; Off end of array!
7 %Y = getelementptr [4 x i32]* %X, i64 0, i64 6 ; <i32*> [#uses=2]
8 store i32 0, i32* %Y
9 %Z = load i32* %Y ; <i32> [#uses=1]
10 ret i32 %Z
Dan Gohmanf17a25c2007-07-18 16:29:46 +000011}
Tanya Lattner307f46e2008-03-18 04:14:37 +000012
Chris Lattnerb2290a12009-02-03 07:08:57 +000013
14define i32 @test2() nounwind {
15entry:
16 %yx2.i = alloca float, align 4 ; <float*> [#uses=1]
17 %yx26.i = bitcast float* %yx2.i to i64* ; <i64*> [#uses=1]
18 %0 = load i64* %yx26.i, align 8 ; <i64> [#uses=0]
19 unreachable
20}