File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -473,21 +473,39 @@ bool DwarfDebug::isLexicalScopeDIENull(LexicalScope* Scope)
473473}
474474
475475// Construct new DW_TAG_lexical_block for this scope and attach
476- // DW_AT_low_pc/DW_AT_high_pc labels as well as DW_AT_INTEL_simd_width
476+ // DW_AT_low_pc/DW_AT_high_pc labels as well as DW_AT_INTEL_simd_width.
477+ // Also add DW_AT_abstract_origin when lexical scope is from inlined code.
477478DIE* DwarfDebug::constructLexicalScopeDIE (CompileUnit* TheCU, LexicalScope* Scope)
478479{
479480 if (isLexicalScopeDIENull (Scope))
480481 return 0 ;
481482
482483 DIE* ScopeDIE = new DIE (dwarf::DW_TAG_lexical_block);
483484 if (Scope->isAbstractScope ())
485+ {
486+ AbsLexicalScopeDIEMap.insert (std::make_pair (Scope, ScopeDIE));
484487 return ScopeDIE;
488+ }
485489
486490 const SmallVectorImpl<InsnRange>& Ranges = Scope->getRanges ();
487491 IGC_ASSERT_MESSAGE (Ranges.empty () == false , " LexicalScope does not have instruction markers!" );
488492
489493 if (m_pModule->isDirectElfInput )
490494 {
495+ if (Scope->getInlinedAt ())
496+ {
497+ auto abstractScope = LScopes.findAbstractScope (dyn_cast_or_null<DILocalScope>(Scope->getScopeNode ()));
498+ if (abstractScope)
499+ {
500+ auto AbsDIE = AbsLexicalScopeDIEMap.lookup (abstractScope);
501+ if (AbsDIE)
502+ {
503+ // Point to corresponding abstract instance of DW_TAG_lexical_block
504+ TheCU->addDIEEntry (ScopeDIE, dwarf::DW_AT_abstract_origin, AbsDIE);
505+ }
506+ }
507+ }
508+
491509 if (IGC_IS_FLAG_ENABLED (EmitDebugRanges))
492510 {
493511 encodeRange (TheCU, ScopeDIE, &Ranges);
Original file line number Diff line number Diff line change @@ -394,6 +394,8 @@ namespace IGC
394394
395395 llvm::DenseMap<VISAModule*, llvm::Function*> VISAModToFunc;
396396
397+ llvm::DenseMap<LexicalScope*, DIE*> AbsLexicalScopeDIEMap;
398+
397399 private:
398400
399401 void addScopeVariable (::IGC::LexicalScope* LS, DbgVariable* Var);
You can’t perform that action at this time.
0 commit comments