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

Unified Diff: test/unittests/compiler/load-elimination-unittest.cc

Issue 2301903002: [turbofan] Properly look through FinishRegion in alias analysis. (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/load-elimination.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler/load-elimination-unittest.cc
diff --git a/test/unittests/compiler/load-elimination-unittest.cc b/test/unittests/compiler/load-elimination-unittest.cc
index 2306f72b4c32f1482a43f1373e11c678f43f943e..81393941bb21c7408ce45c4e35d36700990c2c8f 100644
--- a/test/unittests/compiler/load-elimination-unittest.cc
+++ b/test/unittests/compiler/load-elimination-unittest.cc
@@ -417,6 +417,65 @@ TEST_F(LoadEliminationTest, LoadElementWithTypeMismatch) {
EXPECT_THAT(r.replacement(), IsTypeGuard(value, control));
}
+TEST_F(LoadEliminationTest, AliasAnalysisForFinishRegion) {
+ Node* value0 = Parameter(Type::Signed32(), 0);
+ Node* value1 = Parameter(Type::Signed32(), 1);
+ Node* effect = graph()->start();
+ Node* control = graph()->start();
+ FieldAccess const access = {kTaggedBase,
+ kPointerSize,
+ MaybeHandle<Name>(),
+ Type::Signed32(),
+ MachineType::AnyTagged(),
+ kNoWriteBarrier};
+
+ StrictMock<MockAdvancedReducerEditor> editor;
+ LoadElimination load_elimination(&editor, jsgraph(), zone());
+
+ load_elimination.Reduce(effect);
+
+ effect = graph()->NewNode(
+ common()->BeginRegion(RegionObservability::kNotObservable), effect);
+ load_elimination.Reduce(effect);
+
+ Node* object0 = effect =
+ graph()->NewNode(simplified()->Allocate(NOT_TENURED),
+ jsgraph()->Constant(16), effect, control);
+ load_elimination.Reduce(effect);
+
+ Node* region0 = effect =
+ graph()->NewNode(common()->FinishRegion(), object0, effect);
+ load_elimination.Reduce(effect);
+
+ effect = graph()->NewNode(
+ common()->BeginRegion(RegionObservability::kNotObservable), effect);
+ load_elimination.Reduce(effect);
+
+ Node* object1 = effect =
+ graph()->NewNode(simplified()->Allocate(NOT_TENURED),
+ jsgraph()->Constant(16), effect, control);
+ load_elimination.Reduce(effect);
+
+ Node* region1 = effect =
+ graph()->NewNode(common()->FinishRegion(), object1, effect);
+ load_elimination.Reduce(effect);
+
+ effect = graph()->NewNode(simplified()->StoreField(access), region0, value0,
+ effect, control);
+ load_elimination.Reduce(effect);
+
+ effect = graph()->NewNode(simplified()->StoreField(access), region1, value1,
+ effect, control);
+ load_elimination.Reduce(effect);
+
+ Node* load = graph()->NewNode(simplified()->LoadField(access), region0,
+ effect, control);
+ EXPECT_CALL(editor, ReplaceWithValue(load, value0, effect, _));
+ Reduction r = load_elimination.Reduce(load);
+ ASSERT_TRUE(r.Changed());
+ EXPECT_EQ(value0, r.replacement());
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/compiler/load-elimination.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698