From: Owen Anderson Date: Wed, 26 Aug 2009 22:55:11 +0000 (+0000) Subject: Make this into a static method. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=4eebf0bbfaecb8cee89f38d34c28ae673eab09dd Make this into a static method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80170 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index c782f7da700..a667a98d194 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -730,10 +730,8 @@ namespace { void dump(DenseMap& d); bool iterateOnFunction(Function &F); Value* CollapsePhi(PHINode* p); - bool isSafeReplacement(PHINode* p, Instruction* inst); bool performPRE(Function& F); Value* lookupNumber(BasicBlock* BB, uint32_t num); - bool mergeBlockIntoPredecessor(BasicBlock* BB); Value* AttemptRedundancyElimination(Instruction* orig, unsigned valno); void cleanupGlobalSets(); void verifyRemoved(const Instruction *I) const; @@ -758,6 +756,19 @@ void GVN::dump(DenseMap& d) { printf("}\n"); } +static bool isSafeReplacement(PHINode* p, Instruction* inst) { + if (!isa(inst)) + return true; + + for (Instruction::use_iterator UI = p->use_begin(), E = p->use_end(); + UI != E; ++UI) + if (PHINode* use_phi = dyn_cast(UI)) + if (use_phi->getParent() == inst->getParent()) + return false; + + return true; +} + Value* GVN::CollapsePhi(PHINode* p) { Value* constVal = p->hasConstantValue(); if (!constVal) return 0; @@ -772,19 +783,6 @@ Value* GVN::CollapsePhi(PHINode* p) { return 0; } -bool GVN::isSafeReplacement(PHINode* p, Instruction* inst) { - if (!isa(inst)) - return true; - - for (Instruction::use_iterator UI = p->use_begin(), E = p->use_end(); - UI != E; ++UI) - if (PHINode* use_phi = dyn_cast(UI)) - if (use_phi->getParent() == inst->getParent()) - return false; - - return true; -} - /// GetValueForBlock - Get the value to use within the specified basic block. /// available values are in Phis. Value *GVN::GetValueForBlock(BasicBlock *BB, Instruction* orig,