diff options
author | Ruchira Sasanka <sasanka@students.uiuc.edu> | 2001-11-12 19:32:04 +0000 |
---|---|---|
committer | Ruchira Sasanka <sasanka@students.uiuc.edu> | 2001-11-12 19:32:04 +0000 |
commit | 061b8edb27891b02fd2bae72d05d9c518ed1774f (patch) | |
tree | 06b9e90c29387508b93803756af8901f073bfe0c | |
parent | 3438b21ebde9424e26561e39c2882bf2368167d8 (diff) |
Changed insert instructions only for CONSTANTS - back to original
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1271 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/HoistPHIConstants.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Transforms/HoistPHIConstants.cpp b/lib/Transforms/HoistPHIConstants.cpp index 6e903498f5..d08deba778 100644 --- a/lib/Transforms/HoistPHIConstants.cpp +++ b/lib/Transforms/HoistPHIConstants.cpp @@ -30,12 +30,12 @@ static Value *NormalizePhiOperand(PHINode *PN, Value *CPV, // Check if we've already inserted a copy for this constant in Pred // Note that `copyCache[Pred]' will create an empty vector the first time // - //CachedCopyMap::iterator CCI = CopyCache.find(BBConstTy(Pred, CPV)); - //if (CCI != CopyCache.end()) return CCI->second; + CachedCopyMap::iterator CCI = CopyCache.find(BBConstTy(Pred, CPV)); + if (CCI != CopyCache.end()) return CCI->second; // Create a copy instruction and add it to the cache... CastInst *Inst = new CastInst(CPV, CPV->getType()); - //CopyCache.insert(make_pair(BBConstTy(Pred, CPV), Inst)); + CopyCache.insert(make_pair(BBConstTy(Pred, CPV), Inst)); // Insert the copy just before the terminator inst of the predecessor BB assert(Pred->getTerminator() && "Degenerate BB encountered!"); @@ -68,13 +68,15 @@ bool HoistPHIConstants::doHoistPHIConstants(Method *M) { for (vector<PHINode*>::iterator PI=phis.begin(); PI != phis.end(); ++PI) for (unsigned i = 0; i < (*PI)->getNumIncomingValues(); ++i) { - //if (isa<ConstPoolVal>(Op)) {--- Do for all phi args -- Ruchira + Value *Op = (*PI)->getIncomingValue(i); + + if (isa<ConstPoolVal>(Op)) { (*PI)->setIncomingValue(i, NormalizePhiOperand((*PI), (*PI)->getIncomingValue(i), (*PI)->getIncomingBlock(i), Cache)); Changed = true; - //} + } } } |