[PATCH] Prevent the creation of empty location list ranges.

David Blaikie dblaikie at gmail.com
Mon Dec 8 09:45:47 PST 2014


================
Comment at: lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp:49
@@ +48,3 @@
+  if (SeenInstructionInRange.front())
+    SeenInstructionInRange.push_front(false);
+  Ranges.push_back(
----------------
So 'SeenInstructionInRange' will just keep growing as the function grows? Should we try to limit it in any way.

Perhaps an alternative strategy would be to have a "currently unseen" std::shared_ptr<bool>, and then in "markOpenRangesNonEmpty" it would be:

  if (CurrentlySeen)
    *CurrentlySeen = true;
  CurrentlySeen = llvm::make_unique<bool>(false);

and then in "endInstrRange" the std::shared_ptr<bool> would be:

  if (*Ranges.back().NonEmpty) {
    Ranges.back().second = &MI;
    Ranges.back().NonEmpty = nullptr;
  } ...

(would this make it any easier to move the NonEmpty std::shared_ptr<bool> to the InstrRanges rather than into its elements (so we just have one per range set, rather than one per range)? I forget)

In any case, hoping Alexey can weigh in, as the person who (re)wrote most of this code most recently.

http://reviews.llvm.org/D6497






More information about the llvm-commits mailing list