This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix ARM constant-pool layout calculations under -falign-labels
- From: Roland McGrath <mcgrathr at google dot com>
- To: Richard Earnshaw <rearnsha at arm dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 1 Aug 2012 14:43:33 -0700
- Subject: [PATCH] Fix ARM constant-pool layout calculations under -falign-labels
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.
Thanks,
Roland
2012-08-01 Roland McGrath <mcgrathr@google.com>
* config/arm/arm.c (get_label_padding): Use align_labels as minimum.
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 701ab4c..9bdb52c 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -12384,6 +12384,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;
}