From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89429 invoked by alias); 15 Apr 2015 15:28:30 -0000 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 Received: (qmail 89305 invoked by uid 48); 15 Apr 2015 15:28:27 -0000 From: "wschmidt at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/65773] New: [5.1 regression] GCC 5.1 miscompiles LLVM function AArch64InstrInfo::loadRegFromStackSlot() Date: Wed, 15 Apr 2015 15:28:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 5.1.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: wschmidt at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter cc cf_gcchost cf_gcctarget cf_gccbuild Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-04/txt/msg01232.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65773 Bug ID: 65773 Summary: [5.1 regression] GCC 5.1 miscompiles LLVM function AArch64InstrInfo::loadRegFromStackSlot() Product: gcc Version: 5.1.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: wschmidt at gcc dot gnu.org CC: bergner at gcc dot gnu.org, jakub at gcc dot gnu.org, rguenth at gcc dot gnu.org Host: powerpc64*-linux-gnu Target: powerpc64*-linux-gnu Build: powerpc64*-linux-gnu I built gcc from branches/gcc-5-branch yesterday and used it to build Clang/LLVM as an acid test. Unfortunately the test suite shows a number of failures. I've traced these down to a miscompile of AArch64InstrInfo::loadRegFromStackSlot( ). The bad code can be seen here: 105eb74c: 00 00 60 38 li r3,0 105eb750: 28 00 41 f9 std r10,40(r1) 105eb754: e4 06 29 79 rldicr r9,r9,0,59 105eb758: 30 00 41 f9 std r10,48(r1) 105eb75c: 21 00 01 99 stb r8,33(r1) 105eb760: 22 00 21 99 stb r9,34(r1) 105eb764: a5 ec 79 48 bl 10d8a408 <_ZN4llvm12MachineInstr10addOp\ erandERNS_15MachineFunctionERKNS_14MachineOperandE+0x8> This calls MachineInstr::addOperand(MachineFunction&, MachineOperand const&) with r3 as the this pointer. Loading zero into the this pointer ahead of the call seems somewhat unhelpful. The same code compiled with the 4.8 gcc I usually use shows: 106a8fa0: 78 cb 25 7f mr r5,r25 106a8fa4: 78 f3 c3 7f mr r3,r30 106a8fa8: 20 00 9e eb ld r28,32(r30) 106a8fac: 78 eb a4 7f mr r4,r29 106a8fb0: 78 d3 46 7f mr r6,r26 106a8fb4: 65 d4 7c 48 bl 10e76418 <_ZNK4llvm12MachineInstr21getR\ egClassConstraintEjPKNS_15TargetInstrInfoEPKNS_18TargetRegisterInfoE+0x8> which is clearly much more reasonable. I'll gather reproduction materials, but wanted to get the bug filed quickly for awareness.