how to zero-init a global


I have a module containing a constant e.g.

@input = global %0 zeroinitializer, align 16

when I copy the global into another module I use
but the new module now has

@input = external global %0, align 16

i.e. the zeroinitializer is missing. how do I set it or
copy it from the other global?


The initializer doesn't count as an attribute, I guess.
  if (global->hasInitializer())
Note that, as I mentioned in response to your earlier question, not
all constants are safe to use in a different module. So simply copying
the initializer may be unsafe...

Note that linkage and constness don't seem to count either.

All three of these can also be passed to the constructor for
newGlobal, by the way. According to the comment on
GlobalValue::copyAttributesFrom() (as well as its GlobalVariable
override) this seems to be the defining characteristic that qualifies
them as "attributes"; it considers any property you can't pass to the
constructor an attribute, apparently.

thanks. the reason why I didn't find getInitializer was I
was searching in GlobalValue, not GlobalVariable