Skip to content

Commit 9d4536a

Browse files
committed
[AddressLowering] Project at storage.
The pass rewrites opaque values in reverse post order of their definitions. When an opaque value is rewritten, both its definition and its uses are rewritten. When a def or a use is rewritten, in order to materialize an address with which to rewrite, projection instructions are created. Previously, these projections were created at the site of the def or use. Some of these projection instructions may be reused when rewriting later opaque values. As a result, it's possible to have two opaque values `A` and `B` (which are rewritten in that order) such that rewriting a use of `A` which occurs "after" the def (or a use) of `B` creates a projection `P` which is then used by that "earlier" def (or use) of `B`: ``` A = B = // relies on P use B use A // creates some projection P ``` When rewriting the def (or that use, respectively) of `B`, the projection which was created for the use of `A` will be reused. And previously, the projection would be created at the use of A. But that projection instruction was "after" the place where it is used when rewriting the def or use of `B`. That's invalid! To address this, rather than creating projections at the instruction being rewritten, instead create them "as early as possible". The locations where they will be created are chosen so as to dominate all uses.
1 parent e98df12 commit 9d4536a

File tree

4 files changed

+305
-118
lines changed

4 files changed

+305
-118
lines changed

0 commit comments

Comments
 (0)