SlideShare a Scribd company logo
1 of 18
Download to read offline
Value Numbering in GCC
Dr. Richard Biener
SUSE Labs, Sep 15th, 2022
Value Numbering
I Assign value numbers to expressions
I Expressions that produce the same value should have the same
value number
I Usually achieved by hashing of simplified and canonicalized
expressions with operands replaced by their value number
Value Numbering in GCC
Multiple value numbering implementations and their main users
I RTL CSE (cselib)
I RTL PRE
I GIMPLE SSA DOM (scoped tables)
I GIMPLE SSA FRE/PRE (RPO VN)
I simpler forms of VN in CCP and copy propagation
Common Subexpression Elimination
For each statement
I try to simplify the computed expression using value numbers of
the operands
I lookup value number of the simplified expression
I if found and a register with that value is available, replace the
expression with the register or constant
I if not found, record a new value number for it and make it
available in the destination receiving the value of the expression
Availability
Different ways to track, update and query availability of a so called
leader for a value number
I with a DOM walk a value to leader map can be kept
up-to-date with an unwind stack
I the RPO VN walk records a list of leaders for each value that
can be unwound when iterating and otherwise queried with
dominator checks
Availability and expression simplification
I use match.pd based simplification
I value expression operands get substituted with their leaders
I allows to keep flow-sensitive info like ranges
Memory Expressions
ENTRY
<bb 2>:
# .MEM_3 = VDEF <.MEM_1(D)>
p_2(D)->a = 0;
# .MEM_4 = VDEF <.MEM_3>
p_2(D)->b = 1;
# .MEM_5 = VDEF <.MEM_4>
x = *p_2(D);
# VUSE <.MEM_5>
_6 = x.a;
# .MEM_7 = VDEF <.MEM_5>
x ={v} {CLOBBER(eol)};
# VUSE <.MEM_7>
return _6;
Memory Expressions
I memory state is part of hashing, the current .MEM_n virtual
definition is used
I at lookup time walk the virtual SSA use->def chains, skip
clobbers that do not alias and perform lookups with the
previous memory state
I fancy tricks during walking
I memory to memory copies
I pieces from larger entities
I larger objects formed from smaller entities
I memory handling consumes the majority of compile time
Why RPO VN
I SSA SCC VN
I reduces what to iterate
I difficult to mate with CFG: not executable parts, predication,
equivalences, region
I RPO VN
I iteration more costly
I maps to the CFG, allows for flow-sensitive optimizations easily
I allows region-based operation
RPO VN Operation Modes
I can operate with different effort for memory handling
I can do optimistic, iterating VN with elimination done after the
fact
I can do non-iterating VN with immediate elimination
I can operate on the whole function or a single entry, multiple
exit region
Iterating vs non-Iterating
loop 1
<bb 3>:
# i_1 = PHI <i_4(2), i_7(3)>
# val_2 = PHI <val_5(2), val_6(3)>
val_6 = val_2 + 1;
i_7 = i_1 + 1;
if (i_7 < n_3)
goto <bb 3>; [INV]
else
goto <bb 4>; [INV]
<bb 4>:
_8 = val_6;
return _8;
ENTRY
<bb 2>:
n_3 = 1;
i_4 = 0;
val_5 = 0;
Iteration scheme
I SSA SCC based VN iterates SSA SCCs until nothing changes
I RPO VN iterates CFG cycles
I rev_post_order_and_mark_dfs_back_seme can compute a
RPO with CFG cycles adjacent and their extent in the RPO
array recorded
I handles irreducible regions, loop info would not
I optimal regions for iteration
I avoid iteration when possible, do not iterate until nothing
changes
I unwind cost to the iteration point linear with the amound of
things to undo (expression hashes, availability)
I iteration itself is O(n * loop-depth), inner cycles are iterated
fully before iterating outer cycles
Non-iterative mode
I Greedy walk along edges discovered as executable, but
enforcing RPO visiting of reachable blocks.
I Predecessors not visited and reachable from blocks later in
RPO have to be conservatively assumed reachable.
I Handles PHIs with unreachable incoming non-back edges
optimally
RPO VN as Utility
RPO VN was designed to be usable on small regions of a function
without much overhead when doing that very often and with being
much cheaper than a pass over the whole function.
I loop unrolling applies CSE on unrolled bodies before trying to
unroll the containing loop
I loop if-conversion applies CSE to optimize predicates
I unroll-and-jam applies CSE to leverage cross loop redundancies
I uninit analysis uses RPO VN to compute basic block
reachability without performing actual CSE
RPO VN Utility API
enum vn_lookup_kind { VN_NOWALK, VN_WALK, VN_WALKREWRITE };
unsigned do_rpo_vn
(function *fun, edge entry, bitmap exits,
/* iterate */ bool = false, /* eliminate */ bool = true
vn_lookup_kind = VN_WALKREWRITE);
rev_post_order_and_mark_dfs_back_seme
(function *fn, edge entry, bitmap exit_bbs,
bool for_iteration, int *rev_post_order,
vec<std::pair<int, int> > *scc_ext);
auto_bb_flag, auto_edge_flag
RPO VN Utility Efficiency
Non-iterating region-based VN with or without elimination was
designed to be efficient
I startup cost linear in the size of the region
I performing RPO VN with VN_NOWALK, without iteration
and elimination on each basic-block individually vs. performing
a single RPO VN on the whole function is only around 15%
slower for cc1files with insn-attrtab.i being the outlier at 280%
I more elaborate memory handling or doing elimination does not
allow for an apples vs. apples comparison
I while doing CSE on the whole function might perform more
optimizations doing that should never be faster than only doing
CSE on the regions a pass performed a transformation on
TODO
I experiment with using ranger instead of the ad-hoc predication
we have
I review equivalence tracking changes
I think of a cheaper way to do “iteration”
I we have simple DCE with a SSA worklist, need region
DCE/DSE
Questions?

