[llvm] 9f29050 - [CodeGen][MachinePipeliner] Fix -Wpessimizing-move in MachinePipeliner.cpp (NFC)

Jie Fu via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 22 00:18:16 PST 2024


Author: Jie Fu
Date: 2024-01-22T16:17:18+08:00
New Revision: 9f290509421b874ecf8082fa8f754850fb121655

URL: https://github.com/llvm/llvm-project/commit/9f290509421b874ecf8082fa8f754850fb121655
DIFF: https://github.com/llvm/llvm-project/commit/9f290509421b874ecf8082fa8f754850fb121655.diff

LOG: [CodeGen][MachinePipeliner] Fix -Wpessimizing-move in MachinePipeliner.cpp (NFC)

/Users/jiefu/llvm-project/llvm/lib/CodeGen/MachinePipeliner.cpp:1044:19: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
 1044 |     CycleInstrs = std::move(Schedule.reorderInstructions(SSD, CycleInstrs));
      |                   ^
/Users/jiefu/llvm-project/llvm/lib/CodeGen/MachinePipeliner.cpp:1044:19: note: remove std::move call here
 1044 |     CycleInstrs = std::move(Schedule.reorderInstructions(SSD, CycleInstrs));
      |                   ^~~~~~~~~~                                              ~
/Users/jiefu/llvm-project/llvm/lib/CodeGen/MachinePipeliner.cpp:1395:21: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
 1395 |     auto LastUses = std::move(computeLastUses(OrderedInsts, Stages));
      |                     ^
/Users/jiefu/llvm-project/llvm/lib/CodeGen/MachinePipeliner.cpp:1395:21: note: remove std::move call here
 1395 |     auto LastUses = std::move(computeLastUses(OrderedInsts, Stages));
      |                     ^~~~~~~~~~                                     ~
/Users/jiefu/llvm-project/llvm/lib/CodeGen/MachinePipeliner.cpp:1502:9: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
 1502 |         std::move(computeMaxSetPressure(OrderedInsts, Stages, MaxStage + 1));
      |         ^
/Users/jiefu/llvm-project/llvm/lib/CodeGen/MachinePipeliner.cpp:1502:9: note: remove std::move call here
 1502 |         std::move(computeMaxSetPressure(OrderedInsts, Stages, MaxStage + 1));
      |         ^~~~~~~~~~                                                         ~
/Users/jiefu/llvm-project/llvm/lib/CodeGen/MachinePipeliner.cpp:3381:19: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
 3381 |     cycleInstrs = std::move(reorderInstructions(SSD, cycleInstrs));
      |                   ^
/Users/jiefu/llvm-project/llvm/lib/CodeGen/MachinePipeliner.cpp:3381:19: note: remove std::move call here
 3381 |     cycleInstrs = std::move(reorderInstructions(SSD, cycleInstrs));
      |                   ^~~~~~~~~~                                     ~
4 errors generated.

Added: 
    

Modified: 
    llvm/lib/CodeGen/MachinePipeliner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp
index 5c9f0f1703a6e4a..2d2d0bffe2169be 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -1041,7 +1041,7 @@ static void computeScheduledInsts(const SwingSchedulerDAG *SSD,
   for (int Cycle = Schedule.getFirstCycle(); Cycle <= Schedule.getFinalCycle();
        ++Cycle) {
     std::deque<SUnit *> &CycleInstrs = Instrs[Cycle];
-    CycleInstrs = std::move(Schedule.reorderInstructions(SSD, CycleInstrs));
+    CycleInstrs = Schedule.reorderInstructions(SSD, CycleInstrs);
     for (SUnit *SU : CycleInstrs) {
       MachineInstr *MI = SU->getInstr();
       OrderedInsts.push_back(MI);
@@ -1392,7 +1392,7 @@ class HighRegisterPressureDetector {
 
     auto CurSetPressure = InitSetPressure;
     auto MaxSetPressure = InitSetPressure;
-    auto LastUses = std::move(computeLastUses(OrderedInsts, Stages));
+    auto LastUses = computeLastUses(OrderedInsts, Stages);
 
     LLVM_DEBUG({
       dbgs() << "Ordered instructions:\n";
@@ -1499,7 +1499,7 @@ class HighRegisterPressureDetector {
     Instr2StageTy Stages;
     computeScheduledInsts(SSD, Schedule, OrderedInsts, Stages);
     const auto MaxSetPressure =
-        std::move(computeMaxSetPressure(OrderedInsts, Stages, MaxStage + 1));
+        computeMaxSetPressure(OrderedInsts, Stages, MaxStage + 1);
 
     LLVM_DEBUG({
       dbgs() << "Dump MaxSetPressure:\n";
@@ -3378,7 +3378,7 @@ void SMSchedule::finalizeSchedule(SwingSchedulerDAG *SSD) {
   // generated code.
   for (int Cycle = getFirstCycle(), E = getFinalCycle(); Cycle <= E; ++Cycle) {
     std::deque<SUnit *> &cycleInstrs = ScheduledInstrs[Cycle];
-    cycleInstrs = std::move(reorderInstructions(SSD, cycleInstrs));
+    cycleInstrs = reorderInstructions(SSD, cycleInstrs);
     SSD->fixupRegisterOverlaps(cycleInstrs);
   }
 


        


More information about the llvm-commits mailing list