Skip to content

[GR-35795] Graal should combine multiple exact integer arithmetic operations #4096

Open
@chrisseaton

Description

@chrisseaton

Ruby code that uses exact integer arithmetic such as a + 1 + 1 will not be combined to a + 2. I guess it's because it thinks the two deoptimisations that you get on the two overflows are different so need different deoptimisation points? Both sides of the IntegerAddExactSplit actually eventually lead to the same DynamicDeoptimize node though!

Screenshot 2021-12-07 at 12 55 58

        0x122ad9afe:    add     eax, 1
                                ;Comment 97:    14 BRANCH trueDestinationProbability: 0.0 condition: |of| trueDestination: B0 -> B13 falseDestination: B0 -> B1
        0x122ad9b01:    jo      0x122ad9bf5
                                ;Comment 103:   block B1 null
                                ;Comment 103:   16 [] = LABEL numbPhis: 0 align: false label: ?
                                ;Comment 103:   18 r10|DWORD = ADD rax|DWORD y: 1 size: DWORD
        0x122ad9b07:    mov     r10d, eax
        0x122ad9b0a:    add     r10d, 1
                                ;Comment 110:   20 BRANCH trueDestinationProbability: 0.0 condition: |of| trueDestination: B1 -> B12 falseDestination: B1 -> B2
        0x122ad9b0e:    jo      0x122ad9bd7
                                ;Comment 116:   block B2 null
                                ;Comment 116:   22 [] = LABEL numbPhis: 0 align: false label: ?
                                ;Comment 116:   24 rax|DWORD = LEA [r10|DWORD + 128] size: DWORD

@eregon

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions