mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-19 11:41:53 +00:00
visitVBinOp: Can't fold divide by zero!
llvm-svn: 28584
This commit is contained in:
parent
d5b51c6db3
commit
bbc183c90e
@ -2778,6 +2778,14 @@ SDOperand DAGCombiner::visitVBinOp(SDNode *N, ISD::NodeType IntOp,
|
||||
RHSOp.getOpcode() != ISD::Constant &&
|
||||
RHSOp.getOpcode() != ISD::ConstantFP))
|
||||
break;
|
||||
// Can't fold divide by zero.
|
||||
if (N->getOpcode() == ISD::VSDIV || N->getOpcode() == ISD::VUDIV) {
|
||||
if ((RHSOp.getOpcode() == ISD::Constant &&
|
||||
cast<ConstantSDNode>(RHSOp.Val)->isNullValue()) ||
|
||||
(RHSOp.getOpcode() == ISD::ConstantFP &&
|
||||
!cast<ConstantFPSDNode>(RHSOp.Val)->getValue()))
|
||||
break;
|
||||
}
|
||||
Ops.push_back(DAG.getNode(ScalarOp, EltType, LHSOp, RHSOp));
|
||||
AddToWorkList(Ops.back().Val);
|
||||
assert((Ops.back().getOpcode() == ISD::UNDEF ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user