mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-25 12:50:00 +00:00
Fix bug: Assembler/2003-02-02-ConstGlobal.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5467 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e58ee96b08
commit
bb3e5d4f6e
@ -510,16 +510,16 @@ static bool setValueName(Value *V, char *NameStr) {
|
||||
// 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() ||
|
||||
EGV->getInitializer() == GV->getInitializer())) {
|
||||
if (!EGV->hasInitializer() || !GV->hasInitializer() ||
|
||||
EGV->getInitializer() == GV->getInitializer()) {
|
||||
|
||||
// Make sure the existing global version gets the initializer!
|
||||
// Make sure the existing global version gets the initializer! Make
|
||||
// sure that it also gets marked const if the new version is.
|
||||
if (GV->hasInitializer() && !EGV->hasInitializer())
|
||||
EGV->setInitializer(GV->getInitializer());
|
||||
if (GV->isConstant())
|
||||
EGV->setConstant(true);
|
||||
|
||||
delete GV; // Destroy the duplicate!
|
||||
return true; // They are equivalent!
|
||||
|
Loading…
Reference in New Issue
Block a user