https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78323

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-11-16
            Version|unknown                     |6.2.1
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  It's how we handle lowering the try-finally (testcase with just 3
conditions):



<<cleanup_point return <retval> = (StringEndsWith (fileName, (const struct
nsString &) &TARGET_EXPR <D.2289, <<< Unknown tree: aggr_init_expr
  5
  __comp_ctor
  D.2289
  (struct nsString *) <<< Unknown tree: void_cst >>>
  (const char *) ".xz" >>>>) || StringEndsWith (fileName, (const struct
nsString &) &TARGET_EXPR <D.2290, <<< Unknown tree: aggr_init_expr
  5
  __comp_ctor
  D.2290
  (struct nsString *) <<< Unknown tree: void_cst >>>
  (const char *) ".z" >>>>)) || StringEndsWith (fileName, (const struct
nsString &) &TARGET_EXPR <D.2291, <<< Unknown tree: aggr_init_expr
  5
  __comp_ctor
  D.2291
  (struct nsString *) <<< Unknown tree: void_cst >>>
  (const char *) ".zipx" >>>>)>>;


lowered to

  cleanup.1 = 0;
  try
    {
      cleanup.2 = 0;
      try
        {
          cleanup.3 = 0;
          try
            {
              nsString::nsString (&D.2289, ".xz");
              cleanup.1 = 1;
              D.2301 = StringEndsWith (fileName, &D.2289);
              if (D.2301 != 0) goto <D.2295>; else goto <D.2302>;
              <D.2302>:
              nsString::nsString (&D.2290, ".z");
              cleanup.2 = 1;
              D.2306 = StringEndsWith (fileName, &D.2290);
              if (D.2306 != 0) goto <D.2295>; else goto <D.2307>;
              <D.2307>:
              nsString::nsString (&D.2291, ".zipx");
              cleanup.3 = 1;
              D.2311 = StringEndsWith (fileName, &D.2291);
              if (D.2311 != 0) goto <D.2295>; else goto <D.2296>;
              <D.2295>:
              iftmp.0 = 1;
              goto <D.2297>;
              <D.2296>:
              iftmp.0 = 0;
              <D.2297>:
              D.2293 = iftmp.0;
              return D.2293;
            }
          finally
            {
              if (cleanup.3 != 0) goto <D.2309>; else goto <D.2310>;
              <D.2309>:
              nsString::~nsString (&D.2291);
              D.2291 = {CLOBBER};
              <D.2310>:
            }
        }
      finally
        {
          if (cleanup.2 != 0) goto <D.2304>; else goto <D.2305>;
          <D.2304>:
          nsString::~nsString (&D.2290);
          D.2290 = {CLOBBER};
          <D.2305>:
        }
    }
  finally
    {
      if (cleanup.1 != 0) goto <D.2299>; else goto <D.2300>;
      <D.2299>:
      nsString::~nsString (&D.2289);
      D.2289 = {CLOBBER};
      <D.2300>:
    }
}

and in .optimized that looks like

  # cleanup.1_7 = PHI <1(6), 1(10), 1(8), 0(2), 1(3), 1(5)>
  # cleanup.2_5 = PHI <1(6), 1(10), 1(8), 0(2), 0(3), _17(5)>
<L31>:
  __builtin_eh_copy_values (2, 3);
  if (cleanup.2_5 != 0)
    goto <bb 13>;
  else
    goto <bb 14>;

  <bb 13>:
  nsString::~nsString (&D.2290);
  D.2290 ={v} {CLOBBER};

  <bb 14>:
  __builtin_eh_copy_values (1, 2);
  if (cleanup.1_7 != 0)
    goto <bb 15>;
  else
    goto <bb 16>;

  <bb 15>:
  nsString::~nsString (&D.2289);
  D.2289 ={v} {CLOBBER};

  <bb 16>:
  _8 = __builtin_eh_pointer (1);
  __builtin_unwind_resume (_8);

  <bb 17>:
  nsString::~nsString (&D.2291);
  D.2291 ={v} {CLOBBER};

  <bb 18>:
  # iftmp.0_37 = PHI <_20(7), _23(17)>
  nsString::~nsString (&D.2290);
  D.2290 ={v} {CLOBBER};
  goto <bb 11>;

Reply via email to