forked from OSchip/llvm-project
Added expected decomposed sequence in comments, plus a couple of new cases.
llvm-svn: 3231
This commit is contained in:
parent
33b3b9660b
commit
26a0029255
|
@ -1,3 +1,5 @@
|
||||||
|
; RUN: as < %s | opt -f -lowerrefs -o Output/%s.bc
|
||||||
|
;
|
||||||
%Flat_struct = type { sbyte, float }
|
%Flat_struct = type { sbyte, float }
|
||||||
%Flat_t = type { sbyte, float }
|
%Flat_t = type { sbyte, float }
|
||||||
%Mixed_struct = type { int, [10 x double], [10 x [10 x double]], [10 x { sbyte, float }] }
|
%Mixed_struct = type { int, [10 x double], [10 x [10 x double]], [10 x { sbyte, float }] }
|
||||||
|
@ -14,6 +16,17 @@ implementation
|
||||||
int "test"([20 x [10 x [5 x int]]] * %A)
|
int "test"([20 x [10 x [5 x int]]] * %A)
|
||||||
begin
|
begin
|
||||||
%i = load [20 x [10 x [5 x int]]] * %A, uint 1, uint 2, uint 3, uint 4
|
%i = load [20 x [10 x [5 x int]]] * %A, uint 1, uint 2, uint 3, uint 4
|
||||||
|
|
||||||
|
;; same as above but via a GEP
|
||||||
|
%iptr = getelementptr [20 x [10 x [5 x int]]] * %A, uint 1, uint 2, uint 3, uint 4
|
||||||
|
%ii= load int* %iptr
|
||||||
|
|
||||||
|
;; EXPECTED RESULT: decomposed indices for above LOAD or GEP
|
||||||
|
;; %ptr1 = getelementptr [20 x [10 x [5 x int]]] * %A, uint 1
|
||||||
|
;; %ptr2 = getelementptr [20 x [10 x [5 x int]]] * %ptr1, uint 0, uint 2
|
||||||
|
;; %ptr3 = getelementptr [10 x [5 x int]] * %ptr2, uint 0, uint 3
|
||||||
|
;; %iii = load [5 x int] * %ptr3, uint 0, uint 4
|
||||||
|
|
||||||
ret int %i
|
ret int %i
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -22,9 +35,22 @@ begin
|
||||||
bb0: ;[#uses=2]
|
bb0: ;[#uses=2]
|
||||||
%reg112 = add int %base, 1 ; <int> [#uses=1]
|
%reg112 = add int %base, 1 ; <int> [#uses=1]
|
||||||
%reg164-idxcast = cast int %reg112 to uint ; <uint> [#uses=1]
|
%reg164-idxcast = cast int %reg112 to uint ; <uint> [#uses=1]
|
||||||
|
|
||||||
|
;; Store to a structure field
|
||||||
store sbyte 81, %Mixed_struct * %M, uint 0, ubyte 3, uint %reg164-idxcast, ubyte 0
|
store sbyte 81, %Mixed_struct * %M, uint 0, ubyte 3, uint %reg164-idxcast, ubyte 0
|
||||||
|
|
||||||
|
;; EXPECTED RESULT: decomposed indices for above STORE
|
||||||
|
;; %ptr1 = getelementptr %Mixed_struct * %M, uint 0, ubyte 3
|
||||||
|
;; %ptr2 = getelementptr [10 x { sbyte, float }]* %ptr1, uint 0, uint %reg164-idxcast
|
||||||
|
;; store sbyte 81, {sbyte,float}* %ptr2, uint 0, ubyte 0
|
||||||
|
|
||||||
|
;; Store to an array field within a structure
|
||||||
store double 2.17, %Mixed_struct * %M, uint 0, ubyte 1, uint %reg164-idxcast
|
store double 2.17, %Mixed_struct * %M, uint 0, ubyte 1, uint %reg164-idxcast
|
||||||
|
|
||||||
|
;; EXPECTED RESULT: decomposed indices for above STORE
|
||||||
|
;; %ptr1 = getelementptr %Mixed_struct * %M, uint 0, ubyte 1
|
||||||
|
;; store double 2.17, [10 x double]* %ptr1, uint 0, uint %reg164-idxcast
|
||||||
|
|
||||||
ret void
|
ret void
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -39,15 +65,21 @@ bb0: ;[#uses=1]
|
||||||
%trace = call int (sbyte *, ...) * %printf( sbyte * %trstrP )
|
%trace = call int (sbyte *, ...) * %printf( sbyte * %trstrP )
|
||||||
|
|
||||||
%eltVal = call int %ArrayRef([100 x int]* %ArraySlice, uint 8, uint 12)
|
%eltVal = call int %ArrayRef([100 x int]* %ArraySlice, uint 8, uint 12)
|
||||||
;; ret int %eltVal
|
ret int %eltVal
|
||||||
|
|
||||||
ret int 0
|
;; ret int 0
|
||||||
end
|
end
|
||||||
|
|
||||||
int "ArrayRef"([100 x int] * %Array, uint %I, uint %J)
|
int "ArrayRef"([100 x int] * %Array, uint %I, uint %J)
|
||||||
begin
|
begin
|
||||||
bb0: ;[#uses=3]
|
bb0: ;[#uses=3]
|
||||||
%reg120 = getelementptr [100 x int] * %Array, uint %I ; <[100 x int] *> [#uses=1]
|
%reg121 = load [100 x int]* %Array, uint %I, uint %J ; <int> [#uses=1]
|
||||||
%reg121 = load [100 x int] * %reg120, uint 0, uint %J ; <int> [#uses=1]
|
|
||||||
ret int %reg121;
|
ret int %reg121;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sbyte "PtrRef"(sbyte** %argv, uint %I, uint %J)
|
||||||
|
begin
|
||||||
|
bb0: ;[#uses=3]
|
||||||
|
%reg222 = load sbyte** %argv, uint %I, uint %J ; <sbyte> [#uses=1]
|
||||||
|
ret sbyte %reg222;
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue