Patchwork Fix ARM constant-pool layout calculations under -falign-labels

login
register
mail settings
Submitter Roland McGrath
Date Aug. 22, 2012, 11:32 p.m.
Message ID <CAB=4xhrKBk1+vBWRE_MZ5hceRPLXeVK7SzsfJ8C9mTSzgK+Obg@mail.gmail.com>
Download mbox | patch
Permalink /patch/179446/
State New
Headers show

Comments

Roland McGrath - Aug. 22, 2012, 11:32 p.m.
Hi Richard,

You never responded to this.  Is there something wrong with this fix?
Can you address whether it's sufficient for align_loops > align_labels
and such cases that Julian Brown raised?

A patch against the current trunk is below.


Thanks,
Roland


On Wed, Aug 1, 2012 at 2:43 PM, Roland McGrath <mcgrathr@google.com> wrote:
> Using e.g. -falign-labels=16 on ARM can confuse the constant-pool layout
> code such that it places pool entries too far away from their referring
> instructions.  This change seems to fix it.
>
> I don't have a small test case, only a large one, which I haven't actually
> tried to get to reproduce on any vanilla ARM target.  But the logic of the
> change seems straightforward and sound.

gcc/
2012-08-22  Roland McGrath  <mcgrathr@google.com>

	* config/arm/arm.c (get_label_padding): Use align_labels as minimum.

Patch

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 2805b7c..586d094 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -12409,6 +12409,7 @@  get_label_padding (rtx label)
   HOST_WIDE_INT align, min_insn_size;

   align = 1 << label_to_alignment (label);
+  align = MAX (align, align_labels);
   min_insn_size = TARGET_THUMB ? 2 : 4;
   return align > min_insn_size ? align - min_insn_size : 0;
 }