From: Jim Grosbach Date: Tue, 10 Sep 2013 17:21:39 +0000 (+0000) Subject: ARM: Use the PICADD opcode calculated. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=1039e106d095979b3707bb27cfa765cd2c0f3b54;p=oota-llvm.git ARM: Use the PICADD opcode calculated. We were figuring out whether to use tPICADD or PICADD, then just using tPICADD unconditionally anyway. Oops. A testcase from someone familiar enough with ELF to produce one would be appreciated. The existing PIC testcase correctly verifies the .s generated, but that doesn't catch this bug, which only showed up in direct-to-object mode. http://llvm.org/bugs/show_bug.cgi?id=17180 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190417 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM/ARMInstrInfo.cpp b/lib/Target/ARM/ARMInstrInfo.cpp index 3508795ddcc..df867b49ab5 100644 --- a/lib/Target/ARM/ARMInstrInfo.cpp +++ b/lib/Target/ARM/ARMInstrInfo.cpp @@ -136,8 +136,12 @@ namespace { unsigned GlobalBaseReg = AFI->getGlobalBaseReg(); Opc = TM->getSubtarget().isThumb2() ? ARM::tPICADD : ARM::PICADD; - BuildMI(FirstMBB, MBBI, DL, TII.get(ARM::tPICADD), GlobalBaseReg) - .addReg(TempReg).addImm(ARMPCLabelIndex); + MIB = BuildMI(FirstMBB, MBBI, DL, TII.get(Opc), GlobalBaseReg) + .addReg(TempReg) + .addImm(ARMPCLabelIndex); + if (Opc == ARM::PICADD) + AddDefaultPred(MIB); + return true; }