summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-06-28 17:34:50 +0000
committerChris Lattner <sabre@nondot.org>2006-06-28 17:34:50 +0000
commit3fda386965509c213031f59fa10f8182c66d09f2 (patch)
tree39861f2b4e2175da298ff0a2950a716f09862b3e /llvm/lib/Transforms/Scalar/InstructionCombining.cpp
parent4c6f86816ebad6c7ae93067b8ddcc48144298381 (diff)
downloadbcm5719-llvm-3fda386965509c213031f59fa10f8182c66d09f2.tar.gz
bcm5719-llvm-3fda386965509c213031f59fa10f8182c66d09f2.zip
Fix Transforms/InstCombine/2006-06-28-infloop.ll
llvm-svn: 28961
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 63cd256dc57..797b2b8db2e 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -4934,6 +4934,12 @@ static bool CanEvaluateInDifferentType(Value *V, const Type *Ty,
// If this is a cast from the destination type, we can trivially eliminate
// it, and this will remove a cast overall.
if (I->getOperand(0)->getType() == Ty) {
+ // If the first operand is itself a cast, and is eliminable, do not count
+ // this as an eliminable cast. We would prefer to eliminate those two
+ // casts first.
+ if (CastInst *OpCast = dyn_cast<CastInst>(I->getOperand(0)))
+ return true;
+
++NumCastsRemoved;
return true;
}
OpenPOWER on IntegriCloud