Add comment

llvm-svn: 712
This commit is contained in:
Chris Lattner 2001-10-03 19:35:57 +00:00
parent e504b4395b
commit 78326d20c5
1 changed files with 6 additions and 0 deletions

View File

@ -456,6 +456,12 @@ static bool setValueName(Value *V, char *NameStr) {
// cerr << "Type: " << Ty->getDescription() << " != "
// << cast<const Type>(V)->getDescription() << "!\n";
} else if (GlobalVariable *EGV = dyn_cast<GlobalVariable>(Existing)) {
// We are allowed to redefine a global variable in two circumstances:
// 1. If at least one of the globals is uninitialized or
// 2. If both initializers have the same value.
//
// This can only be done if the const'ness of the vars is the same.
//
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
if (EGV->isConstant() == GV->isConstant() &&
(!EGV->hasInitializer() || !GV->hasInitializer() ||