Apparently we can't expect a BinaryOperator here.

Should fix llvm-gcc selfhost.

llvm-svn: 134699
This commit is contained in:
Benjamin Kramer 2011-07-08 12:08:24 +00:00
parent d280754094
commit 2bb8b26aa8
1 changed files with 2 additions and 2 deletions

View File

@ -2502,14 +2502,14 @@ void SelectionDAGBuilder::visitShift(const User &I, unsigned Opcode) {
}
void SelectionDAGBuilder::visitSDiv(const User &I) {
const BinaryOperator *BO = cast<BinaryOperator>(&I);
SDValue Op1 = getValue(I.getOperand(0));
SDValue Op2 = getValue(I.getOperand(1));
// Turn exact SDivs into multiplications.
// FIXME: This should be in DAGCombiner, but it doesn't have access to the
// exact bit.
if (BO->isExact() && !isa<ConstantSDNode>(Op1) &&
if (isa<BinaryOperator>(&I) && cast<BinaryOperator>(&I)->isExact() &&
!isa<ConstantSDNode>(Op1) &&
isa<ConstantSDNode>(Op2) && !cast<ConstantSDNode>(Op2)->isNullValue())
setValue(&I, TLI.BuildExactSDIV(Op1, Op2, getCurDebugLoc(), DAG));
else