[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Evan Cheng
evan.cheng at apple.com
Tue May 30 23:08:47 PDT 2006
Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.171 -> 1.172
---
Log message:
visitVBinOp: Can't fold divide by zero!
---
Diffs of the changes: (+8 -0)
DAGCombiner.cpp | 8 ++++++++
1 files changed, 8 insertions(+)
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.171 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.172
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.171 Fri May 26 19:43:02 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed May 31 01:08:35 2006
@@ -2778,6 +2778,14 @@
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 ||
More information about the llvm-commits
mailing list