<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">+ Adrian</div><div class=""><div class="">+ David</div></div><div class=""><br class=""></div>Hi Arsen,<div class=""><br class=""></div><div class="">This sounds like a bug to me. Have you tried reproducing it on trunk? For instance, I see that the relation between DICompileUnit and DISubprogram was changed in the meantime (<a href="https://reviews.llvm.org/D19034" class="">https://reviews.llvm.org/D19034</a>).</div><div class=""><br class=""></div><div class="">If this no longer occurs on master you could bisect the compiler to find the commit(s) that fix this and consider backporting them locally. If not, you should file a bug on <a href="http://bugs.llvm.org" class="">bugs.llvm.org</a> and attach the source and commands you’re running. I’d be happy to take a look at it. </div><div class=""><br class=""></div><div class="">Jonas</div><div class=""><br class=""></div><div class=""><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 14 Jan 2018, at 16:33, Arsen Hakobyan via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Thanks Paul,<div class="">Hi Adrian and David I would really appreciate any comments, thoughts assumptions.</div><div class=""><br class=""></div><div class="">If additional information is needed please let me know.</div><div class=""><br class=""></div><div class="">Regards,</div><div class="">Arsen </div></div><div class="gmail_extra" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""><div class="gmail_quote">On Sat, Jan 13, 2018 at 2:54 AM, Robinson, Paul<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:paul.robinson@sony.com" target="_blank" class="">paul.robinson@sony.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div lang="EN-US" link="blue" vlink="purple" class=""><div class="m_8879198985773454742WordSection1"><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Hi Arsen, we are beyond what I understand about how metadata operates. Maybe Adrian or David knows.<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">--paulr<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><a name="m_8879198985773454742__MailEndCompose" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""><u class=""></u> <u class=""></u></span></a></p><div style="border-style: none none none solid; border-left-width: 1.5pt; border-left-color: blue; padding: 0in 0in 0in 4pt;" class=""><div class=""><div style="border-style: solid none none; border-top-width: 1pt; border-top-color: rgb(181, 196, 223); padding: 3pt 0in 0in;" class=""><p class="MsoNormal"><b class=""><span style="font-size: 10pt; font-family: Tahoma, sans-serif;" class="">From:</span></b><span style="font-size: 10pt; font-family: Tahoma, sans-serif;" class=""><span class="Apple-converted-space"> </span>Arsen Hakobyan [mailto:<a href="mailto:hakobyan.ars@gmail.com" target="_blank" class="">hakobyan.ars@gmail.com</a><wbr class="">]<span class="Apple-converted-space"> </span><br class=""><b class="">Sent:</b><span class="Apple-converted-space"> </span>Friday, January 12, 2018 12:16 PM<br class=""><b class="">To:</b><span class="Apple-converted-space"> </span>Robinson, Paul<br class=""><b class="">Cc:</b><span class="Apple-converted-space"> </span><a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>; David Blaikie<br class=""><b class="">Subject:</b><span class="Apple-converted-space"> </span>Re: [llvm-dev] StripDeadDebugInfo for static inline functions.<u class=""></u><u class=""></u></span></p></div></div><div class=""><div class="h5"><p class="MsoNormal"><u class=""></u> <u class=""></u></p><div class=""><p class="MsoNormal">Just one update:<u class=""></u><u class=""></u></p><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><p class="MsoNormal">the function causing the segmentation fault is the following:<u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(205, 121, 35);" class=""> 359<span class="Apple-converted-space"> </span></span><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(52, 188, 38);" class="">void</span><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""><span class="Apple-converted-space"> </span>DwarfDebug::<wbr class="">constructAbstractSubprogramSco<wbr class="">peDIE(LexicalScope *Scope) {<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(205, 121, 35);" class=""> 360<span class="Apple-converted-space"> </span></span><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""> <span class="Apple-converted-space"> </span>assert(Scope && Scope->getScopeNode());<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(205, 121, 35);" class=""> 361<span class="Apple-converted-space"> </span></span><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""> <span class="Apple-converted-space"> </span>assert(Scope->isAbstractScope(<wbr class="">));<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(205, 121, 35);" class=""> 362<span class="Apple-converted-space"> </span></span><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""> <span class="Apple-converted-space"> </span>assert(!Scope->getInlinedAt())<wbr class="">;<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(205, 121, 35);" class=""> 363 <u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(205, 121, 35);" class=""> 364<span class="Apple-converted-space"> </span></span><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""> <span class="Apple-converted-space"> </span></span><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(52, 188, 38);" class="">const</span><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""><span class="Apple-converted-space"> </span>MDNode *SP = Scope->getScopeNode();<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(205, 121, 35);" class=""> 365 <u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(205, 121, 35);" class=""> 366<span class="Apple-converted-space"> </span></span><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""> <span class="Apple-converted-space"> </span>ProcessedSPNodes.insert(SP);<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(205, 121, 35);" class=""> 367 <u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(205, 121, 35);" class=""> 368<span class="Apple-converted-space"> </span></span><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""> <span class="Apple-converted-space"> </span></span><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(82, 48, 225);" class="">// Find the subprogram's DwarfCompileUnit in the SPMap in case the subprogram<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(205, 121, 35);" class=""> 369<span class="Apple-converted-space"> </span></span><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""> <span class="Apple-converted-space"> </span></span><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(82, 48, 225);" class="">// was inlined from another compile unit.<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(205, 121, 35);" class=""> 370<span class="Apple-converted-space"> </span></span><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""> <span class="Apple-converted-space"> </span></span><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(52, 188, 38);" class="">auto</span><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""><span class="Apple-converted-space"> </span>&CU = SPMap[SP];<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(205, 121, 35);" class=""> 371<span class="Apple-converted-space"> </span></span><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""> <span class="Apple-converted-space"> </span>forBothCUs(*CU, [&](DwarfCompileUnit &CU) {<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(205, 121, 35);" class=""> 372<span class="Apple-converted-space"> </span></span><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""> <span class="Apple-converted-space"> </span>CU.<wbr class="">constructAbstractSubprogramSco<wbr class="">peDIE(Scope);<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(205, 121, 35);" class=""> 373<span class="Apple-converted-space"> </span></span><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""> <span class="Apple-converted-space"> </span>});<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(205, 121, 35);" class=""> 374<span class="Apple-converted-space"> </span></span><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">}</span><span style="font-size: 8.5pt; font-family: Menlo, serif; color: rgb(205, 121, 35);" class=""><u class=""></u><u class=""></u></span></div></div><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><p class="MsoNormal"><span style="" class="">Here I checked that "</span><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">SPMap.<span style="background-color: rgb(0, 166, 179); background-position: initial initial; background-repeat: initial initial;" class="">lookup</span>(Scope-><wbr class="">getScopeNode());" returns null. If the transformation does right things then probably there is other issue and SPMap[SP] for inlined function should find the main CompileUnit anyway. What do you think about this?</span><u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><p class="MsoNormal"><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">Regards,</span><u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">Arsen</span><u class=""></u><u class=""></u></p></div></div><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p><div class=""><p class="MsoNormal">On Sat, Jan 13, 2018 at 12:11 AM, Arsen Hakobyan <<a href="mailto:hakobyan.ars@gmail.com" target="_blank" class="">hakobyan.ars@gmail.com</a>> wrote:<u class=""></u><u class=""></u></p><div class=""><p class="MsoNormal">Hi Paul, <u class=""></u><u class=""></u></p><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><p class="MsoNormal">Thanks for your response.<u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal">Let me actually post more details visualizing my case. Assuming that can help.<u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><p class="MsoNormal">so the IR before the opt tool is running is:<u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">; Function Attrs: nounwind<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">define i16 @main() #0 !dbg !13 {<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">entry:<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""> <span class="Apple-converted-space"> </span>%retval = alloca i16, align 1<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""> <span class="Apple-converted-space"> </span>...<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">}<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal; min-height: 13px;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""><u class=""></u> <u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">; Function Attrs: inlinehint nounwind<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">define internal void @delay(i16 %d) #4 !dbg !69 {<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">entry:<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""> <span class="Apple-converted-space"> </span>%d.addr = alloca i16, align 1<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""> <span class="Apple-converted-space"> </span>%i = alloca i16, align 1<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""> <span class="Apple-converted-space"> </span>...<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">}<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal; min-height: 13px;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""><u class=""></u> <u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!<a href="http://llvm.dbg.cu/" target="_blank" class="">llvm.dbg.cu</a><span class="Apple-converted-space"> </span>= !{!0}<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!llvm.module.flags = !{!84, !85}<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!llvm.ident = !{!86}<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""><u class=""></u> <u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 Revision 72230", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !3, subprograms: !12, globals: !73)<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">...<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!12 = !{!13, !54, !57, !60, !61, !62, !65, !66, !67, !68, !69}<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!13 = distinct !DISubprogram(name: "main", scope: !14, file: !14, line: 15, type: !15, isLocal: false, isDefinition: true, scopeLine: 15, isOptimized: true, variables: !17)<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">...<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!54 = distinct !DISubprogram(name: ...<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!57 = distinct !DISubprogram(name: ...<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!60 = distinct !DISubprogram(name: ...<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!61 = distinct !DISubprogram(name: ...<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!62 = distinct !DISubprogram(name: ...<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!65 = distinct !DISubprogram(name: ...<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!66 = distinct !DISubprogram(name: ...<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!67 = distinct !DISubprogram(name: ...<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!68 = distinct !DISubprogram(name: ...<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!69 = distinct !DISubprogram(name: "delay", scope: !14, file: !14, line: 9, type: !55, isLocal: true, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: true, variables: !70)<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!70 = !{!71, !72}<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!71 = !DILocalVariable(name: "d", arg: 1, scope: !69, file: !14, line: 9, type: !11)<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!72 = !DILocalVariable(name: "i", scope: !69, file: !14, line: 9, type: !11)<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">...<u class=""></u><u class=""></u></span></div></div><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><p class="MsoNormal">The IR after opt is:<u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">; Function Attrs: nounwind<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">define i16 @main() #0 !dbg !13 {<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">entry:<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""> <span class="Apple-converted-space"> </span>...<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">} <u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal; min-height: 13px;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""><u class=""></u> <u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!<a href="http://llvm.dbg.cu/" target="_blank" class="">llvm.dbg.cu</a><span class="Apple-converted-space"> </span>= !{!0}<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!llvm.module.flags = !{!64, !65}<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!llvm.ident = !{!66} <u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal; min-height: 13px;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class=""><u class=""></u> <u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 Revision 72230", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !3, subprograms: !12, globals: !54)<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">...<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!12 = !{!13}<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!13 = distinct !DISubprogram(name: "main", scope: !14, file: !14, line: 15, type: !15, isLocal: false, isDefinition: true, scopeLine: 15, isOptimized: true, variables: !17)<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!14 = !DIFile(filename: "main.c", directory: "path_to_directory")<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">...<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!68 = !DILocalVariable(name: "d", arg: 1, scope: !69, file: !14, line: 9, type: !11)<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!69 = distinct !DISubprogram(name: "delay", scope: !14, file: !14, line: 9, type: !70, isLocal: true, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: true, variables: !72)<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">...<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">!73 = !DILocalVariable(name: "i", scope: !69, file: !14, line: 9, type: !11)<u class=""></u><u class=""></u></span></div><div style="margin: 0in 0in 0.0001pt; font-stretch: normal;" class=""><span style="font-size: 8.5pt; font-family: Menlo, serif;" class="">... <u class=""></u><u class=""></u></span></div></div><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><p class="MsoNormal">I checked the StripSymbol.cpp file and there is no difference between version I am using (from clang 3.8) and current (6.0.0) version.<u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><p class="MsoNormal">As you can see the !12 node does not contain reference to !69 after optimizations which I think is incorrect. I assume that !69 has not been removed because there are two nodes (!68 and !73) referenced to it as the scope. But that should force the transformations to not remove the link from !12. Is it right?<u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><p class="MsoNormal">Thank you very much.<u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"><span style="color: rgb(136, 136, 136);" class="">Arsen<u class=""></u><u class=""></u></span></p></div><div class=""><p class="MsoNormal"><span style="color: rgb(136, 136, 136);" class=""><u class=""></u> <u class=""></u></span></p></div></div><div class=""><div class=""><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p><div class=""><p class="MsoNormal">On Fri, Jan 12, 2018 at 10:21 PM, Robinson, Paul <<a href="mailto:paul.robinson@sony.com" target="_blank" class="">paul.robinson@sony.com</a>> wrote:<u class=""></u><u class=""></u></p><div class=""><div class=""><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">I'm not as familiar with all the ins and outs of metadata as maybe I should be, but ultimately the inlined function should have a DWARF description contained within the description of the caller (which is why you're seeing the call to constructAbstractSubprogramSco<wbr class="">peDIE). That suggests that the DISubprogram for the inlined function ought to remain, and its scope should be the DICompileUnit.</span><u class=""></u><u class=""></u></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">--paulr</span><u class=""></u><u class=""></u></p><p class="MsoNormal"><a name="m_8879198985773454742_m_-1677069743473896569_m_600397516357848" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""> </span></a><u class=""></u><u class=""></u></p><div style="border-style: none none none solid; border-left-width: 1.5pt; border-left-color: blue; padding: 0in 0in 0in 4pt;" class=""><div class=""><div style="border-style: solid none none; border-top-width: 1pt; border-top-color: rgb(181, 196, 223); padding: 3pt 0in 0in;" class=""><p class="MsoNormal"><b class=""><span style="font-size: 10pt; font-family: Tahoma, sans-serif;" class="">From:</span></b><span style="font-size: 10pt; font-family: Tahoma, sans-serif;" class=""><span class="Apple-converted-space"> </span>llvm-dev [mailto:<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank" class="">llvm-dev-bounces@<wbr class="">lists.llvm.org</a>]<span class="Apple-converted-space"> </span><b class="">On Behalf Of<span class="Apple-converted-space"> </span></b>Arsen Hakobyan via llvm-dev<br class=""><b class="">Sent:</b><span class="Apple-converted-space"> </span>Friday, January 12, 2018 1:57 AM<br class=""><b class="">To:</b><span class="Apple-converted-space"> </span><a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class=""><b class="">Subject:</b><span class="Apple-converted-space"> </span>[llvm-dev] StripDeadDebugInfo for static inline functions.</span><u class=""></u><u class=""></u></p></div></div><div class=""><div class=""><p class="MsoNormal"> <u class=""></u><u class=""></u></p><div class=""><div class=""><p class="MsoNormal">Hi all,<u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"> <u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal">I would like to understand the strip-dead-debug-info transformation. <u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal">In my test case there is a static inline function with two local variables.<u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal">It appears that the function is already inlined before strip-dead-debug-info starts its work. As a result the DICompileUnit is cleaned and its subprograms list has no reference to the DISubprogram for the inlined function, but as there is reference from the DILocalVariables to the DISubprogram it remains (IMHO).<u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal">This caused to a segmentation fault while running llc on the optimized IR file at function "<wbr class="">constructAbstractSubprogramSco<wbr class="">peDIE" in file DwarfDebug.cpp because the scope of the DISubprogram is null (I assume it should be the DICompileUnit).<u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"> <u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal">So I would like to know what would be the correct solution for this issue: Update optimization to not remove reference from the subprograms list, or to skip finding scope in llc.<u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"> <u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal">Any help is highly appreciated.<u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"> <u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal">Thanks,<u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal">Arsen<u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"> <u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"> <u class=""></u><u class=""></u></p></div><p class="MsoNormal">--<u class=""></u><u class=""></u></p><div class=""><div class=""><div class=""><p class="MsoNormal"> <u class=""></u><u class=""></u></p></div><p class="MsoNormal"><span style="color: rgb(68, 68, 68);" class="">If it's not fun you're not doing it right -- Fran Tarkenton</span><u class=""></u><u class=""></u></p></div></div></div></div></div></div></div></div></div><p class="MsoNormal"><br class=""><br clear="all" class=""><u class=""></u><u class=""></u></p><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><p class="MsoNormal">--<span class="Apple-converted-space"> </span><u class=""></u><u class=""></u></p><div class=""><div class=""><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><p class="MsoNormal"><span style="color: rgb(68, 68, 68);" class="">If it's not fun you're not doing it right -- Fran Tarkenton</span><u class=""></u><u class=""></u></p></div></div></div></div></div></div><p class="MsoNormal"><br class=""><br clear="all" class=""><u class=""></u><u class=""></u></p><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><p class="MsoNormal">--<span class="Apple-converted-space"> </span><u class=""></u><u class=""></u></p><div class=""><div class=""><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><p class="MsoNormal"><span style="color: rgb(68, 68, 68);" class="">If it's not fun you're not doing it right -- Fran Tarkenton</span><u class=""></u><u class=""></u></p></div></div></div></div></div></div></div></div></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class=""><br class=""></div><font color="#444444" class="">If it's not fun you're not doing it right -- Fran Tarkenton</font><br class=""></div></div></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">LLVM Developers mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:llvm-dev@lists.llvm.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">llvm-dev@lists.llvm.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></div></blockquote></div><br class=""></div></div></body></html>