Erick, I assume that this needs to be done on all the functions since you mention "cfun".
Gary ________________________________ From: Erick Ochoa <erick.oc...@theobroma-systems.com> Sent: Monday, September 14, 2020 12:10 AM To: Gary Oblock <g...@amperecomputing.com>; gcc@gcc.gnu.org <gcc@gcc.gnu.org> Subject: Re: Dominance information problem [EXTERNAL EMAIL NOTICE: This email originated from an external sender. Please be mindful of safe email handling and proprietary information protection practices.] Hi Gary, I'm not 100% sure this will fix the problem, but in the past I have had to call the following function: /* If dominator info is not available, we need to calculate it. */ if (!dom_info_available_p (CDI_DOMINATORS)) calculate_dominance_info (CDI_DOMINATORS); Basically dominance information was not available for cfun. Also, you might also need to call: if (dom_info_available_p (CDI_DOMINATORS)) free_dominance_info (CDI_DOMINATORS); Just before your pass is done. These were some calls I needed to make in a different pass when I was working with dominators. On 12/09/2020 09:26, Gary Oblock wrote: > I'm trying to do performance qualification for my structure > reorganization optimization. > > I'm doing pretty straightforward stuff and I haven't at this point in > time (qualifying the optimization,) modified the program. So I'm a > little surprised this is failing. Here is the code that's failing on > the first iteration of the for loops: > > struct cgraph_node *node; > FOR_EACH_FUNCTION_WITH_GIMPLE_BODY ( node) { > struct function *func = DECL_STRUCT_FUNCTION ( node->decl); > push_cfun ( func); > > class loop *loop; > FOR_EACH_LOOP_FN ( func, loop, LI_ONLY_INNERMOST ) > { > size_t num_bbs = loop->num_nodes; > basic_block *bbs = get_loop_body ( loop); // FAILS HERE!!! > : > stuff never reached > > How it's failing (in code from dominance.c) I'm guessing tells me the > dominance information is messed up (unlikely) or needs to be > recomputed. If I'm not wrong, how do I go about doing the later???? > > /* Return TRUE in case BB1 is dominated by BB2. */ > bool > dominated_by_p (enum cdi_direction dir, const_basic_block bb1, > const_basic_block bb2) > { > unsigned int dir_index = dom_convert_dir_to_idx (dir); > struct et_node *n1 = bb1->dom[dir_index], *n2 = bb2->dom[dir_index]; > > gcc_checking_assert (dom_computed[dir_index]); // <=========== BOOM! > > if (dom_computed[dir_index] == DOM_OK) > return (n1->dfs_num_in >= n2->dfs_num_in > && n1->dfs_num_out <= n2->dfs_num_out); > > return et_below (n1, n2); > } > > > Thanks, > > Gary Oblock > > > > > > > CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is > for the sole use of the intended recipient(s) and contains information that > is confidential and proprietary to Ampere Computing or its subsidiaries. It > is to be used solely for the purpose of furthering the parties' business > relationship. Any unauthorized review, copying, or distribution of this email > (or any attachments thereto) is strictly prohibited. If you are not the > intended recipient, please contact the sender immediately and permanently > delete the original and any copies of this email and any attachments thereto. >