Skip to content

Commit 97106f9

Browse files
committed
[RISCV] Avoid Splitting MBB in RISCVExpandPseudo
Since the `RISCVExpandPseudo` pass has been split from `RISCVExpandAtomicPseudo` pass, it would be nice to run the former as early as possible (The latter has to be run as late as possible to ensure correctness). Running earlier means we can reschedule these pairs as we see fit. Running earlier in the machine pass pipeline is good, but would mean teaching many more passes about `hasLabelMustBeEmitted`. Splitting the basic blocks also pessimises possible optimisations because some optimisations are MBB-local, and others are disabled if the block has its address taken (which is notionally what `hasLabelMustBeEmitted` means). This patch uses a new approach of setting the pre-instruction symbol on the AUIPC instruction to a temporary symbol and referencing that. This avoids splitting the basic block, but allows us to reference exactly the instruction that we need to. Notionally, this approach seems more correct because we do actually want to address a specific instruction. This then allows the pass to be moved much earlier in the pass pipeline, before both scheduling and register allocation. However, to do so we must leave the MIR in SSA form (by not redefining registers), and so use a virtual register for the intermediate value. By using this virtual register, this pass now has to come before register allocation. Reviewed By: luismarques, asb Differential Revision: https://reviews.llvm.org/D82988
1 parent 167767a commit 97106f9

File tree

9 files changed

+93
-147
lines changed

9 files changed

+93
-147
lines changed

llvm/include/llvm/CodeGen/MachineBasicBlock.h

-11
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,6 @@ class MachineBasicBlock
143143
/// branch.
144144
bool AddressTaken = false;
145145

146-
/// Indicate that this basic block needs its symbol be emitted regardless of
147-
/// whether the flow just falls-through to it.
148-
bool LabelMustBeEmitted = false;
149-
150146
/// Indicate that this basic block is the entry block of an EH scope, i.e.,
151147
/// the block that used to have a catchpad or cleanuppad instruction in the
152148
/// LLVM IR.
@@ -206,13 +202,6 @@ class MachineBasicBlock
206202
/// branch.
207203
void setHasAddressTaken() { AddressTaken = true; }
208204

209-
/// Test whether this block must have its label emitted.
210-
bool hasLabelMustBeEmitted() const { return LabelMustBeEmitted; }
211-
212-
/// Set this block to reflect that, regardless how we flow to it, we need
213-
/// its label be emitted.
214-
void setLabelMustBeEmitted() { LabelMustBeEmitted = true; }
215-
216205
/// Return the MachineFunction containing this basic block.
217206
const MachineFunction *getParent() const { return xParent; }
218207
MachineFunction *getParent() { return xParent; }

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -3057,16 +3057,13 @@ void AsmPrinter::emitBasicBlockStart(const MachineBasicBlock &MBB) {
30573057

30583058
if (MBB.pred_empty() ||
30593059
(!MF->hasBBLabels() && isBlockOnlyReachableByFallthrough(&MBB) &&
3060-
!MBB.isEHFuncletEntry() && !MBB.hasLabelMustBeEmitted())) {
3060+
!MBB.isEHFuncletEntry())) {
30613061
if (isVerbose()) {
30623062
// NOTE: Want this comment at start of line, don't emit with AddComment.
30633063
OutStreamer->emitRawComment(" %bb." + Twine(MBB.getNumber()) + ":",
30643064
false);
30653065
}
30663066
} else {
3067-
if (isVerbose() && MBB.hasLabelMustBeEmitted()) {
3068-
OutStreamer->AddComment("Label of block must be emitted");
3069-
}
30703067
// Switch to a new section if this basic block must begin a section.
30713068
if (MBB.isBeginSection()) {
30723069
OutStreamer->SwitchSection(

llvm/lib/Target/RISCV/RISCVExpandPseudoInsts.cpp

+36-62
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "llvm/CodeGen/LivePhysRegs.h"
2020
#include "llvm/CodeGen/MachineFunctionPass.h"
2121
#include "llvm/CodeGen/MachineInstrBuilder.h"
22+
#include "llvm/MC/MCContext.h"
2223

2324
using namespace llvm;
2425

@@ -41,24 +42,18 @@ class RISCVExpandPseudo : public MachineFunctionPass {
4142

4243
private:
4344
bool expandMBB(MachineBasicBlock &MBB);
44-
bool expandMI(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
45-
MachineBasicBlock::iterator &NextMBBI);
45+
bool expandMI(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI);
4646
bool expandAuipcInstPair(MachineBasicBlock &MBB,
4747
MachineBasicBlock::iterator MBBI,
48-
MachineBasicBlock::iterator &NextMBBI,
4948
unsigned FlagsHi, unsigned SecondOpcode);
5049
bool expandLoadLocalAddress(MachineBasicBlock &MBB,
51-
MachineBasicBlock::iterator MBBI,
52-
MachineBasicBlock::iterator &NextMBBI);
50+
MachineBasicBlock::iterator MBBI);
5351
bool expandLoadAddress(MachineBasicBlock &MBB,
54-
MachineBasicBlock::iterator MBBI,
55-
MachineBasicBlock::iterator &NextMBBI);
52+
MachineBasicBlock::iterator MBBI);
5653
bool expandLoadTLSIEAddress(MachineBasicBlock &MBB,
57-
MachineBasicBlock::iterator MBBI,
58-
MachineBasicBlock::iterator &NextMBBI);
54+
MachineBasicBlock::iterator MBBI);
5955
bool expandLoadTLSGDAddress(MachineBasicBlock &MBB,
60-
MachineBasicBlock::iterator MBBI,
61-
MachineBasicBlock::iterator &NextMBBI);
56+
MachineBasicBlock::iterator MBBI);
6257
};
6358

