diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-01-10 20:30:41 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-01-10 20:30:41 +0000 |
| commit | 9da953d116939a89af1bb5b8326698e254e9bdc8 (patch) | |
| tree | c0cfca19ce99f6a0da2bf503dc96f5bab86d61ef /lib/Transforms/InstCombine/InstCombineCasts.cpp | |
| parent | 5d67b41f94fbb31ee8ddfbc4c4b277284ebd112f (diff) | |
| download | external_llvm-9da953d116939a89af1bb5b8326698e254e9bdc8.zip external_llvm-9da953d116939a89af1bb5b8326698e254e9bdc8.tar.gz external_llvm-9da953d116939a89af1bb5b8326698e254e9bdc8.tar.bz2 | |
teach sext optimization to handle truncs from types that are not
the dest of the sext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93128 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineCasts.cpp')
| -rw-r--r-- | lib/Transforms/InstCombine/InstCombineCasts.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCasts.cpp b/lib/Transforms/InstCombine/InstCombineCasts.cpp index e2e74c1..49b2e22 100644 --- a/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -799,6 +799,10 @@ static bool CanEvaluateSExtd(Value *V, const Type *Ty, TargetData *TD) { if (!I->hasOneUse()) return false; switch (I->getOpcode()) { + case Instruction::SExt: // sext(sext(x)) -> sext(x) + case Instruction::ZExt: // sext(zext(x)) -> zext(x) + case Instruction::Trunc: // sext(trunc(x)) -> trunc(x) or sext(x) + return true; case Instruction::And: case Instruction::Or: case Instruction::Xor: @@ -813,9 +817,6 @@ static bool CanEvaluateSExtd(Value *V, const Type *Ty, TargetData *TD) { //case Instruction::LShr: TODO //case Instruction::Trunc: TODO - case Instruction::SExt: // sext(sext(x)) -> sext(x) - case Instruction::ZExt: // sext(zext(x)) -> zext(x) - return true; case Instruction::Select: return CanEvaluateSExtd(I->getOperand(1), Ty, TD) && CanEvaluateSExtd(I->getOperand(2), Ty, TD); |
