diff options
| author | David Blaikie <dblaikie@gmail.com> | 2015-09-11 03:22:04 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2015-09-11 03:22:04 +0000 |
| commit | 2f40830ddebea58a5b6dcf31fae32651e4bddc8f (patch) | |
| tree | 75b71c6711893e70d9dbaf83762083db89badb0e /llvm/test/Assembler | |
| parent | 33b4675b4419da760df111a3eea41af1de36384f (diff) | |
| download | bcm5719-llvm-2f40830ddebea58a5b6dcf31fae32651e4bddc8f.tar.gz bcm5719-llvm-2f40830ddebea58a5b6dcf31fae32651e4bddc8f.zip | |
[opaque pointer type] Add textual IR support for explicit type parameter for global aliases
update.py:
import fileinput
import sys
import re
alias_match_prefix = r"(.*(?:=|:|^)\s*(?:external |)(?:(?:private|internal|linkonce|linkonce_odr|weak|weak_odr|common|appending|extern_weak|available_externally) )?(?:default |hidden |protected )?(?:dllimport |dllexport )?(?:unnamed_addr |)(?:thread_local(?:\([a-z]*\))? )?alias"
plain = re.compile(alias_match_prefix + r" (.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|addrspacecast|\[\[[a-zA-Z]|\{\{).*$)")
cast = re.compile(alias_match_prefix + r") ((?:bitcast|inttoptr|addrspacecast)\s*\(.* to (.*?)(| addrspace\(\d+\) *)\*\)\s*(?:;.*)?$)")
gep = re.compile(alias_match_prefix + r") ((?:getelementptr)\s*(?:inbounds)?\s*\((?P<type>.*), (?P=type)(?:\s*addrspace\(\d+\)\s*)?\* .*\)\s*(?:;.*)?$)")
def conv(line):
m = re.match(cast, line)
if m:
return m.group(1) + " " + m.group(3) + ", " + m.group(2)
m = re.match(gep, line)
if m:
return m.group(1) + " " + m.group(3) + ", " + m.group(2)
m = re.match(plain, line)
if m:
return m.group(1) + ", " + m.group(2) + m.group(3) + "*" + m.group(4) + "\n"
return line
for line in sys.stdin:
sys.stdout.write(conv(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
llvm-svn: 247378
Diffstat (limited to 'llvm/test/Assembler')
20 files changed, 43 insertions, 39 deletions
diff --git a/llvm/test/Assembler/2007-09-10-AliasFwdRef.ll b/llvm/test/Assembler/2007-09-10-AliasFwdRef.ll index 8e0a5718058..882569b2f24 100644 --- a/llvm/test/Assembler/2007-09-10-AliasFwdRef.ll +++ b/llvm/test/Assembler/2007-09-10-AliasFwdRef.ll @@ -3,7 +3,7 @@ ; PR1645 @__gthread_active_ptr.5335 = internal constant i8* bitcast (i32 (i32)* @__gthrw_pthread_cancel to i8*) -@__gthrw_pthread_cancel = weak alias i32 (i32)* @pthread_cancel +@__gthrw_pthread_cancel = weak alias i32 (i32), i32 (i32)* @pthread_cancel diff --git a/llvm/test/Assembler/ConstantExprNoFold.ll b/llvm/test/Assembler/ConstantExprNoFold.ll index 38f8cbbc9cd..6b06a8fbb75 100644 --- a/llvm/test/Assembler/ConstantExprNoFold.ll +++ b/llvm/test/Assembler/ConstantExprNoFold.ll @@ -43,8 +43,8 @@ target datalayout = "p:32:32" @empty.cmp = global i1 icmp eq ([0 x i8]* @empty.1, [0 x i8]* @empty.2) ; Don't add an inbounds on @glob.a3, since it's not inbounds. -; CHECK: @glob.a3 = alias getelementptr (i32, i32* @glob.a2, i32 1) +; CHECK: @glob.a3 = alias i32, getelementptr (i32, i32* @glob.a2, i32 1) @glob = global i32 0 -@glob.a3 = alias getelementptr (i32, i32* @glob.a2, i32 1) -@glob.a2 = alias getelementptr (i32, i32* @glob.a1, i32 1) -@glob.a1 = alias i32* @glob +@glob.a3 = alias i32, getelementptr (i32, i32* @glob.a2, i32 1) +@glob.a2 = alias i32, getelementptr (i32, i32* @glob.a1, i32 1) +@glob.a1 = alias i32, i32* @glob diff --git a/llvm/test/Assembler/addrspacecast-alias.ll b/llvm/test/Assembler/addrspacecast-alias.ll index 745e525c15f..32eb5b9d486 100644 --- a/llvm/test/Assembler/addrspacecast-alias.ll +++ b/llvm/test/Assembler/addrspacecast-alias.ll @@ -4,5 +4,5 @@ ; Test that global aliases are allowed to be constant addrspacecast @i = internal addrspace(1) global i8 42 -@ia = internal alias addrspacecast (i8 addrspace(1)* @i to i8 addrspace(2)* addrspace(3)*) -; CHECK: @ia = internal alias addrspacecast (i8 addrspace(2)* addrspace(1)* bitcast (i8 addrspace(1)* @i to i8 addrspace(2)* addrspace(1)*) to i8 addrspace(2)* addrspace(3)*) +@ia = internal alias i8 addrspace(2)*, addrspacecast (i8 addrspace(1)* @i to i8 addrspace(2)* addrspace(3)*) +; CHECK: @ia = internal alias i8 addrspace(2)*, addrspacecast (i8 addrspace(2)* addrspace(1)* bitcast (i8 addrspace(1)* @i to i8 addrspace(2)* addrspace(1)*) to i8 addrspace(2)* addrspace(3)*) diff --git a/llvm/test/Assembler/alias-redefinition.ll b/llvm/test/Assembler/alias-redefinition.ll index 19ad85bf5f5..7c57b63b66f 100644 --- a/llvm/test/Assembler/alias-redefinition.ll +++ b/llvm/test/Assembler/alias-redefinition.ll @@ -3,5 +3,5 @@ ; CHECK: error: redefinition of global named '@bar' @foo = global i32 0 -@bar = alias i32* @foo -@bar = alias i32* @foo +@bar = alias i32, i32* @foo +@bar = alias i32, i32* @foo diff --git a/llvm/test/Assembler/alias-use-list-order.ll b/llvm/test/Assembler/alias-use-list-order.ll index c72bad28e50..7e72e450a75 100644 --- a/llvm/test/Assembler/alias-use-list-order.ll +++ b/llvm/test/Assembler/alias-use-list-order.ll @@ -6,6 +6,6 @@ @alias.ref2 = global i32* getelementptr inbounds (i32, i32* @alias, i64 1) ; Aliases. -@alias = alias i32* @global -@alias.ref3 = alias i32* getelementptr inbounds (i32, i32* @alias, i64 1) -@alias.ref4 = alias i32* getelementptr inbounds (i32, i32* @alias, i64 1) +@alias = alias i32, i32* @global +@alias.ref3 = alias i32, getelementptr inbounds (i32, i32* @alias, i64 1) +@alias.ref4 = alias i32, getelementptr inbounds (i32, i32* @alias, i64 1) diff --git a/llvm/test/Assembler/anon-functions.ll b/llvm/test/Assembler/anon-functions.ll index 42eea837227..2352a00f57d 100644 --- a/llvm/test/Assembler/anon-functions.ll +++ b/llvm/test/Assembler/anon-functions.ll @@ -5,8 +5,8 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" target triple = "x86_64-unknown-linux-gnu" -@f = alias void ()* @0 ; <void ()*> [#uses=0] -@g = alias void ()* @1 ; <void ()*> [#uses=0] +@f = alias void (), void ()* @0 ; <void ()*> [#uses=0] +@g = alias void (), void ()* @1 ; <void ()*> [#uses=0] @h = external global void ()* ; <void ()*> [#uses=0] define internal void @0() nounwind { diff --git a/llvm/test/Assembler/internal-hidden-alias.ll b/llvm/test/Assembler/internal-hidden-alias.ll index df547c0838c..f5bf4fb869e 100644 --- a/llvm/test/Assembler/internal-hidden-alias.ll +++ b/llvm/test/Assembler/internal-hidden-alias.ll @@ -2,5 +2,5 @@ @global = global i32 0 -@alias = internal hidden alias i32* @global +@alias = internal hidden alias i32, i32* @global ; CHECK: symbol with local linkage must have default visibility diff --git a/llvm/test/Assembler/internal-protected-alias.ll b/llvm/test/Assembler/internal-protected-alias.ll index 46a05ec732f..37e90a0de1c 100644 --- a/llvm/test/Assembler/internal-protected-alias.ll +++ b/llvm/test/Assembler/internal-protected-alias.ll @@ -2,5 +2,5 @@ @global = global i32 0 -@alias = internal protected alias i32* @global +@alias = internal protected alias i32, i32* @global ; CHECK: symbol with local linkage must have default visibility diff --git a/llvm/test/Assembler/invalid-alias-mismatched-explicit-type.ll b/llvm/test/Assembler/invalid-alias-mismatched-explicit-type.ll new file mode 100644 index 00000000000..d2822379308 --- /dev/null +++ b/llvm/test/Assembler/invalid-alias-mismatched-explicit-type.ll @@ -0,0 +1,4 @@ +; RUN: not llvm-as < %s 2>&1 | FileCheck %s +; CHECK: <stdin>:4:12: error: explicit pointee type doesn't match operand's pointee type +@y = global i2 0 +@x = alias i1, i2* @y diff --git a/llvm/test/Assembler/invalid-fwdref2.ll b/llvm/test/Assembler/invalid-fwdref2.ll index d823481f8e1..0828cd9b08a 100644 --- a/llvm/test/Assembler/invalid-fwdref2.ll +++ b/llvm/test/Assembler/invalid-fwdref2.ll @@ -1,4 +1,4 @@ ; RUN: not llvm-as %s -disable-output 2>&1 | grep "forward reference and definition of global have different types" -@a2 = alias void ()* @g2 +@a2 = alias void (), void ()* @g2 @g2 = internal global i8 42 diff --git a/llvm/test/Assembler/invalid-uselistorder-indexes-duplicated.ll b/llvm/test/Assembler/invalid-uselistorder-indexes-duplicated.ll index e4affc53c1f..4ab4fbdfcce 100644 --- a/llvm/test/Assembler/invalid-uselistorder-indexes-duplicated.ll +++ b/llvm/test/Assembler/invalid-uselistorder-indexes-duplicated.ll @@ -1,7 +1,7 @@ ; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s ; CHECK: error: expected distinct uselistorder indexes in range [0, size) @global = global i32 0 -@alias1 = alias i32* @global -@alias2 = alias i32* @global -@alias3 = alias i32* @global +@alias1 = alias i32, i32* @global +@alias2 = alias i32, i32* @global +@alias3 = alias i32, i32* @global uselistorder i32* @global, { 0, 0, 2 } diff --git a/llvm/test/Assembler/invalid-uselistorder-indexes-one.ll b/llvm/test/Assembler/invalid-uselistorder-indexes-one.ll index f5eac80a3ca..f61809f7fea 100644 --- a/llvm/test/Assembler/invalid-uselistorder-indexes-one.ll +++ b/llvm/test/Assembler/invalid-uselistorder-indexes-one.ll @@ -1,5 +1,5 @@ ; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s ; CHECK: error: value only has one use @global = global i32 0 -@alias = alias i32* @global +@alias = alias i32, i32* @global uselistorder i32* @global, { 1, 0 } diff --git a/llvm/test/Assembler/invalid-uselistorder-indexes-ordered.ll b/llvm/test/Assembler/invalid-uselistorder-indexes-ordered.ll index 7bdc40037af..e7a17b0e3ab 100644 --- a/llvm/test/Assembler/invalid-uselistorder-indexes-ordered.ll +++ b/llvm/test/Assembler/invalid-uselistorder-indexes-ordered.ll @@ -1,7 +1,7 @@ ; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s ; CHECK: error: expected uselistorder indexes to change the order @global = global i32 0 -@alias1 = alias i32* @global -@alias2 = alias i32* @global -@alias3 = alias i32* @global +@alias1 = alias i32, i32* @global +@alias2 = alias i32, i32* @global +@alias3 = alias i32, i32* @global uselistorder i32* @global, { 0, 1, 2 } diff --git a/llvm/test/Assembler/invalid-uselistorder-indexes-range.ll b/llvm/test/Assembler/invalid-uselistorder-indexes-range.ll index fc97acac5e6..7c3ab116bd8 100644 --- a/llvm/test/Assembler/invalid-uselistorder-indexes-range.ll +++ b/llvm/test/Assembler/invalid-uselistorder-indexes-range.ll @@ -1,7 +1,7 @@ ; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s ; CHECK: error: expected distinct uselistorder indexes in range [0, size) @global = global i32 0 -@alias1 = alias i32* @global -@alias2 = alias i32* @global -@alias3 = alias i32* @global +@alias1 = alias i32, i32* @global +@alias2 = alias i32, i32* @global +@alias3 = alias i32, i32* @global uselistorder i32* @global, { 0, 3, 1 } diff --git a/llvm/test/Assembler/invalid-uselistorder-indexes-toofew.ll b/llvm/test/Assembler/invalid-uselistorder-indexes-toofew.ll index 88a76fc568a..fd9ff8029f9 100644 --- a/llvm/test/Assembler/invalid-uselistorder-indexes-toofew.ll +++ b/llvm/test/Assembler/invalid-uselistorder-indexes-toofew.ll @@ -1,7 +1,7 @@ ; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s ; CHECK: error: wrong number of indexes, expected 3 @global = global i32 0 -@alias1 = alias i32* @global -@alias2 = alias i32* @global -@alias3 = alias i32* @global +@alias1 = alias i32, i32* @global +@alias2 = alias i32, i32* @global +@alias3 = alias i32, i32* @global uselistorder i32* @global, { 1, 0 } diff --git a/llvm/test/Assembler/invalid-uselistorder-indexes-toomany.ll b/llvm/test/Assembler/invalid-uselistorder-indexes-toomany.ll index a2cf3da0bd3..ba8481d61aa 100644 --- a/llvm/test/Assembler/invalid-uselistorder-indexes-toomany.ll +++ b/llvm/test/Assembler/invalid-uselistorder-indexes-toomany.ll @@ -1,6 +1,6 @@ ; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s ; CHECK: error: wrong number of indexes, expected 2 @global = global i32 0 -@alias1 = alias i32* @global -@alias2 = alias i32* @global +@alias1 = alias i32, i32* @global +@alias2 = alias i32, i32* @global uselistorder i32* @global, { 1, 0, 2 } diff --git a/llvm/test/Assembler/private-hidden-alias.ll b/llvm/test/Assembler/private-hidden-alias.ll index 2e770e58784..eac27f488e6 100644 --- a/llvm/test/Assembler/private-hidden-alias.ll +++ b/llvm/test/Assembler/private-hidden-alias.ll @@ -2,5 +2,5 @@ @global = global i32 0 -@alias = private hidden alias i32* @global +@alias = private hidden alias i32, i32* @global ; CHECK: symbol with local linkage must have default visibility diff --git a/llvm/test/Assembler/private-protected-alias.ll b/llvm/test/Assembler/private-protected-alias.ll index f1824a2f3c7..37bdabaf8a5 100644 --- a/llvm/test/Assembler/private-protected-alias.ll +++ b/llvm/test/Assembler/private-protected-alias.ll @@ -2,5 +2,5 @@ @global = global i32 0 -@alias = private protected alias i32* @global +@alias = private protected alias i32, i32* @global ; CHECK: symbol with local linkage must have default visibility diff --git a/llvm/test/Assembler/unnamed-alias.ll b/llvm/test/Assembler/unnamed-alias.ll index 8ae1c45d312..ebba091d770 100644 --- a/llvm/test/Assembler/unnamed-alias.ll +++ b/llvm/test/Assembler/unnamed-alias.ll @@ -5,7 +5,7 @@ @1 = private constant i32 1 ; CHECK: @1 = private constant i32 1 -@2 = private alias i32* @0 -; CHECK: @2 = private alias i32* @0 -@3 = private alias i32* @1 -; CHECK: @3 = private alias i32* @1 +@2 = private alias i32, i32* @0 +; CHECK: @2 = private alias i32, i32* @0 +@3 = private alias i32, i32* @1 +; CHECK: @3 = private alias i32, i32* @1 diff --git a/llvm/test/Assembler/uselistorder.ll b/llvm/test/Assembler/uselistorder.ll index 0d1382461ad..016bd877311 100644 --- a/llvm/test/Assembler/uselistorder.ll +++ b/llvm/test/Assembler/uselistorder.ll @@ -4,7 +4,7 @@ ; RUN: verify-uselistorder < %s @a = global [4 x i1] [i1 0, i1 1, i1 0, i1 1] -@b = alias getelementptr ([4 x i1], [4 x i1]* @a, i64 0, i64 2) +@b = alias i1, getelementptr ([4 x i1], [4 x i1]* @a, i64 0, i64 2) ; Check use-list order of constants used by globals. @glob1 = global i5 7 |

