This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] for PR 32729


Hello,

can_duplicate_block_p prevents us from duplicating a basic block if it has a fallthru edge
going to the exit block (which in the testcase for this PR prevents a loop from being unrolled).
However, there does not seem to be a reason for this restriction; even if there is a problem
with several fallthru edges to exit, cfg_layout_finalize should fix it.

Bootstrapped & regtested on i686.

Zdenek

	PR rtl-optimization/32729
	* cfghooks.c (can_duplicate_block_p): Do not forbid duplicating blocks
	that fallthru to exit.

Index: cfghooks.c
===================================================================
*** cfghooks.c	(revision 126547)
--- cfghooks.c	(working copy)
*************** tidy_fallthru_edges (void)
*** 838,845 ****
  bool
  can_duplicate_block_p (basic_block bb)
  {
-   edge e;
- 
    if (!cfg_hooks->can_duplicate_block_p)
      internal_error ("%s does not support can_duplicate_block_p",
  		    cfg_hooks->name);
--- 838,843 ----
*************** can_duplicate_block_p (basic_block bb)
*** 847,858 ****
    if (bb == EXIT_BLOCK_PTR || bb == ENTRY_BLOCK_PTR)
      return false;
  
-   /* Duplicating fallthru block to exit would require adding a jump
-      and splitting the real last BB.  */
-   e = find_edge (bb, EXIT_BLOCK_PTR);
-   if (e && (e->flags & EDGE_FALLTHRU))
-     return false;
- 
    return cfg_hooks->can_duplicate_block_p (bb);
  }
  
--- 845,850 ----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]