1 ; RUN: opt < %s -sccp -S | FileCheck %s
3 @Y = constant [6 x i101] [ i101 12, i101 123456789000000, i101 -12,
4 i101 -123456789000000, i101 0,i101 9123456789000000]
7 ; CHECK-NEXT: ret i101 123456789000000
9 %A = getelementptr [6 x i101], [6 x i101]* @Y, i32 0, i32 1
10 %B = load i101, i101* %A
13 %E = trunc i101 %DD to i32
14 %F = getelementptr [6 x i101], [6 x i101]* @Y, i32 0, i32 %E
15 %G = load i101, i101* %F
20 ; CHECK-LABEL: @large_aggregate
21 ; CHECK-NEXT: %D = and i101 undef, 1
22 ; CHECK-NEXT: %DD = or i101 %D, 1
23 ; CHECK-NEXT: %G = getelementptr i101, i101* getelementptr inbounds ([6 x i101], [6 x i101]* @Y, i32 0, i32 5), i101 %DD
24 ; CHECK-NEXT: %L3 = load i101, i101* %G
25 ; CHECK-NEXT: ret i101 %L3
27 define i101 @large_aggregate() {
28 %B = load i101, i101* undef
31 %F = getelementptr [6 x i101], [6 x i101]* @Y, i32 0, i32 5
32 %G = getelementptr i101, i101* %F, i101 %DD
33 %L3 = load i101, i101* %G
37 ; CHECK-LABEL: define i101 @large_aggregate_2() {
38 ; CHECK-NEXT: %D = and i101 undef, 1
39 ; CHECK-NEXT: %DD = or i101 %D, 1
40 ; CHECK-NEXT: %G = getelementptr i101, i101* getelementptr inbounds ([6 x i101], [6 x i101]* @Y, i32 0, i32 5), i101 %DD
41 ; CHECK-NEXT: %L3 = load i101, i101* %G
42 ; CHECK-NEXT: ret i101 %L3
44 define i101 @large_aggregate_2() {
45 %D = and i101 undef, 1
47 %F = getelementptr [6 x i101], [6 x i101]* @Y, i32 0, i32 5
48 %G = getelementptr i101, i101* %F, i101 %DD
49 %L3 = load i101, i101* %G
53 ; CHECK-LABEL: @index_too_large
54 ; CHECK-NEXT: store i101* getelementptr (i101, i101* getelementptr ([6 x i101], [6 x i101]* @Y, i32 0, i32 -1), i101 9224497936761618431), i101** undef
55 ; CHECK-NEXT: ret void
56 define void @index_too_large() {
57 %ptr1 = getelementptr [6 x i101], [6 x i101]* @Y, i32 0, i32 -1
58 %ptr2 = getelementptr i101, i101* %ptr1, i101 9224497936761618431
59 store i101* %ptr2, i101** undef