Skip to content

Commit 6b5cab7

Browse files
committed
Update on "[compiler] Instruction reordering"
Adds a pass just after DCE to reorder safely reorderable instructions (jsx, primitives, globals) closer to where they are used, to allow other optimization passes to be more effective. Notably, the reordering allows scope merging to be more effective, since that pass relies on two scopes not having intervening instructions — in many cases we can now reorder such instructions out of the way and unlock merging, as demonstrated in the changed fixtures. The algorithm itself is described in the docblock. note: This is a cleaned up version of #29579 that is ready for review. [ghstack-poisoned]
1 parent 2cb5cdd commit 6b5cab7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MemoizeFbtOperandsInSameScope.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ function visit(fn: HIRFunction, fbtValues: Set<IdentifierId>): void {
134134
}
135135

136136
for (const operand of eachReactiveValueOperand(value)) {
137-
if (operand.identifier.name !== null) {
137+
if (
138+
operand.identifier.name !== null &&
139+
operand.identifier.name.kind === "named"
140+
) {
138141
/*
139142
* named identifiers were already locals, we only have to force temporaries
140143
* into the same scope

0 commit comments

Comments
 (0)