[llvm] r203705 - Reject alias to undefined symbols in the verifier.

Rafael Espindola rafael.espindola at gmail.com
Wed Mar 12 13:15:49 PDT 2014


Author: rafael
Date: Wed Mar 12 15:15:49 2014
New Revision: 203705

URL: http://llvm.org/viewvc/llvm-project?rev=203705&view=rev
Log:
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.

Added:
    llvm/trunk/test/Verifier/alias.ll
Removed:
    llvm/trunk/test/CodeGen/X86/alias-error.ll
Modified:
    llvm/trunk/docs/LangRef.rst
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/trunk/lib/IR/Verifier.cpp
    llvm/trunk/test/Analysis/BasicAA/2007-11-05-SizeCrash.ll
    llvm/trunk/test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll
    llvm/trunk/test/Assembler/2007-09-10-AliasFwdRef.ll
    llvm/trunk/test/CodeGen/X86/2008-03-14-SpillerCrash.ll
    llvm/trunk/test/Feature/aliases.ll
    llvm/trunk/test/Linker/2011-08-22-ResolveAlias2.ll
    llvm/trunk/test/Transforms/GVN/2009-03-10-PREOnVoid.ll
    llvm/trunk/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll
    llvm/trunk/test/Transforms/GlobalOpt/alias-resolve.ll
    llvm/trunk/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll
    llvm/trunk/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll
    llvm/trunk/test/Transforms/MetaRenamer/metarenamer.ll

Modified: llvm/trunk/docs/LangRef.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.rst?rev=203705&r1=203704&r2=203705&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.rst (original)
+++ llvm/trunk/docs/LangRef.rst Wed Mar 12 15:15:49 2014
@@ -687,6 +687,11 @@ The linkage must be one of ``private``,
 might not correctly handle dropping a weak symbol that is aliased by a non-weak
 alias.
 
+Alias that are not ``unnamed_addr`` are guaranteed to have the same address as
+the aliasee.
+
+The aliasee must be a definition.
+
 .. _namedmetadatastructure:
 
 Named Metadata

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=203705&r1=203704&r2=203705&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Mar 12 15:15:49 2014
@@ -928,11 +928,7 @@ bool AsmPrinter::doFinalization(Module &
       MCSymbol *Name = getSymbol(I);
 
       const GlobalValue *GV = I->getAliasedGlobal();
-      if (GV->isDeclaration()) {
-        report_fatal_error(Name->getName() +
-                           ": Target doesn't support aliases to declarations");
-      }
-
+      assert(!GV->isDeclaration());
       MCSymbol *Target = getSymbol(GV);
 
       if (I->hasExternalLinkage() || !MAI->getWeakRefDirective())

Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=203705&r1=203704&r2=203705&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Wed Mar 12 15:15:49 2014
@@ -501,6 +501,7 @@ void Verifier::visitGlobalAlias(const Gl
               &GA);
     }
   }
