OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <limits> | 5 #include <limits> |
6 | 6 |
7 #include "src/compiler/graph.h" | 7 #include "src/compiler/graph.h" |
8 #include "src/compiler/value-numbering-reducer.h" | 8 #include "src/compiler/value-numbering-reducer.h" |
9 #include "src/test/test-utils.h" | 9 #include "src/test/test-utils.h" |
10 | 10 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 r = Reduce(graph()->NewNode(&op1, static_cast<int>(input_count), inputs)); | 99 r = Reduce(graph()->NewNode(&op1, static_cast<int>(input_count), inputs)); |
100 ASSERT_TRUE(r.Changed()); | 100 ASSERT_TRUE(r.Changed()); |
101 EXPECT_EQ(n, r.replacement()); | 101 EXPECT_EQ(n, r.replacement()); |
102 | 102 |
103 r = Reduce(graph()->NewNode(&op1, static_cast<int>(input_count), inputs)); | 103 r = Reduce(graph()->NewNode(&op1, static_cast<int>(input_count), inputs)); |
104 ASSERT_TRUE(r.Changed()); | 104 ASSERT_TRUE(r.Changed()); |
105 EXPECT_EQ(n, r.replacement()); | 105 EXPECT_EQ(n, r.replacement()); |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
| 109 |
| 110 TEST_F(ValueNumberingReducerTest, WontReplaceNodeWithItself) { |
| 111 Node* n = graph()->NewNode(&kOp0); |
| 112 EXPECT_FALSE(Reduce(n).Changed()); |
| 113 EXPECT_FALSE(Reduce(n).Changed()); |
| 114 } |
| 115 |
109 } // namespace compiler | 116 } // namespace compiler |
110 } // namespace internal | 117 } // namespace internal |
111 } // namespace v8 | 118 } // namespace v8 |
OLD | NEW |