[llvm] 0ce8163 - [RISCV] Use const reference when looping over RISCVMatInt::InstSeq. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 6 14:28:03 PDT 2023
Author: Craig Topper
Date: 2023-06-06T14:27:28-07:00
New Revision: 0ce8163f18762f2c361aea2cfaaa10ee4b2a4d01
URL: https://github.com/llvm/llvm-project/commit/0ce8163f18762f2c361aea2cfaaa10ee4b2a4d01
DIFF: https://github.com/llvm/llvm-project/commit/0ce8163f18762f2c361aea2cfaaa10ee4b2a4d01.diff
LOG: [RISCV] Use const reference when looping over RISCVMatInt::InstSeq. NFC
Added:
Modified:
llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
index ad89ee347fa3c..c3b497dea7f47 100644
--- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
+++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
@@ -3008,7 +3008,7 @@ void RISCVAsmParser::emitLoadImm(MCRegister DestReg, int64_t Value,
RISCVMatInt::generateInstSeq(Value, getSTI().getFeatureBits());
MCRegister SrcReg = RISCV::X0;
- for (RISCVMatInt::Inst &Inst : Seq) {
+ for (const RISCVMatInt::Inst &Inst : Seq) {
switch (Inst.getOpndKind()) {
case RISCVMatInt::Imm:
emitToStreamer(Out,
diff --git a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
index cde9020628055..6bd30b274ddcf 100644
--- a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
@@ -175,7 +175,7 @@ void RISCVDAGToDAGISel::PostprocessISelDAG() {
static SDValue selectImmSeq(SelectionDAG *CurDAG, const SDLoc &DL, const MVT VT,
RISCVMatInt::InstSeq &Seq) {
SDValue SrcReg = CurDAG->getRegister(RISCV::X0, VT);
- for (RISCVMatInt::Inst &Inst : Seq) {
+ for (const RISCVMatInt::Inst &Inst : Seq) {
SDValue SDImm = CurDAG->getTargetConstant(Inst.getImm(), DL, VT);
SDNode *Result = nullptr;
switch (Inst.getOpndKind()) {
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
index 67f8096db18bd..e1399b137aba1 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -745,7 +745,7 @@ void RISCVInstrInfo::movImm(MachineBasicBlock &MBB,
RISCVMatInt::generateInstSeq(Val, STI.getFeatureBits());
assert(!Seq.empty());
- for (RISCVMatInt::Inst &Inst : Seq) {
+ for (const RISCVMatInt::Inst &Inst : Seq) {
switch (Inst.getOpndKind()) {
case RISCVMatInt::Imm:
BuildMI(MBB, MBBI, DL, get(Inst.getOpcode()), DstReg)
More information about the llvm-commits
mailing list