blob: decdd4bc29557e73ee00dadea516dc6c3313eaa3 [file] [log] [blame]
Chris Lattner3ad93b02009-11-27 16:31:59 +00001; RUN: opt < %s -scalarrepl -S | FileCheck %s
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002
Chris Lattner3ad93b02009-11-27 16:31:59 +00003; PR3466
4; Off end of array, don't transform.
5define i32 @test1() {
6; CHECK: @test1
7; CHECK: %X = alloca
8 %X = alloca [4 x i32]
Tanya Lattner307f46e2008-03-18 04:14:37 +00009 %Y = getelementptr [4 x i32]* %X, i64 0, i64 6 ; <i32*> [#uses=2]
10 store i32 0, i32* %Y
11 %Z = load i32* %Y ; <i32> [#uses=1]
12 ret i32 %Z
Dan Gohmanf17a25c2007-07-18 16:29:46 +000013}
Tanya Lattner307f46e2008-03-18 04:14:37 +000014
Chris Lattnerb2290a12009-02-03 07:08:57 +000015
Chris Lattner3ad93b02009-11-27 16:31:59 +000016; Off end of array, don't transform.
Chris Lattnerb2290a12009-02-03 07:08:57 +000017define i32 @test2() nounwind {
18entry:
Chris Lattner3ad93b02009-11-27 16:31:59 +000019; CHECK: @test2
20; CHECK: %yx2.i = alloca
Chris Lattnerb2290a12009-02-03 07:08:57 +000021 %yx2.i = alloca float, align 4 ; <float*> [#uses=1]
22 %yx26.i = bitcast float* %yx2.i to i64* ; <i64*> [#uses=1]
23 %0 = load i64* %yx26.i, align 8 ; <i64> [#uses=0]
24 unreachable
25}