More Related Content

Similar to 2022 Cauldron Value Numbering for gcc versions

07 140430-ipp-languages used in llvm during compilation
07 140430-ipp-languages used in llvm during compilation07 140430-ipp-languages used in llvm during compilation
07 140430-ipp-languages used in llvm during compilationAdam Husár
 
Inside AOStA
Inside AOStAInside AOStA
Inside AOStAESUG
 
Functional Smalltalk
Functional SmalltalkFunctional Smalltalk
Functional SmalltalkESUG
 
C++ code, please help! RESPOND W COMPLETED CODE PLEASE, am using V.pdf
C++ code, please help! RESPOND W COMPLETED CODE PLEASE,  am using V.pdfC++ code, please help! RESPOND W COMPLETED CODE PLEASE,  am using V.pdf
C++ code, please help! RESPOND W COMPLETED CODE PLEASE, am using V.pdfrahulfancycorner21
 
Data structures &amp;algorithms
Data structures &amp;algorithmsData structures &amp;algorithms
Data structures &amp;algorithmsNur Saleha
 
Migrating PriceChirp to Rails 3.0: The Pain Points
Migrating PriceChirp to Rails 3.0: The Pain PointsMigrating PriceChirp to Rails 3.0: The Pain Points
Migrating PriceChirp to Rails 3.0: The Pain PointsSteven Evatt
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial javaTpoint s
 
Pointers and call by value, reference, address in C
Pointers and call by value, reference, address in CPointers and call by value, reference, address in C
Pointers and call by value, reference, address in CSyed Mustafa
 
03 and 04 .Operators, Expressions, working with the console and conditional s...
03 and 04 .Operators, Expressions, working with the console and conditional s...03 and 04 .Operators, Expressions, working with the console and conditional s...
03 and 04 .Operators, Expressions, working with the console and conditional s...Intro C# Book
 

Similar to 2022 Cauldron Value Numbering for gcc versions (20)

Pl sql programme
Pl sql programmePl sql programme
Pl sql programme
 
Plsql
PlsqlPlsql
Plsql
 
07 140430-ipp-languages used in llvm during compilation
07 140430-ipp-languages used in llvm during compilation07 140430-ipp-languages used in llvm during compilation
07 140430-ipp-languages used in llvm during compilation
 
Lecture06
Lecture06Lecture06
Lecture06
 
Inside AOStA
Inside AOStAInside AOStA
Inside AOStA
 
Compiler Design- Machine Independent Optimizations
Compiler Design- Machine Independent OptimizationsCompiler Design- Machine Independent Optimizations
Compiler Design- Machine Independent Optimizations
 
Functional Smalltalk
Functional SmalltalkFunctional Smalltalk
Functional Smalltalk
 
C++ code, please help! RESPOND W COMPLETED CODE PLEASE, am using V.pdf
C++ code, please help! RESPOND W COMPLETED CODE PLEASE,  am using V.pdfC++ code, please help! RESPOND W COMPLETED CODE PLEASE,  am using V.pdf
C++ code, please help! RESPOND W COMPLETED CODE PLEASE, am using V.pdf
 
Message in a bottle
Message in a bottleMessage in a bottle
Message in a bottle
 
Data structures &amp;algorithms
Data structures &amp;algorithmsData structures &amp;algorithms
Data structures &amp;algorithms
 
