* [PTR-PLUS] Fix the first bug report reported against the branch (PR 32015)
@ 2007-05-22 1:46 Andrew_Pinski
0 siblings, 0 replies; only message in thread
From: Andrew_Pinski @ 2007-05-22 1:46 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 744 bytes --]
Hi,
The problem here is that chrec_apply was using the type of the left hand
side of the chrec to convert the number of iteractions for the
multiplications to the right hand side. This patch uses chrec_convert_rhs
instead of chrec_convert for that variable and also adds extra checking in
build2_stat to make sure MULT_EXPR is not used for pointers.
Committed to the branch after a bootstrap/test on i686-linux-gnu with no
regressions.
Thanks,
Andrew Pinski
ChangeLog:
* tree.c (build2_stat): Make sure that
MULT_EXPR is not used with pointers.
* tree-chrec.c (chrec_apply): Use chrec_convert_rhs
on the argument x instead of chrec_convert.
* gcc.c-torture/compile/20070520-1.c: New test.
[-- Attachment #2: fixpr32015.diff.txt --]
[-- Type: text/plain, Size: 2485 bytes --]
Index: tree.c
===================================================================
--- tree.c (revision 124922)
+++ tree.c (working copy)
@@ -3069,7 +3069,8 @@ build2_stat (enum tree_code code, tree t
gcc_assert (code != GIMPLE_MODIFY_STMT);
#endif
- if ((code == MINUS_EXPR || code == PLUS_EXPR) && arg0 && arg1 && tt && POINTER_TYPE_P (tt))
+ if ((code == MINUS_EXPR || code == PLUS_EXPR || code == MULT_EXPR)
+ && arg0 && arg1 && tt && POINTER_TYPE_P (tt))
gcc_assert (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST);
if (code == POINTER_PLUS_EXPR && arg0 && arg1 && tt)
Index: tree-chrec.c
===================================================================
--- tree-chrec.c (revision 124922)
+++ tree-chrec.c (working copy)
@@ -572,8 +572,8 @@ chrec_apply (unsigned var,
if (evolution_function_is_affine_p (chrec))
{
/* "{a, +, b} (x)" -> "a + b*x". */
- x = chrec_convert (type, x, NULL_TREE);
- res = chrec_fold_multiply (type, CHREC_RIGHT (chrec), x);
+ x = chrec_convert_rhs (type, x, NULL_TREE);
+ res = chrec_fold_multiply (TREE_TYPE (x), CHREC_RIGHT (chrec), x);
if (!integer_zerop (CHREC_LEFT (chrec)))
res = chrec_fold_plus (type, CHREC_LEFT (chrec), res);
}
Index: testsuite/gcc.c-torture/compile/20070520-1.c
===================================================================
--- testsuite/gcc.c-torture/compile/20070520-1.c (revision 0)
+++ testsuite/gcc.c-torture/compile/20070520-1.c (revision 0)
@@ -0,0 +1,35 @@
+typedef unsigned char uint8_t;
+extern uint8_t ff_cropTbl[256 + 2 * 1024];
+
+void ff_pred8x8_plane_c(uint8_t *src, int stride){
+ int j, k;
+ int a;
+ uint8_t *cm = ff_cropTbl + 1024;
+ const uint8_t * const src0 = src+3-stride;
+ const uint8_t *src1 = src+4*stride-1;
+ const uint8_t *src2 = src1-2*stride;
+ int H = src0[1] - src0[-1];
+ int V = src1[0] - src2[ 0];
+ for(k=2; k<=4; ++k) {
+ src1 += stride; src2 -= stride;
+ H += k*(src0[k] - src0[-k]);
+ V += k*(src1[0] - src2[ 0]);
+ }
+ H = ( 17*H+16 ) >> 5;
+ V = ( 17*V+16 ) >> 5;
+
+ a = 16*(src1[0] + src2[8]+1) - 3*(V+H);
+ for(j=8; j>0; --j) {
+ int b = a;
+ a += V;
+ src[0] = cm[ (b ) >> 5 ];
+ src[1] = cm[ (b+ H) >> 5 ];
+ src[2] = cm[ (b+2*H) >> 5 ];
+ src[3] = cm[ (b+3*H) >> 5 ];
+ src[4] = cm[ (b+4*H) >> 5 ];
+ src[5] = cm[ (b+5*H) >> 5 ];
+ src[6] = cm[ (b+6*H) >> 5 ];
+ src[7] = cm[ (b+7*H) >> 5 ];
+ src += stride;
+ }
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-05-22 1:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-22 1:46 [PTR-PLUS] Fix the first bug report reported against the branch (PR 32015) Andrew_Pinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).