[llvm] [RemoveDIs][DebugInfo][IR] Add parsing for non-intrinsic debug values (PR #79818)

via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 4 07:40:20 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 52a460f9d4640ddc04e65161c78958bdabaae2b2 b56190db4d35efb9bea180a58d5f95707240c03a -- llvm/include/llvm/AsmParser/LLParser.h llvm/include/llvm/AsmParser/LLToken.h llvm/include/llvm/IR/DebugProgramInstruction.h llvm/lib/AsmParser/LLLexer.cpp llvm/lib/AsmParser/LLParser.cpp llvm/lib/IR/DebugProgramInstruction.cpp llvm/lib/IR/Verifier.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/include/llvm/IR/DebugProgramInstruction.h b/llvm/include/llvm/IR/DebugProgramInstruction.h
index 4253f549b5..a8faf415a3 100644
--- a/llvm/include/llvm/IR/DebugProgramInstruction.h
+++ b/llvm/include/llvm/IR/DebugProgramInstruction.h
@@ -227,6 +227,7 @@ class DPLabel : public DbgRecord {
   /// "createUnresolvedDPLabel", which clearly expresses that it is for parsing
   /// only.
   DPLabel(MDNode *Label, MDNode *DL);
+
 public:
   DPLabel(DILabel *Label, DebugLoc DL);
 
@@ -313,8 +314,7 @@ public:
   /// necessary fields are empty or unused fields are not empty, i.e. if the
   /// #dbg_assign fields are used for a non-dbg-assign type.
   static DPValue *createUnresolvedDPValue(LocationType Type, Metadata *Val,
-                                          MDNode *Variable,
-                                          MDNode *Expression,
+                                          MDNode *Variable, MDNode *Expression,
                                           MDNode *AssignID, Metadata *Address,
                                           MDNode *AddressExpression,
                                           MDNode *DI);
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 02c32cff3c..6079232cd7 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -6422,9 +6422,7 @@ bool LLParser::parseBasicBlock(PerFunctionState &PFS) {
   // Parse the instructions and debug values in this block until we get a
   // terminator.
   Instruction *Inst;
-  auto DeleteDbgRecord = [](DbgRecord *DR) {
-    DR->deleteRecord();
-  };
+  auto DeleteDbgRecord = [](DbgRecord *DR) { DR->deleteRecord(); };
   using DbgRecordPtr = std::unique_ptr<DbgRecord, decltype(DeleteDbgRecord)>;
   SmallVector<DbgRecordPtr> TrailingDbgRecord;
   do {
@@ -6514,10 +6512,10 @@ bool LLParser::parseDebugRecord(DbgRecord *&DR, PerFunctionState &PFS) {
   if (Lex.getKind() != lltok::DbgRecordType)
     return error(DPVLoc, "expected debug record type here");
   RecordKind RecordType = StringSwitch<RecordKind>(Lex.getStrVal())
-                  .Case("declare", RecordKind::ValueKind)
-                  .Case("value", RecordKind::ValueKind)
-                  .Case("assign", RecordKind::ValueKind)
-                  .Case("label", RecordKind::LabelKind);
+                              .Case("declare", RecordKind::ValueKind)
+                              .Case("value", RecordKind::ValueKind)
+                              .Case("assign", RecordKind::ValueKind)
+                              .Case("label", RecordKind::LabelKind);
 
   // Parsing labels is trivial; parse here and early exit, otherwise go into the
   // full DPValue processing stage.
@@ -6540,9 +6538,9 @@ bool LLParser::parseDebugRecord(DbgRecord *&DR, PerFunctionState &PFS) {
   }
 
   LocType ValueType = StringSwitch<LocType>(Lex.getStrVal())
-                  .Case("declare", LocType::Declare)
-                  .Case("value", LocType::Value)
-                  .Case("assign", LocType::Assign);
+                          .Case("declare", LocType::Declare)
+                          .Case("value", LocType::Value)
+                          .Case("assign", LocType::Assign);
 
   Lex.Lex();
   if (parseToken(lltok::lparen, "Expected '(' here"))
@@ -6600,9 +6598,9 @@ bool LLParser::parseDebugRecord(DbgRecord *&DR, PerFunctionState &PFS) {
 
   if (parseToken(lltok::rparen, "Expected ')' here"))
     return true;
-  DR = DPValue::createUnresolvedDPValue(
-      ValueType, ValLocMD, Variable, Expression, AssignID,
-      AddressLocation, AddressExpression, DebugLoc);
+  DR = DPValue::createUnresolvedDPValue(ValueType, ValLocMD, Variable,
+                                        Expression, AssignID, AddressLocation,
+                                        AddressExpression, DebugLoc);
   return false;
 }
 //===----------------------------------------------------------------------===//
diff --git a/llvm/lib/IR/DebugProgramInstruction.cpp b/llvm/lib/IR/DebugProgramInstruction.cpp
index dbeaa67410..5ff1e8c19d 100644
--- a/llvm/lib/IR/DebugProgramInstruction.cpp
+++ b/llvm/lib/IR/DebugProgramInstruction.cpp
@@ -138,11 +138,11 @@ DbgRecord::createDebugIntrinsic(Module *M, Instruction *InsertBefore) const {
   llvm_unreachable("unsupported DbgRecord kind");
 }
 
-
 DPLabel::DPLabel(MDNode *Label, MDNode *DL)
     : DbgRecord(LabelKind, DebugLoc(DL)), Label(Label) {
   assert(Label && "Unexpected nullptr");
-  assert((isa<DILabel>(Label) || Label->isTemporary()) && "Label type must be or resolve to a DILabel");
+  assert((isa<DILabel>(Label) || Label->isTemporary()) &&
+         "Label type must be or resolve to a DILabel");
 }
 DPLabel::DPLabel(DILabel *Label, DebugLoc DL)
     : DbgRecord(LabelKind, DL), Label(Label) {
@@ -156,13 +156,14 @@ DPLabel *DPLabel::createUnresolvedDPLabel(MDNode *Label, MDNode *DL) {
 DPValue::DPValue(DPValue::LocationType Type, Metadata *Val, MDNode *Variable,
                  MDNode *Expression, MDNode *AssignID, Metadata *Address,
                  MDNode *AddressExpression, MDNode *DI)
-    : DbgRecord(ValueKind, DebugLoc(DI)), DebugValueUser({Val, Address, AssignID}), Type(Type), Variable(Variable),
+    : DbgRecord(ValueKind, DebugLoc(DI)),
+      DebugValueUser({Val, Address, AssignID}), Type(Type), Variable(Variable),
       Expression(Expression), AddressExpression(AddressExpression) {}
 
 DPValue *DPValue::createUnresolvedDPValue(DPValue::LocationType Type,
                                           Metadata *Val, MDNode *Variable,
-                                          MDNode *Expression,
-                                          MDNode *AssignID, Metadata *Address,
+                                          MDNode *Expression, MDNode *AssignID,
+                                          Metadata *Address,
                                           MDNode *AddressExpression,
                                           MDNode *DI) {
   return new DPValue(Type, Val, Variable, Expression, AssignID, Address,
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index eea98946d6..220d028ddc 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -684,7 +684,7 @@ void Verifier::visitDbgRecords(Instruction &I) {
           &I);
   CheckDI(!isa<PHINode>(&I) || !I.hasDbgValues(),
           "PHI Node must not have any attached DbgRecords", &I);
-  //for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) {
+  // for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) {
   for (DbgRecord &DR : I.getDbgValueRange()) {
     CheckDI(DR.getMarker() == I.DbgMarker, "DbgRecord had invalid DbgMarker",
             &I, &DR);

``````````

</details>


https://github.com/llvm/llvm-project/pull/79818


More information about the llvm-commits mailing list