From: Richard Biener <richard.guenther@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Diego Novillo <dnovillo@google.com>,
Dodji Seketeli <dseketel@redhat.com>,
gcc-patches@gcc.gnu.org, Wei Mi <wmi@google.com>
Subject: Re: [asan] Emit GIMPLE directly, small cleanups
Date: Fri, 12 Oct 2012 10:32:00 -0000 [thread overview]
Message-ID: <CAFiYyc1NqpY=hX9SRtPH_TCGmCrPob=uFo-RiR_CY43EES-6FA@mail.gmail.com> (raw)
In-Reply-To: <20121011173129.GF584@tucnak.redhat.com>
On Thu, Oct 11, 2012 at 7:31 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Oct 11, 2012 at 01:14:31PM -0400, Diego Novillo wrote:
>> On 2012-10-11 12:38 , Jakub Jelinek wrote:
>>
>> >- gimple_seq seq, stmts;
>> >- tree shadow_type = size_in_bytes == 16 ?
>> >- short_integer_type_node : char_type_node;
>> >- tree shadow_ptr_type = build_pointer_type (shadow_type);
>> >- tree uintptr_type = lang_hooks.types.type_for_mode (ptr_mode,
>> >- /*unsignedp=*/true);
>> >+ tree shadow_ptr_type = shadow_ptr_types[size_in_bytes == 16];
>>
>> Add '? 1 : 0' in the array index expression.
>
> Ok.
>
>> > /* Build
>> >- (base_addr >> ASAN_SHADOW_SHIFT) | targetm.asan_shadow_offset (). */
>> >+ (base_addr >> ASAN_SHADOW_SHIFT) + targetm.asan_shadow_offset (). */
>>
>> Hm, I wonder if this is a documentation problem or we're generating
>> bad runtime code. Wei, you tested the runtime and it was working
>> with the GCC generated code, right?
>
> The asan web pages document |, the old tree-asan.c emitted +, I've changed
> it to BIT_IOR_EXPR, but that resulted in worse assembly, and I believe at
> least for the current x86_64 and i686 address ranges and shadow offset
> values it actually doesn't matter.
> On x86_64 stack is like 0x7ffff6e00000, shifted down by 3 is still smaller
> than 1L << 44 that is ored or added to it. And the negative half of the
> address space is used by the kernel, nothing is mapped into it (besides
> vsyscall page) and neither | nor + of 1L << 44 to it would work well.
> On i386, | and + works the same for all addresses, as 0xffffffffU >> 3
> is still smaller than 1 << 29.
> The reason why + generates better code on x86_64/i686 is that one can use
> e.g. movzbl (%r1, %r2), %r3 instead of orq %r2, %r1; movzb (%r1), %r3.
>
>> >+ if (shadow_ptr_types[0] == NULL_TREE)
>> >+ {
>> >+ alias_set_type set = new_alias_set ();
>> >+ shadow_ptr_types[0]
>> >+ = build_distinct_type_copy (unsigned_char_type_node);
>> >+ TYPE_ALIAS_SET (shadow_ptr_types[0]) = set;
>> >+ shadow_ptr_types[0] = build_pointer_type (shadow_ptr_types[0]);
>> >+ shadow_ptr_types[1]
>> >+ = build_distinct_type_copy (short_unsigned_type_node);
>> >+ TYPE_ALIAS_SET (shadow_ptr_types[1]) = set;
>> >+ shadow_ptr_types[1] = build_pointer_type (shadow_ptr_types[1]);
>> >+ }
>>
>> Move this to an initialization function, please.
>
> Okay.
That doesn't work with LTO btw, so make sure you instrument during LTRANS.
Richard.
> Jakub
next prev parent reply other threads:[~2012-10-12 9:31 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-11 16:44 Jakub Jelinek
2012-10-11 17:27 ` Diego Novillo
2012-10-11 17:32 ` Jakub Jelinek
2012-10-11 23:33 ` Wei Mi
2012-10-12 7:57 ` Jakub Jelinek
2012-10-12 16:33 ` Xinliang David Li
2012-10-12 16:33 ` Jakub Jelinek
2012-10-12 16:36 ` Xinliang David Li
2012-10-16 6:28 ` Xinliang David Li
2012-10-16 15:26 ` Jakub Jelinek
2012-10-16 16:27 ` Xinliang David Li
2012-10-16 16:29 ` Jakub Jelinek
2012-10-16 16:57 ` Xinliang David Li
2012-10-16 18:03 ` Jakub Jelinek
2012-10-16 18:05 ` Xinliang David Li
2012-10-12 13:57 ` Diego Novillo
2012-10-12 15:04 ` Rainer Orth
2012-10-12 16:13 ` Diego Novillo
2012-10-12 16:46 ` Jakub Jelinek
2012-10-12 17:09 ` Diego Novillo
2012-10-12 19:14 ` Ian Lance Taylor
2012-10-15 14:44 ` Rainer Orth
2012-10-15 16:14 ` Ian Lance Taylor
2012-10-15 16:33 ` Diego Novillo
2012-10-16 11:28 ` Rainer Orth
2012-10-16 11:39 ` Diego Novillo
2012-10-16 13:31 ` Ian Lance Taylor
2012-10-16 21:52 ` Eric Botcazou
2012-10-16 22:51 ` Ian Lance Taylor
2012-10-16 22:56 ` Diego Novillo
2012-10-17 21:31 ` Eric Botcazou
[not found] ` <CAAkRFZLUe2Dsno28WSajyEZCCQu9Qghi8rDZecjFLE9oioBe+A@mail.gmail.com>
[not found] ` <20121012072644.GJ584@tucnak.redhat.com>
2012-10-12 16:40 ` Xinliang David Li
2012-10-12 10:32 ` Richard Biener [this message]
2012-10-11 17:55 ` Wei Mi
2012-10-11 17:46 ` Xinliang David Li
2012-10-11 18:17 ` Jakub Jelinek
2012-10-11 19:37 ` Xinliang David Li
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='CAFiYyc1NqpY=hX9SRtPH_TCGmCrPob=uFo-RiR_CY43EES-6FA@mail.gmail.com' \
--to=richard.guenther@gmail.com \
--cc=dnovillo@google.com \
--cc=dseketel@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=wmi@google.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).