]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR testsuite/63175 (FAIL: gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a.c scan...
authorRichard Biener <rguenther@suse.de>
Fri, 27 Feb 2015 10:32:14 +0000 (10:32 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 27 Feb 2015 10:32:14 +0000 (10:32 +0000)
2015-02-27  Richard Biener  <rguenther@suse.de>

PR middle-end/63175
* builtins.c (get_object_alignment_2): Make sure to re-apply
the ANDed mask after recursing to its operand gets us a new
misalignment bit position.

From-SVN: r221052

gcc/ChangeLog
gcc/builtins.c

index ee7f3c8f806185913ecaa5ef55d6f88680e5f0ca..2cf5d964f438731f2ec2f7061ff8a9d3b791e7ed 100644 (file)
@@ -1,3 +1,10 @@
+2015-02-27  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/63175
+       * builtins.c (get_object_alignment_2): Make sure to re-apply
+       the ANDed mask after recursing to its operand gets us a new
+       misalignment bit position.
+
 2015-02-27  Andrew Pinski  <apinski@cavium.com>
            Naveen H.S  <Naveen.Hurugalawadi@caviumnetworks.com>
  
index dd57b1ae42a1aeee2749c4619fcd945dec87c9a7..0825391a0d351acad410fa63ca4f5563b3983966 100644 (file)
@@ -369,13 +369,15 @@ get_object_alignment_2 (tree exp, unsigned int *alignp,
       tree addr = TREE_OPERAND (exp, 0);
       unsigned ptr_align;
       unsigned HOST_WIDE_INT ptr_bitpos;
+      unsigned HOST_WIDE_INT ptr_bitmask = ~0;
 
+      /* If the address is explicitely aligned, handle that.  */
       if (TREE_CODE (addr) == BIT_AND_EXPR
          && TREE_CODE (TREE_OPERAND (addr, 1)) == INTEGER_CST)
        {
-         align = (TREE_INT_CST_LOW (TREE_OPERAND (addr, 1))
-                   & -TREE_INT_CST_LOW (TREE_OPERAND (addr, 1)));
-         align *= BITS_PER_UNIT;
+         ptr_bitmask = TREE_INT_CST_LOW (TREE_OPERAND (addr, 1));
+         ptr_bitmask *= BITS_PER_UNIT;
+         align = ptr_bitmask & -ptr_bitmask;
          addr = TREE_OPERAND (addr, 0);
        }
 
@@ -383,6 +385,9 @@ get_object_alignment_2 (tree exp, unsigned int *alignp,
        = get_pointer_alignment_1 (addr, &ptr_align, &ptr_bitpos);
       align = MAX (ptr_align, align);
 
+      /* Re-apply explicit alignment to the bitpos.  */
+      ptr_bitpos &= ptr_bitmask;
+
       /* The alignment of the pointer operand in a TARGET_MEM_REF
         has to take the variable offset parts into account.  */
       if (TREE_CODE (exp) == TARGET_MEM_REF)