--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-sccp" } */
+
+extern char a[];
+int foo ()
+{
+ int cnt = 0;
+ char *aend = a + 32;
+ char *a0 = a;
+ do
+ {
+ a0 = a0 + 16;
+ cnt++;
+ }
+ while (aend - a0 > 12);
+ return cnt;
+}
+
+/* { dg-final { scan-tree-dump "return 2" "sccp" } } */
res = chrec_fold_plus (type, chrec1, chrec2);
break;
+ case POINTER_DIFF_EXPR:
+ {
+ tree utype = unsigned_type_for (type);
+ chrec1 = analyze_scalar_evolution (loop, rhs1);
+ chrec2 = analyze_scalar_evolution (loop, rhs2);
+ chrec1 = chrec_convert (utype, chrec1, at_stmt);
+ chrec2 = chrec_convert (utype, chrec2, at_stmt);
+ chrec1 = instantiate_parameters (loop, chrec1);
+ chrec2 = instantiate_parameters (loop, chrec2);
+ res = chrec_fold_minus (utype, chrec1, chrec2);
+ res = chrec_convert (type, res, at_stmt);
+ break;
+ }
+
case PLUS_EXPR:
chrec1 = analyze_scalar_evolution (loop, rhs1);
chrec2 = analyze_scalar_evolution (loop, rhs2);