Skip to content

Commit 8ac0bba

Browse files
committed
Update on "[compiler] Infer phi types, extend mutable ranges to account for Store effects"
Redo of an earlier (pre-OSS) PR to infer types of phi nodes. There are a few pieces to this: 1. Update InferTypes to infer the type of `phi.id.type`, not the unused `phi.type`. 2. Update the algorithm to verify that all the phi types are actually equal, not just have the same kind. 3. Handle circular types by removing the cycle. However, that reveals another issue: InferMutableRanges currently infers the results of `Store` effects _after_ its fixpoint loop. That was fine when a Store could never occur on a phi (since they wouldn't have a type to get a function signature from). Now though, we can have Store effects occur on phis, and we need to ensure that this correctly updates the mutable range of the phi operands - recursively. See new test that fails without the fixpoint loop. [ghstack-poisoned]
1 parent 4cfcb2e commit 8ac0bba

File tree

2 files changed

+0
-6
lines changed

2 files changed

+0
-6
lines changed

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/phi-type-inference-array-push.expect.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
## Input
33

44
```javascript
5-
import {makeArray} from 'shared-runtime';
6-
75
function Component(props) {
86
const x = {};
97
let y;
@@ -37,8 +35,6 @@ export const FIXTURE_ENTRYPOINT = {
3735

3836
```javascript
3937
import { c as _c } from "react/compiler-runtime";
40-
import { makeArray } from "shared-runtime";
41-
4238
function Component(props) {
4339
const $ = _c(3);
4440
let t0;

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/phi-type-inference-array-push.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import {makeArray} from 'shared-runtime';
2-
31
function Component(props) {
42
const x = {};
53
let y;

0 commit comments

Comments
 (0)