This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR middle-end/60281
- From: Jakub Jelinek <jakub at redhat dot com>
- To: lin zuojian <manjian2006 at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 20 Feb 2014 10:21:12 +0100
- Subject: Re: [PATCH] PR middle-end/60281
- Authentication-results: sourceware.org; auth=none
- References: <5305BA80 dot 5080306 at gmail dot com> <20140220085049 dot GD22862 at tucnak dot redhat dot com> <5305C740 dot 6000105 at gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Feb 20, 2014 at 05:13:36PM +0800, lin zuojian wrote:
> > You certainly don't want to do any of the extra aligning
> > on non-strict alignment targets, so all the changes must be
> > if (STRICT_ALIGNMENT) guarded, as they are quite expensive (you need one
> > extra register in that case).
>
> I have to do realignment.And llvm's backend also do the realignment.I
> just refers to its implementation.
On !STRICT_ALIGNMENT, you don't need to do the realignment, it just works
as is. I don't care what llvm does.
> > Also, I don't think you want to align for ASAN_RED_ZONE_SIZE,
> > but instead (GET_MODE_ALIGNMENT (SImode) << ASAN_SHADOW_SHIFT) / BITS_PER_UNIT,
> > and if you do (of course for STRICT_ALIGNMENT targets only), you should
> > set_mem_align on shadow_mem when it is created.
>
> I agree with you on the alignment value.May invoking set_mem_align on
> shadow_mem happen too late at this point?Given RTL has been expanded.
I meant to do:
shadow_mem = gen_rtx_MEM (SImode, shadow_base);
set_mem_alias_set (shadow_mem, asan_shadow_set);
+ if (STRICT_ALIGNMENT)
+ set_mem_align (shadow_mem, ...);
(the default alignment is BITS_PER_UNIT). No RTL has been expanded with
that yet at that point.
> And again I have to do realignment on non STRICT_ALIGNMENT whatever cost
> it take or there are always alignment faults.
No.
> > Or, if ARM supports unaligned loads/stores using special instructions,
> > perhaps you should also benchmark the alternative of not realigning, but
> > instead making sure those unaligned instructions are used for the shadow
> > memory loads/stores in the asan prologue/epilogue.
> I have tried to use -fno-peephole2 to shutdown instructions
> combinations,but that makes me feel uncomfortable.
You mean that for the prologues right now on ARM we emit unaligned store
insns during expansion and that they are later peepholed into aligned
stores?
Jakub