Migrating PriceChirp to Rails 3.0: The Pain Points
Migrating PriceChirp to Rails 3.0: The Pain PointsMigrating PriceChirp to Rails 3.0: The Pain Points
Migrating PriceChirp to Rails 3.0: The Pain Points
 
Object Oriented Programming with C++
Object Oriented Programming with C++Object Oriented Programming with C++
Object Oriented Programming with C++
 
C++InputOutput.PPT
C++InputOutput.PPTC++InputOutput.PPT
C++InputOutput.PPT
 
Headless Js Testing
Headless Js TestingHeadless Js Testing
Headless Js Testing
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial
 
Profiling Ruby
Profiling RubyProfiling Ruby
Profiling Ruby
 
Pointers and call by value, reference, address in C
Pointers and call by value, reference, address in CPointers and call by value, reference, address in C
Pointers and call by value, reference, address in C
 
03 and 04 .Operators, Expressions, working with the console and conditional s...
03 and 04 .Operators, Expressions, working with the console and conditional s...03 and 04 .Operators, Expressions, working with the console and conditional s...
03 and 04 .Operators, Expressions, working with the console and conditional s...
 
Operators
OperatorsOperators
Operators
 
Programming in c by pkv
Programming in c by pkvProgramming in c by pkv
Programming in c by pkv
 

More from ssuser866937

GNU Toolchain Infrastructure at gcc cauldron
GNU Toolchain Infrastructure at gcc cauldronGNU Toolchain Infrastructure at gcc cauldron
GNU Toolchain Infrastructure at gcc cauldronssuser866937
 
Ctrl-C redesign for gcc cauldron in 2022 in prague
Ctrl-C redesign for gcc cauldron in 2022 in pragueCtrl-C redesign for gcc cauldron in 2022 in prague
Ctrl-C redesign for gcc cauldron in 2022 in praguessuser866937
 
cauldron-2022-docs-bof at gcc cauldron in 2022
cauldron-2022-docs-bof at gcc cauldron in 2022cauldron-2022-docs-bof at gcc cauldron in 2022
cauldron-2022-docs-bof at gcc cauldron in 2022ssuser866937
 
Cauldron_2022_ctf_frame at gcc cauldron 2022 in prague
Cauldron_2022_ctf_frame at gcc cauldron 2022 in pragueCauldron_2022_ctf_frame at gcc cauldron 2022 in prague
Cauldron_2022_ctf_frame at gcc cauldron 2022 in praguessuser866937
 
BoF-OpenMP-OpenACC-Offloading-Cauldron2022.pdf
BoF-OpenMP-OpenACC-Offloading-Cauldron2022.pdfBoF-OpenMP-OpenACC-Offloading-Cauldron2022.pdf
BoF-OpenMP-OpenACC-Offloading-Cauldron2022.pdfssuser866937
 
Anatomy of ROCgdb presentation at gcc cauldron 2022
Anatomy of ROCgdb presentation at gcc cauldron 2022Anatomy of ROCgdb presentation at gcc cauldron 2022
Anatomy of ROCgdb presentation at gcc cauldron 2022ssuser866937
 
2022-ranger-update-Cauldron for gcc versions
2022-ranger-update-Cauldron for gcc versions2022-ranger-update-Cauldron for gcc versions
2022-ranger-update-Cauldron for gcc versionsssuser866937
 
2022-Cauldron-If-Conversion-for-a-Partially-Predicated-VLIW-Architecture.pdf
2022-Cauldron-If-Conversion-for-a-Partially-Predicated-VLIW-Architecture.pdf2022-Cauldron-If-Conversion-for-a-Partially-Predicated-VLIW-Architecture.pdf
2022-Cauldron-If-Conversion-for-a-Partially-Predicated-VLIW-Architecture.pdfssuser866937
 
2022 Cauldron analyzer talk from david malcolm
2022 Cauldron analyzer talk from david malcolm2022 Cauldron analyzer talk from david malcolm
2022 Cauldron analyzer talk from david malcolmssuser866937
 
OpenMP-OpenACC-Offload-Cauldron2022-1.pdf
OpenMP-OpenACC-Offload-Cauldron2022-1.pdfOpenMP-OpenACC-Offload-Cauldron2022-1.pdf
OpenMP-OpenACC-Offload-Cauldron2022-1.pdfssuser866937
 
cs.ds-2211.13454.pdf
cs.ds-2211.13454.pdfcs.ds-2211.13454.pdf
cs.ds-2211.13454.pdfssuser866937
 

More from ssuser866937 (11)

