Mar 22, 2013 - Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland LeiÃa, Christoph Mallon and. Andreas Zwinkau â Simple and Efficient ...
saarland university
computer science
Simple and Efficient Construction of Static Single Assignment Form Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau Institute for Program Structures and Data Organization, Karlsruhe Institute of Technology (KIT)
1
March 22, 2013 Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and KIT – University of the State of Baden-Wuerttemberg and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form National Research Center of the Helmholtz Association
IPD
www.kit.edu
Modern Intermediate Representations
Optimization
Optimization SSA
AST
non-SSA
Two-phase approach: Construct non-SSA intermediate representation from AST Compute dominance tree Compute liveness
Construct SSA form
2
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Simple and Efficient SSA Construction
Optimization
Optimization SSA
AST
non-SSA
Our SSA construction algorithm Requires no prior analysis Constructs SSA form directly from AST
3
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Straight-Line Code
Data structure: For each basic block: Mapping Variables → Values Code:
a = 42; b = a; a = a + b;
4
March 22, 2013
IR:
v0 : 42
Mapping:
"a" 7→ v0
v1 : v0 + v0
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Straight-Line Code
Data structure: For each basic block: Mapping Variables → Values Code:
a = 42; b = a; a = a + b;
4
March 22, 2013
IR:
v0 : 42
Mapping:
"a" 7→ v0 "b" 7→ v0
v1 : v0 + v0
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Straight-Line Code
Data structure: For each basic block: Mapping Variables → Values Code:
a = 42; b = a; a = a + b;
4
March 22, 2013
IR:
v0 : 42
Mapping:
"a" 7→ v0 "b" 7→ v0
v1 : v0 + v0
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Straight-Line Code
Data structure: For each basic block: Mapping Variables → Values Code:
a = 42; b = a; a = a + b;
4
March 22, 2013
IR:
v0 : 42
Mapping:
"a" 7→ v1 "b" 7→ v0
v1 : v0 + v0
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Properties of Basic Blocks
Filled
All code of this block has already been constructed Existing mapping will not change Sealed The block is connected to all its direct control flow predecessors All direct control flow predecessors are filled
5
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
v0 : ...
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
v0 : ...
while
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
v0 : ...
while
if
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
v0 : ...
while
if
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
v0 : ...
while
if
then
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
v0 : ...
while
if
then
v1 : ...
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
v0 : ...
while
if
then
v1 : ...
endif
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
v0 : ...
while
if
then
v1 : ...
use(v? )
endif
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
v0 : ...
while
if
then
v1 : ... v2 : φ(v? , v? ) use(v? ) endif
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
v0 : ...
while
if
then
v1 : ... v2 : φ(v1 , v? ) use(v? ) endif
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
while
v0 : ...
v3 :• if
then
v1 : ... v2 : φ(v1 , v3 ) use(v? ) endif
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
while
v0 : ...
v3 :• if
then
v1 : ... v2 : φ(v1 , v3 ) use(v2 ) endif
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
while
v0 : ...
v3 :• if
then
v1 : ... v2 : φ(v1 , v3 ) use(v2 ) endif
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
while
v0 : ...
v3 :• if
then
v1 : ... v2 : φ(v1 , v3 ) use(v2 ) endif
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
while
v0 : ...
v3 : φ(v? , v? ) if
then
v1 : ... v2 : φ(v1 , v3 ) use(v2 ) endif
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
while
v0 : ...
v3 : φ(v0 , v? ) if
then
v1 : ... v2 : φ(v1 , v3 ) use(v2 ) endif
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
while
v0 : ...
v3 : φ(v0 , v2 ) if
then
v1 : ... v2 : φ(v1 , v3 ) use(v2 ) endif
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
while
v0 : ...
v3 : φ(v0 , v2 ) if
then
end
v1 : ... v2 : φ(v1 , v3 ) use(v2 ) endif
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
while
v0 : ...
v3 : φ(v0 , v2 ) if
then
end
use(v? )
v1 : ... v2 : φ(v1 , v3 ) use(v2 ) endif
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Handling Multiple Basic Blocks start
void foo(void) { x = ... while (...) { if (...) { x = ... } use(x) } use(x) }
while
v0 : ...
v3 : φ(v0 , v2 ) if
then
end
use(v3 )
v1 : ... v2 : φ(v1 , v3 ) use(v2 ) endif
Filled: Inserted all instructions Sealed: Connected to all direct predecessors 6
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Guarantees for Constructed SSA Form
7
Pruned SSA form No dead φ functions.
X
Minimal SSA form (Cytron et al.) φ functions only occur at iterated dominance frontiers.
?
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Trivial φ Functions
v0 : ...
v0 : ...
v1 : φ(v0 , v1 ) v1 : φ(v0 , v0 ) use(v1 )
use(v1 )
Trivial φ function Just references one value (except itself)
8
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Optimization of Trivial φ Functions
v
v
φ1
φ1
v
φ0
Optimization of trivial φ functions Replace trivial φ function by its unique operand Iterative approach to remove all trivial φ functions
9
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Guarantees for Constructed SSA Form
Theorem A program in SSA form with a reducible control flow graph without any trivial φ functions is in minimal SSA form.
Pruned SSA form No dead φ functions.
X
Minimal SSA form (Cytron et al.) φ functions only occur at iterated dominance frontiers.
X
∗
∗ for Java and most C programs
10
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Irreducible Control Flow v0 : ... v0 v1 : φ(v0 ,v2 ) φ1
φ2
v2 : φ(v0 ,v1 ) use use(v2 ) Redundant set of φ functions Generalization of trivial φ functions Just reference one value (except themselves)
11
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Redundant φ Functions and SCCs
v
φ0
φ1
φ2
Lemma Let P be a redundant set of φ functions. Then there is a strongly connected component S ⊆ P that is also redundant.
12
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Optimization of Redundant φ Functions x
y
x
y
φ0
φ0
φ1
φ1
φ2
φ2
x
y φ0
Algorithm to find all redundant φ functions Use Tarjan’s algorithm to find φ-SCCs of maximum size If SCC is not redundant: Check for redundant inner SCC 13
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
New Criterion for Minimal SSA Form
Definition (Minimal SSA form (SCC)) A program is in minimal SSA form if it contains no redundant φ-SCCs. Advantages Independent of the source program Implies Cytron et al.’s criterion
14
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Optimizations and φ-SCCs
start
void foo(void) { x = 42 while (...) { if (...) { x = 42 } use(x) } use(x) }
15
March 22, 2013
while
v0 : 42
v3 : φ(v0 , v2 ) if
then
end
use(v3 )
v1 : 42 v2 : φ(v1 , v3 ) use(v2 ) endif
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Guarantees for Constructed SSA Form
Pruned SSA form No dead φ functions.
X
Minimal SSA form (Cytron et al.) φ functions only occur at iterated dominance frontiers.
X
Minimal SSA form (SCC) No redundant φ-SCC.
X
Can we have even fewer φ functions?
16
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
On-the-Fly Optimizations
int bar(int x) { int mask = 0; int res; if (x & mask) { res = 0; } else { res = x; } return res;
v0 : x v1 : 0 v2 : v0 & v1 v3 : v2 6= 0 condjump v3
v5 : φ(v1 ,v0 ) return v5
}
17
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
On-the-Fly Optimizations
int bar(int x) { int mask = 0; int res;
v0 : x
if (x & mask) { res = 0; } else { res = x; } return res;
v0 : x v1 : 0 v2 : v0 & v1 v3 : v2 6= 0 condjump v3
v5 : φ(v1 ,v0 ) return v5
}
17
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
On-the-Fly Optimizations
int bar(int x) { int mask = 0; int res;
v0 : x v1 : 0
if (x & mask) { res = 0; } else { res = x; } return res;
v0 : x v1 : 0 v2 : v0 & v1 v3 : v2 6= 0 condjump v3
v5 : φ(v1 ,v0 ) return v5
}
17
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
On-the-Fly Optimizations
int bar(int x) { int mask = 0; int res; if (x & mask) { res = 0; } else { res = x; }
v0 : x v1 : 0 v3 : false
return res;
v0 : x v1 : 0 v2 : v0 & v1 v3 : v2 6= 0 condjump v3
v5 : φ(v1 ,v0 ) return v5
}
17
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
On-the-Fly Optimizations
int bar(int x) { int mask = 0; int res; if (x & mask) { res = 0; } else { res = x; }
v0 : x v1 : 0 v3 : false
return res;
v0 : x v1 : 0 v2 : v0 & v1 v3 : v2 6= 0 condjump v3
v5 : φ(v1 ,v0 ) return v5
}
17
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
On-the-Fly Optimizations
int bar(int x) { int mask = 0; int res; if (x & mask) { res = 0; } else { res = x; } return res;
v0 : x v1 : 0 v3 : false
return v0
v0 : x v1 : 0 v2 : v0 & v1 v3 : v2 6= 0 condjump v3
v5 : φ(v1 ,v0 ) return v5
}
17
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Evaluation Setup
Setup to evaluate our SSA construction algorithm Full-fledged implementation in cparser/libFirm Proof-of-concept implementation in clang/LLVM Comparison against existing SSA construction algorithm Sreedhar and Gao Better than Cytron et al. Highly-tuned implementation
C programs of SPEC CINT2000 benchmark
18
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Number of Constructed IR Instructions Benchmark 164.gzip 175.vpr 176.gcc 181.mcf 186.crafty 197.parser 253.perlbmk 254.gap 255.vortex 256.bzip2 300.twolf
non-SSA SSA
LLVM non-SSA
SSA
12,038 40,701 516,537 3,988 44,891 30,237 185,576 201,185 126,097 8,605 76,078
9,187 27,155 395,652 2,613 36,050 20,485 140,489 149,755 88,257 6,012 58,737
Average 19
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
131% 150% 131% 153% 125% 148% 132% 134% 143% 143% 130% 138% IPD
Quality Comparison Benchmark
20
Number of φ functions
Redundant φ-SCCs
LLVM
Our
∆
Optimization
Irreducible
164.gzip 175.vpr 176.gcc 181.mcf 186.crafty 197.parser 253.perlbmk 254.gap 255.vortex 256.bzip2 300.twolf
594 1,201 12,904 154 1,466 1,243 5,840 9,325 2,739 359 2,849
594 1,201 12,910 154 1,466 1,243 5,857 9,326 2,737 359 2,849
0 0 6 0 0 0 17 1 2 0 0
0 0 2 0 0 0 0 0 1 0 0
0 0 3 0 0 0 5 0 0 0 0
Sum
38,674
38,696
22
3
8
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Compilation Speed Benchmark
LLVM
Our
Our LLVM
164.gzip 175.vpr 176.gcc 181.mcf 186.crafty 197.parser 253.perlbmk 254.gap 255.vortex 256.bzip2 300.twolf
969,233,677 3,039,801,575 25,935,984,569 722,918,540 3,653,881,430 2,084,205,254 12,246,953,644 8,358,757,289 7,841,416,740 569,176,687 6,424,027,368
967,798,047 3,025,286,080 26,009,545,723 722,507,455 3,632,605,590 2,068,075,482 12,062,833,383 8,339,871,545 7,845,699,772 564,577,209 6,408,289,297
99.85% 99.52% 100.28% 99.94% 99.42% 99.23% 98.50% 99.77% 100.05% 99.19% 99.76%
Average
21
March 22, 2013
99.59%
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD
Conclusion
Summary Simple SSA construction algorithm: 375 LOC vs. 1141 LOC Guarantees minimal and pruned SSA form Can reuse conservative optimizations New criterion for minimal SSA form A lot more in the paper
Give it a try!
22
March 22, 2013
Matthias Braun, Sebastian Buchwald, Sebastian Hack, Roland Leißa, Christoph Mallon and Andreas Zwinkau – Simple and Efficient Construction of Static Single Assignment Form
IPD