+  Assert1(!GV->isDeclaration(), "Alias must point to a definition", &GA);
 
   const GlobalValue* Resolved = GA.resolveAliasedGlobal(/*stopOnWeak*/ false);
   Assert1(Resolved,

Modified: llvm/trunk/test/Analysis/BasicAA/2007-11-05-SizeCrash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/2007-11-05-SizeCrash.ll?rev=203705&r1=203704&r2=203705&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/BasicAA/2007-11-05-SizeCrash.ll (original)
+++ llvm/trunk/test/Analysis/BasicAA/2007-11-05-SizeCrash.ll Wed Mar 12 15:15:49 2014
@@ -7,7 +7,7 @@ target triple = "x86_64-unknown-linux-gn
         %struct.pci_device_id = type { i32, i32, i32, i32, i32, i32, i64 }
         %struct.usb_bus = type { %struct.device* }
         %struct.usb_hcd = type { %struct.usb_bus, i64, [0 x i64] }
- at uhci_pci_ids = external constant [1 x %struct.pci_device_id]           ; <[1 x %struct.pci_device_id]*> [#uses=1]
+ at uhci_pci_ids = constant [1 x %struct.pci_device_id] zeroinitializer
 
 @__mod_pci_device_table = alias [1 x %struct.pci_device_id]* @uhci_pci_ids     
         ; <[1 x %struct.pci_device_id]*> [#uses=0]

Modified: llvm/trunk/test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll?rev=203705&r1=203704&r2=203705&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll (original)
+++ llvm/trunk/test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll Wed Mar 12 15:15:49 2014
@@ -7,7 +7,7 @@ target triple = "x86_64-unknown-linux-gn
 	%struct.pci_device_id = type { i32, i32, i32, i32, i32, i32, i64 }
 	%struct.usb_bus = type { %struct.device* }
 	%struct.usb_hcd = type { %struct.usb_bus, [0 x i64] }
- at pci_ids = external constant [1 x %struct.pci_device_id]		; <[1 x %struct.pci_device_id]*> [#uses=1]
+ at pci_ids = constant [1 x %struct.pci_device_id] zeroinitializer
 
 @__mod_pci_device_table = alias [1 x %struct.pci_device_id]* @pci_ids		; <[1 x %struct.pci_device_id]*> [#uses=0]
 

Modified: llvm/trunk/test/Assembler/2007-09-10-AliasFwdRef.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2007-09-10-AliasFwdRef.ll?rev=203705&r1=203704&r2=203705&view=diff
==============================================================================
--- llvm/trunk/test/Assembler/2007-09-10-AliasFwdRef.ll (original)
+++ llvm/trunk/test/Assembler/2007-09-10-AliasFwdRef.ll Wed Mar 12 15:15:49 2014
@@ -6,4 +6,6 @@
 
 
 
-declare extern_weak i32 @pthread_cancel(i32)
+define weak i32 @pthread_cancel(i32) {
+  ret i32 0
+}

Modified: llvm/trunk/test/CodeGen/X86/2008-03-14-SpillerCrash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-03-14-SpillerCrash.ll?rev=203705&r1=203704&r2=203705&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2008-03-14-SpillerCrash.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2008-03-14-SpillerCrash.ll Wed Mar 12 15:15:49 2014
@@ -6,7 +6,7 @@
 	%struct.locale_data = type { i8*, i8*, i32, i32, { void (%struct.locale_data*)*, %struct.anon }, i32, i32, i32, [0 x %struct.locale_data_value] }
 	%struct.locale_data_value = type { i32* }
 
- at wcstoll_l = alias i64 (i32*, i32**, i32, %struct.__locale_struct*)* @__wcstoll_l		; <i64 (i32*, i32**, i32, %struct.__locale_struct*)*> [#uses=0]
+ at wcstoll_l = alias i64 (i32*, i32**, i32, %struct.__locale_struct*)* @__wcstoll_l
 
 define i64 @____wcstoll_l_internal(i32* %nptr, i32** %endptr, i32 %base, i32 %group, %struct.__locale_struct* %loc) nounwind  {
 entry:

Removed: llvm/trunk/test/CodeGen/X86/alias-error.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/alias-error.ll?rev=203704&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/alias-error.ll (original)
+++ llvm/trunk/test/CodeGen/X86/alias-error.ll (removed)
@@ -1,5 +0,0 @@
-; RUN: not llc -mtriple=i686-pc-linux-gnu %s -o /dev/null 2>&1 | FileCheck %s
-
- at a = external global i32
- at b = alias i32* @a
-; CHECK: b: Target doesn't support aliases to declarations

Modified: llvm/trunk/test/Feature/aliases.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Feature/aliases.ll?rev=203705&r1=203704&r2=203705&view=diff
==============================================================================
--- llvm/trunk/test/Feature/aliases.ll (original)
+++ llvm/trunk/test/Feature/aliases.ll Wed Mar 12 15:15:49 2014
@@ -4,14 +4,16 @@
 
 @llvm.used = appending global [1 x i8*] [i8* bitcast (i32* @foo1 to i8*)], section "llvm.metadata"
 
- at bar = external global i32
+ at bar = global i32 0
 @foo1 = alias i32* @bar
 @foo2 = alias i32* @bar
 @foo3 = alias i32* @foo2
 
 %FunTy = type i32()
 
-declare i32 @foo_f()
+define i32 @foo_f() {
+  ret i32 0
+}
 @bar_f = alias weak %FunTy* @foo_f
 @bar_ff = alias i32()* @bar_f
 

Modified: llvm/trunk/test/Linker/2011-08-22-ResolveAlias2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2011-08-22-ResolveAlias2.ll?rev=203705&r1=203704&r2=203705&view=diff
==============================================================================
--- llvm/trunk/test/Linker/2011-08-22-ResolveAlias2.ll (original)
+++ llvm/trunk/test/Linker/2011-08-22-ResolveAlias2.ll Wed Mar 12 15:15:49 2014
@@ -37,56 +37,110 @@
 @_ZL33__gthrw_pthread_mutexattr_settypeP19pthread_mutexattr_ti = alias weak i32 (%union.pthread_mutexattr_t*, i32)* @pthread_mutexattr_settype
 @_ZL33__gthrw_pthread_mutexattr_destroyP19pthread_mutexattr_t = alias weak i32 (%union.pthread_mutexattr_t*)* @pthread_mutexattr_destroy
 
-declare void @_ZN13HexxagonBoardC2ERKS_(%struct.HexxagonBoard*, %struct.HexxagonBoard*) uwtable align 2
-
-declare extern_weak i32 @pthread_once(i32*, void ()*)
-
-declare extern_weak i8* @pthread_getspecific(i32)
-
-declare extern_weak i32 @pthread_setspecific(i32, i8*)
-
-declare extern_weak i32 @pthread_create(i64*, %union.pthread_attr_t*, i8* (i8*)*, i8*)
-
-declare extern_weak i32 @pthread_join(i64, i8**)
-
-declare extern_weak i32 @pthread_equal(i64, i64)
-
-declare extern_weak i64 @pthread_self()
-
-declare extern_weak i32 @pthread_detach(i64)
-
-declare extern_weak i32 @pthread_cancel(i64)
-
-declare extern_weak i32 @sched_yield()
-
-declare extern_weak i32 @pthread_mutex_lock(%union.pthread_mutex_t*)
-
-declare extern_weak i32 @pthread_mutex_trylock(%union.pthread_mutex_t*)
-
-declare extern_weak i32 @pthread_mutex_timedlock(%union.pthread_mutex_t*, %struct.timespec*)
-
-declare extern_weak i32 @pthread_mutex_unlock(%union.pthread_mutex_t*)
-
-declare extern_weak i32 @pthread_mutex_init(%union.pthread_mutex_t*, %union.pthread_mutexattr_t*)
-
-declare extern_weak i32 @pthread_mutex_destroy(%union.pthread_mutex_t*)
-
-declare extern_weak i32 @pthread_cond_broadcast(%union.pthread_cond_t*)
-
-declare extern_weak i32 @pthread_cond_signal(%union.pthread_cond_t*)
-
-declare extern_weak i32 @pthread_cond_wait(%union.pthread_cond_t*, %union.pthread_mutex_t*)
-
-declare extern_weak i32 @pthread_cond_timedwait(%union.pthread_cond_t*, %union.pthread_mutex_t*, %struct.timespec*)
-
-declare extern_weak i32 @pthread_cond_destroy(%union.pthread_cond_t*)
-
-declare extern_weak i32 @pthread_key_create(i32*, void (i8*)*)
-
-declare extern_weak i32 @pthread_key_delete(i32)
-
-declare extern_weak i32 @pthread_mutexattr_init(%union.pthread_mutexattr_t*)
-
-declare extern_weak i32 @pthread_mutexattr_settype(%union.pthread_mutexattr_t*, i32)
-
-declare extern_weak i32 @pthread_mutexattr_destroy(%union.pthread_mutexattr_t*)
+define void @_ZN13HexxagonBoardC2ERKS_(%struct.HexxagonBoard*, %struct.HexxagonBoard*) uwtable align 2 {
+  ret void
+}
+
+define weak i32 @pthread_once(i32*, void ()*) {
+  ret i32 0
+}
+
+define weak i8* @pthread_getspecific(i32) {
+  ret i8* null
+}
+
+define weak i32 @pthread_setspecific(i32, i8*) {
+  ret i32 0
+}
+
+define weak i32 @pthread_create(i64*, %union.pthread_attr_t*, i8* (i8*)*, i8*) {
+  ret i32 0
+}
+
+define weak i32 @pthread_join(i64, i8**) {
+  ret i32 0
+}
+
+define weak i32 @pthread_equal(i64, i64) {
+  ret i32 0
+}
+
+define weak i64 @pthread_self() {
+  ret i64 0
+}
+
+define weak i32 @pthread_detach(i64) {
+  ret i32 0
+}
+
+define weak i32 @pthread_cancel(i64) {
+  ret i32 0
+}
+
+define weak i32 @sched_yield() {
+  ret i32 0
+}
+
+define weak i32 @pthread_mutex_lock(%union.pthread_mutex_t*) {
+  ret i32 0
+}
+
+define weak i32 @pthread_mutex_trylock(%union.pthread_mutex_t*) {
+  ret i32 0
+}
+
+define weak i32 @pthread_mutex_timedlock(%union.pthread_mutex_t*, %struct.timespec*) {
+  ret i32 0
+}
+
+define weak i32 @pthread_mutex_unlock(%union.pthread_mutex_t*) {
+  ret i32 0
+}
+
+define weak i32 @pthread_mutex_init(%union.pthread_mutex_t*, %union.pthread_mutexattr_t*) {
+  ret i32 0
+}
+
+define weak i32 @pthread_mutex_destroy(%union.pthread_mutex_t*) {
+  ret i32 0
+}
+
+define weak i32 @pthread_cond_broadcast(%union.pthread_cond_t*) {
+  ret i32 0
+}
+
+define weak i32 @pthread_cond_signal(%union.pthread_cond_t*) {
+  ret i32 0
+}
+
+define weak i32 @pthread_cond_wait(%union.pthread_cond_t*, %union.pthread_mutex_t*) {
+  ret i32 0
+}
+
+define weak i32 @pthread_cond_timedwait(%union.pthread_cond_t*, %union.pthread_mutex_t*, %struct.timespec*) {
+  ret i32 0
+}
+
+define weak i32 @pthread_cond_destroy(%union.pthread_cond_t*) {
+  ret i32 0
+}
+
+define weak i32 @pthread_key_create(i32*, void (i8*)*) {
+  ret i32 0
+}
+
+define weak i32 @pthread_key_delete(i32) {
+  ret i32 0
+}
+
+define weak i32 @pthread_mutexattr_init(%union.pthread_mutexattr_t*) {
+  ret i32 0
+}
+
+define weak i32 @pthread_mutexattr_settype(%union.pthread_mutexattr_t*, i32) {
+  ret i32 0
+}
+
+define weak i32 @pthread_mutexattr_destroy(%union.pthread_mutexattr_t*) {
+  ret i32 0
+}

Modified: llvm/trunk/test/Transforms/GVN/2009-03-10-PREOnVoid.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVN/2009-03-10-PREOnVoid.ll?rev=203705&r1=203704&r2=203705&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/GVN/2009-03-10-PREOnVoid.ll (original)
+++ llvm/trunk/test/Transforms/GVN/2009-03-10-PREOnVoid.ll Wed Mar 12 15:15:49 2014
@@ -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
+}

Modified: llvm/trunk/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll?rev=203705&r1=203704&r2=203705&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll (original)
+++ llvm/trunk/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll Wed Mar 12 15:15:49 2014
@@ -1,6 +1,6 @@
 ; RUN: opt < %s -globalopt
 
- at g = external global i32
+ at g = global i32 0
 
 @a = alias bitcast (i32* @g to i8*)
 

Modified: llvm/trunk/test/Transforms/GlobalOpt/alias-resolve.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalOpt/alias-resolve.ll?rev=203705&r1=203704&r2=203705&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/GlobalOpt/alias-resolve.ll (original)
+++ llvm/trunk/test/Transforms/GlobalOpt/alias-resolve.ll Wed Mar 12 15:15:49 2014
@@ -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:

Modified: llvm/trunk/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll?rev=203705&r1=203704&r2=203705&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll Wed Mar 12 15:15:49 2014
@@ -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:

Modified: llvm/trunk/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll?rev=203705&r1=203704&r2=203705&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll Wed Mar 12 15:15:49 2014
@@ -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:

Modified: llvm/trunk/test/Transforms/MetaRenamer/metarenamer.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MetaRenamer/metarenamer.ll?rev=203705&r1=203704&r2=203705&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/MetaRenamer/metarenamer.ll (original)
+++ llvm/trunk/test/Transforms/MetaRenamer/metarenamer.ll Wed Mar 12 15:15:49 2014
@@ -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

Added: llvm/trunk/test/Verifier/alias.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/alias.ll?rev=203705&view=auto
==============================================================================
--- llvm/trunk/test/Verifier/alias.ll (added)
+++ llvm/trunk/test/Verifier/alias.ll Wed Mar 12 15:15:49 2014
@@ -0,0 +1,12 @@
+; RUN:  not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
+
+
+declare void @f()
+ at fa = alias void ()* @f
+; CHECK: Alias must point to a definition
+; CHECK-NEXT: @fa
+
+ at g = external global i32
+ at ga = alias i32* @g
+; CHECK: Alias must point to a definition
+; CHECK-NEXT: @ga





More information about the llvm-commits mailing list