This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] for PRs 27639 and 26719


> 	* tree-chrec.c (convert_affine_scev, chrec_convert_1,
> 	scev_direction): New functions.
> 	(chrec_convert): Changed to a wrapper over chrec_convert_1.

This breaks Ada on platforms that don't use ZCX exceptions (PR 27937).

The loop optimizer now generates IVs in subtypes instead of base types:

const positive___XDLU_1__2147483647 ivtmp.115;

  # ivtmp.115_14 = PHI <ivtmp.115_60(11), ivtmp.115_57(9)>;
<L8>:;
  ivtmp.115_60 = ivtmp.115_14 + 1;
  if (ivtmp.115_60 == D.1539_45) goto <L35>; else goto <L36>;

which causes VRP to enter the kind of infinite loops Jeff Law was chasing down 
3 months ago and that prompted him to add

  if (INTEGRAL_TYPE_P (type))
    {
      tree t;

      t = upper_bound_in_type (type, inner_type);
      if (! TYPE_MAX_VALUE (type)
	  || ! operand_equal_p (TYPE_MAX_VALUE (type), t, 0))
	return NULL_TREE;

      t = lower_bound_in_type (type, inner_type);
      if (! TYPE_MIN_VALUE (type)
	  || ! operand_equal_p (TYPE_MIN_VALUE (type), t, 0))
	return NULL_TREE;
    }

to chrec_convert_aggressive.

It looks like chrec_convert is now more aggressive too; in particular, the old 
log contained many

(failed conversion:
  type: positive___XDLU_1__2147483647
  base: (integer) R46b_2 + 1
  step: 1
  estimated_nb_iterations: 0ffffffff
)
  (evolution_function = (positive___XDLU_1__2147483647) {(integer) R46b_141, 
+, 1}_1))

[Btw, why did you remove this logging capability from chrec_convert?]


The problem is that the new predicate nowrap_type_p returns false on 

(gdb) p debug_tree(type)
 <integer_type 0x556f3cf0 positive___XDLU_1__2147483647
    type <integer_type 0x556b8284 integer sizes-gimplified public visited SI
        size <integer_cst 0x556a93f0 constant invariant 32>
        unit size <integer_cst 0x556a9180 constant invariant 4>
        align 32 symtab 0 alias set 2 precision 32 min <integer_cst 0x556a93a8 
-2147483648> max <integer_cst 0x556a93c0 2147483647>
        pointer_to_this <pointer_type 0x556b8a6c>>
    sizes-gimplified public visited unsigned SI size <integer_cst 0x556a93f0 
32> unit size <integer_cst 0x556a9180 4>
    user align 32 symtab 0 alias set 2 precision 32 min <integer_cst 
0x556a97981> max <integer_cst 0x556a93c0 2147483647>
    RM size <integer_cst 0x556a9330 type <integer_type 0x556b805c 
bit_size_type> constant invariant 31>>

so I'm proposing to simply make nowrap_type_p return true for subtypes (i.e. 
integer types that have a base type):

Index: tree-ssa-loop-niter.c
===================================================================
--- tree-ssa-loop-niter.c       (revision 114982)
+++ tree-ssa-loop-niter.c       (working copy)
@@ -1945,6 +1945,10 @@ nowrap_type_p (tree type)
       && !TYPE_UNSIGNED (type))
     return true;

+  /* Assume that types don't wrap if they have a base type.  */
+  if (TREE_CODE (type) == INTEGER_TYPE && TREE_TYPE (type))
+    return true;
+
   if (POINTER_TYPE_P (type))
     return true;


What do you think?  Thanks in advance.

--
Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]