[llvm] a964099 - [AMDGPU][SetWavePriority] Fix dealing with MBBInfo records.

Ivan Kosarev via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 30 06:28:09 PDT 2022


Author: Ivan Kosarev
Date: 2022-09-30T14:27:50+01:00
New Revision: a964099ce5e560b0c4431938b2b28d131cd59bf5

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

LOG: [AMDGPU][SetWavePriority] Fix dealing with MBBInfo records.

Happened earlier than I anticipated. :)

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D134726

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/AMDGPUSetWavePriority.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/AMDGPUSetWavePriority.cpp b/llvm/lib/Target/AMDGPU/AMDGPUSetWavePriority.cpp
index da2a2b9353215..64f1bd5cc5da4 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUSetWavePriority.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUSetWavePriority.cpp
@@ -122,13 +122,13 @@ bool AMDGPUSetWavePriority::runOnMachineFunction(MachineFunction &MF) {
   // executed provided no backedge is ever taken.
   MBBInfoSet MBBInfos;
   for (MachineBasicBlock *MBB : post_order(&MF)) {
-    MBBInfo &Info = MBBInfos[MBB];
     bool AtStart = true;
     unsigned MaxNumVALUInstsInMiddle = 0;
     unsigned NumVALUInstsAtEnd = 0;
     for (MachineInstr &MI : *MBB) {
       if (isVMEMLoad(MI)) {
         AtStart = false;
+        MBBInfo &Info = MBBInfos[MBB];
         Info.NumVALUInstsAtStart = 0;
         MaxNumVALUInstsInMiddle = 0;
         NumVALUInstsAtEnd = 0;
@@ -140,7 +140,7 @@ bool AMDGPUSetWavePriority::runOnMachineFunction(MachineFunction &MF) {
         NumVALUInstsAtEnd = 0;
       } else if (SIInstrInfo::isVALU(MI)) {
         if (AtStart)
-          ++Info.NumVALUInstsAtStart;
+          ++MBBInfos[MBB].NumVALUInstsAtStart;
         ++NumVALUInstsAtEnd;
       }
     }
@@ -152,6 +152,7 @@ bool AMDGPUSetWavePriority::runOnMachineFunction(MachineFunction &MF) {
       NumFollowingVALUInsts =
           std::max(NumFollowingVALUInsts, MBBInfos[Succ].NumVALUInstsAtStart);
     }
+    MBBInfo &Info = MBBInfos[MBB];
     if (AtStart)
       Info.NumVALUInstsAtStart += NumFollowingVALUInsts;
     NumVALUInstsAtEnd += NumFollowingVALUInsts;


        


More information about the llvm-commits mailing list