Changeset 215057 in webkit for trunk/Source/JavaScriptCore/b3/B3ReduceStrength.cpp
- Timestamp:
- Apr 6, 2017, 1:58:34 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/b3/B3ReduceStrength.cpp
r214636 r215057 443 443 simplifySSA(); 444 444 445 m_proc.resetValueOwners(); 446 m_dominators = &m_proc.dominators(); // Recompute if necessary. 447 m_pureCSE.clear(); 445 if (m_proc.optLevel() >= 2) { 446 m_proc.resetValueOwners(); 447 m_dominators = &m_proc.dominators(); // Recompute if necessary. 448 m_pureCSE.clear(); 449 } 448 450 449 451 for (BasicBlock* block : m_proc.blocksInPreOrder()) { … … 458 460 m_value = m_block->at(m_index); 459 461 m_value->performSubstitution(); 460 461 462 reduceValueStrength(); 462 replaceIfRedundant(); 463 if (m_proc.optLevel() >= 2) 464 replaceIfRedundant(); 463 465 } 464 466 m_insertionSet.execute(m_block); … … 466 468 467 469 m_changedCFG |= m_blockInsertionSet.execute(); 468 if (m_changedCFG) { 469 m_proc.resetReachability(); 470 m_proc.invalidateCFG(); 471 m_dominators = nullptr; // Dominators are not valid anymore, and we don't need them yet. 472 m_changed = true; 473 } 470 handleChangedCFGIfNecessary(); 474 471 475 472 result |= m_changed; 476 } while (m_changed); 473 } while (m_changed && m_proc.optLevel() >= 2); 474 475 if (m_proc.optLevel() < 2) { 476 m_changedCFG = false; 477 simplifyCFG(); 478 handleChangedCFGIfNecessary(); 479 } 480 477 481 return result; 478 482 } … … 726 730 727 731 if (m_value->type() != Int32) 732 break; 733 734 if (m_proc.optLevel() < 2) 728 735 break; 729 736 … … 822 829 823 830 default: 831 if (m_proc.optLevel() < 2) 832 break; 833 824 834 // Turn this: Mod(N, D) 825 835 // Into this: Sub(N, Mul(Div(N, D), D)) … … 1842 1852 m_changed = true; 1843 1853 } 1854 1855 if (m_proc.optLevel() < 2) 1856 break; 1844 1857 1845 1858 // If we are checking some bounded-size SSA expression that leads to a Select that … … 1948 1961 } 1949 1962 1950 // If a check for the same property dominates us, we can kill the branch. This sort 1951 // of makes sense here because it's cheap, but hacks like this show that we're going 1952 // to need SCCP. 1953 Value* check = m_pureCSE.findMatch( 1954 ValueKey(Check, Void, m_value->child(0)), m_block, *m_dominators); 1955 if (check) { 1956 // The Check would have side-exited if child(0) was non-zero. So, it must be 1957 // zero here. 1958 m_block->taken().block()->removePredecessor(m_block); 1959 m_value->replaceWithJump(m_block, m_block->notTaken()); 1960 m_changedCFG = true; 1963 if (m_proc.optLevel() >= 2) { 1964 // If a check for the same property dominates us, we can kill the branch. This sort 1965 // of makes sense here because it's cheap, but hacks like this show that we're going 1966 // to need SCCP. 1967 Value* check = m_pureCSE.findMatch( 1968 ValueKey(Check, Void, m_value->child(0)), m_block, *m_dominators); 1969 if (check) { 1970 // The Check would have side-exited if child(0) was non-zero. So, it must be 1971 // zero here. 1972 m_block->taken().block()->removePredecessor(m_block); 1973 m_value->replaceWithJump(m_block, m_block->notTaken()); 1974 m_changedCFG = true; 1975 } 1961 1976 } 1962 1977 break; … … 2379 2394 } 2380 2395 } 2396 2397 void handleChangedCFGIfNecessary() 2398 { 2399 if (m_changedCFG) { 2400 m_proc.resetReachability(); 2401 m_proc.invalidateCFG(); 2402 m_dominators = nullptr; // Dominators are not valid anymore, and we don't need them yet. 2403 m_changed = true; 2404 } 2405 } 2381 2406 2382 2407 void checkPredecessorValidity()
Note:
See TracChangeset
for help on using the changeset viewer.