[PATCH] D74057: [DebugInfo][NFC] Fixup the UserValue methods to use FragmentInfo

Orlando Cazalet-Hyams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 5 09:27:47 PST 2020


Orlando updated this revision to Diff 242658.
Orlando marked an inline comment as done.
Orlando added a comment.

Address comments:

+ UserValue FragInfo -> Fragment


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74057/new/

https://reviews.llvm.org/D74057

Files:
  llvm/lib/CodeGen/LiveDebugVariables.cpp


Index: llvm/lib/CodeGen/LiveDebugVariables.cpp
===================================================================
--- llvm/lib/CodeGen/LiveDebugVariables.cpp
+++ llvm/lib/CodeGen/LiveDebugVariables.cpp
@@ -148,9 +148,8 @@
 /// closure of that relation.
 class UserValue {
   const DILocalVariable *Variable; ///< The debug info variable we are part of.
-  // FIXME: This is only used to get the FragmentInfo that describes the part
-  // of the variable we are a part of. We should just store the FragmentInfo.
-  const DIExpression *Expression; ///< Any complex address expression.
+  /// The part of the variable we describe.
+  const Optional<DIExpression::FragmentInfo> Fragment;
   DebugLoc dl;            ///< The debug location for the variable. This is
                           ///< used by dwarf writer to find lexical scope.
   UserValue *leader;      ///< Equivalence class leader.
@@ -176,9 +175,10 @@
 
 public:
   /// Create a new UserValue.
-  UserValue(const DILocalVariable *var, const DIExpression *expr, DebugLoc L,
+  UserValue(const DILocalVariable *var,
+            Optional<DIExpression::FragmentInfo> Fragment, DebugLoc L,
             LocMap::Allocator &alloc)
-      : Variable(var), Expression(expr), dl(std::move(L)), leader(this),
+      : Variable(var), Fragment(Fragment), dl(std::move(L)), leader(this),
         locInts(alloc) {}
 
   /// Get the leader of this value's equivalence class.
@@ -193,7 +193,8 @@
   UserValue *getNext() const { return next; }
 
   /// Does this UserValue match the parameters?
-  bool match(const DILocalVariable *Var, const DIExpression *Expr,
+  bool match(const DILocalVariable *Var,
+             Optional<DIExpression::FragmentInfo> OtherFragment,
              const DILocation *IA) const {
     // FIXME: Handle partially overlapping fragments.
     // A DBG_VALUE with a fragment which overlaps a previous DBG_VALUE fragment
@@ -205,8 +206,7 @@
     // therefore we do not faithfully represent the original intervals.
     // See D70121#1849741 for a more detailed explanation and further
     // discussion.
-    return Var == Variable &&
-           Expr->getFragmentInfo() == Expression->getFragmentInfo() &&
+    return Var == Variable && OtherFragment == Fragment &&
            dl->getInlinedAt() == IA;
   }
 
@@ -419,7 +419,8 @@
   UVMap userVarMap;
 
   /// Find or create a UserValue.
-  UserValue *getUserValue(const DILocalVariable *Var, const DIExpression *Expr,
+  UserValue *getUserValue(const DILocalVariable *Var,
+                          Optional<DIExpression::FragmentInfo> Fragment,
                           const DebugLoc &DL);
 
   /// Find the EC leader for VirtReg or null.
@@ -580,18 +581,19 @@
 }
 
 UserValue *LDVImpl::getUserValue(const DILocalVariable *Var,
-                                 const DIExpression *Expr, const DebugLoc &DL) {
+                                 Optional<DIExpression::FragmentInfo> Fragment,
+                                 const DebugLoc &DL) {
   UserValue *&Leader = userVarMap[Var];
   if (Leader) {
     UserValue *UV = Leader->getLeader();
     Leader = UV;
     for (; UV; UV = UV->getNext())
-      if (UV->match(Var, Expr, DL->getInlinedAt()))
+      if (UV->match(Var, Fragment, DL->getInlinedAt()))
         return UV;
   }
 
   userValues.push_back(
-      std::make_unique<UserValue>(Var, Expr, DL, allocator));
+      std::make_unique<UserValue>(Var, Fragment, DL, allocator));
   UserValue *UV = userValues.back().get();
   Leader = UserValue::merge(Leader, UV);
   return UV;
@@ -656,7 +658,7 @@
          "DBG_VALUE with nonzero offset");
   const DILocalVariable *Var = MI.getDebugVariable();
   const DIExpression *Expr = MI.getDebugExpression();
-  UserValue *UV = getUserValue(Var, Expr, MI.getDebugLoc());
+  UserValue *UV = getUserValue(Var, Expr->getFragmentInfo(), MI.getDebugLoc());
   if (!Discard)
     UV->addDef(Idx, MI.getOperand(0), *Expr);
   else {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74057.242658.patch
Type: text/x-patch
Size: 3922 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200205/113ff672/attachment-0001.bin>


More information about the llvm-commits mailing list