Skip to content

Commit 780d560

Browse files
sethbrenithV8 LUCI CQ
authored andcommitted
[compiler] Clear stale data for ZeroExtendsWord32ToWord64
The first call to ZeroExtendsWord32ToWord64 produces a correct result, but leaves some incorrect values in phi_states_. To avoid incorrect behavior, we should clear those values when starting anew. I think that the performance impact of this change on compilation time should be small, because calls to ZeroExtendsWord32ToWord64 are infrequent. Here is a histogram showing, per function compiled in Octane, how often this new code is run: 0: 74.7% 1: 13.1% 2: 6.3% 3: 2.5% 4 or 5: 1.7% 6 to 9: 0.9% 11 to 33: 0.8% Bug: 356196918 Change-Id: I00a9e74652025bf8a32cb083a6e01c0273e44043 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5766478 Commit-Queue: Seth Brenith <[email protected]> Reviewed-by: Nico Hartmann <[email protected]> Cr-Commit-Position: refs/heads/main@{#95528}
1 parent 0ae8b73 commit 780d560

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/compiler/backend/instruction-selector.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5734,6 +5734,14 @@ bool InstructionSelectorT<Adapter>::ZeroExtendsWord32ToWord64(
57345734
const int kMaxRecursionDepth = 100;
57355735

57365736
if (this->IsPhi(node)) {
5737+
// Intermediate results from previous calls are not necessarily correct.
5738+
if (recursion_depth == 0) {
5739+
static_assert(sizeof(Upper32BitsState) == 1);
5740+
memset(phi_states_.data(),
5741+
static_cast<int>(Upper32BitsState::kNotYetChecked),
5742+
phi_states_.size());
5743+
}
5744+
57375745
Upper32BitsState current = phi_states_[this->id(node)];
57385746
if (current != Upper32BitsState::kNotYetChecked) {
57395747
return current == Upper32BitsState::kUpperBitsGuaranteedZero;

0 commit comments

Comments
 (0)