Improve independence analysis in code optimizer #974

Merged
zxq9 merged 2 commits from fix_optimization_bug into master 2023-08-24 16:43:41 +09:00
zxq9 commented 2023-08-23 20:38:06 +09:00 (Migrated from gitlab.com)

Created by: hanssv

There is an omission in the logic checking whether two byte code instructions are independent - as demonstrated by #482

This adds a check that an instruction reading the store/state is not pushed past an impure instruction (for example a function call).

This results in:

FUNCTION foo( integer) : integer
  ;; BB : 0
          MAP_LOOKUP var0 store1 arg0
          PUSH arg0
          CALL "IBB"
  ;; BB : 1
          POP var9999
          RETURNR var0

Fixes #482

This PR is supported by the Æternity Crypto Foundation

*Created by: hanssv* There is an omission in the logic checking whether two byte code instructions are independent - as demonstrated by #482 This adds a check that an instruction reading the store/state is not pushed past an impure instruction (for example a function call). This results in: ``` FUNCTION foo( integer) : integer ;; BB : 0 MAP_LOOKUP var0 store1 arg0 PUSH arg0 CALL "IBB" ;; BB : 1 POP var9999 RETURNR var0 ``` Fixes #482 This PR is supported by the Æternity Crypto Foundation
ghallak (Migrated from gitlab.com) approved these changes 2023-08-23 20:38:06 +09:00
zxq9 commented 2023-08-24 16:22:25 +09:00 (Migrated from gitlab.com)

Created by: radrow

Review: Approved

We definitely need runtime tests in the compiler repo.

*Created by: radrow* **Review:** Approved We definitely need runtime tests in the compiler repo.
ghallak commented 2023-08-24 16:27:01 +09:00 (Migrated from gitlab.com)

approved this merge request

approved this merge request
zxq9 commented 2023-08-24 16:43:41 +09:00 (Migrated from gitlab.com)

Merged by: hanssv at 2023-08-24 07:43:41 UTC

*Merged by: hanssv at 2023-08-24 07:43:41 UTC*
Sign in to join this conversation.
No description provided.