[llvm] [RemoveDIs] Auto-upgrade debug intrinsics to DbgRecords (default false) (PR #85650)
J. Ryan Stinnett via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 19 04:29:17 PDT 2024
================
@@ -609,17 +609,25 @@ class MetadataLoader::MetadataLoaderImpl {
if (!NeedDeclareExpressionUpgrade)
return;
+ auto UpdateDeclareIfNeeded = [&](auto *Declare) {
+ auto *DIExpr = Declare->getExpression();
+ if (!DIExpr || !DIExpr->startsWithDeref() ||
+ !isa_and_nonnull<Argument>(Declare->getAddress()))
+ return;
+ SmallVector<uint64_t, 8> Ops;
+ Ops.append(std::next(DIExpr->elements_begin()), DIExpr->elements_end());
+ Declare->setExpression(DIExpression::get(Context, Ops));
+ };
+
for (auto &BB : F)
- for (auto &I : BB)
+ for (auto &I : BB) {
+ for (DPValue &DPV : filterDbgVars(I.getDbgRecordRange())) {
----------------
jryans wrote:
I guess the intention here is to port all these accumulated debug info upgrades so that apply to the new format as well (since anyone might convert upgrade-needing-debug-info from old to new format)?
Will `NeedDeclareExpressionUpgrade` be set properly by `upgradeDIExpression` for the new format as well?
https://github.com/llvm/llvm-project/pull/85650
More information about the llvm-commits
mailing list