[compiler-rt] [TSan][compiler-rt] Defer symbolization of Reports to as late as possible (PR #151120)

Dan Blackwell via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 30 05:52:10 PDT 2025


================
@@ -199,6 +198,55 @@ void ScopedReportBase::AddMemoryAccess(uptr addr, uptr external_tag, Shadow s,
   }
 }
 
+void ScopedReportBase::SymbolizeStackElems() {
+  // symbolize memory ops
+  for (usize i = 0; i < rep_->mops.Size(); i++) {
+    ReportMop *mop = rep_->mops[i];
+    mop->stack = SymbolizeStack(mop->stack_trace);
+    if (mop->stack)
+      mop->stack->suppressable = true;
+  }
+
+  // symbolize locations
+  for (usize i = 0; i < rep_->locs.Size(); i++) {
+    // added locations have a NULL placeholder - don't dereference them
+    if (ReportLocation *loc = rep_->locs[i])
+      loc->stack = SymbolizeStackId(loc->stack_id);
+  }
----------------
DanBlackwell wrote:

We run `SymboliseData` on any added locations, but `SymbolizeStackId` on the other locs; so I don't think we could move this after and drop the if-statement unfortunately :/. 

I could interleave it with the `// symbolize any added locations` block, but given that this is (hopefully) a cold path my preference would be for legibility over optimisation.

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


More information about the llvm-commits mailing list