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]

Re: [patch] Couple of tweaks to the gimplifier


> > ?1) Set TREE_THIS_NOTRAP on the INDIRECT_REF built for VLA decls. ?This
> > is correct since stack memory isn't considered as trapping in the IL.
>
> This is ok.

Thanks.

> > ?2) Improve gimplification of complex conditions in COND_EXPR. ?They are
> > ? ? naturally generated by the Ada compiler and the patch avoids emitting
> > ? ? redundant branches in GIMPLE, visible at -O0 for the testcase:
>
> Shouldn't
>
> +  /* Remove any COMPOUND_EXPR so the following cases will be caught.  */
> +  STRIP_TYPE_NOPS (TREE_OPERAND (expr, 0));
> +  if (TREE_CODE (TREE_OPERAND (expr, 0)) == COMPOUND_EXPR)
> +    gimplify_compound_expr (&TREE_OPERAND (expr, 0), pre_p, true);
>
> happen in gimple_boolify instead so that other callers also benefit?
> That is, add a COMPOUND_EXPR case there?

Not clear to me.  gimple_boolify doesn't gimplify, it boolifies, i.e. only does 
type conversions to boolean.  This looks orthogonal.

> So, what does the GENERIC look like here?

Attached.  Barely readable, like pretty much all GENERIC for Ada, but you can 
see the big IF statement with the COMPOUND_EXPR on the RHS of the &&.

