[clang] 92122b0 - Revert "[RemoveDIs] Update Clang front end to handle DbgRecords (#84756)"
Orlando Cazalet-Hyams via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 18 03:14:22 PDT 2024
Author: Orlando Cazalet-Hyams
Date: 2024-03-18T10:13:35Z
New Revision: 92122b0b4b514ea6c081e428f47ef1bf9d4f0f17
URL: https://github.com/llvm/llvm-project/commit/92122b0b4b514ea6c081e428f47ef1bf9d4f0f17
DIFF: https://github.com/llvm/llvm-project/commit/92122b0b4b514ea6c081e428f47ef1bf9d4f0f17.diff
LOG: Revert "[RemoveDIs] Update Clang front end to handle DbgRecords (#84756)"
This reverts commit 6f60ad7e9a3508f19d54c827cf11f7930a0685ee.
Buildbots: https://lab.llvm.org/buildbot/#/builders/196/builds/47206
Added:
Modified:
clang/lib/CodeGen/CGBlocks.cpp
clang/lib/CodeGen/CGStmtOpenMP.cpp
clang/test/CodeGenObjC/debug-info-blocks.m
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp
index 768b786c6426df..0cbace7b7f7bbd 100644
--- a/clang/lib/CodeGen/CGBlocks.cpp
+++ b/clang/lib/CodeGen/CGBlocks.cpp
@@ -1540,10 +1540,7 @@ llvm::Function *CodeGenFunction::GenerateBlockFunction(
llvm::BasicBlock *resume = Builder.GetInsertBlock();
// Go back to the entry.
- if (entry_ptr->getNextNonDebugInstruction())
- entry_ptr = entry_ptr->getNextNonDebugInstruction()->getIterator();
- else
- entry_ptr = entry->end();
+ ++entry_ptr;
Builder.SetInsertPoint(entry, entry_ptr);
// Emit debug information for all the DeclRefExprs.
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index d7c18146b71b16..452ce6983f6ac1 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -4749,10 +4749,10 @@ void CodeGenFunction::EmitOMPTaskBasedDirective(
if (CGF.CGM.getCodeGenOpts().hasReducedDebugInfo())
(void)DI->EmitDeclareOfAutoVariable(SharedVar, ContextValue,
CGF.Builder, false);
+ llvm::Instruction &Last = CGF.Builder.GetInsertBlock()->back();
// Get the call dbg.declare instruction we just created and update
// its DIExpression to add offset to base address.
- auto UpdateExpr = [](llvm::LLVMContext &Ctx, auto *Declare,
- unsigned Offset) {
+ if (auto DDI = dyn_cast<llvm::DbgVariableIntrinsic>(&Last)) {
SmallVector<uint64_t, 8> Ops;
// Add offset to the base address if non zero.
if (Offset) {
@@ -4760,21 +4760,9 @@ void CodeGenFunction::EmitOMPTaskBasedDirective(
Ops.push_back(Offset);
}
Ops.push_back(llvm::dwarf::DW_OP_deref);
- Declare->setExpression(llvm::DIExpression::get(Ctx, Ops));
- };
- llvm::Instruction &Last = CGF.Builder.GetInsertBlock()->back();
- if (auto DDI = dyn_cast<llvm::DbgVariableIntrinsic>(&Last))
- UpdateExpr(DDI->getContext(), DDI, Offset);
- // If we're emitting using the new debug info format into a block
- // without a terminator, the record will be "trailing".
- assert(!Last.isTerminator() && "unexpected terminator");
- if (auto *Marker =
- CGF.Builder.GetInsertBlock()->getTrailingDPValues()) {
- for (llvm::DPValue &DPV : llvm::reverse(
- llvm::DPValue::filter(Marker->getDbgValueRange()))) {
- UpdateExpr(Last.getContext(), &DPV, Offset);
- break;
- }
+ auto &Ctx = DDI->getContext();
+ llvm::DIExpression *DIExpr = llvm::DIExpression::get(Ctx, Ops);
+ Last.setOperand(2, llvm::MetadataAsValue::get(Ctx, DIExpr));
}
}
}
diff --git a/clang/test/CodeGenObjC/debug-info-blocks.m b/clang/test/CodeGenObjC/debug-info-blocks.m
index 59171da016da1e..14b29f222fbe8e 100644
--- a/clang/test/CodeGenObjC/debug-info-blocks.m
+++ b/clang/test/CodeGenObjC/debug-info-blocks.m
@@ -5,8 +5,8 @@
// CHECK: define {{.*}}_block_invoke
// CHECK: store ptr %.block_descriptor, ptr %[[ALLOCA:block.addr]], align
-// CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr %d, metadata ![[D:[0-9]+]], metadata !{{.*}})
// CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr %[[ALLOCA]], metadata ![[SELF:[0-9]+]], metadata !{{.*}})
+// CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr %d, metadata ![[D:[0-9]+]], metadata !{{.*}})
// Test that we do emit scope info for the helper functions, and that the
// parameters to these functions are marked as artificial (so the debugger
More information about the cfe-commits
mailing list