summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-05 22:30:42 +0000
committerChris Lattner <sabre@nondot.org>2010-01-05 22:30:42 +0000
commit554d0564ff6e777add62638069b92a89aeda4dd6 (patch)
tree841a163c1575f1848d73b2c6264888e3b9d0bea4 /llvm/lib/Transforms
parent404a984780a9aa253fc52e9d3dd36705a6077838 (diff)
downloadbcm5719-llvm-554d0564ff6e777add62638069b92a89aeda4dd6.tar.gz
bcm5719-llvm-554d0564ff6e777add62638069b92a89aeda4dd6.zip
make this a static function instead of a method.
llvm-svn: 92795
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombine.h2
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp9
2 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombine.h b/llvm/lib/Transforms/InstCombine/InstCombine.h
index e6ad1c73c25..136bb885e51 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombine.h
+++ b/llvm/lib/Transforms/InstCombine/InstCombine.h
@@ -338,8 +338,6 @@ private:
Value *EvaluateInDifferentType(Value *V, const Type *Ty, bool isSigned);
- bool CanEvaluateInDifferentType(Value *V, const Type *Ty,
- unsigned CastOpc, int &NumCastsRemoved);
unsigned GetOrEnforceKnownAlignment(Value *V,
unsigned PrefAlign = 0);
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 52c36ddd3fe..c5ddec8b751 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -165,9 +165,8 @@ Instruction *InstCombiner::PromoteCastOfAllocation(BitCastInst &CI,
/// If CastOpc is a sext or zext, we are asking if the low bits of the value can
/// bit computed in a larger type, which is then and'd or sext_in_reg'd to get
/// the final result.
-bool InstCombiner::CanEvaluateInDifferentType(Value *V, const Type *Ty,
- unsigned CastOpc,
- int &NumCastsRemoved){
+static bool CanEvaluateInDifferentType(Value *V, const Type *Ty,
+ unsigned CastOpc, int &NumCastsRemoved) {
// We can always evaluate constants in another type.
if (isa<Constant>(V))
return true;
@@ -274,7 +273,9 @@ bool InstCombiner::CanEvaluateInDifferentType(Value *V, const Type *Ty,
NumCastsRemoved);
}
case Instruction::PHI: {
- // We can change a phi if we can change all operands.
+ // We can change a phi if we can change all operands. Note that we never
+ // get into trouble with cyclic PHIs here because we only consider
+ // instructions with a single use.
PHINode *PN = cast<PHINode>(I);
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
if (!CanEvaluateInDifferentType(PN->getIncomingValue(i), Ty, CastOpc,
OpenPOWER on IntegriCloud