[PATCH] D86153: [DwarfDebug] Improve validThroughout performance (4/4)

Orlando Cazalet-Hyams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 04:14:21 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG57d8acac64b8: [DwarfDebug] Improve validThroughout performance (4/4) (authored by Orlando).

Changed prior to commit:
  https://reviews.llvm.org/D86153?vs=286332&id=288267#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86153

Files:
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/test/DebugInfo/X86/inlined-formal-parameter.ll


Index: llvm/test/DebugInfo/X86/inlined-formal-parameter.ll
===================================================================
--- llvm/test/DebugInfo/X86/inlined-formal-parameter.ll
+++ llvm/test/DebugInfo/X86/inlined-formal-parameter.ll
@@ -19,8 +19,7 @@
 ; CHECK:       DW_TAG_inlined_subroutine
 ; CHECK-NEXT:    DW_AT_abstract_origin {{.*}} "bar"
 ; CHECK:         DW_TAG_formal_parameter
-; CHECK-NEXT:      DW_AT_location [DW_FORM_data4]	(
-; CHECK-NEXT:        [{{.*}}, {{.*}}): DW_OP_consts +0)
+; CHECK-NEXT:      DW_AT_const_value [DW_FORM_sdata]   (0)
 ; CHECK-NEXT:      DW_AT_abstract_origin {{.*}} "a"
 
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
Index: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1531,27 +1531,30 @@
   if (LSRange.size() == 0)
     return false;
 
-
-  // Determine if the DBG_VALUE is valid at the beginning of its lexical block.
   const MachineInstr *LScopeBegin = LSRange.front().first;
-  // Early exit if the lexical scope begins outside of the current block.
-  if (LScopeBegin->getParent() != MBB)
-    return false;
-
-  MachineBasicBlock::const_reverse_iterator Pred(DbgValue);
-  for (++Pred; Pred != MBB->rend(); ++Pred) {
-    if (Pred->getFlag(MachineInstr::FrameSetup))
-      break;
-    auto PredDL = Pred->getDebugLoc();
-    if (!PredDL || Pred->isMetaInstruction())
-      continue;
-    // Check whether the instruction preceding the DBG_VALUE is in the same
-    // (sub)scope as the DBG_VALUE.
-    if (DL->getScope() == PredDL->getScope())
-      return false;
-    auto *PredScope = LScopes.findLexicalScope(PredDL);
-    if (!PredScope || LScope->dominates(PredScope))
+  // If the scope starts before the DBG_VALUE then we may have a negative
+  // result. Otherwise the location is live coming into the scope and we
+  // can skip the following checks.
+  if (!Ordering.isBefore(DbgValue, LScopeBegin)) {
+    // Exit if the lexical scope begins outside of the current block.
+    if (LScopeBegin->getParent() != MBB)
       return false;
+
+    MachineBasicBlock::const_reverse_iterator Pred(DbgValue);
+    for (++Pred; Pred != MBB->rend(); ++Pred) {
+      if (Pred->getFlag(MachineInstr::FrameSetup))
+        break;
+      auto PredDL = Pred->getDebugLoc();
+      if (!PredDL || Pred->isMetaInstruction())
+        continue;
+      // Check whether the instruction preceding the DBG_VALUE is in the same
+      // (sub)scope as the DBG_VALUE.
+      if (DL->getScope() == PredDL->getScope())
+        return false;
+      auto *PredScope = LScopes.findLexicalScope(PredDL);
+      if (!PredScope || LScope->dominates(PredScope))
+        return false;
+    }
   }
 
   // If the range of the DBG_VALUE is open-ended, report success.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86153.288267.patch
Type: text/x-patch
Size: 2884 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200827/44bcff1f/attachment.bin>


More information about the llvm-commits mailing list