diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-05-09 17:22:59 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-05-09 17:22:59 +0000 |
commit | 95f885390bff8ff2d0c5eb33e6bc3bd536c1594f (patch) | |
tree | 9751b0895b579c44b1f9dfae7eb2bff058544d0a /test/Transforms | |
parent | 9bd913c4c1f350562b5a31e79a82dcaf143b06e0 (diff) | |
download | external_llvm-95f885390bff8ff2d0c5eb33e6bc3bd536c1594f.zip external_llvm-95f885390bff8ff2d0c5eb33e6bc3bd536c1594f.tar.gz external_llvm-95f885390bff8ff2d0c5eb33e6bc3bd536c1594f.tar.bz2 |
Don't replace an alias in llvm.used with its target.
When we replace an internal alias with its target, be careful not to
replace the entry in llvm.used (and llvm.compiler_used).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181524 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/GlobalOpt/alias-used.ll | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/Transforms/GlobalOpt/alias-used.ll b/test/Transforms/GlobalOpt/alias-used.ll new file mode 100644 index 0000000..f91579b --- /dev/null +++ b/test/Transforms/GlobalOpt/alias-used.ll @@ -0,0 +1,42 @@ +; RUN: opt < %s -globalopt -S | FileCheck %s + +@c = global i8 42 + +@llvm.used = appending global [3 x i8*] [i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @f to i8*), i8* @ca], section "llvm.metadata" +; CHECK: @llvm.used = appending global [3 x i8*] [i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @f to i8*), i8* @ca], section "llvm.metadata" + +@llvm.compiler_used = appending global [2 x i8*] [i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @fa3 to i8*)], section "llvm.metadata" + +@sameAsUsed = global [3 x i8*] [i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @f to i8*), i8* @ca] +; CHECK: @sameAsUsed = global [3 x i8*] [i8* bitcast (void ()* @f to i8*), i8* bitcast (void ()* @f to i8*), i8* @c] + +@other = global i32* bitcast (void ()* @fa to i32*) +; CHECK: @other = global i32* bitcast (void ()* @f to i32*) + +@fa = alias internal void ()* @f +; CHECK: @fa = alias internal void ()* @f + +@fa2 = alias internal void ()* @f +; CHECK-NOT: @fa2 + +@fa3 = alias internal void ()* @f +; CHECK: @fa3 + +@ca = alias internal i8* @c +; CHECK: @ca = alias internal i8* @c + +define void @f() { + ret void +} + +define i8* @g() { + ret i8* bitcast (void ()* @fa to i8*); +} + +define i8* @g2() { + ret i8* bitcast (void ()* @fa2 to i8*); +} + +define i8* @h() { + ret i8* @ca +} |