From b3f27881a9e796ac37a7b8bfc5d44af80a30bca9 Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Sun, 15 Feb 2009 09:56:08 +0000 Subject: 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 --- llvm/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll | 10 ++++++++++ llvm/test/Transforms/GlobalOpt/2009-02-15-ResolveAlias.ll | 12 ++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 llvm/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll create mode 100644 llvm/test/Transforms/GlobalOpt/2009-02-15-ResolveAlias.ll (limited to 'llvm/test/Transforms') 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 +} -- cgit v1.2.3