diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-08-27 20:32:06 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-08-27 20:32:06 +0000 |
| commit | 739843467598e7ca95e9d0be12b538ace682a00a (patch) | |
| tree | f093cbe37fce1c2c07a8bdfdc4e8f16b94dd5cea /llvm/lib/Transforms | |
| parent | 167fd1084bcb59dc26d3d3e9b993723800c478b9 (diff) | |
| download | bcm5719-llvm-739843467598e7ca95e9d0be12b538ace682a00a.tar.gz bcm5719-llvm-739843467598e7ca95e9d0be12b538ace682a00a.zip | |
teach the truncation optimization that an entire chain of
computation can be truncated if it is fed by a sext/zext that doesn't
have to be exactly equal to the truncation result type.
llvm-svn: 112285
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp index 1372a1891fa..89719bef09e 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -396,6 +396,11 @@ static bool CanEvaluateTruncated(Value *V, const Type *Ty) { case Instruction::Trunc: // trunc(trunc(x)) -> trunc(x) return true; + case Instruction::ZExt: + case Instruction::SExt: + // trunc(ext(x)) -> ext(x) if the source type is smaller than the new dest + // trunc(ext(x)) -> trunc(x) if the source type is larger than the new dest + return true; case Instruction::Select: { SelectInst *SI = cast<SelectInst>(I); return CanEvaluateTruncated(SI->getTrueValue(), Ty) && |

