diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-10 07:08:30 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-10 07:08:30 +0000 |
commit | d8509424a404906a39e6ba7ba17eb58e22ff191d (patch) | |
tree | 4360ff5f9e8c2479bdf3f8b2fb97cbc17a30b197 /llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp | |
parent | 2b459fe7e1e3501063889ce7245a6ada56e104e6 (diff) | |
download | bcm5719-llvm-d8509424a404906a39e6ba7ba17eb58e22ff191d.tar.gz bcm5719-llvm-d8509424a404906a39e6ba7ba17eb58e22ff191d.zip |
change the preferred canonical form for a sign extension to be
lshr+ashr instead of trunc+sext. We want to avoid type
conversions whenever possible, it is easier to codegen expressions
without truncates and extensions.
llvm-svn: 93107
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp index a2d528b5f4e..fe91da1b6af 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp @@ -325,26 +325,6 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, return BinaryOperator::CreateAnd(X, ConstantInt::get(I.getContext(), Mask)); } - // We can simplify ((X << C) >>s C) into a trunc + sext. - // NOTE: we could do this for any C, but that would make 'unusual' integer - // types. For now, just stick to ones well-supported by the code - // generators. - const Type *SExtType = 0; - switch (Ty->getBitWidth() - ShiftAmt1) { - case 1 : - case 8 : - case 16 : - case 32 : - case 64 : - case 128: - SExtType = IntegerType::get(I.getContext(), - Ty->getBitWidth() - ShiftAmt1); - break; - default: break; - } - if (SExtType) - return new SExtInst(Builder->CreateTrunc(X, SExtType, "sext"), Ty); - // Otherwise, we can't handle it yet. } else if (ShiftAmt1 < ShiftAmt2) { uint32_t ShiftDiff = ShiftAmt2-ShiftAmt1; |