aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-12-19 22:21:21 +0000
committerChris Lattner <sabre@nondot.org>2005-12-19 22:21:21 +0000
commit9f8cc69009468a5096e32e897060ee0b5b9dddd8 (patch)
treea8312b1f1446ea0492148a3d68b6e90e5506c62a
parent241116fbadd027ca34fdf567420edbcaac55405c (diff)
downloadexternal_llvm-9f8cc69009468a5096e32e897060ee0b5b9dddd8.zip
external_llvm-9f8cc69009468a5096e32e897060ee0b5b9dddd8.tar.gz
external_llvm-9f8cc69009468a5096e32e897060ee0b5b9dddd8.tar.bz2
Fix a case where the DAG Combiner would accidentally CSE flag-producing nodes,
creating graphs that cannot be scheduled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24866 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 2fe1b0d..86ad89e 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -389,9 +389,14 @@ SDNode *SelectionDAG::AddNonLeafNodeToCSEMaps(SDNode *N) {
assert(N->getNumOperands() && "This is a leaf node!");
if (N->getOpcode() == ISD::CALLSEQ_START ||
N->getOpcode() == ISD::CALLSEQ_END ||
- N->getOpcode() == ISD::HANDLENODE)
+ N->getOpcode() == ISD::HANDLENODE || N->getValueType(0) == MVT::Flag)
return 0; // Never add these nodes.
+ // Check that remaining values produced are not flags.
+ for (unsigned i = 1, e = N->getNumValues(); i != e; ++i)
+ if (N->getValueType(i) == MVT::Flag)
+ return 0; // Never CSE anything that produces a flag.
+
if (N->getNumValues() == 1) {
if (N->getNumOperands() == 1) {
SDNode *&U = UnaryOps[std::make_pair(N->getOpcode(),