GNU Toolchain Infrastructure at gcc cauldron
GNU Toolchain Infrastructure at gcc cauldronGNU Toolchain Infrastructure at gcc cauldron
GNU Toolchain Infrastructure at gcc cauldron
 
Ctrl-C redesign for gcc cauldron in 2022 in prague
Ctrl-C redesign for gcc cauldron in 2022 in pragueCtrl-C redesign for gcc cauldron in 2022 in prague
Ctrl-C redesign for gcc cauldron in 2022 in prague
 
cauldron-2022-docs-bof at gcc cauldron in 2022
cauldron-2022-docs-bof at gcc cauldron in 2022cauldron-2022-docs-bof at gcc cauldron in 2022
cauldron-2022-docs-bof at gcc cauldron in 2022
 
Cauldron_2022_ctf_frame at gcc cauldron 2022 in prague
Cauldron_2022_ctf_frame at gcc cauldron 2022 in pragueCauldron_2022_ctf_frame at gcc cauldron 2022 in prague
Cauldron_2022_ctf_frame at gcc cauldron 2022 in prague
 
BoF-OpenMP-OpenACC-Offloading-Cauldron2022.pdf
BoF-OpenMP-OpenACC-Offloading-Cauldron2022.pdfBoF-OpenMP-OpenACC-Offloading-Cauldron2022.pdf
BoF-OpenMP-OpenACC-Offloading-Cauldron2022.pdf
 
Anatomy of ROCgdb presentation at gcc cauldron 2022
Anatomy of ROCgdb presentation at gcc cauldron 2022Anatomy of ROCgdb presentation at gcc cauldron 2022
Anatomy of ROCgdb presentation at gcc cauldron 2022
 
2022-ranger-update-Cauldron for gcc versions
2022-ranger-update-Cauldron for gcc versions2022-ranger-update-Cauldron for gcc versions
2022-ranger-update-Cauldron for gcc versions
 
2022-Cauldron-If-Conversion-for-a-Partially-Predicated-VLIW-Architecture.pdf
2022-Cauldron-If-Conversion-for-a-Partially-Predicated-VLIW-Architecture.pdf2022-Cauldron-If-Conversion-for-a-Partially-Predicated-VLIW-Architecture.pdf
2022-Cauldron-If-Conversion-for-a-Partially-Predicated-VLIW-Architecture.pdf
 
2022 Cauldron analyzer talk from david malcolm
2022 Cauldron analyzer talk from david malcolm2022 Cauldron analyzer talk from david malcolm
2022 Cauldron analyzer talk from david malcolm
 
OpenMP-OpenACC-Offload-Cauldron2022-1.pdf
OpenMP-OpenACC-Offload-Cauldron2022-1.pdfOpenMP-OpenACC-Offload-Cauldron2022-1.pdf
OpenMP-OpenACC-Offload-Cauldron2022-1.pdf
 
cs.ds-2211.13454.pdf
cs.ds-2211.13454.pdfcs.ds-2211.13454.pdf
cs.ds-2211.13454.pdf
 

Recently uploaded

Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubaikojalkojal131
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...SUHANI PANDEY
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge GraphsEleniIlkou
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Call Girls in Nagpur High Profile
 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...SUHANI PANDEY
 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceEscorts Call Girls
 
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...nilamkumrai
 
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...tanu pandey
 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...SUHANI PANDEY
 
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋nirzagarg
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"growthgrids
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...tanu pandey
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)Delhi Call girls
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtrahman018755
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.soniya singh
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLimonikaupta
 

Recently uploaded (20)

Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
 
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
 
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
 
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 

