Clean up the tablegen descriptions for SparcV8.
[oota-llvm.git] / test / LLC / 2003-05-30-BadFoldGEP.ll
1 ;; Date:     May 28, 2003.
2 ;; From:     test/Programs/External/SPEC/CINT2000/254.gap.llvm.bc
3 ;; Function: int %OpenOutput(sbyte* %filename.1)
4 ;;
5 ;; Error:    A sequence of GEPs is folded incorrectly by llc during selection
6 ;;           causing an assertion about a dynamic casting error.
7 ;;           This code sequence was produced (correctly) by preselection
8 ;;           from a nested pair of ConstantExpr getelementptrs.
9 ;;           The code below is the output of preselection.
10 ;;           The original ConstantExprs are included in a comment.
11 ;;
12 ;; Cause:    FoldGetElemChain() was inserting an extra leading 0 even though
13 ;;           the first instruction in the sequence contributes no indices.
14 ;;           The next instruction contributes a leading non-zero so another
15 ;;           zero should not be added before it!
16 ;;
17
18
19 %FileType = type { int, [256 x sbyte], int, int, int, int }
20 %OutputFiles = uninitialized global [16 x %FileType]
21 %Output = internal global %FileType* null
22
23
24 implementation; Functions:
25
26 internal int %OpenOutput(sbyte* %filename.1) {
27 entry:
28         %tmp.0 = load %FileType** %Output      
29         %tmp.4 = getelementptr %FileType* %tmp.0, long 1
30
31         ;;------ Original instruction in 254.gap.llvm.bc:
32         ;; %tmp.10 = seteq { int, [256 x sbyte], int, int, int, int }* %tmp.4, getelementptr ([16 x { int, [256 x sbyte], int, int, int, int }]* getelementptr ([16 x { int, [256 x sbyte], int, int, int, int }]* %OutputFiles, long 1), long 0, long 0)
33
34         ;;------ Code sequence produced by preselection phase for above instr:
35         ;; This code sequence is folded incorrectly by llc during selection
36         ;; causing an assertion about a dynamic casting error.
37         %addrOfGlobal = getelementptr [16 x %FileType]* %OutputFiles, long 0
38         %constantGEP = getelementptr [16 x %FileType]* %addrOfGlobal, long 1
39         %constantGEP = getelementptr [16 x %FileType]* %constantGEP, long 0, long 0
40         %tmp.10 = seteq %FileType* %tmp.4, %constantGEP
41         br bool %tmp.10, label %return, label %endif.0
42
43 endif.0:
44         ret int 0
45
46 return:
47         ret int 1
48 }