[ptr-compr][turbofan] Add some simplified reducers for compressions

ChangeTaggedSignedToInt32(ChangeCompressedSignedToTaggedSigned((x)) ->
  ChangeCompressedSignedToInt32(x)

This pattern shows up in the Octane Richards benchmark (on arm64):

    sxtw x11, w10
    asr w11, w11, #1

This patch will remove the sxtw.

ChangeCompressedSignedToInt32(CheckedInt32ToCompressedSigned(x)) -> x

This pattern shows up in the Octane Richards benchmark (on arm64):

    adds w10, w10, w10
    b.vs #+0x1118
    asr w11, w10, #1
    stur w10, [x6, #19]
    cmp w11, #0x1a

This patch will remove the asr, and produce:

    adds w11, w10, w10
    b.vs #+0x1108
    stur w11, [x6, #19]
    cmp w10, #0x1a

Bug: v8:7703
Change-Id: I5843e0a4f723b202857ee86130f835cd048d7e31
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1763529
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Santiago Aboy Solanes <solanes@chromium.org>
Commit-Queue: Rodolph Perfetta <rodolph.perfetta@arm.com>
Cr-Commit-Position: refs/heads/master@{#63389}
This commit is contained in:
Joey Gouly 2019-08-22 15:04:46 +01:00 committed by Commit Bot
parent 9b986bf97c
commit e68a51f7b6

View File

@ -106,6 +106,11 @@ Reduction SimplifiedOperatorReducer::Reduce(Node* node) {
if (m.IsChangeInt31ToTaggedSigned() || m.IsChangeInt32ToTagged()) {
return Replace(m.InputAt(0));
}
if (m.IsChangeCompressedSignedToTaggedSigned()) {
Node* new_node = graph()->NewNode(
simplified()->ChangeCompressedSignedToInt32(), m.InputAt(0));
return Replace(new_node);
}
break;
}
case IrOpcode::kChangeTaggedToUint32: {
@ -170,6 +175,13 @@ Reduction SimplifiedOperatorReducer::Reduce(Node* node) {
}
break;
}
case IrOpcode::kChangeCompressedSignedToInt32: {
NodeMatcher m(node->InputAt(0));
if (m.IsCheckedInt32ToCompressedSigned()) {
return Replace(m.InputAt(0));
}
break;
}
case IrOpcode::kCheckedTaggedToInt32:
case IrOpcode::kCheckedTaggedSignedToInt32: {
NodeMatcher m(node->InputAt(0));