[llvm] e036ba5 - [StatepointLowering] Fix possible nullptr access in debug output

Danila Malyutin via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 25 13:08:23 PDT 2023


Author: Danila Malyutin
Date: 2023-08-25T22:56:17+03:00
New Revision: e036ba50a764c58971181849b7727b78449c6b70

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

LOG: [StatepointLowering] Fix possible nullptr access in debug output

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

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
index 5afd05648772e6..584c8c91780e4d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
@@ -715,7 +715,8 @@ SDValue SelectionDAGBuilder::LowerAsSTATEPOINT(
   assert((GFI || SI.Bases.empty()) &&
          "No gc specified, so cannot relocate pointers!");
 
-  LLVM_DEBUG(dbgs() << "Lowering statepoint " << *SI.StatepointInstr << "\n");
+  LLVM_DEBUG(if (SI.StatepointInstr) dbgs()
+             << "Lowering statepoint " << *SI.StatepointInstr << "\n");
 #ifndef NDEBUG
   for (const auto *Reloc : SI.GCRelocates)
     if (Reloc->getParent() == SI.StatepointInstr->getParent())
@@ -1156,6 +1157,7 @@ void SelectionDAGBuilder::LowerCallSiteWithDeoptBundleImpl(
 
   // NB! The GC arguments are deliberately left empty.
 
+  LLVM_DEBUG(dbgs() << "Lowering call with deopt bundle " << *Call << "\n");
   if (SDValue ReturnVal = LowerAsSTATEPOINT(SI)) {
     ReturnVal = lowerRangeToAssertZExt(DAG, *Call, ReturnVal);
     setValue(Call, ReturnVal);


        


More information about the llvm-commits mailing list