mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
Driveby optimization of DCE
Lift a constant evaluation out of a loop
This commit is contained in:
1 parent
d4b8df5441
commit
5b9992075c
1 file changed
+1
-1
@@ -33,13 +33,13 @@ export function deadCodeElimination(fn: HIRFunction): void {
|
||||
// of the blocks
|
||||
const hasLoop = hasBackEdge(fn);
|
||||
|
||||
const reversedBlocks = [...fn.body.blocks.values()].reverse();
|
||||
let size = state.count;
|
||||
do {
|
||||
size = state.count;
|
||||
|
||||
// Iterate blocks in postorder (successors before predecessors, excepting loops)
|
||||
// to find usages before declarations
|
||||
const reversedBlocks = [...fn.body.blocks.values()].reverse();
|
||||
for (const block of reversedBlocks) {
|
||||
for (const operand of eachTerminalOperand(block.terminal)) {
|
||||
state.reference(operand.identifier);
|
||||
|
||||
Reference in new issue
Block a user