summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/XCore
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-02-27 19:29:02 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-02-27 19:29:02 +0000
commit79e6c74981f4755ed55b38175d8cd34ec91395b1 (patch)
tree3e3d41d853795c46029a07c3fb78b1e2f7668185 /llvm/test/CodeGen/XCore
parentbad3ff207f68e69f36b9a1f90a29f22341e505bb (diff)
downloadbcm5719-llvm-79e6c74981f4755ed55b38175d8cd34ec91395b1.tar.gz
bcm5719-llvm-79e6c74981f4755ed55b38175d8cd34ec91395b1.zip
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers, replacing them with a single opaque pointer type. This adds an explicit type parameter to the gep instruction so that when the first parameter becomes an opaque pointer type, the type to gep through is still available to the instructions. * This doesn't modify gep operators, only instructions (operators will be handled separately) * Textual IR changes only. Bitcode (including upgrade) and changing the in-memory representation will be in separate changes. * geps of vectors are transformed as: getelementptr <4 x float*> %x, ... ->getelementptr float, <4 x float*> %x, ... Then, once the opaque pointer type is introduced, this will ultimately look like: getelementptr float, <4 x ptr> %x with the unambiguous interpretation that it is a vector of pointers to float. * address spaces remain on the pointer, not the type: getelementptr float addrspace(1)* %x ->getelementptr float, float addrspace(1)* %x Then, eventually: getelementptr float, ptr addrspace(1) %x Importantly, the massive amount of test case churn has been automated by same crappy python code. I had to manually update a few test cases that wouldn't fit the script's model (r228970,r229196,r229197,r229198). The python script just massages stdin and writes the result to stdout, I then wrapped that in a shell script to handle replacing files, then using the usual find+xargs to migrate all the files. update.py: import fileinput import sys import re ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))") normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))") def conv(match, line): if not match: return line line = match.groups()[0] if len(match.groups()[5]) == 0: line += match.groups()[2] line += match.groups()[3] line += ", " line += match.groups()[1] line += "\n" return line for line in sys.stdin: if line.find("getelementptr ") == line.find("getelementptr inbounds"): if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("): line = conv(re.match(ibrep, line), line) elif line.find("getelementptr ") != line.find("getelementptr ("): line = conv(re.match(normrep, line), line) sys.stdout.write(line) apply.sh: for name in "$@" do python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name" rm -f "$name.tmp" done The actual commands: From llvm/src: find test/ -name *.ll | xargs ./apply.sh From llvm/src/tools/clang: find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}" From llvm/src/tools/polly: find test/ -name *.ll | xargs ./apply.sh After that, check-all (with llvm, clang, clang-tools-extra, lld, compiler-rt, and polly all checked out). The extra 'rm' in the apply.sh script is due to a few files in clang's test suite using interesting unicode stuff that my python script was throwing exceptions on. None of those files needed to be migrated, so it seemed sufficient to ignore those cases. Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7636 llvm-svn: 230786
Diffstat (limited to 'llvm/test/CodeGen/XCore')
-rw-r--r--llvm/test/CodeGen/XCore/2009-01-08-Crash.ll2
-rw-r--r--llvm/test/CodeGen/XCore/2010-02-25-LSR-Crash.ll2
-rw-r--r--llvm/test/CodeGen/XCore/codemodel.ll4
-rw-r--r--llvm/test/CodeGen/XCore/epilogue_prologue.ll8
-rw-r--r--llvm/test/CodeGen/XCore/indirectbr.ll2
-rw-r--r--llvm/test/CodeGen/XCore/load.ll8
-rw-r--r--llvm/test/CodeGen/XCore/offset_folding.ll8
-rw-r--r--llvm/test/CodeGen/XCore/scavenging.ll14
-rw-r--r--llvm/test/CodeGen/XCore/store.ll8
-rw-r--r--llvm/test/CodeGen/XCore/trampoline.ll8
10 files changed, 32 insertions, 32 deletions
diff --git a/llvm/test/CodeGen/XCore/2009-01-08-Crash.ll b/llvm/test/CodeGen/XCore/2009-01-08-Crash.ll
index a31ea1e2e9b..6b55e892c89 100644
--- a/llvm/test/CodeGen/XCore/2009-01-08-Crash.ll
+++ b/llvm/test/CodeGen/XCore/2009-01-08-Crash.ll
@@ -6,7 +6,7 @@
define i32 @test(i32 %bar) nounwind readnone {
entry:
%bar_addr = alloca i32
- %0 = getelementptr i32* %bar_addr, i32 -1
+ %0 = getelementptr i32, i32* %bar_addr, i32 -1
%1 = load i32* %0, align 4
ret i32 %1
}
diff --git a/llvm/test/CodeGen/XCore/2010-02-25-LSR-Crash.ll b/llvm/test/CodeGen/XCore/2010-02-25-LSR-Crash.ll
index 6ad9a73899d..396b083f592 100644
--- a/llvm/test/CodeGen/XCore/2010-02-25-LSR-Crash.ll
+++ b/llvm/test/CodeGen/XCore/2010-02-25-LSR-Crash.ll
@@ -14,7 +14,7 @@ entry:
bb3.i15.i.i: ; preds = %bb3.i15.i.i, %entry
%indvar.i.i.i = phi i32 [ %indvar.next.i.i.i, %bb3.i15.i.i ], [ 0, %entry ] ; <i32> [#uses=2]
%tmp137 = sub i32 0, %indvar.i.i.i ; <i32> [#uses=1]
- %scevgep13.i.i.i = getelementptr i32* undef, i32 %tmp137 ; <i32*> [#uses=2]
+ %scevgep13.i.i.i = getelementptr i32, i32* undef, i32 %tmp137 ; <i32*> [#uses=2]
%scevgep1314.i.i.i = bitcast i32* %scevgep13.i.i.i to %struct.dwarf_fde** ; <%struct.dwarf_fde**> [#uses=1]
%0 = load %struct.dwarf_fde** %scevgep1314.i.i.i, align 4 ; <%struct.dwarf_fde*> [#uses=0]
store i32 undef, i32* %scevgep13.i.i.i
diff --git a/llvm/test/CodeGen/XCore/codemodel.ll b/llvm/test/CodeGen/XCore/codemodel.ll
index 0245893c478..d2091251d30 100644
--- a/llvm/test/CodeGen/XCore/codemodel.ll
+++ b/llvm/test/CodeGen/XCore/codemodel.ll
@@ -96,9 +96,9 @@ entry:
; LARGE: retsp 0
define i32 @f(i32* %i) {
entry:
- %0 = getelementptr inbounds i32* %i, i32 16383
+ %0 = getelementptr inbounds i32, i32* %i, i32 16383
%1 = load i32* %0
- %2 = getelementptr inbounds i32* %i, i32 16384
+ %2 = getelementptr inbounds i32, i32* %i, i32 16384
%3 = load i32* %2
%4 = add nsw i32 %1, %3
%5 = load i32* getelementptr inbounds ([100 x i32]* @l, i32 0, i32 0)
diff --git a/llvm/test/CodeGen/XCore/epilogue_prologue.ll b/llvm/test/CodeGen/XCore/epilogue_prologue.ll
index 99978145ed3..923cc4a09e0 100644
--- a/llvm/test/CodeGen/XCore/epilogue_prologue.ll
+++ b/llvm/test/CodeGen/XCore/epilogue_prologue.ll
@@ -199,9 +199,9 @@ declare void @f5(i32*)
define i32 @f6(i32 %i) {
entry:
%0 = alloca [200000 x i32]
- %1 = getelementptr inbounds [200000 x i32]* %0, i32 0, i32 0
+ %1 = getelementptr inbounds [200000 x i32], [200000 x i32]* %0, i32 0, i32 0
call void @f5(i32* %1)
- %2 = getelementptr inbounds [200000 x i32]* %0, i32 0, i32 199999
+ %2 = getelementptr inbounds [200000 x i32], [200000 x i32]* %0, i32 0, i32 199999
call void @f5(i32* %2)
ret i32 %i
}
@@ -229,7 +229,7 @@ entry:
define void @f8() nounwind {
entry:
%0 = alloca [256 x i32]
- %1 = getelementptr inbounds [256 x i32]* %0, i32 0, i32 253
+ %1 = getelementptr inbounds [256 x i32], [256 x i32]* %0, i32 0, i32 253
call void @f5(i32* %1)
ret void
}
@@ -257,7 +257,7 @@ entry:
define void @f9() nounwind {
entry:
%0 = alloca [32768 x i32]
- %1 = getelementptr inbounds [32768 x i32]* %0, i32 0, i32 32765
+ %1 = getelementptr inbounds [32768 x i32], [32768 x i32]* %0, i32 0, i32 32765
call void @f5(i32* %1)
ret void
}
diff --git a/llvm/test/CodeGen/XCore/indirectbr.ll b/llvm/test/CodeGen/XCore/indirectbr.ll
index d7758ea1d57..3565b20eb1c 100644
--- a/llvm/test/CodeGen/XCore/indirectbr.ll
+++ b/llvm/test/CodeGen/XCore/indirectbr.ll
@@ -16,7 +16,7 @@ bb2: ; preds = %entry, %bb3
indirectbr i8* %gotovar.4.0, [label %L5, label %L4, label %L3, label %L2, label %L1]
bb3: ; preds = %entry
- %2 = getelementptr inbounds [5 x i8*]* @C.0.2070, i32 0, i32 %i ; <i8**> [#uses=1]
+ %2 = getelementptr inbounds [5 x i8*], [5 x i8*]* @C.0.2070, i32 0, i32 %i ; <i8**> [#uses=1]
%gotovar.4.0.pre = load i8** %2, align 4 ; <i8*> [#uses=1]
br label %bb2
diff --git a/llvm/test/CodeGen/XCore/load.ll b/llvm/test/CodeGen/XCore/load.ll
index c7fc2a33db1..fc0497814d8 100644
--- a/llvm/test/CodeGen/XCore/load.ll
+++ b/llvm/test/CodeGen/XCore/load.ll
@@ -4,7 +4,7 @@ define i32 @load32(i32* %p, i32 %offset) nounwind {
entry:
; CHECK-LABEL: load32:
; CHECK: ldw r0, r0[r1]
- %0 = getelementptr i32* %p, i32 %offset
+ %0 = getelementptr i32, i32* %p, i32 %offset
%1 = load i32* %0, align 4
ret i32 %1
}
@@ -13,7 +13,7 @@ define i32 @load32_imm(i32* %p) nounwind {
entry:
; CHECK-LABEL: load32_imm:
; CHECK: ldw r0, r0[11]
- %0 = getelementptr i32* %p, i32 11
+ %0 = getelementptr i32, i32* %p, i32 11
%1 = load i32* %0, align 4
ret i32 %1
}
@@ -23,7 +23,7 @@ entry:
; CHECK-LABEL: load16:
; CHECK: ld16s r0, r0[r1]
; CHECK-NOT: sext
- %0 = getelementptr i16* %p, i32 %offset
+ %0 = getelementptr i16, i16* %p, i32 %offset
%1 = load i16* %0, align 2
%2 = sext i16 %1 to i32
ret i32 %2
@@ -34,7 +34,7 @@ entry:
; CHECK-LABEL: load8:
; CHECK: ld8u r0, r0[r1]
; CHECK-NOT: zext
- %0 = getelementptr i8* %p, i32 %offset
+ %0 = getelementptr i8, i8* %p, i32 %offset
%1 = load i8* %0, align 1
%2 = zext i8 %1 to i32
ret i32 %2
diff --git a/llvm/test/CodeGen/XCore/offset_folding.ll b/llvm/test/CodeGen/XCore/offset_folding.ll
index 8085a0fd28a..ab29ad587a5 100644
--- a/llvm/test/CodeGen/XCore/offset_folding.ll
+++ b/llvm/test/CodeGen/XCore/offset_folding.ll
@@ -8,7 +8,7 @@ entry:
; CHECK-LABEL: f1:
; CHECK: ldaw r11, cp[a+4]
; CHECK: mov r0, r11
- %0 = getelementptr [0 x i32]* @a, i32 0, i32 1
+ %0 = getelementptr [0 x i32], [0 x i32]* @a, i32 0, i32 1
ret i32* %0
}
@@ -16,7 +16,7 @@ define i32 *@f2() nounwind {
entry:
; CHECK-LABEL: f2:
; CHECK: ldaw r0, dp[b+4]
- %0 = getelementptr [0 x i32]* @b, i32 0, i32 1
+ %0 = getelementptr [0 x i32], [0 x i32]* @b, i32 0, i32 1
ret i32* %0
}
@@ -28,7 +28,7 @@ entry:
; CHECK-LABEL: f3:
; CHECK: ldaw r11, cp[a]
; CHECK: sub r0, r11, 4
- %0 = getelementptr [0 x i32]* @a, i32 0, i32 -1
+ %0 = getelementptr [0 x i32], [0 x i32]* @a, i32 0, i32 -1
ret i32* %0
}
@@ -37,6 +37,6 @@ entry:
; CHECK-LABEL: f4:
; CHECK: ldaw [[REG:r[0-9]+]], dp[b]
; CHECK: sub r0, [[REG]], 4
- %0 = getelementptr [0 x i32]* @b, i32 0, i32 -1
+ %0 = getelementptr [0 x i32], [0 x i32]* @b, i32 0, i32 -1
ret i32* %0
}
diff --git a/llvm/test/CodeGen/XCore/scavenging.ll b/llvm/test/CodeGen/XCore/scavenging.ll
index a0c8a2e0937..2756c125aa8 100644
--- a/llvm/test/CodeGen/XCore/scavenging.ll
+++ b/llvm/test/CodeGen/XCore/scavenging.ll
@@ -31,7 +31,7 @@ entry:
%11 = load volatile i32* @g9, align 4 ; <i32> [#uses=1]
%12 = load volatile i32* @g10, align 4 ; <i32> [#uses=1]
%13 = load volatile i32* @g11, align 4 ; <i32> [#uses=2]
- %14 = getelementptr [100 x i32]* %x, i32 0, i32 50 ; <i32*> [#uses=1]
+ %14 = getelementptr [100 x i32], [100 x i32]* %x, i32 0, i32 50 ; <i32*> [#uses=1]
store i32 %13, i32* %14, align 4
store volatile i32 %13, i32* @g11, align 4
store volatile i32 %12, i32* @g10, align 4
@@ -45,7 +45,7 @@ entry:
store volatile i32 %4, i32* @g2, align 4
store volatile i32 %3, i32* @g1, align 4
store volatile i32 %2, i32* @g0, align 4
- %x1 = getelementptr [100 x i32]* %x, i32 0, i32 0 ; <i32*> [#uses=1]
+ %x1 = getelementptr [100 x i32], [100 x i32]* %x, i32 0, i32 0 ; <i32*> [#uses=1]
call void @g(i32* %x1, i32* %1) nounwind
ret void
}
@@ -103,15 +103,15 @@ declare void @g(i32*, i32*)
define void @ScavengeSlots(i32 %r0, i32 %r1, i32 %r2, i32 %r3, i32 %r4) nounwind {
entry:
%Data = alloca [100000 x i32]
- %i0 = getelementptr inbounds [100000 x i32]* %Data, i32 0, i32 80000
+ %i0 = getelementptr inbounds [100000 x i32], [100000 x i32]* %Data, i32 0, i32 80000
store volatile i32 %r0, i32* %i0
- %i1 = getelementptr inbounds [100000 x i32]* %Data, i32 0, i32 81000
+ %i1 = getelementptr inbounds [100000 x i32], [100000 x i32]* %Data, i32 0, i32 81000
store volatile i32 %r1, i32* %i1
- %i2 = getelementptr inbounds [100000 x i32]* %Data, i32 0, i32 82000
+ %i2 = getelementptr inbounds [100000 x i32], [100000 x i32]* %Data, i32 0, i32 82000
store volatile i32 %r2, i32* %i2
- %i3 = getelementptr inbounds [100000 x i32]* %Data, i32 0, i32 83000
+ %i3 = getelementptr inbounds [100000 x i32], [100000 x i32]* %Data, i32 0, i32 83000
store volatile i32 %r3, i32* %i3
- %i4 = getelementptr inbounds [100000 x i32]* %Data, i32 0, i32 84000
+ %i4 = getelementptr inbounds [100000 x i32], [100000 x i32]* %Data, i32 0, i32 84000
store volatile i32 %r4, i32* %i4
ret void
}
diff --git a/llvm/test/CodeGen/XCore/store.ll b/llvm/test/CodeGen/XCore/store.ll
index 87553d8da18..a42b444bdff 100644
--- a/llvm/test/CodeGen/XCore/store.ll
+++ b/llvm/test/CodeGen/XCore/store.ll
@@ -4,7 +4,7 @@ define void @store32(i32* %p, i32 %offset, i32 %val) nounwind {
entry:
; CHECK-LABEL: store32:
; CHECK: stw r2, r0[r1]
- %0 = getelementptr i32* %p, i32 %offset
+ %0 = getelementptr i32, i32* %p, i32 %offset
store i32 %val, i32* %0, align 4
ret void
}
@@ -13,7 +13,7 @@ define void @store32_imm(i32* %p, i32 %val) nounwind {
entry:
; CHECK-LABEL: store32_imm:
; CHECK: stw r1, r0[11]
- %0 = getelementptr i32* %p, i32 11
+ %0 = getelementptr i32, i32* %p, i32 11
store i32 %val, i32* %0, align 4
ret void
}
@@ -22,7 +22,7 @@ define void @store16(i16* %p, i32 %offset, i16 %val) nounwind {
entry:
; CHECK-LABEL: store16:
; CHECK: st16 r2, r0[r1]
- %0 = getelementptr i16* %p, i32 %offset
+ %0 = getelementptr i16, i16* %p, i32 %offset
store i16 %val, i16* %0, align 2
ret void
}
@@ -31,7 +31,7 @@ define void @store8(i8* %p, i32 %offset, i8 %val) nounwind {
entry:
; CHECK-LABEL: store8:
; CHECK: st8 r2, r0[r1]
- %0 = getelementptr i8* %p, i32 %offset
+ %0 = getelementptr i8, i8* %p, i32 %offset
store i8 %val, i8* %0, align 1
ret void
}
diff --git a/llvm/test/CodeGen/XCore/trampoline.ll b/llvm/test/CodeGen/XCore/trampoline.ll
index 7ca331a6067..45d4bf4b363 100644
--- a/llvm/test/CodeGen/XCore/trampoline.ll
+++ b/llvm/test/CodeGen/XCore/trampoline.ll
@@ -9,14 +9,14 @@ entry:
; CHECK: stw r11, sp[7]
%TRAMP.23 = alloca [20 x i8], align 2
%FRAME.0 = alloca %struct.FRAME.f, align 4
- %TRAMP.23.sub = getelementptr inbounds [20 x i8]* %TRAMP.23, i32 0, i32 0
+ %TRAMP.23.sub = getelementptr inbounds [20 x i8], [20 x i8]* %TRAMP.23, i32 0, i32 0
%FRAME.02 = bitcast %struct.FRAME.f* %FRAME.0 to i8*
call void @llvm.init.trampoline(i8* %TRAMP.23.sub, i8* bitcast (i32 (%struct.FRAME.f*)* @g.1101 to i8*), i8* %FRAME.02)
%tramp = call i8* @llvm.adjust.trampoline(i8* %TRAMP.23.sub)
- %0 = getelementptr inbounds %struct.FRAME.f* %FRAME.0, i32 0, i32 1
+ %0 = getelementptr inbounds %struct.FRAME.f, %struct.FRAME.f* %FRAME.0, i32 0, i32 1
%1 = bitcast i8* %tramp to i32 ()*
store i32 ()* %1, i32 ()** %0, align 4
- %2 = getelementptr inbounds %struct.FRAME.f* %FRAME.0, i32 0, i32 0
+ %2 = getelementptr inbounds %struct.FRAME.f, %struct.FRAME.f* %FRAME.0, i32 0, i32 0
store i32 1, i32* %2, align 4
call void @h(i32 ()* %1) nounwind
ret void
@@ -28,7 +28,7 @@ entry:
; CHECK: ldw r11, sp[0]
; CHECK-NEXT: ldw r0, r11[0]
; CHECK-NEXT: retsp 0
- %0 = getelementptr inbounds %struct.FRAME.f* %CHAIN.1, i32 0, i32 0
+ %0 = getelementptr inbounds %struct.FRAME.f, %struct.FRAME.f* %CHAIN.1, i32 0, i32 0
%1 = load i32* %0, align 4
ret i32 %1
}
OpenPOWER on IntegriCloud