fix test/Regression/CodeGen/X86/weak.ll
authorRafael Espindola <rafael.espindola@gmail.com>
Sat, 9 Dec 2006 23:14:08 +0000 (23:14 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Sat, 9 Dec 2006 23:14:08 +0000 (23:14 +0000)
if a variable has no initialization, I->getInitializer() will fail

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32407 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86AsmPrinter.cpp
test/CodeGen/X86/weak.ll [new file with mode: 0644]

index 85a1cb642485537737cab324fdb42b98ef0dfbba..021e55c5c5c0f5f53722a063955b1fe04e515a63 100644 (file)
@@ -132,7 +132,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
   // Print out module-level global variables here.
   for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
        I != E; ++I) {
-    if (!I->hasInitializer() && !I->hasExternalWeakLinkage())
+    if (!I->hasInitializer())
       continue;   // External global require no code
     
     // Check to see if this is a special global used by LLVM, if so, emit it.
diff --git a/test/CodeGen/X86/weak.ll b/test/CodeGen/X86/weak.ll
new file mode 100644 (file)
index 0000000..1397b19
--- /dev/null
@@ -0,0 +1,3 @@
+; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86
+%a = extern_weak global int
+%b = global int* %a