mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-04-08 18:52:23 +00:00
Don't use ConstantExpr::getShift anymore
llvm-svn: 10791
This commit is contained in:
parent
52759f5c5e
commit
758109ce2e
@ -1218,7 +1218,7 @@ ConstExpr: CAST '(' ConstVal TO Types ')' {
|
|||||||
ThrowException("Shift count for shift constant must be unsigned byte!");
|
ThrowException("Shift count for shift constant must be unsigned byte!");
|
||||||
if (!$3->getType()->isInteger())
|
if (!$3->getType()->isInteger())
|
||||||
ThrowException("Shift constant expression requires integer operand!");
|
ThrowException("Shift constant expression requires integer operand!");
|
||||||
$$ = ConstantExpr::getShift($1, $3, $5);
|
$$ = ConstantExpr::get($1, $3, $5);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -182,8 +182,6 @@ Constant *BytecodeParser::parseConstantValue(const unsigned char *&Buf,
|
|||||||
} else if (Opcode == Instruction::GetElementPtr) { // GetElementPtr
|
} else if (Opcode == Instruction::GetElementPtr) { // GetElementPtr
|
||||||
std::vector<Constant*> IdxList(ArgVec.begin()+1, ArgVec.end());
|
std::vector<Constant*> IdxList(ArgVec.begin()+1, ArgVec.end());
|
||||||
return ConstantExpr::getGetElementPtr(ArgVec[0], IdxList);
|
return ConstantExpr::getGetElementPtr(ArgVec[0], IdxList);
|
||||||
} else if (Opcode == Instruction::Shl || Opcode == Instruction::Shr) {
|
|
||||||
return ConstantExpr::getShift(Opcode, ArgVec[0], ArgVec[1]);
|
|
||||||
} else { // All other 2-operand expressions
|
} else { // All other 2-operand expressions
|
||||||
return ConstantExpr::get(Opcode, ArgVec[0], ArgVec[1]);
|
return ConstantExpr::get(Opcode, ArgVec[0], ArgVec[1]);
|
||||||
}
|
}
|
||||||
|
@ -596,19 +596,11 @@ void SCCP::visitBinaryOperator(Instruction &I) {
|
|||||||
Result.markOverdefined();
|
Result.markOverdefined();
|
||||||
break; // Cannot fold this operation over the PHI nodes!
|
break; // Cannot fold this operation over the PHI nodes!
|
||||||
} else if (In1.isConstant() && In2.isConstant()) {
|
} else if (In1.isConstant() && In2.isConstant()) {
|
||||||
Constant *Val = 0;
|
Constant *V = ConstantExpr::get(I.getOpcode(), In1.getConstant(),
|
||||||
if (isa<BinaryOperator>(I))
|
|
||||||
Val = ConstantExpr::get(I.getOpcode(), In1.getConstant(),
|
|
||||||
In2.getConstant());
|
In2.getConstant());
|
||||||
else {
|
|
||||||
assert(isa<ShiftInst>(I) &&
|
|
||||||
"Can only handle binops and shifts here!");
|
|
||||||
Val = ConstantExpr::getShift(I.getOpcode(), In1.getConstant(),
|
|
||||||
In2.getConstant());
|
|
||||||
}
|
|
||||||
if (Result.isUndefined())
|
if (Result.isUndefined())
|
||||||
Result.markConstant(Val);
|
Result.markConstant(V);
|
||||||
else if (Result.isConstant() && Result.getConstant() != Val) {
|
else if (Result.isConstant() && Result.getConstant() != V) {
|
||||||
Result.markOverdefined();
|
Result.markOverdefined();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -652,17 +644,8 @@ void SCCP::visitBinaryOperator(Instruction &I) {
|
|||||||
|
|
||||||
markOverdefined(IV, &I);
|
markOverdefined(IV, &I);
|
||||||
} else if (V1State.isConstant() && V2State.isConstant()) {
|
} else if (V1State.isConstant() && V2State.isConstant()) {
|
||||||
Constant *Result = 0;
|
markConstant(IV, &I, ConstantExpr::get(I.getOpcode(), V1State.getConstant(),
|
||||||
if (isa<BinaryOperator>(I))
|
V2State.getConstant()));
|
||||||
Result = ConstantExpr::get(I.getOpcode(), V1State.getConstant(),
|
|
||||||
V2State.getConstant());
|
|
||||||
else {
|
|
||||||
assert (isa<ShiftInst>(I) && "Can only handle binops and shifts here!");
|
|
||||||
Result = ConstantExpr::getShift(I.getOpcode(), V1State.getConstant(),
|
|
||||||
V2State.getConstant());
|
|
||||||
}
|
|
||||||
|
|
||||||
markConstant(IV, &I, Result); // This instruction constant folds!
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user