6459
char RISCVExpandPseudo::ID = 0;
@@ -77,81 +72,64 @@ bool RISCVExpandPseudo::expandMBB(MachineBasicBlock &MBB) {
7772
MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end();
7873
while (MBBI != E) {
7974
MachineBasicBlock::iterator NMBBI = std::next(MBBI);
80-
Modified |= expandMI(MBB, MBBI, NMBBI);
75+
Modified |= expandMI(MBB, MBBI);
8176
MBBI = NMBBI;
8277
}
8378

8479
return Modified;
8580
}
8681

8782
bool RISCVExpandPseudo::expandMI(MachineBasicBlock &MBB,
88-
MachineBasicBlock::iterator MBBI,
89-
MachineBasicBlock::iterator &NextMBBI) {
83+
MachineBasicBlock::iterator MBBI) {
9084
switch (MBBI->getOpcode()) {
9185
case RISCV::PseudoLLA:
92-
return expandLoadLocalAddress(MBB, MBBI, NextMBBI);
86+
return expandLoadLocalAddress(MBB, MBBI);
9387
case RISCV::PseudoLA:
94-
return expandLoadAddress(MBB, MBBI, NextMBBI);
88+
return expandLoadAddress(MBB, MBBI);
9589
case RISCV::PseudoLA_TLS_IE:
96-
return expandLoadTLSIEAddress(MBB, MBBI, NextMBBI);
90+
return expandLoadTLSIEAddress(MBB, MBBI);
9791
case RISCV::PseudoLA_TLS_GD:
98-
return expandLoadTLSGDAddress(MBB, MBBI, NextMBBI);
92+
return expandLoadTLSGDAddress(MBB, MBBI);
9993
}
10094

10195
return false;
10296
}
10397

