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
// 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.
--- /dev/null
+; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86
+%a = extern_weak global int
+%b = global int* %a