mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
InstCombine: Hoist 3 copies of AddOne/SubOne into a header.
llvm-svn: 199605
This commit is contained in:
parent
47d4c4c113
commit
319cbf6707
@ -51,6 +51,15 @@ static inline unsigned getComplexity(Value *V) {
|
||||
return isa<Constant>(V) ? (isa<UndefValue>(V) ? 0 : 1) : 2;
|
||||
}
|
||||
|
||||
/// AddOne - Add one to a Constant
|
||||
static inline Constant *AddOne(Constant *C) {
|
||||
return ConstantExpr::getAdd(C, ConstantInt::get(C->getType(), 1));
|
||||
}
|
||||
/// SubOne - Subtract one from a Constant
|
||||
static inline Constant *SubOne(Constant *C) {
|
||||
return ConstantExpr::getSub(C, ConstantInt::get(C->getType(), 1));
|
||||
}
|
||||
|
||||
|
||||
/// InstCombineIRInserter - This is an IRBuilder insertion helper that works
|
||||
/// just like the normal insertion helper, but also adds any new instructions
|
||||
|
@ -845,17 +845,6 @@ Value *FAddCombine::createAddendVal
|
||||
return createFMul(OpndVal, Coeff.getValue(Instr->getType()));
|
||||
}
|
||||
|
||||
/// AddOne - Add one to a ConstantInt.
|
||||
static Constant *AddOne(Constant *C) {
|
||||
return ConstantExpr::getAdd(C, ConstantInt::get(C->getType(), 1));
|
||||
}
|
||||
|
||||
/// SubOne - Subtract one from a ConstantInt.
|
||||
static Constant *SubOne(Constant *C) {
|
||||
return ConstantExpr::getAdd(C, ConstantInt::getAllOnesValue(C->getType()));
|
||||
}
|
||||
|
||||
|
||||
// dyn_castFoldableMul - If this value is a multiply that can be folded into
|
||||
// other computations (because it has a constant operand), return the
|
||||
// non-constant operand of the multiply, and set CST to point to the multiplier.
|
||||
|
@ -20,16 +20,6 @@
|
||||
using namespace llvm;
|
||||
using namespace PatternMatch;
|
||||
|
||||
|
||||
/// AddOne - Add one to a ConstantInt.
|
||||
static Constant *AddOne(ConstantInt *C) {
|
||||
return ConstantInt::get(C->getContext(), C->getValue() + 1);
|
||||
}
|
||||
/// SubOne - Subtract one from a ConstantInt.
|
||||
static Constant *SubOne(ConstantInt *C) {
|
||||
return ConstantInt::get(C->getContext(), C->getValue()-1);
|
||||
}
|
||||
|
||||
/// isFreeToInvert - Return true if the specified value is free to invert (apply
|
||||
/// ~ to). This happens in cases where the ~ can be eliminated.
|
||||
static inline bool isFreeToInvert(Value *V) {
|
||||
|
@ -28,15 +28,6 @@ static ConstantInt *getOne(Constant *C) {
|
||||
return ConstantInt::get(cast<IntegerType>(C->getType()), 1);
|
||||
}
|
||||
|
||||
/// AddOne - Add one to a ConstantInt
|
||||
static Constant *AddOne(Constant *C) {
|
||||
return ConstantExpr::getAdd(C, ConstantInt::get(C->getType(), 1));
|
||||
}
|
||||
/// SubOne - Subtract one from a ConstantInt
|
||||
static Constant *SubOne(Constant *C) {
|
||||
return ConstantExpr::getSub(C, ConstantInt::get(C->getType(), 1));
|
||||
}
|
||||
|
||||
static ConstantInt *ExtractElement(Constant *V, Constant *Idx) {
|
||||
return cast<ConstantInt>(ConstantExpr::getExtractElement(V, Idx));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user