Hello!
>>> When hard frame pointer isn't needed, the register for hard frame pointer
>>> may be reused. This patch clears alignment on hard frame pointer if hard
>>> frame pointer isn't needed. OK for trunk after bootstrap and test on
>>> Linux/x86-64?
>>
>> LRA can set up frame_pointer_needed in some complicated cases (in
>> lra-eliminations.c::setup_can_eliminate). So I'd reset REGNO_POINTER_ALIGN
>> in setup_can_eleminate for any case even although without the change the
>> patch is safe.
>>
>> So, H.J., if you add resetting REGNO_POINTER_ALIGN in setup_can_eliminate,
>> the patch is automatically approved.
>
> This is what I checked in.
Attached patch disables the test on -fPIC targets, explicitly passes
-fomit-frame-pointer and removes unneeded main for a compile test.
2015-02-05 Uros Bizjak <[email protected]>
PR rtl-optimization/64905
* gcc.target/i386/pr64905.c: Require nonpic target.
(dg-options): Add -fomit-frame-pointer.
(main): Remove.
Tested on x86_64-linux-gnu and committed to mainline SVN.
Uros.
Index: gcc.target/i386/pr64905.c
===================================================================
--- gcc.target/i386/pr64905.c (revision 220434)
+++ gcc.target/i386/pr64905.c (working copy)
@@ -1,22 +1,13 @@
-/* { dg-do compile { target { ! ia32 } } } */
-/* { dg-options "-Os -ffixed-rax -ffixed-rbx -ffixed-rcx -ffixed-rdx
-ffixed-rdi -ffixed-rsi -ffixed-r8 -ffixed-r9 -ffixed-r10 -ffixed-r11
-ffixed-r12 -ffixed-r13 -ffixed-r14 -ffixed-r15" } */
+/* { dg-do compile { target { { ! ia32 } && nonpic } } } */
+/* { dg-options "-Os -fomit-frame-pointer -ffixed-rax -ffixed-rbx -ffixed-rcx
-ffixed-rdx -ffixed-rdi -ffixed-rsi -ffixed-r8 -ffixed-r9 -ffixed-r10
-ffixed-r11 -ffixed-r12 -ffixed-r13 -ffixed-r14 -ffixed-r15" } */
/* { dg-final { scan-assembler-not "movl\[ \t\]0\\(%.*\\), %.*" } } */
typedef unsigned short uint16_t;
uint16_t a_global;
-void __attribute__ ((noinline))
+void
function (uint16_t **a_p)
{
// unaligned access by address in %rbp: mov 0x0(%rbp),%ebp
a_global = **a_p;
}
-
-int main(int argc, char **argv)
-{
- uint16_t array [4] = { 1, 2, 3, 4 };
- uint16_t *array_elem_p = &array [3];
-
- function (&array_elem_p);
- return 0;
-}