From ba23b990acf5d16cd8c96975e38298bbfb6de344 Mon Sep 17 00:00:00 2001 From: Joe Savona Date: Tue, 10 Oct 2023 13:15:39 -0700 Subject: [PATCH] [be] Remove dead code in ConstantPropagation --- .../src/Optimization/ConstantPropagation.ts | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/compiler/packages/babel-plugin-react-forget/src/Optimization/ConstantPropagation.ts b/compiler/packages/babel-plugin-react-forget/src/Optimization/ConstantPropagation.ts index 378e3a2824..5541bef417 100644 --- a/compiler/packages/babel-plugin-react-forget/src/Optimization/ConstantPropagation.ts +++ b/compiler/packages/babel-plugin-react-forget/src/Optimization/ConstantPropagation.ts @@ -97,26 +97,6 @@ function applyConstantPropagation( fn: HIRFunction, constants: Constants ): boolean { - // Track the set of identifiers which are used as dependencies for function expressions - // in order to avoid propagating these constants. This is necessary because the function - // itself will still reference the original value. If the dependency is propagated but the - // function still refers to the original value, this can create a situation where DCE - // will think the original expression is unused. Until we are able to propagate constants - // into function expression bodies, we disable propagation of function deps. - const functionDependencies = new Set(); - for (const [, block] of fn.body.blocks) { - for (const instr of block.instructions) { - if ( - instr.value.kind === "FunctionExpression" || - instr.value.kind === "ObjectMethod" - ) { - for (const operand of instr.value.loweredFunc.dependencies) { - functionDependencies.add(operand.identifier.id); - } - } - } - } - let hasChanges = false; for (const [, block] of fn.body.blocks) { // Initialize phi values if all operands have the same known constant value.