<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Wed, Jun 28, 2017 at 3:21 AM Petar Jovanovic via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: petarj<br>
Date: Wed Jun 28 03:21:17 2017<br>
New Revision: 306529<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=306529&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=306529&view=rev</a><br>
Log:<br>
[X86] Correct dwarf unwind information in function epilogue<br></blockquote><div><br></div><div>So, this says "[X86]", but is it really X86-specific? there is a pretty huge set of changes to common CFI infrastructure that is used by PPC and AArch64 at least.</div><div><br></div><div>And somewhat alarmingly there are no updates to either target. For example:</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Incoming and outgoing CFI information is used by a late pass<br>
(CFIInstrInserter) that corrects CFA calculation rule for a basic block if<br>
needed.</blockquote><div><br></div><div>It seems like these late passes (that run on all targets from what I can tell) *require* the new information to be set up in the basic block...</div><div><br></div><div>But the place I see this information being set up is here:</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FrameLowering.cpp?rev=306529&r1=306528&r2=306529&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FrameLowering.cpp?rev=306529&r1=306528&r2=306529&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/X86/X86FrameLowering.cpp (original)<br>
+++ llvm/trunk/lib/Target/X86/X86FrameLowering.cpp Wed Jun 28 03:21:17 2017<br>@@ -1093,6 +1094,9 @@ void X86FrameLowering::emitPrologue(Mach<br>
       assert(StackSize);<br>
       BuildCFI(MBB, MBBI, DL,<br>
                MCCFIInstruction::createDefCfaOffset(nullptr, 2 * stackGrowth));<br>
+      MBB.setDefOffset(true);<br>
+      MBB.updateCFIInfo(std::prev(MBBI));<br>
+      InsertedCFI = true;<br>
<br>
       // Change the rule for the FramePtr to be an "offset" rule.<br>
       unsigned DwarfFramePtr = TRI->getDwarfRegNum(MachineFramePtr, true);<br></blockquote><div><br></div><div>But this is x86 specific! There is very similar code in both AArch64 and PPC backends inserting these CFI directives, but no updates to the MBB...</div><div><br></div><div>How does this work? Is this not a (serious) bug?</div></div></div>