[gcc r10-8347] middle-end/94964 - avoid EH loop entry with CP_SIMPLE_PREHEADERS

Richard Biener rguenth@gcc.gnu.org
Tue Jun 23 11:06:20 GMT 2020


https://gcc.gnu.org/g:fb2b8bf32b72a7976b2bdea1fa04c8af50786429

commit r10-8347-gfb2b8bf32b72a7976b2bdea1fa04c8af50786429
Author: Richard Biener <rguenther@suse.de>
Date:   Wed May 6 10:23:15 2020 +0200

    middle-end/94964 - avoid EH loop entry with CP_SIMPLE_PREHEADERS
    
    Loop optimizers expect to be able to insert on the preheader
    edge w/o splitting it thus avoid ending up with a preheader
    that enters the loop via an EH edge (or an abnormal edge).
    
    2020-05-06  Richard Biener  <rguenther@suse.de>
    
            PR middle-end/94964
            * cfgloopmanip.c (create_preheader): Require non-complex
            preheader edge for CP_SIMPLE_PREHEADERS.

Diff:
---
 gcc/cfgloopmanip.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 50c7267ec49..73134a20e33 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -1506,9 +1506,10 @@ create_preheader (class loop *loop, int flags)
       else
         {
           /* If we want simple preheaders, also force the preheader to have
-             just a single successor.  */
+	     just a single successor and a normal edge.  */
           if ((flags & CP_SIMPLE_PREHEADERS)
-              && !single_succ_p (single_entry->src))
+	      && ((single_entry->flags & EDGE_COMPLEX)
+		  || !single_succ_p (single_entry->src)))
             need_forwarder_block = true;
           /* If we want fallthru preheaders, also create forwarder block when
              preheader ends with a jump or has predecessors from loop.  */


More information about the Gcc-cvs mailing list