On Wed, May 04, 2016 at 12:52:47AM +0200, Bernd Schmidt wrote: > I must say I find the argumentation about the fallout not compelling. It's a > normal consequence of development work, and by enabling it at -O2, we have > found: > * a Linux kernel bug > * a rs6000 testsuite bug > * some i386.md issues that can cause performance problems > * and a compare-debug problem in regrename itself. > All of these are _good_ things. If we don't want to run into such issues > we'll have to cease all development work.
I agree it's good to find these things.. Another nasty bug to add to the list is complete breakage of gccgo on powerpc64le. I see register renaming around the prologue call to __morestack, which trashes function arguments. Dump of assembler code for function main: 0x00000000100014e0 <+0>: lis r2,4098 0x00000000100014e4 <+4>: addi r2,r2,-18176 0x00000000100014e8 <+8>: ld r0,-28736(r13) 0x00000000100014ec <+12>: addi r12,r1,-16496 0x00000000100014f0 <+16>: nop 0x00000000100014f4 <+20>: cmpld cr7,r12,r0 0x00000000100014f8 <+24>: blt cr7,0x10001550 <main+112> 0x00000000100014fc <+28>: mflr r5 0x0000000010001500 <+32>: std r30,-16(r1) 0x0000000010001504 <+36>: std r31,-8(r1) 0x0000000010001508 <+40>: li r8,0 0x000000001000150c <+44>: nop 0x0000000010001510 <+48>: ld r10,-32664(r2) 0x0000000010001514 <+52>: nop 0x0000000010001518 <+56>: ld r6,-32672(r2) 0x000000001000151c <+60>: std r5,16(r1) 0x0000000010001520 <+64>: stdu r1,-112(r1) 0x0000000010001524 <+68>: stb r8,0(r6) 0x0000000010001528 <+72>: lbz r9,0(r10) 0x000000001000152c <+76>: cmpwi r9,0 0x0000000010001530 <+80>: beq 0x1000156c <main+140> 0x0000000010001534 <+84>: li r3,0 0x0000000010001538 <+88>: addi r1,r1,112 0x000000001000153c <+92>: ld r0,16(r1) 0x0000000010001540 <+96>: ld r30,-16(r1) 0x0000000010001544 <+100>: ld r31,-8(r1) 0x0000000010001548 <+104>: mtlr r0 0x000000001000154c <+108>: blr => 0x0000000010001550 <+112>: mflr r3 # argc trashed 0x0000000010001554 <+116>: std r3,16(r1) 0x0000000010001558 <+120>: bl 0x10001818 <__morestack> 0x000000001000155c <+124>: ld r4,16(r1) 0x0000000010001560 <+128>: mtlr r4 0x0000000010001564 <+132>: blr 0x0000000010001568 <+136>: b 0x100014fc <main+28> __morestack has a non-standard calling convention. After buying more stack, it calls its caller! In this case that means a call to 0x10001568. So regrename can't use r3 at 0x10001550 as it is a parameter passing reg for main. The use of r4 at 0x1000155c would also be wrong for a function that returns a value in r4. -- Alan Modra Australia Development Lab, IBM