File tree Expand file tree Collapse file tree 4 files changed +16
-13
lines changed Expand file tree Collapse file tree 4 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -74,8 +74,8 @@ namespace llvm {
74
74
// allowing Debugify to ignore intentionally-empty DebugLocs and display the
75
75
// code responsible for generating unintentionally-empty DebugLocs.
76
76
// Currently we only need to track the Origin of this DILoc when using a
77
- // DebugLoc that is Normal and empty, so only collect the origin stacktrace in
78
- // those cases.
77
+ // DebugLoc that is not annotated (i.e. has DebugLocKind::Normal) and has a
78
+ // null DILocation, so only collect the origin stacktrace in those cases.
79
79
class DILocAndCoverageTracking : public TrackingMDNodeRef ,
80
80
public DbgLocOrigin {
81
81
public:
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ class StringRef;
25
25
class raw_ostream ;
26
26
27
27
#if ENABLE_DEBUGLOC_ORIGIN_TRACKING
28
- // Typedefs that are convenient but only used by the StackTrace -collection code
28
+ // Typedefs that are convenient but only used by the stack-trace -collection code
29
29
// added if DebugLoc origin-tracking is enabled.
30
30
template <typename T, typename Enable> struct DenseMapInfo ;
31
31
template <typename ValueT, typename ValueInfoT> class DenseSet ;
@@ -79,7 +79,7 @@ LLVM_ABI void PrintStackTrace(raw_ostream &OS, int Depth = 0);
79
79
#ifdef NDEBUG
80
80
#error DebugLoc origin-tracking should not be enabled in Release builds.
81
81
#endif
82
- // / Populates the given array with a stacktrace of the current program, up to
82
+ // / Populates the given array with a stack trace of the current program, up to
83
83
// / MaxDepth frames. Returns the number of frames returned, which will be
84
84
// / inserted into \p StackTrace from index 0. All entries after the returned
85
85
// / depth will be unmodified. NB: This is only intended to be used for
Original file line number Diff line number Diff line change 42
42
#include " llvm/CodeGen/TargetPassConfig.h"
43
43
#include " llvm/CodeGen/TargetRegisterInfo.h"
44
44
#include " llvm/CodeGen/TargetSubtargetInfo.h"
45
+ #include " llvm/Config/config.h"
45
46
#include " llvm/IR/DebugInfoMetadata.h"
46
47
#include " llvm/IR/DebugLoc.h"
47
48
#include " llvm/IR/Function.h"
@@ -933,12 +934,18 @@ bool BranchFolder::TryTailMergeBlocks(MachineBasicBlock *SuccBB,
933
934
934
935
// Sort by hash value so that blocks with identical end sequences sort
935
936
// together.
937
+ #if ENABLE_DEBUGLOC_ORIGIN_TRACKING
938
+ // If origin-tracking is enabled then MergePotentialElt is no longer a POD
939
+ // type, so we need std::sort instead.
940
+ std::sort (MergePotentials.begin (), MergePotentials.end ());
941
+ #else
936
942
array_pod_sort (MergePotentials.begin (), MergePotentials.end ());
943
+ #endif
937
944
938
945
// Walk through equivalence sets looking for actual exact matches.
939
946
while (MergePotentials.size () > 1 ) {
940
947
unsigned CurHash = MergePotentials.back ().getHash ();
941
- const DebugLoc BranchDL = MergePotentials.back ().getBranchDebugLoc ();
948
+ const DebugLoc & BranchDL = MergePotentials.back ().getBranchDebugLoc ();
942
949
943
950
// Build SameTails, identifying the set of blocks with this hash code
944
951
// and with the maximum number of instructions in common.
Original file line number Diff line number Diff line change @@ -50,15 +50,11 @@ class TargetRegisterInfo;
50
50
class MergePotentialsElt {
51
51
unsigned Hash;
52
52
MachineBasicBlock *Block;
53
- // We use MDNode rather than DebugLoc here because under certain CMake
54
- // options*, DebugLoc may contain a SmallVector used for introspection
55
- // purposes, which causes errors when stored here.
56
- // *LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING=COVERAGE_AND_ORIGIN
57
- MDNode *BranchDebugLoc;
53
+ DebugLoc BranchDebugLoc;
58
54
59
55
public:
60
- MergePotentialsElt (unsigned h, MachineBasicBlock *b, MDNode * bdl)
61
- : Hash(h), Block(b), BranchDebugLoc(bdl) {}
56
+ MergePotentialsElt (unsigned h, MachineBasicBlock *b, DebugLoc bdl)
57
+ : Hash(h), Block(b), BranchDebugLoc(std::move( bdl) ) {}
62
58
63
59
unsigned getHash () const { return Hash; }
64
60
MachineBasicBlock *getBlock () const { return Block; }
@@ -67,7 +63,7 @@ class TargetRegisterInfo;
67
63
Block = MBB;
68
64
}
69
65
70
- const DebugLoc getBranchDebugLoc () { return DebugLoc ( BranchDebugLoc) ; }
66
+ const DebugLoc & getBranchDebugLoc () { return BranchDebugLoc; }
71
67
72
68
bool operator <(const MergePotentialsElt &) const ;
73
69
};
You can’t perform that action at this time.
0 commit comments