Skip to content

Commit 798002c

Browse files
committed
[compiler] Remove phi type, infer phi.id.type
ghstack-source-id: 0c26bb2 Pull Request resolved: facebook/react#30795
1 parent 49cb13f commit 798002c

File tree

5 files changed

+3
-6
lines changed

5 files changed

+3
-6
lines changed

compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,6 @@ export type Phi = {
759759
kind: 'Phi';
760760
id: Identifier;
761761
operands: Map<BlockId, Identifier>;
762-
type: Type;
763762
};
764763

765764
/**

compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export function printPhi(phi: Phi): string {
165165
const items = [];
166166
items.push(printIdentifier(phi.id));
167167
items.push(printMutableRange(phi.id));
168-
items.push(printType(phi.type));
168+
items.push(printType(phi.id.type));
169169
items.push(': phi(');
170170
const phis = [];
171171
for (const [blockId, id] of phi.operands) {

compiler/packages/babel-plugin-react-compiler/src/SSA/EnterSSA.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ class SSABuilder {
192192
kind: 'Phi',
193193
id: newId,
194194
operands: predDefs,
195-
type: makeType(),
196195
};
197196

198197
block.phis.add(phi);

compiler/packages/babel-plugin-react-compiler/src/TypeInference/InferTypes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export function inferTypes(func: HIRFunction): void {
6868
function apply(func: HIRFunction, unifier: Unifier): void {
6969
for (const [_, block] of func.body.blocks) {
7070
for (const phi of block.phis) {
71-
phi.type = unifier.get(phi.type);
71+
phi.id.type = unifier.get(phi.id.type);
7272
}
7373
for (const instr of block.instructions) {
7474
for (const operand of eachInstructionLValue(instr)) {
@@ -126,7 +126,7 @@ function* generate(
126126
const returnTypes: Array<Type> = [];
127127
for (const [_, block] of func.body.blocks) {
128128
for (const phi of block.phis) {
129-
yield equation(phi.type, {
129+
yield equation(phi.id.type, {
130130
kind: 'Phi',
131131
operands: [...phi.operands.values()].map(id => id.type),
132132
});

compiler/packages/babel-plugin-react-compiler/src/TypeInference/PropagatePhiTypes.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ export function propagatePhiTypes(fn: HIRFunction): void {
7676
}
7777
if (type !== null) {
7878
phi.id.type = type;
79-
phi.type = type;
8079
propagated.add(phi.id.id);
8180
}
8281
}

0 commit comments

Comments
 (0)