From 9cc0023fb863194be526f0bf19bd21e36236c5f6 Mon Sep 17 00:00:00 2001 From: Andrea Di Biagio Date: Thu, 26 Aug 2021 19:43:18 +0100 Subject: [PATCH] [MCA][NFC] Remove redundant calls to std::move. This fixes some redundant move in return statement [-Wredundant-move] gcc 9.3.0 warnings. This also fixes a minor coverity issue reported agaist class MCAOperand about the lack of proper initialization for field Index. No functional change intended. --- llvm/include/llvm/MCA/Instruction.h | 5 +++-- llvm/lib/MCA/InstrBuilder.cpp | 8 ++++---- llvm/lib/MCA/Pipeline.cpp | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/llvm/include/llvm/MCA/Instruction.h b/llvm/include/llvm/MCA/Instruction.h index 988cddc..326b933 100644 --- a/llvm/include/llvm/MCA/Instruction.h +++ b/llvm/include/llvm/MCA/Instruction.h @@ -46,7 +46,7 @@ class MCAOperand { kSFPImmediate, ///< Single-floating-point immediate operand. kDFPImmediate, ///< Double-Floating-point immediate operand. }; - MCAOperandType Kind = kInvalid; + MCAOperandType Kind; union { unsigned RegVal; @@ -62,7 +62,8 @@ class MCAOperand { unsigned Index; public: - MCAOperand() : FPImmVal(0) {} + + MCAOperand() : Kind(kInvalid), FPImmVal(), Index() {} bool isValid() const { return Kind != kInvalid; } bool isReg() const { return Kind == kRegister; } diff --git a/llvm/lib/MCA/InstrBuilder.cpp b/llvm/lib/MCA/InstrBuilder.cpp index 4067d86..633df8a 100644 --- a/llvm/lib/MCA/InstrBuilder.cpp +++ b/llvm/lib/MCA/InstrBuilder.cpp @@ -604,7 +604,7 @@ InstrBuilder::createInstrDescImpl(const MCInst &MCI) { computeMaxLatency(*ID, MCDesc, SCDesc, STI); if (Error Err = verifyOperands(MCDesc, MCI)) - return std::move(Err); + return Err; populateWrites(*ID, MCI, SchedClassID); populateReads(*ID, MCI, SchedClassID); @@ -614,7 +614,7 @@ InstrBuilder::createInstrDescImpl(const MCInst &MCI) { // Sanity check on the instruction descriptor. if (Error Err = verifyInstrDesc(*ID, MCI)) - return std::move(Err); + return Err; // Now add the new descriptor. bool IsVariadic = MCDesc.isVariadic(); @@ -707,7 +707,7 @@ InstrBuilder::createInstruction(const MCInst &MCI) { // Early exit if there are no writes. if (D.Writes.empty()) - return std::move(NewIS); + return NewIS; // Track register writes that implicitly clear the upper portion of the // underlying super-registers using an APInt. @@ -736,7 +736,7 @@ InstrBuilder::createInstruction(const MCInst &MCI) { ++WriteIndex; } - return std::move(NewIS); + return NewIS; } } // namespace mca } // namespace llvm diff --git a/llvm/lib/MCA/Pipeline.cpp b/llvm/lib/MCA/Pipeline.cpp index 22b9d07..eb651c3 100644 --- a/llvm/lib/MCA/Pipeline.cpp +++ b/llvm/lib/MCA/Pipeline.cpp @@ -40,7 +40,8 @@ Expected Pipeline::run() { do { notifyCycleBegin(); if (Error Err = runCycle()) - return std::move(Err); + return Err; + notifyCycleEnd(); ++Cycles; } while (hasWorkToProcess()); -- 2.7.4