+2006-08-22 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/28776
+ * tree-scalar-evolution.c (fold_used_pointer): Add at_stmt
+ parameter. Convert arguments to arithmetic expression to the
+ chrecs type.
+ (analyze_scalar_evolution_1): Adjust caller.
+
2006-08-22 Jan Hubicka <jh@suse.cz>
Patch by Paolo Bonzini
--- /dev/null
+typedef struct RangeCoder
+{
+ unsigned char one_state[256];
+} RangeCoder;
+static inline void put_rac(RangeCoder *c, unsigned char* const state)
+{
+ *state= c->one_state[*state];
+}
+typedef struct PlaneContext{
+ unsigned (*state)[32];
+} PlaneContext;
+static inline void put_symbol(RangeCoder *c, unsigned char *state)
+{
+ int i;
+ const int e;
+ put_rac(c, state);
+ for(i=e-1; i>=0; i--)
+ put_rac(c, state+22+i);
+}
+int encode_line(void)
+{
+ PlaneContext * const p;
+ RangeCoder * const c;
+ int a;
+ put_symbol(c, p->state[a]);
+}
/* EXPR is a scalar evolution of a pointer that is dereferenced or used in
comparison. This means that it must point to a part of some object in
memory, which enables us to argue about overflows and possibly simplify
- the EXPR. Returns the simplified value.
+ the EXPR. AT_STMT is the statement in which this conversion has to be
+ performed. Returns the simplified value.
Currently, for
bugs. */
static tree
-fold_used_pointer (tree expr)
+fold_used_pointer (tree expr, tree at_stmt)
{
tree op0, op1, new0, new1;
enum tree_code code = TREE_CODE (expr);
if (pointer_offset_p (op1))
{
- new0 = fold_used_pointer (op0);
+ new0 = fold_used_pointer (op0, at_stmt);
new1 = fold_used_pointer_cast (op1);
}
else if (code == PLUS_EXPR && pointer_offset_p (op0))
{
new0 = fold_used_pointer_cast (op0);
- new1 = fold_used_pointer (op1);
+ new1 = fold_used_pointer (op1, at_stmt);
}
else
return expr;
if (new0 == op0 && new1 == op1)
return expr;
+ new0 = chrec_convert (TREE_TYPE (expr), new0, at_stmt);
+ new1 = chrec_convert (TREE_TYPE (expr), new1, at_stmt);
+
if (code == PLUS_EXPR)
expr = chrec_fold_plus (TREE_TYPE (expr), new0, new1);
else
if (POINTER_TYPE_P (type)
&& !automatically_generated_chrec_p (res)
&& pointer_used_p (var))
- res = fold_used_pointer (res);
+ res = fold_used_pointer (res, def);
break;
case PHI_NODE: