Message ID | CAFiYyc3LT16MaxHYzPdeDZAqPUA8G+bd=1P_U8Qo7h02403VVA@mail.gmail.com |
---|---|
State | New |
Headers | show |
On 12/08/2015 07:27 AM, Richard Biener wrote: >> >> I wonder if it makes more sense to integrate this with the >> domwalker itself. Add a constructor flag to it and do everything >> in itself. By letting the before_dom_children return a taken edge >> (or NULL if unknown) it can drive the outgoing edge marking. And >> the domwalk worker would simply not recurse to dom children for >> unreachable blocks. > > So interface-wise do [ ... ] Close :-) If skip_unreachable_blocks is true, then we want the walker to initialize EDGE_EXECUTABLE automatically. So we drop the member initialization and constructor body from domwalk.h and instead have a ctor in domwalk.c where we can initialize the private members and set EDGE_EXECUTABLE as needed. My first iteration let the clients clear EDGE_EXECUTABLE as they found conditionals that could be optimized. That was pretty clean and localized in sccvn & dom. If we have the before_dom_children return the taken edge, then we have to twiddle all the clients due to the api change in before_dom_children. . There's ~18 in total, so it's not too bad. 2 of the 18 clearly need to use the skip_unreachable_blocks capability (dom and sccvn). 2 others might be able to use it (tree-ssa-pre.c and tree-ssa-propagate.c) I converted dom and sccvn, but not pre and the generic propagation engine. I can submit the iteration which lets clients clear EDGE_EXECUTABLE, or the iteration where the clients return the taken edge (or NULL) from the before_dom_children callback. Either is fine with me, so if you have a preference, let me know. jeff
On Wed, Dec 9, 2015 at 9:31 AM, Jeff Law <law@redhat.com> wrote: > On 12/08/2015 07:27 AM, Richard Biener wrote: >>> >>> >>> I wonder if it makes more sense to integrate this with the >>> domwalker itself. Add a constructor flag to it and do everything >>> in itself. By letting the before_dom_children return a taken edge >>> (or NULL if unknown) it can drive the outgoing edge marking. And >>> the domwalk worker would simply not recurse to dom children for >>> unreachable blocks. >> >> >> So interface-wise do > > [ ... ] > Close :-) > > If skip_unreachable_blocks is true, then we want the walker to initialize > EDGE_EXECUTABLE automatically. So we drop the member initialization and > constructor body from domwalk.h and instead have a ctor in domwalk.c where > we can initialize the private members and set EDGE_EXECUTABLE as needed. > > My first iteration let the clients clear EDGE_EXECUTABLE as they found > conditionals that could be optimized. That was pretty clean and localized > in sccvn & dom. > > If we have the before_dom_children return the taken edge, then we have to > twiddle all the clients due to the api change in before_dom_children. . > There's ~18 in total, so it's not too bad. > > 2 of the 18 clearly need to use the skip_unreachable_blocks capability (dom > and sccvn). 2 others might be able to use it (tree-ssa-pre.c and > tree-ssa-propagate.c) I converted dom and sccvn, but not pre and the > generic propagation engine. > > I can submit the iteration which lets clients clear EDGE_EXECUTABLE, or the > iteration where the clients return the taken edge (or NULL) from the > before_dom_children callback. > > Either is fine with me, so if you have a preference, let me know. Return the taken edge. Richard. > jeff
Index: gcc/domwalk.h =================================================================== --- gcc/domwalk.h (revision 231396) +++ gcc/domwalk.h (working copy) @@ -30,13 +30,16 @@ along with GCC; see the file COPYING3. class dom_walker { public: - dom_walker (cdi_direction direction) : m_dom_direction (direction) {} + dom_walker (cdi_direction direction, + bool skip_unreachable_blocks = false) + : m_dom_direction (direction), + m_skip_unreachable_blocks (skip_unreachable_blocks) {} /* Walk the dominator tree. */ void walk (basic_block); /* Function to call before the recursive walk of the dominator children. */ - virtual void before_dom_children (basic_block) {} + virtual edge before_dom_children (basic_block) {} /* Function to call after the recursive walk of the dominator children. */ virtual void after_dom_children (basic_block) {} @@ -47,6 +50,7 @@ private: if it is set to CDI_POST_DOMINATORS, then we walk the post dominator tree. */ const ENUM_BITFIELD (cdi_direction) m_dom_direction : 2; + const bool m_skip_unreachable_blocks; }; #endif