summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2002-08-03 13:16:47 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2002-08-03 13:16:47 +0000
commit6ae7d3c9ec03dbb3100e7e687302c902cd4a7616 (patch)
tree3e40757b66aca66724f7c599c2b6e3ac6f3e1477 /test
parent69ab7a8ac6c52465f7b886fb11e390330e8cf10f (diff)
downloadexternal_llvm-6ae7d3c9ec03dbb3100e7e687302c902cd4a7616.zip
external_llvm-6ae7d3c9ec03dbb3100e7e687302c902cd4a7616.tar.gz
external_llvm-6ae7d3c9ec03dbb3100e7e687302c902cd4a7616.tar.bz2
Added expected decomposed sequence in comments, plus a couple of new cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3231 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/DecomposeMultiDimRefs/multidim.ll40
1 files changed, 36 insertions, 4 deletions
diff --git a/test/Transforms/DecomposeMultiDimRefs/multidim.ll b/test/Transforms/DecomposeMultiDimRefs/multidim.ll
index 8fdb476..45f4198 100644
--- a/test/Transforms/DecomposeMultiDimRefs/multidim.ll
+++ b/test/Transforms/DecomposeMultiDimRefs/multidim.ll
@@ -1,3 +1,5 @@
+; RUN: as < %s | opt -f -lowerrefs -o Output/%s.bc
+;
%Flat_struct = type { sbyte, float }
%Flat_t = type { 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)
begin
%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
end
@@ -22,9 +35,22 @@ begin
bb0: ;[#uses=2]
%reg112 = add int %base, 1 ; <int> [#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
+ ;; 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
+
+ ;; 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
end
@@ -39,15 +65,21 @@ bb0: ;[#uses=1]
%trace = call int (sbyte *, ...) * %printf( sbyte * %trstrP )
%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
int "ArrayRef"([100 x int] * %Array, uint %I, uint %J)
begin
bb0: ;[#uses=3]
- %reg120 = getelementptr [100 x int] * %Array, uint %I ; <[100 x int] *> [#uses=1]
- %reg121 = load [100 x int] * %reg120, uint 0, uint %J ; <int> [#uses=1]
+ %reg121 = load [100 x int]* %Array, uint %I, uint %J ; <int> [#uses=1]
ret int %reg121;
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