aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/DebugInfo.cpp
diff options
context:
space:
mode:
authorElvin Wang <elvin.wang@intel.com>2025-02-11 10:33:07 -0800
committerGitHub <noreply@github.com>2025-02-11 10:33:07 -0800
commit71e623d878ecbf66324e15b3a3b2e983e2d7942a (patch)
tree87a87d7815d79cd327a332059226b6d2af5b346b /llvm/lib/IR/DebugInfo.cpp
parent1188b1ff7b956cb65d8ddda5f1e56c432f1a57c7 (diff)
downloadllvm-71e623d878ecbf66324e15b3a3b2e983e2d7942a.zip
llvm-71e623d878ecbf66324e15b3a3b2e983e2d7942a.tar.gz
llvm-71e623d878ecbf66324e15b3a3b2e983e2d7942a.tar.bz2
[llvm] Avoid out-of-order evaluation in DebugInfo (#125116)
This is an upstream proposal from https://github.com/intel/intel-graphics-compiler/commit/e60884cb98c4332a0eecff8396eb353c5b86cd35 We observed malfunctioning StripNonLineTableDebugInfo during debugging and it's caused by out-of-order evaluation, this is a C++ level semantic ambiguity issue, refer https://en.cppreference.com/w/cpp/language/eval_order Solution is simply separating one line into two.
Diffstat (limited to 'llvm/lib/IR/DebugInfo.cpp')
-rw-r--r--llvm/lib/IR/DebugInfo.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 4ce5180..ea1d79d 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -798,7 +798,11 @@ private:
return getReplacementMDNode(N);
};
- Replacements[N] = doRemap(N);
+ // Seperate recursive doRemap and operator [] into 2 lines to avoid
+ // out-of-order evaluations since both of them can access the same memory
+ // location in map Replacements.
+ auto Value = doRemap(N);
+ Replacements[N] = Value;
}
/// Do the remapping traversal.