Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: test/unittests/compiler/select-lowering-unittest.cc

Issue 1870763003: [turbofan] Remove some clever-but-wrong bits from select lowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update (= remove) the test Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/compiler/regress-600593.js ('k') | test/unittests/unittests.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "src/compiler/select-lowering.h"
6 #include "test/unittests/compiler/graph-unittest.h"
7 #include "test/unittests/compiler/node-test-utils.h"
8 #include "testing/gmock-support.h"
9
10 using testing::AllOf;
11 using testing::Capture;
12 using testing::CaptureEq;
13 using testing::Not;
14
15 namespace v8 {
16 namespace internal {
17 namespace compiler {
18
19 class SelectLoweringTest : public GraphTest {
20 public:
21 SelectLoweringTest() : GraphTest(5), lowering_(graph(), common()) {}
22
23 protected:
24 Reduction Reduce(Node* node) { return lowering_.Reduce(node); }
25
26 private:
27 SelectLowering lowering_;
28 };
29
30
31 TEST_F(SelectLoweringTest, SelectWithSameConditions) {
32 Node* const p0 = Parameter(0);
33 Node* const p1 = Parameter(1);
34 Node* const p2 = Parameter(2);
35 Node* const p3 = Parameter(3);
36 Node* const p4 = Parameter(4);
37 Node* const s0 = graph()->NewNode(
38 common()->Select(MachineRepresentation::kWord32), p0, p1, p2);
39
40 Capture<Node*> branch;
41 Capture<Node*> merge;
42 {
43 Reduction const r = Reduce(s0);
44 ASSERT_TRUE(r.Changed());
45 EXPECT_THAT(
46 r.replacement(),
47 IsPhi(
48 MachineRepresentation::kWord32, p1, p2,
49 AllOf(CaptureEq(&merge),
50 IsMerge(IsIfTrue(CaptureEq(&branch)),
51 IsIfFalse(AllOf(CaptureEq(&branch),
52 IsBranch(p0, graph()->start())))))));
53 }
54 {
55 Reduction const r = Reduce(graph()->NewNode(
56 common()->Select(MachineRepresentation::kWord32), p0, p3, p4));
57 ASSERT_TRUE(r.Changed());
58 EXPECT_THAT(r.replacement(), IsPhi(MachineRepresentation::kWord32, p3, p4,
59 CaptureEq(&merge)));
60 }
61 {
62 // We must not reuse the diamond if it is reachable from either else/then
63 // values of the Select, because the resulting graph can not be scheduled.
64 Reduction const r = Reduce(graph()->NewNode(
65 common()->Select(MachineRepresentation::kWord32), p0, s0, p0));
66 ASSERT_TRUE(r.Changed());
67 EXPECT_THAT(r.replacement(), IsPhi(MachineRepresentation::kWord32, s0, p0,
68 Not(CaptureEq(&merge))));
69 }
70 }
71
72 } // namespace compiler
73 } // namespace internal
74 } // namespace v8
OLDNEW
« no previous file with comments | « test/mjsunit/compiler/regress-600593.js ('k') | test/unittests/unittests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698