summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-03-12 20:15:49 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-03-12 20:15:49 +0000
commitf3336bc1d52832a299d0530fb20071e8517bd80b (patch)
tree5cd5474e65ced36279d6bffcd33865c6045611d1 /llvm/test/Transforms
parentbfee8d49c4dcb9674fc3ae5c39f131685c516663 (diff)
downloadbcm5719-llvm-f3336bc1d52832a299d0530fb20071e8517bd80b.tar.gz
bcm5719-llvm-f3336bc1d52832a299d0530fb20071e8517bd80b.zip
Reject alias to undefined symbols in the verifier.
On ELF and COFF an alias is just another name for a position in the file. There is no way to refer to a position in another file, so an alias to undefined is meaningless. MachO currently doesn't support aliases. The spec has a N_INDR, which when implemented will have a different set of restrictions. Adding support for it shouldn't be harder than any other IR extension. For now, having the IR represent what is actually possible with current tools makes it easier to fix the design of GlobalAlias. llvm-svn: 203705
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/GVN/2009-03-10-PREOnVoid.ll56
-rw-r--r--llvm/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll2
-rw-r--r--llvm/test/Transforms/GlobalOpt/alias-resolve.ll6
-rw-r--r--llvm/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll4
-rw-r--r--llvm/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll4
-rw-r--r--llvm/test/Transforms/MetaRenamer/metarenamer.ll4
6 files changed, 56 insertions, 20 deletions
diff --git a/llvm/test/Transforms/GVN/2009-03-10-PREOnVoid.ll b/llvm/test/Transforms/GVN/2009-03-10-PREOnVoid.ll
index 89d6a5f982b..fd31fce59a8 100644
--- a/llvm/test/Transforms/GVN/2009-03-10-PREOnVoid.ll
+++ b/llvm/test/Transforms/GVN/2009-03-10-PREOnVoid.ll
@@ -53,30 +53,58 @@ bb11: ; preds = %bb7, %bb5
unreachable
}
-declare i32 @pthread_once(i32*, void ()*)
+define i32 @pthread_once(i32*, void ()*) {
+ ret i32 0
+}
-declare i8* @pthread_getspecific(i32)
+define i8* @pthread_getspecific(i32) {
+ ret i8* null
+}
-declare i32 @pthread_setspecific(i32, i8*)
+define i32 @pthread_setspecific(i32, i8*) {
+ ret i32 0
+}
-declare i32 @pthread_create(i32*, %struct.pthread_attr_t*, i8* (i8*)*, i8*)
+define i32 @pthread_create(i32*, %struct.pthread_attr_t*, i8* (i8*)*, i8*) {
+ ret i32 0
+}
-declare i32 @pthread_cancel(i32)
+define i32 @pthread_cancel(i32) {
+ ret i32 0
+}
-declare i32 @pthread_mutex_lock(%struct.pthread_mutex_t*)
+define i32 @pthread_mutex_lock(%struct.pthread_mutex_t*) {
+ ret i32 0
+}
-declare i32 @pthread_mutex_trylock(%struct.pthread_mutex_t*)
+define i32 @pthread_mutex_trylock(%struct.pthread_mutex_t*) {
+ ret i32 0
+}
-declare i32 @pthread_mutex_unlock(%struct.pthread_mutex_t*)
+define i32 @pthread_mutex_unlock(%struct.pthread_mutex_t*) {
+ ret i32 0
+}
-declare i32 @pthread_mutex_init(%struct.pthread_mutex_t*, %struct.__sched_param*)
+define i32 @pthread_mutex_init(%struct.pthread_mutex_t*, %struct.__sched_param*) {
+ ret i32 0
+}
-declare i32 @pthread_key_create(i32*, void (i8*)*)
+define i32 @pthread_key_create(i32*, void (i8*)*) {
+ ret i32 0
+}
-declare i32 @pthread_key_delete(i32)
+define i32 @pthread_key_delete(i32) {
+ ret i32 0
+}
-declare i32 @pthread_mutexattr_init(%struct.__sched_param*)
+define i32 @pthread_mutexattr_init(%struct.__sched_param*) {
+ ret i32 0
+}
-declare i32 @pthread_mutexattr_settype(%struct.__sched_param*, i32)
+define i32 @pthread_mutexattr_settype(%struct.__sched_param*, i32) {
+ ret i32 0
+}
-declare i32 @pthread_mutexattr_destroy(%struct.__sched_param*)
+define i32 @pthread_mutexattr_destroy(%struct.__sched_param*) {
+ ret i32 0
+}
diff --git a/llvm/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll b/llvm/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll
index a1b69efe1a7..d6a565ad10a 100644
--- a/llvm/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll
+++ b/llvm/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll
@@ -1,6 +1,6 @@
; RUN: opt < %s -globalopt
-@g = external global i32
+@g = global i32 0
@a = alias bitcast (i32* @g to i8*)
diff --git a/llvm/test/Transforms/GlobalOpt/alias-resolve.ll b/llvm/test/Transforms/GlobalOpt/alias-resolve.ll
index 5e229b94268..64e3d88af8a 100644
--- a/llvm/test/Transforms/GlobalOpt/alias-resolve.ll
+++ b/llvm/test/Transforms/GlobalOpt/alias-resolve.ll
@@ -9,8 +9,10 @@
@bar1 = alias void ()* @bar2
; CHECK: @bar1 = alias void ()* @bar2
-declare void @bar2()
-; CHECK: declare void @bar2()
+define void @bar2() {
+ ret void
+}
+; CHECK: define void @bar2()
define void @baz() {
entry:
diff --git a/llvm/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll b/llvm/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll
index c27fe0ab6a6..7f9bd9e40dc 100644
--- a/llvm/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll
+++ b/llvm/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll
@@ -3,7 +3,9 @@
@__gthrw_pthread_cancel = alias weak i32 (i32)* @pthread_cancel ; <i32 (i32)*> [#uses=1]
@__gthread_active_ptr.5335 = internal constant i8* bitcast (i32 (i32)* @__gthrw_pthread_cancel to i8*) ; <i8**> [#uses=1]
-declare extern_weak i32 @pthread_cancel(i32)
+define weak i32 @pthread_cancel(i32) {
+ ret i32 0
+}
define i1 @__gthread_active_p() {
entry:
diff --git a/llvm/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll b/llvm/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll
index 23ee12ba754..c7cef752dcc 100644
--- a/llvm/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll
+++ b/llvm/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll
@@ -3,7 +3,9 @@
@A = alias weak void ()* @B ; <void ()*> [#uses=1]
-declare extern_weak void @B()
+define weak void @B() {
+ ret void
+}
define i32 @active() {
entry:
diff --git a/llvm/test/Transforms/MetaRenamer/metarenamer.ll b/llvm/test/Transforms/MetaRenamer/metarenamer.ll
index 4020e104508..6297af62ff0 100644
--- a/llvm/test/Transforms/MetaRenamer/metarenamer.ll
+++ b/llvm/test/Transforms/MetaRenamer/metarenamer.ll
@@ -14,7 +14,9 @@ target triple = "x86_64-pc-linux-gnu"
@func_7_xxx = alias weak i32 (...)* @aliased_func_7_xxx
-declare i32 @aliased_func_7_xxx(...)
+define i32 @aliased_func_7_xxx(...) {
+ ret i32 0
+}
define i32 @func_3_xxx() nounwind uwtable ssp {
ret i32 3
OpenPOWER on IntegriCloud