Skip to content

Commit 51a59a4

Browse files
committed
Merging r246372:
------------------------------------------------------------------------ r246372 | hfinkel | 2015-08-30 03:44:05 -0400 (Sun, 30 Aug 2015) | 10 lines [PowerPC] Don't assume ADDISdtprelHA's source is r3 Even through ADDISdtprelHA generally has r3 as its source register, it is possible for the instruction scheduler to move things around such that some other register is the source. We need to print the actual source register, not always r3. Fixes PR24394. The test case will come in a follow-up commit because it depends on MIR target-flags parsing. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_37@252477 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 4ab6754 commit 51a59a4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/Target/PowerPC/PPCAsmPrinter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -947,11 +947,11 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
947947
return;
948948
}
949949
case PPC::ADDISdtprelHA:
950-
// Transform: %Xd = ADDISdtprelHA %X3, <ga:@sym>
951-
// Into: %Xd = ADDIS8 %X3, sym@dtprel@ha
950+
// Transform: %Xd = ADDISdtprelHA %Xs, <ga:@sym>
951+
// Into: %Xd = ADDIS8 %Xs, sym@dtprel@ha
952952
case PPC::ADDISdtprelHA32: {
953-
// Transform: %Rd = ADDISdtprelHA32 %R3, <ga:@sym>
954-
// Into: %Rd = ADDIS %R3, sym@dtprel@ha
953+
// Transform: %Rd = ADDISdtprelHA32 %Rs, <ga:@sym>
954+
// Into: %Rd = ADDIS %Rs, sym@dtprel@ha
955955
const MachineOperand &MO = MI->getOperand(2);
956956
const GlobalValue *GValue = MO.getGlobal();
957957
MCSymbol *MOSymbol = getSymbol(GValue);
@@ -962,7 +962,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
962962
*OutStreamer,
963963
MCInstBuilder(Subtarget->isPPC64() ? PPC::ADDIS8 : PPC::ADDIS)
964964
.addReg(MI->getOperand(0).getReg())
965-
.addReg(Subtarget->isPPC64() ? PPC::X3 : PPC::R3)
965+
.addReg(MI->getOperand(1).getReg())
966966
.addExpr(SymDtprel));
967967
return;
968968
}

0 commit comments

Comments
 (0)