Revert previous check in r168581, r169079 as they are still in code review status.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169083 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Zhou Sheng 2012-12-01 10:54:28 +00:00
parent 702aa2ee19
commit efcdb2944b
3 changed files with 4 additions and 8343 deletions

View File

@ -36,7 +36,6 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h"
#include <algorithm>
@ -2399,8 +2398,7 @@ static bool isSimpleEnoughPointerToCommit(Constant *C) {
/// initializer. This returns 'Init' modified to reflect 'Val' stored into it.
/// At this point, the GEP operands of Addr [0, OpNo) have been stepped into.
static Constant *EvaluateStoreInto(Constant *Init, Constant *Val,
ConstantExpr *Addr, unsigned OpNo,
SetVector<Constant*>& Obsolete) {
ConstantExpr *Addr, unsigned OpNo) {
// Base case of the recursion.
if (OpNo == Addr->getNumOperands()) {
assert(Val->getType() == Init->getType() && "Type mismatch!");
@ -2417,9 +2415,7 @@ static Constant *EvaluateStoreInto(Constant *Init, Constant *Val,
ConstantInt *CU = cast<ConstantInt>(Addr->getOperand(OpNo));
unsigned Idx = CU->getZExtValue();
assert(Idx < STy->getNumElements() && "Struct index out of range!");
if (Elts[Idx]->getType()->isAggregateType())
Obsolete.insert(Elts[Idx]);
Elts[Idx] = EvaluateStoreInto(Elts[Idx], Val, Addr, OpNo+1, Obsolete);
Elts[Idx] = EvaluateStoreInto(Elts[Idx], Val, Addr, OpNo+1);
// Return the modified struct.
return ConstantStruct::get(STy, Elts);
@ -2439,11 +2435,8 @@ static Constant *EvaluateStoreInto(Constant *Init, Constant *Val,
Elts.push_back(Init->getAggregateElement(i));
assert(CI->getZExtValue() < NumElts);
Constant *OrigElem = Elts[CI->getZExtValue()];
if (OrigElem->getType()->isAggregateType())
Obsolete.insert(OrigElem);
Elts[CI->getZExtValue()] =
EvaluateStoreInto(OrigElem, Val, Addr, OpNo+1, Obsolete);
EvaluateStoreInto(Elts[CI->getZExtValue()], Val, Addr, OpNo+1);
if (Init->getType()->isArrayTy())
return ConstantArray::get(cast<ArrayType>(InitTy), Elts);
@ -2459,20 +2452,9 @@ static void CommitValueTo(Constant *Val, Constant *Addr) {
return;
}
// Collect obsolete constants created in previous CommitValueTo() invoke.
SetVector<Constant*> Obsolete;
ConstantExpr *CE = cast<ConstantExpr>(Addr);
GlobalVariable *GV = cast<GlobalVariable>(CE->getOperand(0));
Constant *OrigInit = GV->getInitializer();
if (OrigInit->getType()->isAggregateType())
Obsolete.insert(OrigInit);
Constant *Init = EvaluateStoreInto(OrigInit, Val, CE, 2, Obsolete);
GV->setInitializer(Init);
for (unsigned i = 0; i < Obsolete.size(); ++i) {
if (Obsolete[i]->use_empty())
Obsolete[i]->destroyConstant();
}
GV->setInitializer(EvaluateStoreInto(GV->getInitializer(), Val, CE, 2));
}
namespace {

View File

@ -1640,18 +1640,6 @@ void MPPassManager::addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass) {
OnTheFlyManagers[P] = FPP;
}
// If RequiredPass is an analysis pass and it is available then do not
// generate the analysis again. Stale analysis info should not be
// available at this point.
const PassInfo *PI =
PassRegistry::getPassRegistry()->getPassInfo(RequiredPass->getPassID());
if (PI && PI->isAnalysis() &&
FPP->getTopLevelManager()->findAnalysisPass(RequiredPass->getPassID())) {
delete RequiredPass;
return;
}
FPP->add(RequiredPass);
// Register P as the last user of RequiredPass.

File diff suppressed because it is too large Load Diff