Summary: | [4.3/4.4 Regression] Incorrectly assumed aligned_operand | ||
---|---|---|---|
Product: | gcc | Reporter: | Jakub Jelinek <jakub> |
Component: | target | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | bergner, gcc-bugs, ht990332, hubicka, pinskia |
Priority: | P1 | Keywords: | wrong-code |
Version: | 4.3.1 | ||
Target Milestone: | 4.3.2 | ||
Host: | Target: | i686-linux | |
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: |
Description
Jakub Jelinek
2008-06-13 21:31:47 UTC
aligned_operand looks wrong: /* Look for some component that isn't known to be aligned. */ if (parts.index) { if (REGNO_POINTER_ALIGN (REGNO (parts.index)) * parts.scale < 32) return 0; } if (parts.base) { if (REGNO_POINTER_ALIGN (REGNO (parts.base)) < 32) return 0; } We are using the hard registers here so we can have the wrong alignment as they are shared. Why are we looking into register pointer's alignment anyways? The MEM_ALIGN check about should give the correct information anyways. We shouldn't be attempting to call mark_reg_pointer in set_reg_attrs_from_value for a hard reg, since they can be shared between different values. Andrew mentioned we maybe shouldn't be calling set_reg_attrs_from_value() with a hard reg, or we could do the following: --- emit-rtl.c (revision 134986) +++ emit-rtl.c (working copy) @@ -969,14 +969,14 @@ set_reg_attrs_from_value (rtx reg, rtx x if (MEM_OFFSET (x) && GET_CODE (MEM_OFFSET (x)) == CONST_INT) REG_ATTRS (reg) = get_reg_attrs (MEM_EXPR (x), INTVAL (MEM_OFFSET (x)) + offset); - if (MEM_POINTER (x)) + if (!HARD_REGISTER_P (reg) && MEM_POINTER (x)) mark_reg_pointer (reg, MEM_ALIGN (x)); } else if (REG_P (x)) { if (REG_ATTRS (x)) update_reg_offset (reg, x, offset); - if (REG_POINTER (x)) + if (!HARD_REGISTER_P (reg) && REG_POINTER (x)) mark_reg_pointer (reg, REGNO_POINTER_ALIGN (REGNO (x))); } } In addition to that, I wonder whether i386's aligned_operand shouldn't prefer ORIGINAL_REGNO over REGNO when checking pointer alignment. Subject: Bug 36533 Author: jakub Date: Mon Jun 23 13:06:15 2008 New Revision: 137038 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=137038 Log: PR target/36533 * emit-rtl.c (set_reg_attrs_from_value): Do nothing if REG is a hard register. * gcc.target/i386/pr36533.c: New test. Added: trunk/gcc/testsuite/gcc.target/i386/pr36533.c Modified: trunk/gcc/ChangeLog trunk/gcc/emit-rtl.c trunk/gcc/testsuite/ChangeLog Subject: Bug 36533 Author: jakub Date: Mon Jun 23 13:16:07 2008 New Revision: 137039 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=137039 Log: PR target/36533 * emit-rtl.c (set_reg_attrs_from_value): Do nothing if REG is a hard register. * gcc.target/i386/pr36533.c: New test. Added: branches/gcc-4_3-branch/gcc/testsuite/gcc.target/i386/pr36533.c Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/emit-rtl.c branches/gcc-4_3-branch/gcc/testsuite/ChangeLog Fixed. |