From 2bb8b26aa836aea1f87ef5469aed325c7f202d37 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Fri, 8 Jul 2011 12:08:24 +0000 Subject: Apparently we can't expect a BinaryOperator here. Should fix llvm-gcc selfhost. llvm-svn: 134699 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp') diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 2a362eb..2afec33 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -2502,14 +2502,14 @@ void SelectionDAGBuilder::visitShift(const User &I, unsigned Opcode) { } void SelectionDAGBuilder::visitSDiv(const User &I) { - const BinaryOperator *BO = cast(&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(Op1) && + if (isa(&I) && cast(&I)->isExact() && + !isa(Op1) && isa(Op2) && !cast(Op2)->isNullValue()) setValue(&I, TLI.BuildExactSDIV(Op1, Op2, getCurDebugLoc(), DAG)); else -- cgit v1.1