2022 Cauldron Value Numbering for gcc versions

  • 1. Value Numbering in GCC Dr. Richard Biener SUSE Labs, Sep 15th, 2022
  • 2. Value Numbering I Assign value numbers to expressions I Expressions that produce the same value should have the same value number I Usually achieved by hashing of simplified and canonicalized expressions with operands replaced by their value number
  • 3. Value Numbering in GCC Multiple value numbering implementations and their main users I RTL CSE (cselib) I RTL PRE I GIMPLE SSA DOM (scoped tables) I GIMPLE SSA FRE/PRE (RPO VN) I simpler forms of VN in CCP and copy propagation
  • 4. Common Subexpression Elimination For each statement I try to simplify the computed expression using value numbers of the operands I lookup value number of the simplified expression I if found and a register with that value is available, replace the expression with the register or constant I if not found, record a new value number for it and make it available in the destination receiving the value of the expression
  • 5. Availability Different ways to track, update and query availability of a so called leader for a value number I with a DOM walk a value to leader map can be kept up-to-date with an unwind stack I the RPO VN walk records a list of leaders for each value that can be unwound when iterating and otherwise queried with dominator checks
  • 6. Availability and expression simplification I use match.pd based simplification I value expression operands get substituted with their leaders I allows to keep flow-sensitive info like ranges
  • 7. Memory Expressions ENTRY <bb 2>: # .MEM_3 = VDEF <.MEM_1(D)> p_2(D)->a = 0; # .MEM_4 = VDEF <.MEM_3> p_2(D)->b = 1; # .MEM_5 = VDEF <.MEM_4> x = *p_2(D); # VUSE <.MEM_5> _6 = x.a; # .MEM_7 = VDEF <.MEM_5> x ={v} {CLOBBER(eol)}; # VUSE <.MEM_7> return _6;
  • 8. Memory Expressions I memory state is part of hashing, the current .MEM_n virtual definition is used I at lookup time walk the virtual SSA use->def chains, skip clobbers that do not alias and perform lookups with the previous memory state I fancy tricks during walking I memory to memory copies I pieces from larger entities I larger objects formed from smaller entities I memory handling consumes the majority of compile time
  • 9. Why RPO VN I SSA SCC VN I reduces what to iterate I difficult to mate with CFG: not executable parts, predication, equivalences, region I RPO VN I iteration more costly I maps to the CFG, allows for flow-sensitive optimizations easily I allows region-based operation
  • 10. RPO VN Operation Modes I can operate with different effort for memory handling I can do optimistic, iterating VN with elimination done after the fact I can do non-iterating VN with immediate elimination I can operate on the whole function or a single entry, multiple exit region
  • 11. Iterating vs non-Iterating loop 1 <bb 3>: # i_1 = PHI <i_4(2), i_7(3)> # val_2 = PHI <val_5(2), val_6(3)> val_6 = val_2 + 1; i_7 = i_1 + 1; if (i_7 < n_3) goto <bb 3>; [INV] else goto <bb 4>; [INV] <bb 4>: _8 = val_6; return _8; ENTRY <bb 2>: n_3 = 1; i_4 = 0; val_5 = 0;
  • 12. Iteration scheme I SSA SCC based VN iterates SSA SCCs until nothing changes I RPO VN iterates CFG cycles I rev_post_order_and_mark_dfs_back_seme can compute a RPO with CFG cycles adjacent and their extent in the RPO array recorded I handles irreducible regions, loop info would not I optimal regions for iteration I avoid iteration when possible, do not iterate until nothing changes I unwind cost to the iteration point linear with the amound of things to undo (expression hashes, availability) I iteration itself is O(n * loop-depth), inner cycles are iterated fully before iterating outer cycles
  • 13. Non-iterative mode I Greedy walk along edges discovered as executable, but enforcing RPO visiting of reachable blocks. I Predecessors not visited and reachable from blocks later in RPO have to be conservatively assumed reachable. I Handles PHIs with unreachable incoming non-back edges optimally
  • 14. RPO VN as Utility RPO VN was designed to be usable on small regions of a function without much overhead when doing that very often and with being much cheaper than a pass over the whole function. I loop unrolling applies CSE on unrolled bodies before trying to unroll the containing loop I loop if-conversion applies CSE to optimize predicates I unroll-and-jam applies CSE to leverage cross loop redundancies I uninit analysis uses RPO VN to compute basic block reachability without performing actual CSE
  • 15. RPO VN Utility API enum vn_lookup_kind { VN_NOWALK, VN_WALK, VN_WALKREWRITE }; unsigned do_rpo_vn (function *fun, edge entry, bitmap exits, /* iterate */ bool = false, /* eliminate */ bool = true vn_lookup_kind = VN_WALKREWRITE); rev_post_order_and_mark_dfs_back_seme (function *fn, edge entry, bitmap exit_bbs, bool for_iteration, int *rev_post_order, vec<std::pair<int, int> > *scc_ext); auto_bb_flag, auto_edge_flag
  • 16. RPO VN Utility Efficiency Non-iterating region-based VN with or without elimination was designed to be efficient I startup cost linear in the size of the region I performing RPO VN with VN_NOWALK, without iteration and elimination on each basic-block individually vs. performing a single RPO VN on the whole function is only around 15% slower for cc1files with insn-attrtab.i being the outlier at 280% I more elaborate memory handling or doing elimination does not allow for an apples vs. apples comparison I while doing CSE on the whole function might perform more optimizations doing that should never be faster than only doing CSE on the regions a pass performed a transformation on
  • 17. TODO I experiment with using ranger instead of the ad-hoc predication we have I review equivalence tracking changes I think of a cheaper way to do “iteration” I we have simple DCE with a SSA worklist, need region DCE/DSE