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

Unified Diff: src/compiler/register-allocator-verifier.cc

Issue 1720003002: [turbofan] fix validator in face of phi optimizations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/register-allocator-verifier.cc
diff --git a/src/compiler/register-allocator-verifier.cc b/src/compiler/register-allocator-verifier.cc
index 463795ecf227d8e3f66ca15959a355d83cc50cf6..0b12e149e847acaa77cd39e741325655351dbfe3 100644
--- a/src/compiler/register-allocator-verifier.cc
+++ b/src/compiler/register-allocator-verifier.cc
@@ -578,7 +578,26 @@ class RegisterAllocatorVerifier::BlockMaps {
CHECK_EQ(succ_vreg, pred_val.second->define_vreg);
}
if (pred_val.second->succ_vreg != kInvalidVreg) {
- CHECK_EQ(succ_vreg, pred_val.second->succ_vreg);
+ if (succ_vreg != pred_val.second->succ_vreg) {
+ // When a block introduces 2 identical phis A and B, and both are
+ // operands to other phis C and D, and we optimized the moves
+ // defining A or B such that they now appear in the block defining
+ // A and B, the back propagation will get confused when visiting
+ // upwards from C and D. The operand in the block defining A and B
+ // will be attributed to C (or D, depending which of these is
+ // visited first).
+ CHECK(IsPhi(pred_val.second->succ_vreg));
+ CHECK(IsPhi(succ_vreg));
+ const PhiData* current_phi = GetPhi(succ_vreg);
+ const PhiData* assigned_phi = GetPhi(pred_val.second->succ_vreg);
+ CHECK_EQ(current_phi->operands.size(),
+ assigned_phi->operands.size());
+ CHECK_EQ(current_phi->definition_rpo,
+ assigned_phi->definition_rpo);
+ for (size_t i = 0; i < current_phi->operands.size(); ++i) {
+ CHECK_EQ(current_phi->operands[i], assigned_phi->operands[i]);
+ }
+ }
} else {
pred_val.second->succ_vreg = succ_vreg;
block_ids.insert(pred_rpo.ToSize());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698