aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorRuchira Sasanka <sasanka@students.uiuc.edu>2001-11-03 17:09:59 +0000
committerRuchira Sasanka <sasanka@students.uiuc.edu>2001-11-03 17:09:59 +0000
commitfca59d7dc909a54a9e49601aa81252f6b935db01 (patch)
tree49cfec72d8a00ebe3560e0e38858785af1ae7e48 /lib/Transforms
parent0f279b245dc5f84a6b7c89900fd0d48e324452e7 (diff)
downloadexternal_llvm-fca59d7dc909a54a9e49601aa81252f6b935db01.zip
external_llvm-fca59d7dc909a54a9e49601aa81252f6b935db01.tar.gz
external_llvm-fca59d7dc909a54a9e49601aa81252f6b935db01.tar.bz2
Commented out code so that copies are inserted for all phi args
CahedCopyMap was disabled to insert phi elimination code for all phi args git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1105 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/HoistPHIConstants.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/lib/Transforms/HoistPHIConstants.cpp b/lib/Transforms/HoistPHIConstants.cpp
index a47ab26..b8e1d7b 100644
--- a/lib/Transforms/HoistPHIConstants.cpp
+++ b/lib/Transforms/HoistPHIConstants.cpp
@@ -6,6 +6,9 @@
//
//===----------------------------------------------------------------------===//
+
+
+
#include "llvm/Transforms/HoistPHIConstants.h"
#include "llvm/iOther.h"
#include "llvm/BasicBlock.h"
@@ -18,15 +21,20 @@ typedef map<BBConstTy, CastInst *> CachedCopyMap;
static Value *NormalizePhiOperand(PHINode *PN, Value *CPV,
BasicBlock *Pred, CachedCopyMap &CopyCache) {
+ /* NOTE: CahedCopyMap was disabled to insert phi elimination code
+ for all phi args -- Ruchira
+ */
+
+
// 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!");
@@ -52,11 +60,14 @@ bool HoistPHIConstants::doHoistPHIConstants(Method *M) {
PHINode *PN = cast<PHINode>(Inst);
for (unsigned i = 0; i < PN->getNumIncomingValues(); ++i) {
Value *Op = PN->getIncomingValue(i);
- if (isa<ConstPoolVal>(Op)) {
- PN->setIncomingValue(i,
- NormalizePhiOperand(PN, Op, PN->getIncomingBlock(i), Cache));
- Changed = true;
- }
+
+ //if (isa<ConstPoolVal>(Op)) { --- Do for all phi args -- Ruchira
+
+ PN->setIncomingValue(i,
+ NormalizePhiOperand(PN, Op, PN->getIncomingBlock(i), Cache));
+ Changed = true;
+
+ //}
}
}