Skip to content

Commit 2b49d26

Browse files
authored
Merge pull request #31694 from JuliaLang/tb/dibuilder_ptrarg
Simplify llvm.dbg.declare for pointer arguments
2 parents 150ec97 + 51a8411 commit 2b49d26

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/codegen.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5948,10 +5948,13 @@ static std::unique_ptr<Module> emit_function(
59485948
vi.value = theArg;
59495949
if (specsig && theArg.V && ctx.debug_enabled && vi.dinfo) {
59505950
SmallVector<uint64_t, 8> addr;
5951-
if ((Metadata*)vi.dinfo->getType() != jl_pvalue_dillvmt && theArg.ispointer())
5952-
addr.push_back(llvm::dwarf::DW_OP_deref);
5953-
AllocaInst *parg = dyn_cast<AllocaInst>(theArg.V);
5954-
if (!parg) {
5951+
Value *parg;
5952+
if (theArg.ispointer()) {
5953+
parg = theArg.V;
5954+
if ((Metadata*)vi.dinfo->getType() != jl_pvalue_dillvmt)
5955+
addr.push_back(llvm::dwarf::DW_OP_deref);
5956+
}
5957+
else {
59555958
parg = ctx.builder.CreateAlloca(theArg.V->getType(), NULL, jl_symbol_name(s));
59565959
ctx.builder.CreateStore(theArg.V, parg);
59575960
}

src/llvm-gc-invariant-verifier.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,10 @@ void GCInvariantVerifier::visitStoreInst(StoreInst &SI) {
8585
if (VTy->isPointerTy()) {
8686
/* We currently don't obey this for arguments. That's ok - they're
8787
externally rooted. */
88-
if (!isa<Argument>(SI.getValueOperand())) {
89-
unsigned AS = cast<PointerType>(VTy)->getAddressSpace();
90-
Check(AS != AddressSpace::CalleeRooted &&
91-
AS != AddressSpace::Derived,
92-
"Illegal store of decayed value", &SI);
93-
}
88+
unsigned AS = cast<PointerType>(VTy)->getAddressSpace();
89+
Check(AS != AddressSpace::CalleeRooted &&
90+
AS != AddressSpace::Derived,
91+
"Illegal store of decayed value", &SI);
9492
}
9593
VTy = SI.getPointerOperand()->getType();
9694
if (VTy->isPointerTy()) {

0 commit comments

Comments
 (0)