[CSA] Updating machine verification of Compressed

There were some cases that were not yet contemplated on machine graph
verifier.

Also, there is some work to be done to create a Compressed HeapConstant.
Until that happens, we have to ignore HeapConstants for
DecompressionElimination's reductions.

Cq-Include-Trybots: luci.v8.try:v8_linux64_pointer_compression_rel_ng
Cq-Include-Trybots: luci.v8.try:v8_linux64_arm64_pointer_compression_rel_ng
Bug: v8:8977, v8:7703, v8:9298
Change-Id: I9de8dd4272866830807a8d88e625e863fb5f1d0d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1632209
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61892}
This commit is contained in:
Santiago Aboy Solanes 2019-05-28 13:59:37 +01:00 committed by Commit Bot
parent 0ab6cc739f
commit b7744db7f9
3 changed files with 77 additions and 3 deletions

View File

@ -21,8 +21,10 @@ bool DecompressionElimination::IsReducibleConstantOpcode(
IrOpcode::Value opcode) {
switch (opcode) {
case IrOpcode::kInt64Constant:
case IrOpcode::kHeapConstant:
return true;
// TODO(v8:8977): Disabling HeapConstant until CompressedHeapConstant
// exists, since it breaks with verify CSA on.
case IrOpcode::kHeapConstant:
default:
return false;
}

View File

@ -498,8 +498,8 @@ class MachineRepresentationChecker {
node, 1, inferrer_->GetRepresentation(node->InputAt(0)));
}
} else {
CheckValueInputForInt32Op(node, 0);
CheckValueInputForInt32Op(node, 1);
CheckValueIsCompressedOrInt32(node, 0);
CheckValueIsCompressedOrInt32(node, 1);
}
break;
@ -602,6 +602,11 @@ class MachineRepresentationChecker {
case MachineRepresentation::kTaggedSigned:
CheckValueInputIsTagged(node, 2);
break;
case MachineRepresentation::kCompressed:
case MachineRepresentation::kCompressedPointer:
case MachineRepresentation::kCompressedSigned:
CheckValueInputIsCompressed(node, 2);
break;
default:
CheckValueInputRepresentationIs(
node, 2, inferrer_->GetRepresentation(node));
@ -641,6 +646,13 @@ class MachineRepresentationChecker {
CheckValueInputIsTagged(node, i);
}
break;
case MachineRepresentation::kCompressed:
case MachineRepresentation::kCompressedPointer:
case MachineRepresentation::kCompressedSigned:
for (int i = 0; i < node->op()->ValueInputCount(); ++i) {
CheckValueInputIsCompressed(node, i);
}
break;
case MachineRepresentation::kWord32:
for (int i = 0; i < node->op()->ValueInputCount(); ++i) {
CheckValueInputForInt32Op(node, i);
@ -729,6 +741,24 @@ class MachineRepresentationChecker {
}
}
void CheckValueInputIsCompressed(Node const* node, int index) {
Node const* input = node->InputAt(index);
switch (inferrer_->GetRepresentation(input)) {
case MachineRepresentation::kCompressed:
case MachineRepresentation::kCompressedPointer:
case MachineRepresentation::kCompressedSigned:
return;
default:
break;
}
std::ostringstream str;
str << "TypeError: node #" << node->id() << ":" << *node->op()
<< " uses node #" << input->id() << ":" << *input->op()
<< " which doesn't have a compressed representation.";
PrintDebugHelp(str, node);
FATAL("%s", str.str().c_str());
}
void CheckValueInputIsTagged(Node const* node, int index) {
Node const* input = node->InputAt(index);
switch (inferrer_->GetRepresentation(input)) {
@ -808,6 +838,38 @@ class MachineRepresentationChecker {
FATAL("%s", str.str().c_str());
}
void CheckValueIsCompressedOrInt32(Node const* node, int index) {
Node const* input = node->InputAt(index);
switch (inferrer_->GetRepresentation(input)) {
case MachineRepresentation::kBit:
case MachineRepresentation::kWord8:
case MachineRepresentation::kWord16:
case MachineRepresentation::kWord32:
return;
case MachineRepresentation::kCompressed:
case MachineRepresentation::kCompressedSigned:
case MachineRepresentation::kCompressedPointer:
return;
case MachineRepresentation::kNone: {
std::ostringstream str;
str << "TypeError: node #" << input->id() << ":" << *input->op()
<< " is untyped.";
PrintDebugHelp(str, node);
FATAL("%s", str.str().c_str());
break;
}
default:
break;
}
std::ostringstream str;
str << "TypeError: node #" << node->id() << ":" << *node->op()
<< " uses node #" << input->id() << ":" << *input->op()
<< " which doesn't have a compressed or int32-compatible "
"representation.";
PrintDebugHelp(str, node);
FATAL("%s", str.str().c_str());
}
void CheckValueInputForInt64Op(Node const* node, int index) {
Node const* input = node->InputAt(index);
MachineRepresentation input_representation =

View File

@ -311,6 +311,11 @@ TEST_F(DecompressionEliminationTest,
TEST_F(DecompressionEliminationTest,
DecompressionConstantStoreElementHeapConstant) {
// TODO(v8:8977): Disabling HeapConstant until CompressedHeapConstant
// exists, since it breaks with verify CSA on.
if (COMPRESS_POINTERS_BOOL) {
return;
}
// Skip test if pointer compression is not enabled.
if (!COMPRESS_POINTERS_BOOL) {
return;
@ -1010,6 +1015,11 @@ TEST_F(DecompressionEliminationTest, DecompressionConstantWord64Equal) {
}
TEST_F(DecompressionEliminationTest, DecompressionHeapConstantWord64Equal) {
// TODO(v8:8977): Disabling HeapConstant until CompressedHeapConstant
// exists, since it breaks with verify CSA on.
if (COMPRESS_POINTERS_BOOL) {
return;
}
// Skip test if pointer compression is not enabled
if (!COMPRESS_POINTERS_BOOL) {
return;