Skip to content

Commit 0933a7a

Browse files
committed
[LoongArch] Rename some OptWInstrs functions. NFC
1 parent 69d740e commit 0933a7a

File tree

2 files changed

+32
-28
lines changed

2 files changed

+32
-28
lines changed

llvm/lib/Target/LoongArch/LoongArchOptWInstrs.cpp

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ STATISTIC(NumRemovedSExtW, "Number of removed sign-extensions");
4646
STATISTIC(NumTransformedToWInstrs,
4747
"Number of instructions transformed to W-ops");
4848

49-
static cl::opt<bool> DisableSExtWRemoval("loongarch-disable-sextw-removal",
50-
cl::desc("Disable removal of sext.w"),
51-
cl::init(false), cl::Hidden);
52-
static cl::opt<bool> DisableStripWSuffix("loongarch-disable-strip-w-suffix",
53-
cl::desc("Disable strip W suffix"),
54-
cl::init(false), cl::Hidden);
49+
static cl::opt<bool>
50+
DisableSExtWRemoval("loongarch-disable-sextw-removal",
51+
cl::desc("Disable removal of sign-extend insn"),
52+
cl::init(false), cl::Hidden);
53+
static cl::opt<bool>
54+
DisableCvtToDSuffix("loongarch-disable-cvt-to-d-suffix",
55+
cl::desc("Disable convert to D suffix"),
56+
cl::init(false), cl::Hidden);
5557

5658
namespace {
5759

@@ -65,10 +67,12 @@ class LoongArchOptWInstrs : public MachineFunctionPass {
6567
bool removeSExtWInstrs(MachineFunction &MF, const LoongArchInstrInfo &TII,
6668
const LoongArchSubtarget &ST,
6769
MachineRegisterInfo &MRI);
68-
bool stripWSuffixes(MachineFunction &MF, const LoongArchInstrInfo &TII,
69-
const LoongArchSubtarget &ST, MachineRegisterInfo &MRI);
70-
bool appendWSuffixes(MachineFunction &MF, const LoongArchInstrInfo &TII,
71-
const LoongArchSubtarget &ST, MachineRegisterInfo &MRI);
70+
bool convertToDSuffixes(MachineFunction &MF, const LoongArchInstrInfo &TII,
71+
const LoongArchSubtarget &ST,
72+
MachineRegisterInfo &MRI);
73+
bool convertToWSuffixes(MachineFunction &MF, const LoongArchInstrInfo &TII,
74+
const LoongArchSubtarget &ST,
75+
MachineRegisterInfo &MRI);
7276

7377
void getAnalysisUsage(AnalysisUsage &AU) const override {
7478
AU.setPreservesCFG();
@@ -713,10 +717,10 @@ bool LoongArchOptWInstrs::removeSExtWInstrs(MachineFunction &MF,
713717
return MadeChange;
714718
}
715719

716-
bool LoongArchOptWInstrs::stripWSuffixes(MachineFunction &MF,
717-
const LoongArchInstrInfo &TII,
718-
const LoongArchSubtarget &ST,
719-
MachineRegisterInfo &MRI) {
720+
bool LoongArchOptWInstrs::convertToDSuffixes(MachineFunction &MF,
721+
const LoongArchInstrInfo &TII,
722+
const LoongArchSubtarget &ST,
723+
MachineRegisterInfo &MRI) {
720724
bool MadeChange = false;
721725
for (MachineBasicBlock &MBB : MF) {
722726
for (MachineInstr &MI : MBB) {
@@ -739,10 +743,10 @@ bool LoongArchOptWInstrs::stripWSuffixes(MachineFunction &MF,
739743
return MadeChange;
740744
}
741745

742-
bool LoongArchOptWInstrs::appendWSuffixes(MachineFunction &MF,
743-
const LoongArchInstrInfo &TII,
744-
const LoongArchSubtarget &ST,
745-
MachineRegisterInfo &MRI) {
746+
bool LoongArchOptWInstrs::convertToWSuffixes(MachineFunction &MF,
747+
const LoongArchInstrInfo &TII,
748+
const LoongArchSubtarget &ST,
749+
MachineRegisterInfo &MRI) {
746750
bool MadeChange = false;
747751
for (MachineBasicBlock &MBB : MF) {
748752
for (MachineInstr &MI : MBB) {
@@ -805,11 +809,11 @@ bool LoongArchOptWInstrs::runOnMachineFunction(MachineFunction &MF) {
805809
bool MadeChange = false;
806810
MadeChange |= removeSExtWInstrs(MF, TII, ST, MRI);
807811

808-
if (!(DisableStripWSuffix || ST.preferWInst()))
809-
MadeChange |= stripWSuffixes(MF, TII, ST, MRI);
812+
if (!(DisableCvtToDSuffix || ST.preferWInst()))
813+
MadeChange |= convertToDSuffixes(MF, TII, ST, MRI);
810814

811815
if (ST.preferWInst())
812-
MadeChange |= appendWSuffixes(MF, TII, ST, MRI);
816+
MadeChange |= convertToWSuffixes(MF, TII, ST, MRI);
813817

814818
return MadeChange;
815819
}

llvm/test/CodeGen/LoongArch/prefer-w-inst.ll

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
22
; RUN: llc --mtriple=loongarch64 --verify-machineinstrs < %s \
33
; RUN: | FileCheck --check-prefixes=NO-PREFER-W-INST %s
4-
; RUN: llc --mtriple=loongarch64 --loongarch-disable-strip-w-suffix --verify-machineinstrs < %s \
5-
; RUN: | FileCheck --check-prefixes=NO-STRIP %s
4+
; RUN: llc --mtriple=loongarch64 --loongarch-disable-cvt-to-d-suffix --verify-machineinstrs < %s \
5+
; RUN: | FileCheck --check-prefixes=NO-CVT-D-INST %s
66
; RUN: llc --mtriple=loongarch64 --mattr=+prefer-w-inst --verify-machineinstrs < %s \
77
; RUN: | FileCheck --check-prefixes=PREFER-W-INST %s
88

@@ -13,11 +13,11 @@ define signext i32 @addw(i32 %x) {
1313
; NO-PREFER-W-INST-NEXT: addi.w $a0, $a0, 2033
1414
; NO-PREFER-W-INST-NEXT: ret
1515
;
16-
; NO-STRIP-LABEL: addw:
17-
; NO-STRIP: # %bb.0:
18-
; NO-STRIP-NEXT: addi.w $a0, $a0, 2047
19-
; NO-STRIP-NEXT: addi.w $a0, $a0, 2033
20-
; NO-STRIP-NEXT: ret
16+
; NO-CVT-D-INST-LABEL: addw:
17+
; NO-CVT-D-INST: # %bb.0:
18+
; NO-CVT-D-INST-NEXT: addi.w $a0, $a0, 2047
19+
; NO-CVT-D-INST-NEXT: addi.w $a0, $a0, 2033
20+
; NO-CVT-D-INST-NEXT: ret
2121
;
2222
; PREFER-W-INST-LABEL: addw:
2323
; PREFER-W-INST: # %bb.0:

0 commit comments

Comments
 (0)