B3::reduceStrength() should do DCE
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Oct 2015 01:57:17 +0000 (01:57 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Oct 2015 01:57:17 +0000 (01:57 +0000)
commitdea30ee26e58a25c784c866903e477068b5a79a7
treee34fbd61f75e8b342522f9f24b51038d576d5505
parentc6255e7b3bfdbf7469c345d49f2d836be3272269
B3::reduceStrength() should do DCE
https://bugs.webkit.org/show_bug.cgi?id=150656

Reviewed by Saam Barati.

* b3/B3BasicBlock.cpp:
(JSC::B3::BasicBlock::removeNops): This now deletes the values from the procedure, to preserve the invariant that valuesInProc == valuesInBlocks.
* b3/B3BasicBlock.h:
* b3/B3Procedure.cpp:
(JSC::B3::Procedure::deleteValue): Add a utility used by removeNops().
(JSC::B3::Procedure::addValueIndex): Make sure that we reuse Value indices so that m_values doesn't get too sparse.
* b3/B3Procedure.h:
(JSC::B3::Procedure::ValuesCollection::iterator::iterator): Teach this that m_values can be slightly sparse.
(JSC::B3::Procedure::ValuesCollection::iterator::operator++):
(JSC::B3::Procedure::ValuesCollection::iterator::operator!=):
(JSC::B3::Procedure::ValuesCollection::iterator::findNext):
(JSC::B3::Procedure::values):
* b3/B3ProcedureInlines.h:
(JSC::B3::Procedure::add): Use addValueIndex() instead of always creating a new index.
* b3/B3ReduceStrength.cpp: Implement the optimization using UseCounts and Effects.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191718 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/b3/B3BasicBlock.cpp
Source/JavaScriptCore/b3/B3BasicBlock.h
Source/JavaScriptCore/b3/B3Procedure.cpp
Source/JavaScriptCore/b3/B3Procedure.h
Source/JavaScriptCore/b3/B3ProcedureInlines.h
Source/JavaScriptCore/b3/B3ReduceStrength.cpp