blob: 8d8a2871a74031dd09b9b4adbb5fcdd4c651969f [file] [log] [blame]
Vikram S. Adved28c8c82002-09-28 18:09:05 +00001;; GetMemInstArgs() folded the two getElementPtr instructions together,
2;; producing an illegal getElementPtr. That's because the type generated
3;; by the last index for the first one is a structure field, not an array
4;; element, and the second one indexes off that structure field.
5;; The code is legal but not type-safe and the two GEPs should not be folded.
6;;
7;; This code fragment is from Spec/CINT2000/197.parser/197.parser.bc,
8;; file post_process.c, function build_domain().
9;; (Modified to replace store with load and return load value.)
10;;
11
12%Domain = type { sbyte*, int, int*, int, int, int*, %Domain* }
13%domain_array = internal uninitialized global [497 x %Domain]
14
15implementation; Functions:
16
17declare void %opaque([497 x %Domain]*)
18
19int %main(int %argc, sbyte** %argv) {
20bb0: ;[#uses=0]
21 call void %opaque([497 x %Domain]* %domain_array)
22 %cann-indvar-idxcast = cast int %argc to long
23 %reg841 = getelementptr [497 x %Domain]* %domain_array, long 0, long %cann-indvar-idxcast, ubyte 3
24 %reg846 = getelementptr int* %reg841, long 1
25 %reg820 = load int* %reg846
26 ret int %reg820
27}