diff options
author | Duncan Sands <baldrick@free.fr> | 2009-02-15 09:56:08 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2009-02-15 09:56:08 +0000 |
commit | b3f27881a9e796ac37a7b8bfc5d44af80a30bca9 (patch) | |
tree | 4661a49fc6e68ddb0d206c12106edadf1c7e6620 /llvm/test/Transforms/GlobalOpt | |
parent | 2510436e20b761010cd2507cf3822cd36d4d799f (diff) | |
download | bcm5719-llvm-b3f27881a9e796ac37a7b8bfc5d44af80a30bca9.tar.gz bcm5719-llvm-b3f27881a9e796ac37a7b8bfc5d44af80a30bca9.zip |
If the target of an alias has internal linkage, then the
alias can be morphed into the target. Implement this
transform, and fix a crash in the existing transform at
the same time.
llvm-svn: 64583
Diffstat (limited to 'llvm/test/Transforms/GlobalOpt')
-rw-r--r-- | llvm/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll | 10 | ||||
-rw-r--r-- | llvm/test/Transforms/GlobalOpt/2009-02-15-ResolveAlias.ll | 12 |
2 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll b/llvm/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll new file mode 100644 index 00000000000..e59c8df5570 --- /dev/null +++ b/llvm/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | opt -globalopt + +@g = external global i32 + +@a = alias bitcast (i32* @g to i8*) + +define void @f() { + %tmp = load i8* @a + ret void +} diff --git a/llvm/test/Transforms/GlobalOpt/2009-02-15-ResolveAlias.ll b/llvm/test/Transforms/GlobalOpt/2009-02-15-ResolveAlias.ll new file mode 100644 index 00000000000..f042e59c19d --- /dev/null +++ b/llvm/test/Transforms/GlobalOpt/2009-02-15-ResolveAlias.ll @@ -0,0 +1,12 @@ +; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep {define void @a} + +define internal void @f() { + ret void +} + +@a = alias void ()* @f + +define void @g() { + call void()* @a() + ret void +} |