From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23631 invoked by alias); 3 May 2006 21:33:15 -0000 Received: (qmail 23612 invoked by uid 48); 3 May 2006 21:33:09 -0000 Date: Wed, 03 May 2006 21:33:00 -0000 Message-ID: <20060503213309.23611.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug tree-optimization/26944] [4.1/4.2 Regression] -ftree-ch generates worse code In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "steven at gcc dot gnu dot org" 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 X-SW-Source: 2006-05/txt/msg00312.txt.bz2 List-Id: ------- Comment #7 from steven at gcc dot gnu dot org 2006-05-03 21:33 ------- Re. comment #5, user code could also have a CFG like that, so we should handle this case properly (and we do, tree-ch is doing the right thing afaict). Re. comment #6, I don't see what the register allocator has to do with this at all. The bottom line is that for the case where we produce good code, IVOPTs selects a simple addressing mode and produces a simple loop exit condition; and for the complicated code, IVOPTs picks an addressing mode that requires a lea and an extra register. Look back at that loop for a moment. With tree-ch, ignoring dead code (the sets to SSA names 5[456] are dead!), the .cunroll dump (i.e. just before IVOPTs) looks like this: # Int_Index_37 = PHI ; :; (*pretmp.28_49)[Int_Index_37] = Int_Loc_3; Int_Index_58 = Int_Index_37 + 1; if (D.1563_41 >= Int_Index_58) goto ; else goto ; :; goto (); That looks rather nice to me. But just after IVOPTs (in the .ivopts dump) we have turned that simple nice code into this mess: # ivtmp.38_26 = PHI ; :; D.1622_34 = (int *) pretmp.28_49; D.1623_33 = (int *) Int_1_Par_Val_2; D.1624_22 = (int *) ivtmp.38_26; D.1625_21 = D.1623_33 + D.1624_22; MEM[base: D.1622_34, index: D.1625_21, step: 4B, offset: 20B] = Int_Loc_3; ivtmp.38_35 = ivtmp.38_26 + 1; D.1626_20 = (unsigned int) Int_1_Par_Val_2; D.1627_17 = D.1626_20 + ivtmp.38_35; D.1628_16 = D.1627_17 + 5; Int_Index_15 = (One_Fifty) D.1628_16; if (D.1563_41 >= Int_Index_15) goto ; else goto ; :; goto (); If this is caused by the register allocator, I'd like to know why you'd think that. And if this is the doing of tree-ch, then I'd like to know what you expect tree-ch to do instead. But as far as I can tell, this is just a very poor choice by IVOPTs. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26944