104-
bool RISCVExpandPseudo::expandAuipcInstPair(
105-
MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
106-
MachineBasicBlock::iterator &NextMBBI, unsigned FlagsHi,
107-
unsigned SecondOpcode) {
98+
bool RISCVExpandPseudo::expandAuipcInstPair(MachineBasicBlock &MBB,
99+
MachineBasicBlock::iterator MBBI,
100+
unsigned FlagsHi,
101+
unsigned SecondOpcode) {
108102
MachineFunction *MF = MBB.getParent();
109103
MachineInstr &MI = *MBBI;
110104
DebugLoc DL = MI.getDebugLoc();
111105

112106
Register DestReg = MI.getOperand(0).getReg();
113-
const MachineOperand &Symbol = MI.getOperand(1);
107+
Register ScratchReg =
108+
MF->getRegInfo().createVirtualRegister(&RISCV::GPRRegClass);
114109

115-
MachineBasicBlock *NewMBB = MF->CreateMachineBasicBlock(MBB.getBasicBlock());
110+
MachineOperand &Symbol = MI.getOperand(1);
111+
Symbol.setTargetFlags(FlagsHi);
112+
MCSymbol *AUIPCSymbol = MF->getContext().createTempSymbol(false);
116113

117-
// Tell AsmPrinter that we unconditionally want the symbol of this label to be
118-
// emitted.
119-
NewMBB->setLabelMustBeEmitted();
114+
MachineInstr *MIAUIPC =
115+
BuildMI(MBB, MBBI, DL, TII->get(RISCV::AUIPC), ScratchReg).add(Symbol);
116+
MIAUIPC->setPreInstrSymbol(*MF, AUIPCSymbol);
120117

121-
MF->insert(++MBB.getIterator(), NewMBB);
118+
BuildMI(MBB, MBBI, DL, TII->get(SecondOpcode), DestReg)
119+
.addReg(ScratchReg)
120+
.addSym(AUIPCSymbol, RISCVII::MO_PCREL_LO);
122121

123-
BuildMI(NewMBB, DL, TII->get(RISCV::AUIPC), DestReg)
124-
.addDisp(Symbol, 0, FlagsHi);
125-
BuildMI(NewMBB, DL, TII->get(SecondOpcode), DestReg)
126-
.addReg(DestReg)
127-
.addMBB(NewMBB, RISCVII::MO_PCREL_LO);
128-
129-
// Move all the rest of the instructions to NewMBB.
130-
NewMBB->splice(NewMBB->end(), &MBB, std::next(MBBI), MBB.end());
131-
// Update machine-CFG edges.
132-
NewMBB->transferSuccessorsAndUpdatePHIs(&MBB);
133-
// Make the original basic block fall-through to the new.
134-
MBB.addSuccessor(NewMBB);
135-
136-
// Make sure live-ins are correctly attached to this new basic block.
137-
LivePhysRegs LiveRegs;
138-
computeAndAddLiveIns(LiveRegs, *NewMBB);
139-
140-
NextMBBI = MBB.end();
141122
MI.eraseFromParent();
142123
return true;
143124
}
144125

145126
bool RISCVExpandPseudo::expandLoadLocalAddress(
146-
MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
147-
MachineBasicBlock::iterator &NextMBBI) {
148-
return expandAuipcInstPair(MBB, MBBI, NextMBBI, RISCVII::MO_PCREL_HI,
149-
RISCV::ADDI);
127+
MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) {
128+
return expandAuipcInstPair(MBB, MBBI, RISCVII::MO_PCREL_HI, RISCV::ADDI);
150129
}
151130

152-
bool RISCVExpandPseudo::expandLoadAddress(
153-
MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
154-
MachineBasicBlock::iterator &NextMBBI) {
131+
bool RISCVExpandPseudo::expandLoadAddress(MachineBasicBlock &MBB,
132+
MachineBasicBlock::iterator MBBI) {
155133
MachineFunction *MF = MBB.getParent();
156134

157135
unsigned SecondOpcode;
@@ -164,25 +142,21 @@ bool RISCVExpandPseudo::expandLoadAddress(
164142
SecondOpcode = RISCV::ADDI;
165143
FlagsHi = RISCVII::MO_PCREL_HI;
166144
}
167-
return expandAuipcInstPair(MBB, MBBI, NextMBBI, FlagsHi, SecondOpcode);
145+
return expandAuipcInstPair(MBB, MBBI, FlagsHi, SecondOpcode);
168146
}
169147

170148
bool RISCVExpandPseudo::expandLoadTLSIEAddress(
171-
MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
172-
MachineBasicBlock::iterator &NextMBBI) {
149+
MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) {
173150
MachineFunction *MF = MBB.getParent();
174151

175152
const auto &STI = MF->getSubtarget<RISCVSubtarget>();
176153
unsigned SecondOpcode = STI.is64Bit() ? RISCV::LD : RISCV::LW;
177-
return expandAuipcInstPair(MBB, MBBI, NextMBBI, RISCVII::MO_TLS_GOT_HI,
178-
SecondOpcode);
154+
return expandAuipcInstPair(MBB, MBBI, RISCVII::MO_TLS_GOT_HI, SecondOpcode);
179155
}
180156

181157
bool RISCVExpandPseudo::expandLoadTLSGDAddress(
182-
MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
183-
MachineBasicBlock::iterator &NextMBBI) {
184-
return expandAuipcInstPair(MBB, MBBI, NextMBBI, RISCVII::MO_TLS_GD_HI,
185-
RISCV::ADDI);
158+
MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) {
159+
return expandAuipcInstPair(MBB, MBBI, RISCVII::MO_TLS_GD_HI, RISCV::ADDI);
186160
}
187161

188162
} // end of anonymous namespace

llvm/lib/Target/RISCV/RISCVMCInstLower.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ bool llvm::LowerRISCVMachineOperandToMCOperand(const MachineOperand &MO,
121121
case MachineOperand::MO_ConstantPoolIndex:
122122
MCOp = lowerSymbolOperand(MO, AP.GetCPISymbol(MO.getIndex()), AP);
123123
break;
124+
case MachineOperand::MO_MCSymbol:
125+
MCOp = lowerSymbolOperand(MO, MO.getMCSymbol(), AP);
126+
break;
124127
}
125128
return true;
126129
}

