[llvm] 39ae5bf - [CSSPGO] Fix an AV caused by a block that has only pseudo pseudo instructions.

Hongtao Yu via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 27 17:54:41 PDT 2021


Author: Hongtao Yu
Date: 2021-04-27T17:54:34-07:00
New Revision: 39ae5bf5c539fe7761d7add355aef708cb1600bd

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

LOG: [CSSPGO] Fix an AV caused by a block that has only pseudo pseudo instructions.

Reviewed By: wenlei

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

Added: 
    

Modified: 
    llvm/lib/CodeGen/RegAllocGreedy.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp
index 340453b9af11..f71df3f0ad43 100644
--- a/llvm/lib/CodeGen/RegAllocGreedy.cpp
+++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp
@@ -1324,10 +1324,10 @@ bool RAGreedy::addThroughConstraints(InterferenceCache::Cursor Intf,
 
     // Abort if the spill cannot be inserted at the MBB' start
     MachineBasicBlock *MBB = MF->getBlockNumbered(Number);
-    if (!MBB->empty() &&
-        SlotIndex::isEarlierInstr(
-            LIS->getInstructionIndex(*MBB->getFirstNonDebugInstr()),
-            SA->getFirstSplitPoint(Number)))
+    auto FirstNonDebugInstr = MBB->getFirstNonDebugInstr();
+    if (FirstNonDebugInstr != MBB->end() &&
+        SlotIndex::isEarlierInstr(LIS->getInstructionIndex(*FirstNonDebugInstr),
+                                  SA->getFirstSplitPoint(Number)))
       return false;
     // Interference for the live-in value.
     if (Intf.first() <= Indexes->getMBBStartIdx(Number))


        


More information about the llvm-commits mailing list