Skip to content

Commit abd7613

Browse files
author
Filip Pizlo
committed
B3 CSE should be able to match a full redundancy even if none of the matches dominate the value in question
https://bugs.webkit.org/show_bug.cgi?id=153321 Reviewed by Benjamin Poulain. I once learned that LLVM's GVN can manufacture Phi functions. I don't know the details but I'm presuming that it involves: if (p) tmp1 = *ptr else tmp2 = *ptr tmp3 = *ptr // Replace this with Phi(tmp1, tmp2). This adds such an optimization to our CSE. The idea is that we search through basic blocks until we find the value we want, a side effect, or the start of the procedure. If we find a value that matches our search criteria, we record it and ignore the predecessors. If we find a side effect or the start of the procedure, we give up the whole search. This ensures that if we come out of the search without giving up, we'll have a set of matches that are fully redundant. CSE could then create a Phi graph by using SSACalculator. But the recent work on FixSSA revealed a much more exciting option: create a stack slot! In case there is more than one match, CSE now creates a stack slot that each match stores to, and replaces the redundant instruction with a loadfrom the stack slot. The stack slot is anonymous, which ensures that FixSSA will turn it into an optimal Phi graph or whatever. This is a significant speed-up on Octane/richards. * b3/B3DuplicateTails.cpp: * b3/B3EliminateCommonSubexpressions.cpp: * b3/B3FixSSA.cpp: (JSC::B3::fixSSA): * b3/B3Generate.cpp: (JSC::B3::generateToAir): * b3/B3Procedure.h: (JSC::B3::Procedure::setFrontendData): (JSC::B3::Procedure::frontendData): * b3/testb3.cpp: * ftl/FTLState.cpp: (JSC::FTL::State::State): Canonical link: https://commits.webkit.org/171402@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195434 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 0a5e46a commit abd7613

8 files changed

Lines changed: 359 additions & 109 deletions

File tree

‎Source/JavaScriptCore/ChangeLog‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1+
2016-01-21 Filip Pizlo <fpizlo@apple.com>
2+
3+
B3 CSE should be able to match a full redundancy even if none of the matches dominate the value in question
4+
https://bugs.webkit.org/show_bug.cgi?id=153321
5+
6+
Reviewed by Benjamin Poulain.
7+
8+
I once learned that LLVM's GVN can manufacture Phi functions. I don't know the details
9+
but I'm presuming that it involves:
10+
11+
if (p)
12+
tmp1 = *ptr
13+
else
14+
tmp2 = *ptr
15+
tmp3 = *ptr // Replace this with Phi(tmp1, tmp2).
16+
17+
This adds such an optimization to our CSE. The idea is that we search through basic
18+
blocks until we find the value we want, a side effect, or the start of the procedure. If
19+
we find a value that matches our search criteria, we record it and ignore the
20+
predecessors. If we find a side effect or the start of the procedure, we give up the
21+
whole search. This ensures that if we come out of the search without giving up, we'll
22+
have a set of matches that are fully redundant.
23+
24+
CSE could then create a Phi graph by using SSACalculator. But the recent work on FixSSA
25+
revealed a much more exciting option: create a stack slot! In case there is more than one
26+
match, CSE now creates a stack slot that each match stores to, and replaces the redundant
27+
instruction with a loadfrom the stack slot. The stack slot is anonymous, which ensures
28+
that FixSSA will turn it into an optimal Phi graph or whatever.
29+
30+
This is a significant speed-up on Octane/richards.
31+
32+
* b3/B3DuplicateTails.cpp:
33+
* b3/B3EliminateCommonSubexpressions.cpp:
34+
* b3/B3FixSSA.cpp:
35+
(JSC::B3::fixSSA):
36+
* b3/B3Generate.cpp:
37+
(JSC::B3::generateToAir):
38+
* b3/B3Procedure.h:
39+
(JSC::B3::Procedure::setFrontendData):
40+
(JSC::B3::Procedure::frontendData):
41+
* b3/testb3.cpp:
42+
* ftl/FTLState.cpp:
43+
(JSC::FTL::State::State):
44+
145
2016-01-21 Filip Pizlo <fpizlo@apple.com>
246

347
Air should know that CeilDouble has the partial register stall issue

‎Source/JavaScriptCore/b3/B3DuplicateTails.cpp‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,6 @@ class DuplicateTails {
123123

124124
m_proc.resetReachability();
125125
m_proc.invalidateCFG();
126-
127-
if (verbose) {
128-
dataLog("Procedure just before SSA conversion:\n");
129-
dataLog(m_proc);
130-
}
131-
fixSSA(m_proc);
132126
}
133127

134128
private:

0 commit comments

Comments
 (0)