public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kai Tietz <ktietz70@googlemail.com>
To: Richard Guenther <richard.guenther@gmail.com>
Cc: Paolo Bonzini <bonzini@gnu.org>, GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch gimplifier]: Boolify more strict conditional expressions and transform simple form to binary
Date: Wed, 11 May 2011 10:31:00 -0000	[thread overview]
Message-ID: <BANLkTi=_jZGm_3ZUzWU_H16M6RgK8XiWig@mail.gmail.com> (raw)
In-Reply-To: <BANLkTinbznaS6f_+U4ObhtvjefVOhxBEJQ@mail.gmail.com>

For more detail what happens and why this conditional handling is necessary:

The sample code is:

int
foo (int a, int b)
{
  return (a ? b != 3 : 0);
}

leads for variant without condition boolifying of arms to:

;; Function foo (foo)

foo (int a, int b)
{
  int D.1991;
  int D.1990;
  int D.1989;

<bb 2>:
  D.1990_2 = a_1(D) != 0;
  D.1991_4 = b_3(D) != 3;
  D.1989_5 = D.1991_4 & D.1990_2;
  return D.1989_5;

}

with this code we see


;; Function foo (foo)

foo (int a, int b)
{
  _Bool D.1992;
  _Bool D.1991;
  _Bool D.1990;
  int D.1989;

<bb 2>:
  D.1990_2 = a_1(D) != 0;
  D.1991_4 = b_3(D) != 3;
  D.1992_5 = D.1991_4 & D.1990_2;
  D.1989_6 = (int) D.1992_5;
  return D.1989_6;

}

So you see that by this, the SSA variable having _Bool type, as to be
wished, and not being handled as int.

Regards,
Kai

  reply	other threads:[~2011-05-11  9:35 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-10 14:25 Kai Tietz
2011-05-10 15:24 ` Richard Guenther
2011-05-10 15:34   ` Kai Tietz
2011-05-10 15:38     ` Richard Guenther
2011-05-10 15:45       ` Paolo Bonzini
2011-05-10 15:52         ` Richard Guenther
2011-05-10 17:28           ` Kai Tietz
2011-05-10 20:49             ` Kai Tietz
2011-05-11  9:35               ` Richard Guenther
2011-05-11 10:06                 ` Kai Tietz
2011-05-11 10:51                 ` Kai Tietz
2011-05-11 10:00               ` Kai Tietz
2011-05-11 10:03                 ` Richard Guenther
2011-05-11 10:12                   ` Kai Tietz
2011-05-11 10:31                     ` Kai Tietz [this message]
2011-05-11 12:08                       ` Richard Guenther
2011-05-11 10:46 ` Eric Botcazou
2011-05-11 11:12   ` Kai Tietz
2011-05-11 12:16     ` Richard Guenther
2011-05-11 19:39       ` Kai Tietz
2011-05-12 10:32         ` Richard Guenther
2011-05-12 14:57           ` Kai Tietz
2011-05-12 15:41             ` Richard Guenther
2011-05-12 21:33               ` Kai Tietz
2011-05-12 22:48                 ` H.J. Lu
2011-05-13 10:07                   ` Richard Guenther

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTi=_jZGm_3ZUzWU_H16M6RgK8XiWig@mail.gmail.com' \
    --to=ktietz70@googlemail.com \
    --cc=bonzini@gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).