From 47e6f155fc653e05c1724a0c98ed4eefae7ea937 Mon Sep 17 00:00:00 2001 From: Joe Savona Date: Thu, 30 May 2024 08:37:21 -0700 Subject: [PATCH] Update base for Update on "compiler: allow reordering of loadlocal after last assignment" Extends the instruction reordering from the previous PR to allow reordering LoadLocal, but only after the last assignment of the loaded variable. Thus if we have: ``` t0 = StoreLocal const x = ... t1 = LoadLocal x t2 = foo t3 = bar t1 # t1 used here ``` We know that x isn't assigned after the first instruction, and can safely reorder the loadlocal to where it's first used: ``` t0 = StoreLocal const x = ... t2 = foo t1 = LoadLocal x t3 = bar t1 ``` Note that this assumes each LoadLocal temporary is used exactly once, which we already guarantee in BuildHIR. [ghstack-poisoned]