llvm/lib/Target/RISCV/RISCVTargetMachine.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,13 @@ void RISCVPassConfig::addPreSched2() {}
173173
void RISCVPassConfig::addPreEmitPass() { addPass(&BranchRelaxationPassID); }
174174

175175
void RISCVPassConfig::addPreEmitPass2() {
176-
addPass(createRISCVExpandPseudoPass());
177176
// Schedule the expansion of AMOs at the last possible moment, avoiding the
178177
// possibility for other passes to break the requirements for forward
179178
// progress in the LR/SC block.
180179
addPass(createRISCVExpandAtomicPseudoPass());
181180
}
182181

183182
void RISCVPassConfig::addPreRegAlloc() {
183+
addPass(createRISCVExpandPseudoPass());
184184
addPass(createRISCVMergeBaseOffsetOptPass());
185185
}

llvm/test/CodeGen/RISCV/codemodel-lowering.ll

+10-11
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ define i32 @lower_global(i32 %a) nounwind {
1616
;
1717
; RV32I-MEDIUM-LABEL: lower_global:
1818
; RV32I-MEDIUM: # %bb.0:
19-
; RV32I-MEDIUM-NEXT: .LBB0_1: # Label of block must be emitted
19+
; RV32I-MEDIUM-NEXT: .Ltmp0:
2020
; RV32I-MEDIUM-NEXT: auipc a0, %pcrel_hi(G)
21-
; RV32I-MEDIUM-NEXT: addi a0, a0, %pcrel_lo(.LBB0_1)
21+
; RV32I-MEDIUM-NEXT: addi a0, a0, %pcrel_lo(.Ltmp0)
2222
; RV32I-MEDIUM-NEXT: lw a0, 0(a0)
2323
; RV32I-MEDIUM-NEXT: ret
2424
%1 = load volatile i32, i32* @G
@@ -39,9 +39,9 @@ define void @lower_blockaddress() nounwind {
3939
;
4040
; RV32I-MEDIUM-LABEL: lower_blockaddress:
4141
; RV32I-MEDIUM: # %bb.0:
42-
; RV32I-MEDIUM-NEXT: .LBB1_1: # Label of block must be emitted
42+
; RV32I-MEDIUM-NEXT: .Ltmp1:
4343
; RV32I-MEDIUM-NEXT: auipc a0, %pcrel_hi(addr)
44-
; RV32I-MEDIUM-NEXT: addi a0, a0, %pcrel_lo(.LBB1_1)
44+
; RV32I-MEDIUM-NEXT: addi a0, a0, %pcrel_lo(.Ltmp1)
4545
; RV32I-MEDIUM-NEXT: addi a1, zero, 1
4646
; RV32I-MEDIUM-NEXT: sw a1, 0(a0)
4747
; RV32I-MEDIUM-NEXT: ret
@@ -82,17 +82,16 @@ define signext i32 @lower_blockaddress_displ(i32 signext %w) nounwind {
8282
; RV32I-MEDIUM: # %bb.0: # %entry
8383
; RV32I-MEDIUM-NEXT: addi sp, sp, -16
8484
; RV32I-MEDIUM-NEXT: sw ra, 12(sp)
85-
; RV32I-MEDIUM-NEXT: .LBB2_5: # %entry
86-
; RV32I-MEDIUM-NEXT: # Label of block must be emitted
87-
; RV32I-MEDIUM-NEXT: auipc a1, %pcrel_hi(.Ltmp0)
88-
; RV32I-MEDIUM-NEXT: addi a1, a1, %pcrel_lo(.LBB2_5)
85+
; RV32I-MEDIUM-NEXT: .Ltmp2:
86+
; RV32I-MEDIUM-NEXT: auipc a1, %pcrel_hi(.Ltmp3)
87+
; RV32I-MEDIUM-NEXT: addi a1, a1, %pcrel_lo(.Ltmp2)
8988
; RV32I-MEDIUM-NEXT: addi a2, zero, 101
9089
; RV32I-MEDIUM-NEXT: sw a1, 8(sp)
9190
; RV32I-MEDIUM-NEXT: blt a0, a2, .LBB2_3
9291
; RV32I-MEDIUM-NEXT: # %bb.1: # %if.then
9392
; RV32I-MEDIUM-NEXT: lw a0, 8(sp)
9493
; RV32I-MEDIUM-NEXT: jr a0
95-
; RV32I-MEDIUM-NEXT: .Ltmp0: # Block address taken
94+
; RV32I-MEDIUM-NEXT: .Ltmp3: # Block address taken
9695
; RV32I-MEDIUM-NEXT: .LBB2_2: # %return
9796
; RV32I-MEDIUM-NEXT: addi a0, zero, 4
9897
; RV32I-MEDIUM-NEXT: j .LBB2_4
@@ -140,9 +139,9 @@ define float @lower_constantpool(float %a) nounwind {
140139
;
141140
; RV32I-MEDIUM-LABEL: lower_constantpool:
142141
; RV32I-MEDIUM: # %bb.0:
143-
; RV32I-MEDIUM-NEXT: .LBB3_1: # Label of block must be emitted
142+
; RV32I-MEDIUM-NEXT: .Ltmp4:
144143
; RV32I-MEDIUM-NEXT: auipc a1, %pcrel_hi(.LCPI3_0)
145-
; RV32I-MEDIUM-NEXT: addi a1, a1, %pcrel_lo(.LBB3_1)
144+
; RV32I-MEDIUM-NEXT: addi a1, a1, %pcrel_lo(.Ltmp4)
146145
; RV32I-MEDIUM-NEXT: flw ft0, 0(a1)
147146
; RV32I-MEDIUM-NEXT: fmv.w.x ft1, a0
148147
; RV32I-MEDIUM-NEXT: fadd.s ft0, ft1, ft0

llvm/test/CodeGen/RISCV/mir-target-flags.ll

+10-10
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,29 @@ define i32 @caller(i32 %a) nounwind {
2727
; RV32-SMALL-NEXT: target-flags(riscv-hi) @g_i
2828
; RV32-SMALL-NEXT: target-flags(riscv-lo) @g_i
2929
; RV32-SMALL: target-flags(riscv-tls-got-hi) @t_un
30-
; RV32-SMALL-NEXT: target-flags(riscv-pcrel-lo) %bb.1
30+
; RV32-SMALL-NEXT: target-flags(riscv-pcrel-lo)
3131
; RV32-SMALL: target-flags(riscv-tls-got-hi) @t_ld
32-
; RV32-SMALL-NEXT: target-flags(riscv-pcrel-lo) %bb.2
32+
; RV32-SMALL-NEXT: target-flags(riscv-pcrel-lo)
3333
; RV32-SMALL: target-flags(riscv-tls-got-hi) @t_ie
34-
; RV32-SMALL-NEXT: target-flags(riscv-pcrel-lo) %bb.3
34+
; RV32-SMALL-NEXT: target-flags(riscv-pcrel-lo)
3535
; RV32-SMALL: target-flags(riscv-tprel-hi) @t_le
3636
; RV32-SMALL-NEXT: target-flags(riscv-tprel-add) @t_le
3737
; RV32-SMALL-NEXT: target-flags(riscv-tprel-lo) @t_le
3838
; RV32-SMALL: target-flags(riscv-call) @callee
3939
;
4040
; RV32-MED-LABEL: name: caller
4141
; RV32-MED: target-flags(riscv-got-hi) @g_e
42-
; RV32-MED-NEXT: target-flags(riscv-pcrel-lo) %bb.1
42+
; RV32-MED-NEXT: target-flags(riscv-pcrel-lo)
4343
; RV32-MED: target-flags(riscv-pcrel-hi) @g_i
44-
; RV32-MED-NEXT: target-flags(riscv-pcrel-lo) %bb.2
44+
; RV32-MED-NEXT: target-flags(riscv-pcrel-lo)
4545
; RV32-MED: target-flags(riscv-tls-gd-hi) @t_un
46-
; RV32-MED-NEXT: target-flags(riscv-pcrel-lo) %bb.3
47-
; RV32-MED-NEXT: target-flags(riscv-plt) &__tls_get_addr
46+
; RV32-MED-NEXT: target-flags(riscv-pcrel-lo)
47+
; RV32-MED: target-flags(riscv-plt) &__tls_get_addr
4848
; RV32-MED: target-flags(riscv-tls-gd-hi) @t_ld
49-
; RV32-MED-NEXT: target-flags(riscv-pcrel-lo) %bb.4
50-
; RV32-MED-NEXT: target-flags(riscv-plt) &__tls_get_addr
49+
; RV32-MED-NEXT: target-flags(riscv-pcrel-lo)
50+
; RV32-MED: target-flags(riscv-plt) &__tls_get_addr
5151
; RV32-MED: target-flags(riscv-tls-got-hi) @t_ie
52-
; RV32-MED-NEXT: target-flags(riscv-pcrel-lo) %bb.5
52+
; RV32-MED-NEXT: target-flags(riscv-pcrel-lo)
5353
; RV32-MED: target-flags(riscv-tprel-hi) @t_le
5454
; RV32-MED-NEXT: target-flags(riscv-tprel-add) @t_le
5555
; RV32-MED-NEXT: target-flags(riscv-tprel-lo) @t_le

llvm/test/CodeGen/RISCV/pic-models.ll

+8-12
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ define i32* @f1() nounwind {
2626
;
2727
; RV32-PIC-LABEL: f1:
2828
; RV32-PIC: # %bb.0: # %entry
29-
; RV32-PIC-NEXT: .LBB0_1: # %entry
30-
; RV32-PIC-NEXT: # Label of block must be emitted
29+
; RV32-PIC-NEXT: .Ltmp0:
3130
; RV32-PIC-NEXT: auipc a0, %got_pcrel_hi(external_var)
32-
; RV32-PIC-NEXT: lw a0, %pcrel_lo(.LBB0_1)(a0)
31+
; RV32-PIC-NEXT: lw a0, %pcrel_lo(.Ltmp0)(a0)
3332
; RV32-PIC-NEXT: ret
3433
;
3534
; RV64-STATIC-LABEL: f1:
@@ -40,10 +39,9 @@ define i32* @f1() nounwind {
4039
;
4140
; RV64-PIC-LABEL: f1:
4241
; RV64-PIC: # %bb.0: # %entry
43-
; RV64-PIC-NEXT: .LBB0_1: # %entry
44-
; RV64-PIC-NEXT: # Label of block must be emitted
42+
; RV64-PIC-NEXT: .Ltmp0:
4543
; RV64-PIC-NEXT: auipc a0, %got_pcrel_hi(external_var)
46-
; RV64-PIC-NEXT: ld a0, %pcrel_lo(.LBB0_1)(a0)
44+
; RV64-PIC-NEXT: ld a0, %pcrel_lo(.Ltmp0)(a0)
4745
; RV64-PIC-NEXT: ret
4846
entry:
4947
ret i32* @external_var
@@ -61,10 +59,9 @@ define i32* @f2() nounwind {
6159
;
6260
; RV32-PIC-LABEL: f2:
6361
; RV32-PIC: # %bb.0: # %entry
64-
; RV32-PIC-NEXT: .LBB1_1: # %entry
65-
; RV32-PIC-NEXT: # Label of block must be emitted
62+
; RV32-PIC-NEXT: .Ltmp1:
6663
; RV32-PIC-NEXT: auipc a0, %pcrel_hi(internal_var)
67-
; RV32-PIC-NEXT: addi a0, a0, %pcrel_lo(.LBB1_1)
64+
; RV32-PIC-NEXT: addi a0, a0, %pcrel_lo(.Ltmp1)
6865
; RV32-PIC-NEXT: ret
6966
;
7067
; RV64-STATIC-LABEL: f2:
@@ -75,10 +72,9 @@ define i32* @f2() nounwind {
7572
;
7673
; RV64-PIC-LABEL: f2:
7774
; RV64-PIC: # %bb.0: # %entry
78-
; RV64-PIC-NEXT: .LBB1_1: # %entry
79-
; RV64-PIC-NEXT: # Label of block must be emitted
75+
; RV64-PIC-NEXT: .Ltmp1:
8076
; RV64-PIC-NEXT: auipc a0, %pcrel_hi(internal_var)
81-
; RV64-PIC-NEXT: addi a0, a0, %pcrel_lo(.LBB1_1)
77+
; RV64-PIC-NEXT: addi a0, a0, %pcrel_lo(.Ltmp1)
8278
; RV64-PIC-NEXT: ret
8379
entry:
8480
ret i32* @internal_var

0 commit comments

Comments
 (0)