Skip to content

Copy propagation on Get needs a small modification #1383

@minhddo

Description

@minhddo

The current implementation of copy propagation at word_copy doesn't optimize away multiple Gets from the same stores before a Set as shown in this example

      (17 <- HeapLength)
      (inst (Arith (Shift Lsl 21 17 1)))
      (25 := CurrHeap Add 21)
      (inst (Mem Load 29 (Addr 25 0xFFFFFFFFFFFFFFF8)))
      (inst (Arith (Binop Add 33 29 (Imm 0x1))))
      (37 <- HeapLength)
      (inst (Arith (Shift Lsl 41 37 1)))
      (45 := CurrHeap Add 41)
      (inst (Mem Load 49 (Addr 45 0xFFFFFFFFFFFFFFF8)))
      (inst (Arith (Shift Lsl 53 49 2)))
      (57 <- HeapLength)

The current implementation allows multiple loads from HeapLength to persist, while these can be changed to Move instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions