aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-10 01:00:46 +0000
committerChris Lattner <sabre@nondot.org>2010-01-10 01:00:46 +0000
commitd84dfa43f25c4f4b84e51fc1060353a738a9812e (patch)
tree44a455084d85d1618dba5ccaa2577c9aee7aa653 /lib/Transforms
parent75215c9e39e72ca9ffda0078b92286d03f1f5a3f (diff)
downloadexternal_llvm-d84dfa43f25c4f4b84e51fc1060353a738a9812e.zip
external_llvm-d84dfa43f25c4f4b84e51fc1060353a738a9812e.tar.gz
external_llvm-d84dfa43f25c4f4b84e51fc1060353a738a9812e.tar.bz2
inline and remove the rest of commonIntCastTransforms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93091 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/InstCombine/InstCombine.h1
-rw-r--r--lib/Transforms/InstCombine/InstCombineCasts.cpp35
2 files changed, 18 insertions, 18 deletions
diff --git a/lib/Transforms/InstCombine/InstCombine.h b/lib/Transforms/InstCombine/InstCombine.h
index 136bb88..5367900 100644
--- a/lib/Transforms/InstCombine/InstCombine.h
+++ b/lib/Transforms/InstCombine/InstCombine.h
@@ -150,7 +150,6 @@ public:
Instruction *FoldShiftByConstant(Value *Op0, ConstantInt *Op1,
BinaryOperator &I);
Instruction *commonCastTransforms(CastInst &CI);
- Instruction *commonIntCastTransforms(CastInst &CI);
Instruction *commonPointerCastTransforms(CastInst &CI);
Instruction *visitTrunc(TruncInst &CI);
Instruction *visitZExt(ZExtInst &CI);
diff --git a/lib/Transforms/InstCombine/InstCombineCasts.cpp b/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 3b4821d..4bea64d 100644
--- a/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -302,19 +302,6 @@ Instruction *InstCombiner::commonCastTransforms(CastInst &CI) {
return 0;
}
-/// commonIntCastTransforms - This function implements the common transforms
-/// for trunc, zext, and sext.
-Instruction *InstCombiner::commonIntCastTransforms(CastInst &CI) {
- if (Instruction *Result = commonCastTransforms(CI))
- return Result;
-
- // See if we can simplify any instructions used by the LHS whose sole
- // purpose is to compute bits we don't care about.
- if (SimplifyDemandedInstructionBits(CI))
- return &CI;
- return 0;
-}
-
/// CanEvaluateTruncated - Return true if we can evaluate the specified
/// expression tree as type Ty instead of its larger type, and arrive with the
/// same value. This is used by code that tries to eliminate truncates.
@@ -420,9 +407,14 @@ static bool CanEvaluateTruncated(Value *V, const Type *Ty) {
}
Instruction *InstCombiner::visitTrunc(TruncInst &CI) {
- if (Instruction *Result = commonIntCastTransforms(CI))
+ if (Instruction *Result = commonCastTransforms(CI))
return Result;
+ // See if we can simplify any instructions used by the input whose sole
+ // purpose is to compute bits we don't care about.
+ if (SimplifyDemandedInstructionBits(CI))
+ return &CI;
+
Value *Src = CI.getOperand(0);
const Type *DestTy = CI.getType(), *SrcTy = Src->getType();
@@ -690,11 +682,15 @@ static int CanEvaluateZExtd(Value *V, const Type *Ty,unsigned &NumCastsRemoved,
Instruction *InstCombiner::visitZExt(ZExtInst &CI) {
// If one of the common conversion will work, do it.
- if (Instruction *Result = commonIntCastTransforms(CI))
+ if (Instruction *Result = commonCastTransforms(CI))
return Result;
- Value *Src = CI.getOperand(0);
+ // See if we can simplify any instructions used by the input whose sole
+ // purpose is to compute bits we don't care about.
+ if (SimplifyDemandedInstructionBits(CI))
+ return &CI;
+ Value *Src = CI.getOperand(0);
const Type *SrcTy = Src->getType(), *DestTy = CI.getType();
// Attempt to extend the entire input expression tree to the destination
@@ -941,9 +937,14 @@ static unsigned CanEvaluateSExtd(Value *V, const Type *Ty,
}
Instruction *InstCombiner::visitSExt(SExtInst &CI) {
- if (Instruction *I = commonIntCastTransforms(CI))
+ if (Instruction *I = commonCastTransforms(CI))
return I;
+ // See if we can simplify any instructions used by the input whose sole
+ // purpose is to compute bits we don't care about.
+ if (SimplifyDemandedInstructionBits(CI))
+ return &CI;
+
Value *Src = CI.getOperand(0);
const Type *SrcTy = Src->getType(), *DestTy = CI.getType();