[llvm] r306529 - [X86] Correct dwarf unwind information in function epilogue

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 00:47:19 PDT 2017


On Wed, Jun 28, 2017 at 3:21 AM Petar Jovanovic via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: petarj
> Date: Wed Jun 28 03:21:17 2017
> New Revision: 306529
>
> URL: http://llvm.org/viewvc/llvm-project?rev=306529&view=rev
> Log:
> [X86] Correct dwarf unwind information in function epilogue
>

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.

And somewhat alarmingly there are no updates to either target. For example:


> Incoming and outgoing CFI information is used by a late pass
> (CFIInstrInserter) that corrects CFA calculation rule for a basic block if
> needed.


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...

But the place I see this information being set up is here:


> Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FrameLowering.cpp?rev=306529&r1=306528&r2=306529&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86FrameLowering.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86FrameLowering.cpp Wed Jun 28 03:21:17 2017
> @@ -1093,6 +1094,9 @@ void X86FrameLowering::emitPrologue(Mach
>        assert(StackSize);
>        BuildCFI(MBB, MBBI, DL,
>                 MCCFIInstruction::createDefCfaOffset(nullptr, 2 *
> stackGrowth));
> +      MBB.setDefOffset(true);
> +      MBB.updateCFIInfo(std::prev(MBBI));
> +      InsertedCFI = true;
>
>        // Change the rule for the FramePtr to be an "offset" rule.
>        unsigned DwarfFramePtr = TRI->getDwarfRegNum(MachineFramePtr, true);
>

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...

How does this work? Is this not a (serious) bug?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170629/12c1e5d8/attachment.html>


More information about the llvm-commits mailing list