[patch] Gate EliminatePhi fix behind feature flag

This commit is contained in:
Mofei Zhang
2023-08-07 17:41:34 -04:00
parent adfae63f20
commit ff2f2e0685
@@ -106,19 +106,20 @@ export function eliminateRedundantPhi(
for (const place of eachInstructionOperand(instr)) {
rewritePlace(place, rewrites);
}
if (instr.value.kind === "FunctionExpression") {
if (
instr.value.kind === "FunctionExpression" &&
fn.env.enableOptimizeFunctionExpressions
) {
const { context } = instr.value.loweredFunc;
for (const place of context) {
rewritePlace(place, rewrites);
}
}
// visit function expressions on first iteration of each block
if (
isFirstIteration &&
instr.value.kind === "FunctionExpression" &&
fn.env.enableOptimizeFunctionExpressions
) {
eliminateRedundantPhi(instr.value.loweredFunc, rewrites);
// visit function expressions on first iteration of each block
if (isFirstIteration) {
eliminateRedundantPhi(instr.value.loweredFunc, rewrites);
}
}
}