diff options
author | Zhou Sheng <zhousheng00@gmail.com> | 2007-03-30 05:45:18 +0000 |
---|---|---|
committer | Zhou Sheng <zhousheng00@gmail.com> | 2007-03-30 05:45:18 +0000 |
commit | 90b9681886bb6dcaa2335b5874194a1820967c88 (patch) | |
tree | f4da7e88b372f6c450316bd609e16283ed69f9ef /lib | |
parent | 0642f75836960afd547a6b98fad33026d0c355be (diff) | |
download | external_llvm-90b9681886bb6dcaa2335b5874194a1820967c88.zip external_llvm-90b9681886bb6dcaa2335b5874194a1820967c88.tar.gz external_llvm-90b9681886bb6dcaa2335b5874194a1820967c88.tar.bz2 |
Use APInt operation instead of ConstantExpr::getXX.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35503 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 94f4cf2..82b3f8c 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -5658,9 +5658,9 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, BinaryOperator::create(Op0BO->getOpcode(), YS, V1, Op0BO->getOperand(1)->getName()); InsertNewInstBefore(X, I); // (X + (Y << C)) - Constant *C2 = ConstantInt::getAllOnesValue(X->getType()); - C2 = ConstantExpr::getShl(C2, Op1); - return BinaryOperator::createAnd(X, C2); + uint32_t Op1Val = Op1->getZExtValue(); + return BinaryOperator::createAnd(X, ConstantInt::get( + APInt::getHighBitsSet(TypeBits, TypeBits-Op1Val))); } // Turn (Y + ((X >> C) & CC)) << C -> ((X & (CC << C)) + (Y << C)) @@ -5697,9 +5697,9 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, BinaryOperator::create(Op0BO->getOpcode(), V1, YS, Op0BO->getOperand(0)->getName()); InsertNewInstBefore(X, I); // (X + (Y << C)) - Constant *C2 = ConstantInt::getAllOnesValue(X->getType()); - C2 = ConstantExpr::getShl(C2, Op1); - return BinaryOperator::createAnd(X, C2); + uint32_t Op1Val = Op1->getZExtValue(); + return BinaryOperator::createAnd(X, ConstantInt::get( + APInt::getHighBitsSet(TypeBits, TypeBits-Op1Val))); } // Turn (((X >> C)&CC) + Y) << C -> (X + (Y << C)) & (CC << C) |