From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7806 invoked by alias); 21 Jun 2010 20:14:16 -0000 Received: (qmail 7622 invoked by uid 48); 21 Jun 2010 20:13:46 -0000 Date: Mon, 21 Jun 2010 20:14:00 -0000 Subject: [Bug rtl-optimization/44618] New: Arguments are not passed correctly to out-of-line restore functions. [4.4][4.5][4.6] X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "edmar at freescale dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-06/txt/msg02103.txt.bz2 On 32 bit powerpc targets, the family of out-of-line restore functions (_restgpr__x), expects r11 (or something else, depending on the ABI used) to have the new value of the stack pointer. Gcc emits rtl that sets r11, and a jump_insn that flags the use of r11. When compiling the test case with "-Os -frename-registers", the register rename pass (regrename.c) may rename this r11 def-use chain. test case: int calc (int j) { if (j==0) return 0; return calc(j-1)*(j+1); } compiled with: -Os -frename-registers -S results in assembler like this: . . . .L3: addi 4,1,16 b _restgpr_31_x This problem exists in the 4.4 branch, the 4.5 branch, and in the main trunk as well. In general, the optimization avoids renaming registers involved in argument passing, but only when a call_insn is involved. The attached patches extends this behavior to jump_insn as well. Is my approach to fix the problem adequate ? In case it is, attached are a patch that can be applied to gcc-4.5 and the trunk, and a specific one for the 4.4 branch. I have bootstraped and regression tested each of the following: (All of them completed with no regressions) Note: I have no WAA privilege. 4.4 branch rev 160848 on target powerpc-unkown-linux-gnu (--with-cpu=603e, G5 hardware) 4.4 branch rev 160838 on target powerpc64-unkown-linux-gnu (--with-cpu=970, G5 hardware) 4.4 branch rev 160837 on target i686-pc-linux (--with-cpu=generic, --with-arch=i686, Xeon hardware) 4.4 branch rev 160837 on target x86_64-pc-linux (--with-cpu=generic, Xeon hardware) 4.5 branch rev 160890 on target powerpc-unkown-linux-gnu (--with-cpu=603e, G5 hardware) 4.5 branch rev 160869 on target powerpc64-unkown-linux-gnu (--with-cpu=970, G5 hardware) 4.5 branch rev 160869 on target i686-pc-linux (--with-cpu=generic, --with-arch=i686, Xeon hardware) 4.5 branch rev 160857 on target x86_64-pc-linux (--with-cpu=generic, Xeon hardware) 4.6 (trunk) rev 160955 on target powerpc-unkown-linux-gnu (--with-cpu=603e, G5 hardware) 4.6 (trunk) rev 161009 on target powerpc64-unkown-linux-gnu (--with-cpu=970, G5 hardware) 4.6 (trunk) rev 160906 on target i686-pc-linux (--with-cpu=generic, --with-arch=i686, Xeon hardware) 4.6 (trunk) rev 160919 on target x86_64-pc-linux (--with-cpu=generic, Xeon hardware) -- Summary: Arguments are not passed correctly to out-of-line restore functions. [4.4][4.5][4.6] Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: edmar at freescale dot com GCC host triplet: powerpc-unkonw-linux-gnu GCC target triplet: powerpc-unkonw-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44618