-- 
Eric Botcazou
P (const boolean b, struct  s1, struct  s2)
{
  SAVE_EXPR <s2.P_BOUNDS->LB0>;
  SAVE_EXPR <s2.P_BOUNDS->UB0>;
  SAVE_EXPR <SAVE_EXPR <s2.P_BOUNDS->UB0> >= SAVE_EXPR <s2.P_BOUNDS->LB0> ? (SAVE_EXPR <s2.P_BOUNDS->UB0> - SAVE_EXPR <s2.P_BOUNDS->LB0>) + 1 : 0>;
  SAVE_EXPR <s1.P_BOUNDS->LB0>;
  SAVE_EXPR <s1.P_BOUNDS->UB0>;
  SAVE_EXPR <SAVE_EXPR <s1.P_BOUNDS->UB0> >= SAVE_EXPR <s1.P_BOUNDS->LB0> ? (SAVE_EXPR <s1.P_BOUNDS->UB0> - SAVE_EXPR <s1.P_BOUNDS->LB0>) + 1 : 0>;
  {
    typedef p__TS2bP1___XD p__TS2bP1___XD;
    typedef <unnamed-signed:64> struct <unnamed-signed:64>;
    typedef character p__S2b[(size_type) SAVE_EXPR <s2.P_BOUNDS->LB0>:SAVE_EXPR <s2.P_BOUNDS->UB0> >= SAVE_EXPR <s2.P_BOUNDS->LB0> ? (size_type) SAVE_EXPR <s2.P_BOUNDS->UB0> : (size_type) SAVE_EXPR <s2.P_BOUNDS->LB0> + -1];
    typedef p__TS1bP1___XD p__TS1bP1___XD;
    typedef <unnamed-signed:64> struct <unnamed-signed:64>;
    typedef character p__S1b[(size_type) SAVE_EXPR <s1.P_BOUNDS->LB0>:SAVE_EXPR <s1.P_BOUNDS->UB0> >= SAVE_EXPR <s1.P_BOUNDS->LB0> ? (size_type) SAVE_EXPR <s1.P_BOUNDS->UB0> : (size_type) SAVE_EXPR <s1.P_BOUNDS->LB0> + -1];
    const integer L3b = (const integer) (SAVE_EXPR <SAVE_EXPR <s1.P_BOUNDS->UB0> >= SAVE_EXPR <s1.P_BOUNDS->LB0> ? (SAVE_EXPR <s1.P_BOUNDS->UB0> - SAVE_EXPR <s1.P_BOUNDS->LB0>) + 1 : 0>);
    const integer L4b = (const integer) (SAVE_EXPR <SAVE_EXPR <s2.P_BOUNDS->UB0> >= SAVE_EXPR <s2.P_BOUNDS->LB0> ? (SAVE_EXPR <s2.P_BOUNDS->UB0> - SAVE_EXPR <s2.P_BOUNDS->LB0>) + 1 : 0>);
    const integer L5b = (const integer) ((integer) L3b + (integer) L4b);
    const integer L6b = (integer) L3b != 0 ? (const integer) SAVE_EXPR <s1.P_BOUNDS->LB0> : (const integer) SAVE_EXPR <s2.P_BOUNDS->LB0>;
    const integer R8b = (integer) L5b == 0 ? (const integer) SAVE_EXPR <s2.P_BOUNDS->UB0> : (const integer) (((integer) L5b + -1) + (integer) L6b);
    typedef p__TTS7bSP1___XD p__TTS7bSP1___XD;
    typedef <unnamed-signed:64> struct <unnamed-signed:64>;
    typedef character p__TS7bS[(size_type) L6b:(integer) R8b >= (integer) L6b ? (size_type) R8b : (size_type) L6b + -1];
    character S7b[(size_type) L6b:(integer) R8b >= (integer) L6b ? (size_type) R8b : (size_type) L6b + -1];
    typedef <unnamed-signed:64> struct <unnamed-signed:64>;
    typedef character p__T9b[1:4];

        typedef p__TS2bP1___XD p__TS2bP1___XD;
        typedef <unnamed-signed:64> struct <unnamed-signed:64>;
        typedef character p__S2b[(size_type) SAVE_EXPR <s2.P_BOUNDS->LB0>:SAVE_EXPR <s2.P_BOUNDS->UB0> >= SAVE_EXPR <s2.P_BOUNDS->LB0> ? (size_type) SAVE_EXPR <s2.P_BOUNDS->UB0> : (size_type) SAVE_EXPR <s2.P_BOUNDS->LB0> + -1];
        typedef p__TS1bP1___XD p__TS1bP1___XD;
        typedef <unnamed-signed:64> struct <unnamed-signed:64>;
        typedef character p__S1b[(size_type) SAVE_EXPR <s1.P_BOUNDS->LB0>:SAVE_EXPR <s1.P_BOUNDS->UB0> >= SAVE_EXPR <s1.P_BOUNDS->LB0> ? (size_type) SAVE_EXPR <s1.P_BOUNDS->UB0> : (size_type) SAVE_EXPR <s1.P_BOUNDS->LB0> + -1];
        typedef <unnamed-signed:64> struct <unnamed-signed:64>;
        typedef character p__T9b[1:4];
    if ((boolean) b && (SAVE_EXPR <    const integer L3b = (const integer) (SAVE_EXPR <SAVE_EXPR <s1.P_BOUNDS->UB0> >= SAVE_EXPR <s1.P_BOUNDS->LB0> ? (SAVE_EXPR <s1.P_BOUNDS->UB0> - SAVE_EXPR <s1.P_BOUNDS->LB0>) + 1 : 0>);
        const integer L4b = (const integer) (SAVE_EXPR <SAVE_EXPR <s2.P_BOUNDS->UB0> >= SAVE_EXPR <s2.P_BOUNDS->LB0> ? (SAVE_EXPR <s2.P_BOUNDS->UB0> - SAVE_EXPR <s2.P_BOUNDS->LB0>) + 1 : 0>);
        const integer L5b = (const integer) ((integer) L3b + (integer) L4b);
        const integer L6b = (integer) L3b != 0 ? (const integer) SAVE_EXPR <s1.P_BOUNDS->LB0> : (const integer) SAVE_EXPR <s2.P_BOUNDS->LB0>;
        const integer R8b = (integer) L5b == 0 ? (const integer) SAVE_EXPR <s2.P_BOUNDS->UB0> : (const integer) (((integer) L5b + -1) + (integer) L6b);
        typedef p__TTS7bSP1___XD p__TTS7bSP1___XD;
        typedef <unnamed-signed:64> struct <unnamed-signed:64>;
        typedef character p__TS7bS[(size_type) L6b:(integer) R8b >= (integer) L6b ? (size_type) R8b : (size_type) L6b + -1];
        character S7b[(size_type) L6b:(integer) R8b >= (integer) L6b ? (size_type) R8b : (size_type) L6b + -1];
    system.concat_2.str_concat_2 ({.P_ARRAY=(character[(size_type) <PLACEHOLDER_EXPR struct >.P_BOUNDS->LB0:<PLACEHOLDER_EXPR struct >.P_BOUNDS->UB0 >= <PLACEHOLDER_EXPR struct >.P_BOUNDS->LB0 ? (size_type) <PLACEHOLDER_EXPR struct >.P_BOUNDS->UB0 : (size_type) <PLACEHOLDER_EXPR struct >.P_BOUNDS->LB0 + -1] *) &S7b, .P_BOUNDS=&{.LB0=(integer) L6b, .UB0=(integer) R8b}}, s1, s2);>;, (integer) R8b - (integer) L6b == 3 && VIEW_CONVERT_EXPR<character[1:4]>(S7b) == "toto";))
      {
        .gnat_rcheck_21 ("p.adb", 4);
      }
    else
      {
        
      }
    return;
  }


_GLOBAL.SZ0.ada_p (integer p0, integer p1)
{
  return p1 <= p0 ? (bit_size_type) ((((size_type) p0 - (size_type) p1) + 1) * 8) : 0;


_GLOBAL.SZ1.ada_p (integer p0, integer p1)
{
  return p1 <= p0 ? ((size_type) p0 - (size_type) p1) + 1 : 0;



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