[llvm] 0933a7a - [LoongArch] Rename some OptWInstrs functions. NFC
WANG Rui via llvm-commits
llvm-commits at lists.llvm.org
Mon May 6 03:07:16 PDT 2024
Author: WANG Rui
Date: 2024-05-06T18:07:30+08:00
New Revision: 0933a7a12508901f1c99c3a23f2841740a1cf845
URL: https://github.com/llvm/llvm-project/commit/0933a7a12508901f1c99c3a23f2841740a1cf845
DIFF: https://github.com/llvm/llvm-project/commit/0933a7a12508901f1c99c3a23f2841740a1cf845.diff
LOG: [LoongArch] Rename some OptWInstrs functions. NFC
Added:
Modified:
llvm/lib/Target/LoongArch/LoongArchOptWInstrs.cpp
llvm/test/CodeGen/LoongArch/prefer-w-inst.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/LoongArch/LoongArchOptWInstrs.cpp b/llvm/lib/Target/LoongArch/LoongArchOptWInstrs.cpp
index 677ba11c17d516..abac69054f3b91 100644
--- a/llvm/lib/Target/LoongArch/LoongArchOptWInstrs.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchOptWInstrs.cpp
@@ -46,12 +46,14 @@ STATISTIC(NumRemovedSExtW, "Number of removed sign-extensions");
STATISTIC(NumTransformedToWInstrs,
"Number of instructions transformed to W-ops");
-static cl::opt<bool> DisableSExtWRemoval("loongarch-disable-sextw-removal",
- cl::desc("Disable removal of sext.w"),
- cl::init(false), cl::Hidden);
-static cl::opt<bool> DisableStripWSuffix("loongarch-disable-strip-w-suffix",
- cl::desc("Disable strip W suffix"),
- cl::init(false), cl::Hidden);
+static cl::opt<bool>
+ DisableSExtWRemoval("loongarch-disable-sextw-removal",
+ cl::desc("Disable removal of sign-extend insn"),
+ cl::init(false), cl::Hidden);
+static cl::opt<bool>
+ DisableCvtToDSuffix("loongarch-disable-cvt-to-d-suffix",
+ cl::desc("Disable convert to D suffix"),
+ cl::init(false), cl::Hidden);
namespace {
@@ -65,10 +67,12 @@ class LoongArchOptWInstrs : public MachineFunctionPass {
bool removeSExtWInstrs(MachineFunction &MF, const LoongArchInstrInfo &TII,
const LoongArchSubtarget &ST,
MachineRegisterInfo &MRI);
- bool stripWSuffixes(MachineFunction &MF, const LoongArchInstrInfo &TII,
- const LoongArchSubtarget &ST, MachineRegisterInfo &MRI);
- bool appendWSuffixes(MachineFunction &MF, const LoongArchInstrInfo &TII,
- const LoongArchSubtarget &ST, MachineRegisterInfo &MRI);
+ bool convertToDSuffixes(MachineFunction &MF, const LoongArchInstrInfo &TII,
+ const LoongArchSubtarget &ST,
+ MachineRegisterInfo &MRI);
+ bool convertToWSuffixes(MachineFunction &MF, const LoongArchInstrInfo &TII,
+ const LoongArchSubtarget &ST,
+ MachineRegisterInfo &MRI);
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG();
@@ -713,10 +717,10 @@ bool LoongArchOptWInstrs::removeSExtWInstrs(MachineFunction &MF,
return MadeChange;
}
-bool LoongArchOptWInstrs::stripWSuffixes(MachineFunction &MF,
- const LoongArchInstrInfo &TII,
- const LoongArchSubtarget &ST,
- MachineRegisterInfo &MRI) {
+bool LoongArchOptWInstrs::convertToDSuffixes(MachineFunction &MF,
+ const LoongArchInstrInfo &TII,
+ const LoongArchSubtarget &ST,
+ MachineRegisterInfo &MRI) {
bool MadeChange = false;
for (MachineBasicBlock &MBB : MF) {
for (MachineInstr &MI : MBB) {
@@ -739,10 +743,10 @@ bool LoongArchOptWInstrs::stripWSuffixes(MachineFunction &MF,
return MadeChange;
}
-bool LoongArchOptWInstrs::appendWSuffixes(MachineFunction &MF,
- const LoongArchInstrInfo &TII,
- const LoongArchSubtarget &ST,
- MachineRegisterInfo &MRI) {
+bool LoongArchOptWInstrs::convertToWSuffixes(MachineFunction &MF,
+ const LoongArchInstrInfo &TII,
+ const LoongArchSubtarget &ST,
+ MachineRegisterInfo &MRI) {
bool MadeChange = false;
for (MachineBasicBlock &MBB : MF) {
for (MachineInstr &MI : MBB) {
@@ -805,11 +809,11 @@ bool LoongArchOptWInstrs::runOnMachineFunction(MachineFunction &MF) {
bool MadeChange = false;
MadeChange |= removeSExtWInstrs(MF, TII, ST, MRI);
- if (!(DisableStripWSuffix || ST.preferWInst()))
- MadeChange |= stripWSuffixes(MF, TII, ST, MRI);
+ if (!(DisableCvtToDSuffix || ST.preferWInst()))
+ MadeChange |= convertToDSuffixes(MF, TII, ST, MRI);
if (ST.preferWInst())
- MadeChange |= appendWSuffixes(MF, TII, ST, MRI);
+ MadeChange |= convertToWSuffixes(MF, TII, ST, MRI);
return MadeChange;
}
diff --git a/llvm/test/CodeGen/LoongArch/prefer-w-inst.ll b/llvm/test/CodeGen/LoongArch/prefer-w-inst.ll
index ddf77efb885749..385f27f04d5f6e 100644
--- a/llvm/test/CodeGen/LoongArch/prefer-w-inst.ll
+++ b/llvm/test/CodeGen/LoongArch/prefer-w-inst.ll
@@ -1,8 +1,8 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc --mtriple=loongarch64 --verify-machineinstrs < %s \
; RUN: | FileCheck --check-prefixes=NO-PREFER-W-INST %s
-; RUN: llc --mtriple=loongarch64 --loongarch-disable-strip-w-suffix --verify-machineinstrs < %s \
-; RUN: | FileCheck --check-prefixes=NO-STRIP %s
+; RUN: llc --mtriple=loongarch64 --loongarch-disable-cvt-to-d-suffix --verify-machineinstrs < %s \
+; RUN: | FileCheck --check-prefixes=NO-CVT-D-INST %s
; RUN: llc --mtriple=loongarch64 --mattr=+prefer-w-inst --verify-machineinstrs < %s \
; RUN: | FileCheck --check-prefixes=PREFER-W-INST %s
@@ -13,11 +13,11 @@ define signext i32 @addw(i32 %x) {
; NO-PREFER-W-INST-NEXT: addi.w $a0, $a0, 2033
; NO-PREFER-W-INST-NEXT: ret
;
-; NO-STRIP-LABEL: addw:
-; NO-STRIP: # %bb.0:
-; NO-STRIP-NEXT: addi.w $a0, $a0, 2047
-; NO-STRIP-NEXT: addi.w $a0, $a0, 2033
-; NO-STRIP-NEXT: ret
+; NO-CVT-D-INST-LABEL: addw:
+; NO-CVT-D-INST: # %bb.0:
+; NO-CVT-D-INST-NEXT: addi.w $a0, $a0, 2047
+; NO-CVT-D-INST-NEXT: addi.w $a0, $a0, 2033
+; NO-CVT-D-INST-NEXT: ret
;
; PREFER-W-INST-LABEL: addw:
; PREFER-W-INST: # %bb.0:
More information about the llvm-commits
mailing list