This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Couple of tweaks to the gimplifier
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 21 Mar 2011 13:28:18 +0100
- Subject: Re: [patch] Couple of tweaks to the gimplifier
- References: <201103211219.30008.ebotcazou@adacore.com>
On Mon, Mar 21, 2011 at 12:19 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> the attached patch makes a couple of tweaks to the gimplifier in order to help
> Ada, but I think that they are of general usefulness:
>
> ?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.
> ?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?
> procedure P (B : Boolean; S1, S2 : String) is
> begin
> ?if B and then S1 & S2 = "toto" then
> ? ?raise Program_Error;
> ?end if;
> end;
So, what does the GENERIC look like here?
Thanks,
Richard.
> @@ -158,21 +158,12 @@
> ? ? ? ?movl ? ?%r12d, %eax
> ? ? ? ?subl ? ?%ebx, %eax
> ? ? ? ?cmpl ? ?$3, %eax
> - ? ? ? jne ? ? .L33
> + ? ? ? jne ? ? .L18
> ? ? ? ?.loc 1 3 0 discriminator 1
> ? ? ? ?movq ? ?-40(%rbp), %rax
> ? ? ? ?movl ? ?(%rax), %eax
> ? ? ? ?cmpl ? ?$1869901684, %eax
> - ? ? ? jne ? ? .L33
> - ? ? ? .loc 1 3 0 discriminator 2
> - ? ? ? movl ? ?$1, %eax
> - ? ? ? jmp ? ? .L34
> -.L33:
> - ? ? ? movl ? ?$0, %eax
> -.L34:
> - ? ? ? .loc 1 3 0 discriminator 3
> - ? ? ? testb ? %al, %al
> - ? ? ? je ? ? ?.L18
> + ? ? ? jne ? ? .L18
> ? ? ? ?.loc 1 4 0 is_stmt 1
> ? ? ? ?movl ? ?$4, %esi
> ? ? ? ?movl ? ?$.LC0, %edi
>
> Bootstrapped/regtested on x86_64-suse-linux, OK for the mainline?
>
>
> 2011-03-21 ?Eric Botcazou ?<ebotcazou@adacore.com>
>
> ? ? ? ?* gimplify.c (gimplify_vla_decl): Set TREE_THIS_NOTRAP flag.
> ? ? ? ?(gimplify_cond_expr): Gimplify COMPOUND_EXPR conditions.
>
>
> --
> Eric Botcazou
>