From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16777 invoked by alias); 7 Sep 2006 08:11:55 -0000 Received: (qmail 16712 invoked by uid 48); 7 Sep 2006 08:11:46 -0000 Date: Thu, 07 Sep 2006 08:11:00 -0000 Message-ID: <20060907081146.16711.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug rtl-optimization/28940] [4.1/4.2 Regression] address selection does not work correctly In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "bonzini at 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-09/txt/msg00507.txt.bz2 List-Id: ------- Comment #2 from bonzini at gnu dot org 2006-09-07 08:11 ------- It's not really CSE's fault, though I agree that doing addressing mode selection there is wrong. fwprop does not fix the bug for example, though teaching it about this case could be easier than teaching CSE. Unlike CSE, fwprop fixes this case: char a[10], b[10]; int f1(log i) { return a[i+1] + b[i+1]; } which generates incq %rdi movsbl a(%rdi),%eax movsbl b(%rdi),%edx addl %edx, %eax with current GCC. So one way to fix this bug (assuming fwprop is merged in 4.3) is to teach something (expand?) that (set (reg:DI 58 [ D.1872 ]) (sign_extend:DI (reg:SI 60 [ D.1872 ]))) (parallel [ (set (reg:DI 62 [ D.1872 ]) (plus:DI (reg/v:DI 58 [ i ]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) at least when we can disregard overflow, might be better than (parallel [ (set (reg:SI 58 [ D.1872 ]) (plus:SI (reg/v:SI 60 [ i ]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) (set (reg:DI 62 [ D.1872 ]) (sign_extend:DI (reg:SI 58 [ D.1872 ]))) -- bonzini at gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bonzini at gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28940