[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp ScalarReplAggregates.cpp
Reid Spencer
reid at x10sys.com
Fri Feb 2 06:08:36 PST 2007
Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.621 -> 1.622
ScalarReplAggregates.cpp updated: 1.69 -> 1.70
---
Log message:
Use short form of binary operator create functions.
---
Diffs of the changes: (+25 -25)
InstructionCombining.cpp | 46 +++++++++++++++++++++++-----------------------
ScalarReplAggregates.cpp | 4 ++--
2 files changed, 25 insertions(+), 25 deletions(-)
Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.621 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.622
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.621 Thu Feb 1 23:29:55 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri Feb 2 08:08:20 2007
@@ -1200,7 +1200,7 @@
// the shift amount is >= the size of the datatype, which is undefined.
if (DemandedMask == 1) {
// Perform the logical shift right.
- Value *NewVal = BinaryOperator::create(Instruction::LShr,
+ Value *NewVal = BinaryOperator::createLShr(
I->getOperand(0), I->getOperand(1), I->getName());
InsertNewInstBefore(cast<Instruction>(NewVal), *I);
return UpdateValueUsesWith(I, NewVal);
@@ -1232,7 +1232,7 @@
// are demanded, turn this into an unsigned shift right.
if ((KnownZero & SignBit) || (HighBits & ~DemandedMask) == HighBits) {
// Perform the logical shift right.
- Value *NewVal = BinaryOperator::create(Instruction::LShr,
+ Value *NewVal = BinaryOperator::createLShr(
I->getOperand(0), SA, I->getName());
InsertNewInstBefore(cast<Instruction>(NewVal), *I);
return UpdateValueUsesWith(I, NewVal);
@@ -1549,7 +1549,7 @@
AddRHS(Value *rhs) : RHS(rhs) {}
bool shouldApply(Value *LHS) const { return LHS == RHS; }
Instruction *apply(BinaryOperator &Add) const {
- return BinaryOperator::create(Instruction::Shl, Add.getOperand(0),
+ return BinaryOperator::createShl(Add.getOperand(0),
ConstantInt::get(Add.getType(), 1));
}
};
@@ -1973,7 +1973,7 @@
if (CU->getZExtValue() ==
SI->getType()->getPrimitiveSizeInBits()-1) {
// Ok, the transformation is safe. Insert LShr.
- return BinaryOperator::create(Instruction::LShr,
+ return BinaryOperator::createLShr(
SI->getOperand(0), CU, SI->getName());
}
}
@@ -2126,7 +2126,7 @@
int64_t Val = (int64_t)cast<ConstantInt>(CI)->getZExtValue();
if (isPowerOf2_64(Val)) { // Replace X*(2^C) with X << C
uint64_t C = Log2_64(Val);
- return BinaryOperator::create(Instruction::Shl, Op0,
+ return BinaryOperator::createShl(Op0,
ConstantInt::get(Op0->getType(), C));
}
} else if (ConstantFP *Op1F = dyn_cast<ConstantFP>(Op1)) {
@@ -2322,7 +2322,7 @@
if (uint64_t Val = C->getZExtValue()) // Don't break X / 0
if (isPowerOf2_64(Val)) {
uint64_t ShiftAmt = Log2_64(Val);
- return BinaryOperator::create(Instruction::LShr, Op0,
+ return BinaryOperator::createLShr(Op0,
ConstantInt::get(Op0->getType(), ShiftAmt));
}
}
@@ -2339,7 +2339,7 @@
Constant *C2V = ConstantInt::get(NTy, C2);
N = InsertNewInstBefore(BinaryOperator::createAdd(N, C2V, "tmp"), I);
}
- return BinaryOperator::create(Instruction::LShr, Op0, N);
+ return BinaryOperator::createLShr(Op0, N);
}
}
}
@@ -2356,13 +2356,13 @@
unsigned TSA = Log2_64(TVA), FSA = Log2_64(FVA);
// Construct the "on true" case of the select
Constant *TC = ConstantInt::get(Op0->getType(), TSA);
- Instruction *TSI = BinaryOperator::create(Instruction::LShr,
+ Instruction *TSI = BinaryOperator::createLShr(
Op0, TC, SI->getName()+".t");
TSI = InsertNewInstBefore(TSI, I);
// Construct the "on false" case of the select
Constant *FC = ConstantInt::get(Op0->getType(), FSA);
- Instruction *FSI = BinaryOperator::create(Instruction::LShr,
+ Instruction *FSI = BinaryOperator::createLShr(
Op0, FC, SI->getName()+".f");
FSI = InsertNewInstBefore(FSI, I);
@@ -2916,7 +2916,7 @@
// Make the argument unsigned.
Value *ShVal = Op->getOperand(0);
ShVal = InsertNewInstBefore(
- BinaryOperator::create(Instruction::LShr, ShVal, OpRHS,
+ BinaryOperator::createLShr(ShVal, OpRHS,
Op->getName()), TheAnd);
return BinaryOperator::createAnd(ShVal, AndRHS, TheAnd.getName());
}
@@ -4681,11 +4681,11 @@
// Compute C << Y.
Value *NS;
if (Shift->getOpcode() == Instruction::LShr) {
- NS = BinaryOperator::create(Instruction::Shl, AndCST,
+ NS = BinaryOperator::createShl(AndCST,
Shift->getOperand(1), "tmp");
} else {
// Insert a logical shift.
- NS = BinaryOperator::create(Instruction::LShr, AndCST,
+ NS = BinaryOperator::createLShr(AndCST,
Shift->getOperand(1), "tmp");
}
InsertNewInstBefore(cast<Instruction>(NS), I);
@@ -5426,7 +5426,7 @@
if (I.isArithmeticShift()) {
if (MaskedValueIsZero(Op0,
1ULL << (I.getType()->getPrimitiveSizeInBits()-1))) {
- return BinaryOperator::create(Instruction::LShr, Op0, Op1, I.getName());
+ return BinaryOperator::createLShr(Op0, Op1, I.getName());
}
}
@@ -5493,7 +5493,7 @@
if (isLeftShift && Op0BO->getOperand(1)->hasOneUse() &&
match(Op0BO->getOperand(1),
m_Shr(m_Value(V1), m_ConstantInt(CC))) && CC == Op1) {
- Instruction *YS = BinaryOperator::create(Instruction::Shl,
+ Instruction *YS = BinaryOperator::createShl(
Op0BO->getOperand(0), Op1,
Op0BO->getName());
InsertNewInstBefore(YS, I); // (Y << C)
@@ -5511,7 +5511,7 @@
match(Op0BO->getOperand(1), m_And(m_Shr(m_Value(V1), m_Value(V2)),
m_ConstantInt(CC))) && V2 == Op1 &&
cast<BinaryOperator>(Op0BO->getOperand(1))->getOperand(0)->hasOneUse()) {
- Instruction *YS = BinaryOperator::create(Instruction::Shl,
+ Instruction *YS = BinaryOperator::createShl(
Op0BO->getOperand(0), Op1,
Op0BO->getName());
InsertNewInstBefore(YS, I); // (Y << C)
@@ -5529,7 +5529,7 @@
if (isLeftShift && Op0BO->getOperand(0)->hasOneUse() &&
match(Op0BO->getOperand(0),
m_Shr(m_Value(V1), m_ConstantInt(CC))) && CC == Op1) {
- Instruction *YS = BinaryOperator::create(Instruction::Shl,
+ Instruction *YS = BinaryOperator::createShl(
Op0BO->getOperand(1), Op1,
Op0BO->getName());
InsertNewInstBefore(YS, I); // (Y << C)
@@ -5549,7 +5549,7 @@
m_ConstantInt(CC))) && V2 == Op1 &&
cast<BinaryOperator>(Op0BO->getOperand(0))
->getOperand(0)->hasOneUse()) {
- Instruction *YS = BinaryOperator::create(Instruction::Shl,
+ Instruction *YS = BinaryOperator::createShl(
Op0BO->getOperand(1), Op1,
Op0BO->getName());
InsertNewInstBefore(YS, I); // (Y << C)
@@ -5684,7 +5684,7 @@
ShiftAmt2-ShiftAmt1));
} else if (isShiftOfUnsignedShift || isShiftOfLeftShift) {
if (isShiftOfUnsignedShift && !isShiftOfLeftShift && isSignedShift) {
- return BinaryOperator::create(Instruction::LShr, Mask,
+ return BinaryOperator::createLShr(Mask,
ConstantInt::get(Mask->getType(),
ShiftAmt1-ShiftAmt2));
} else {
@@ -6191,7 +6191,7 @@
Instruction::BitCast : Instruction::Trunc);
Value *Op0c = InsertOperandCastBefore(opcode, Op0, DestTy, SrcI);
Value *Op1c = InsertOperandCastBefore(opcode, Op1, DestTy, SrcI);
- return BinaryOperator::create(Instruction::Shl, Op0c, Op1c);
+ return BinaryOperator::createShl(Op0c, Op1c);
}
break;
case Instruction::AShr:
@@ -6203,7 +6203,7 @@
unsigned ShiftAmt = cast<ConstantInt>(Op1)->getZExtValue();
if (SrcBitSize > ShiftAmt && SrcBitSize-ShiftAmt >= DestBitSize) {
// Insert the new logical shift right.
- return BinaryOperator::create(Instruction::LShr, Op0, Op1);
+ return BinaryOperator::createLShr(Op0, Op1);
}
}
break;
@@ -6249,7 +6249,7 @@
// Perform a logical shr by shiftamt.
// Insert the shift to put the result in the low bit.
In = InsertNewInstBefore(
- BinaryOperator::create(Instruction::LShr, In,
+ BinaryOperator::createLShr(In,
ConstantInt::get(In->getType(), ShiftAmt),
In->getName()+".lobit"), CI);
}
@@ -6301,7 +6301,7 @@
Value *V1 = InsertCastBefore(Instruction::Trunc, SrcIOp0, Ty, CI);
Value *V2 = InsertCastBefore(Instruction::Trunc, SrcI->getOperand(1),
Ty, CI);
- return BinaryOperator::create(Instruction::LShr, V1, V2);
+ return BinaryOperator::createLShr(V1, V2);
}
} else { // This is a variable shr.
@@ -6312,7 +6312,7 @@
Value *One = ConstantInt::get(SrcI->getType(), 1);
Value *V = InsertNewInstBefore(
- BinaryOperator::create(Instruction::Shl, One, SrcI->getOperand(1),
+ BinaryOperator::createShl(One, SrcI->getOperand(1),
"tmp"), CI);
V = InsertNewInstBefore(BinaryOperator::createAnd(V,
SrcI->getOperand(0),
Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.69 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.70
--- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.69 Thu Feb 1 20:16:22 2007
+++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Fri Feb 2 08:08:20 2007
@@ -655,7 +655,7 @@
} else {
assert(NV->getType()->isInteger() && "Unknown promotion!");
if (Offset && Offset < TD.getTypeSize(NV->getType())*8) {
- NV = BinaryOperator::create(Instruction::LShr, NV,
+ NV = BinaryOperator::createLShr(NV,
ConstantInt::get(NV->getType(), Offset),
LI->getName(), LI);
}
@@ -740,7 +740,7 @@
SV = CastInst::createZExtOrBitCast(SV, AllocaType,
SV->getName(), SI);
if (Offset && Offset < AllocaType->getPrimitiveSizeInBits())
- SV = BinaryOperator::create(Instruction::Shl, SV,
+ SV = BinaryOperator::createShl(SV,
ConstantInt::get(SV->getType(), Offset),
SV->getName()+".adj", SI);
// Mask out the bits we are about to insert from the old value.
More information about the llvm-commits
mailing list