PR tree-optimization/43796
* tree-vrp.c (adjust_range_with_scev): Lookup init and step
from SCEV in the lattice.
(vrp_visit_phi_node): Dump change.
* gfortran.dg/pr43796.f90: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158520
138bc75d-0d04-0410-961f-
82ee72b054a4
2010-04-19 Richard Guenther <rguenther@suse.de>
+ PR tree-optimization/43796
+ * tree-vrp.c (adjust_range_with_scev): Lookup init and step
+ from SCEV in the lattice.
+ (vrp_visit_phi_node): Dump change.
+
+2010-04-19 Richard Guenther <rguenther@suse.de>
+
* configure.ac: Fix quoting around elf_getshstrndx ABI check.
* configure: Re-generated.
2010-04-19 Richard Guenther <rguenther@suse.de>
+ PR tree-optimization/43796
+ * gfortran.dg/pr43796.f90: New testcase.
+
+2010-04-19 Richard Guenther <rguenther@suse.de>
+
PR tree-optimization/43783
* gcc.c-torture/execute/pr43783.c: New testcase.
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fcheck=bounds" }
+
+ FUNCTION F06FKFN(N,W,INCW,X,INCX)
+ IMPLICIT NONE
+ INTEGER, PARAMETER :: WP = KIND(0.0D0)
+ REAL (KIND=WP) :: F06FKFN
+ REAL (KIND=WP), PARAMETER :: ONE = 1.0E+0_WP
+ REAL (KIND=WP), PARAMETER :: ZERO = 0.0E+0_WP
+ INTEGER, INTENT (IN) :: INCW, INCX, N
+ REAL (KIND=WP), INTENT (IN) :: W(*), X(*)
+ REAL (KIND=WP) :: ABSYI, NORM, SCALE, SSQ
+ INTEGER :: I, IW, IX
+ REAL (KIND=WP), EXTERNAL :: F06BMFN
+ INTRINSIC ABS, SQRT
+ IF (N<1) THEN
+ NORM = ZERO
+ ELSE IF (N==1) THEN
+ NORM = SQRT(W(1))*ABS(X(1))
+ ELSE
+ IF (INCW>0) THEN
+ IW = 1
+ ELSE
+ IW = 1 - (N-1)*INCW
+ END IF
+ IF (INCX>0) THEN
+ IX = 1
+ ELSE
+ IX = 1 - (N-1)*INCX
+ END IF
+ SCALE = ZERO
+ SSQ = ONE
+ DO I = 1, N
+ IF ((W(IW)/=ZERO) .AND. (X(IX)/=ZERO)) THEN
+ ABSYI = SQRT(W(IW))*ABS(X(IX))
+ IF (SCALE<ABSYI) THEN
+ SSQ = 1 + SSQ*(SCALE/ABSYI)**2
+ SCALE = ABSYI
+ ELSE
+ SSQ = SSQ + (ABSYI/SCALE)**2
+ END IF
+ END IF
+ IW = IW + INCW
+ IX = IX + INCX
+ END DO
+ NORM = F06BMFN(SCALE,SSQ)
+ END IF
+ F06FKFN = NORM
+ RETURN
+ END FUNCTION F06FKFN
+
adjust_range_with_scev (value_range_t *vr, struct loop *loop,
gimple stmt, tree var)
{
- tree init, step, chrec, tmin, tmax, min, max, type;
+ tree init, step, chrec, tmin, tmax, min, max, type, tem;
enum ev_direction dir;
/* TODO. Don't adjust anti-ranges. An anti-range may provide
return;
init = initial_condition_in_loop_num (chrec, loop->num);
+ tem = op_with_constant_singleton_value_range (init);
+ if (tem)
+ init = tem;
step = evolution_part_in_loop_num (chrec, loop->num);
+ tem = op_with_constant_singleton_value_range (step);
+ if (tem)
+ step = tem;
/* If STEP is symbolic, we can't know whether INIT will be the
minimum or maximum value in the range. Also, unless INIT is
/* If the new range is different than the previous value, keep
iterating. */
if (update_value_range (lhs, &vr_result))
- return SSA_PROP_INTERESTING;
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Found new range for ");
+ print_generic_expr (dump_file, lhs, 0);
+ fprintf (dump_file, ": ");
+ dump_value_range (dump_file, &vr_result);
+ fprintf (dump_file, "\n\n");
+ }
+
+ return SSA_PROP_INTERESTING;
+ }
/* Nothing changed, don't add outgoing edges. */
return SSA_PROP_NOT_INTERESTING;