From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11186 invoked by alias); 27 Feb 2005 02:09:52 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 10781 invoked by alias); 27 Feb 2005 02:09:46 -0000 Date: Sun, 27 Feb 2005 13:21:00 -0000 Message-ID: <20050227020946.10780.qmail@sourceware.org> From: "dberlin at dberlin dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20050225212929.20216.fjahanian@apple.com> References: <20050225212929.20216.fjahanian@apple.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug tree-optimization/20216] [4.0/4.1 Regression] Simple loop runs out of stack at -O1 X-Bugzilla-Reason: CC X-SW-Source: 2005-02/txt/msg03269.txt.bz2 List-Id: ------- Additional Comments From dberlin at gcc dot gnu dot org 2005-02-27 02:09 ------- Subject: Re: [4.0/4.1 Regression] Simple loop runs out of stack at -O1 On Sun, 2005-02-27 at 00:51 +0000, fjahanian at apple dot com wrote: > ------- Additional Comments From fjahanian at apple dot com 2005-02-27 00:51 ------- > (In reply to comment #6) > > The first part of the patch seems fine. > > We should make tree_fold_binomial non-recursive. > You meant tree_fold_factorial? tree_fold_binomial is not recursive as is. > > > Note, however, that once you do that, the other part of the patch isn't actually > > doing anything (the change to chrec_apply). > I agree. checking for 1024 is arbitrary and I did not propose it as a final solution. > I think a better solution would be to compute the factorial of the array upper bound, > as currently is done. If it cannot be evaluated, due to overflow, chrec_evaluate > which depends on computation of tree_fold_binomial returns chrec_dont_know. In other words, we > do this optimization only when factorial can be computed. This prevents > setting an arbitrary limit and will let the implmentation limitations dicides feasibility > of this optimization. What do you think on a patch along this line? I believe Roger Sayle was considering simply rewriting this code to not use fold at all, for starters, and then doing the smart thing about evaluation of binomial. Let's see what he has to say. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20216