[llvm] r251904 - [X86] Generate .cfi_adjust_cfa_offset correctly when pushing arguments

Kuperstein, Michael M via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 4 23:04:35 PST 2015


It looks like this flag doesn’t behave exactly like one may expect.
Playing around with gcc, I got:

1) With –fexceptions, specifying –fno-asynchronous-unwind-tables has no effect.
2) With –fno-exceptions but with -g, specifying –fno-asynchronous-unwind-tables also has no effect
3) With –fno-excpetions and without –g, –fno-asynchronous-unwind-tables doesn’t make CFI imprecise in the sense we’re talking about – rather, it makes it disappear entirely.

The current clang interpretation seems to be close to that too - –fno-asynchronous-unwind-tables controls the default behavior of passing –munwind-tables to –cc1.
It doesn’t claim to be fully compatible though, see https://llvm.org/bugs/show_bug.cgi?id=4932 .

In any case, I think using it as Dave suggested is fine – it sounds consistent with the documented semantics, and we’re not really compatible with GCC on this to begin with.

Michael

From: Kreitzer, David L
Sent: Thursday, November 05, 2015 01:07
To: Smith, Kevin B; Kuperstein, Michael M; Rafael Espíndola; rnk at google.com; friss at apple.com
Cc: llvm-commits
Subject: RE: [llvm] r251904 - [X86] Generate .cfi_adjust_cfa_offset correctly when pushing arguments

I believe this is exactly the purpose of the -f[no-]asynchronous-unwind-tables option, which clang at least accepts. This is how gcc documents it:

-fasynchronous-unwind-tables
Generate unwind table in DWARF 2 format, if supported by target machine. The table is exact at each instruction boundary, so it can be used for stack unwinding from asynchronous events (such as debugger or garbage collector).

- Dave

From: Smith, Kevin B
Sent: Wednesday, November 04, 2015 11:19 AM
To: Kuperstein, Michael M; Rafael Espíndola; rnk at google.com<mailto:rnk at google.com>; friss at apple.com<mailto:friss at apple.com>; Kreitzer, David L
Cc: llvm-commits
Subject: RE: [llvm] r251904 - [X86] Generate .cfi_adjust_cfa_offset correctly when pushing arguments

+1 to Rafael’s comment.

From: Kuperstein, Michael M
Sent: Wednesday, November 04, 2015 7:32 AM
To: Rafael Espíndola; rnk at google.com<mailto:rnk at google.com>; friss at apple.com<mailto:friss at apple.com>; Kreitzer, David L; Smith, Kevin B
Cc: llvm-commits
Subject: RE: [llvm] r251904 - [X86] Generate .cfi_adjust_cfa_offset correctly when pushing arguments

Adding people who participated in the original review.

From: Rafael Espíndola [mailto:rafael.espindola at gmail.com]
Sent: Wednesday, November 04, 2015 14:46
To: Kuperstein, Michael M
Cc: llvm-commits
Subject: RE: [llvm] r251904 - [X86] Generate .cfi_adjust_cfa_offset correctly when pushing arguments


I would personally prefer to be precise by default and have a command line option to switch it off

Cheers,
Rafael
On Nov 3, 2015 12:13 PM, "Kuperstein, Michael M" <michael.m.kuperstein at intel.com<mailto:michael.m.kuperstein at intel.com>> wrote:
Sorry, I wasn't clear - when I said "always", I meant both -O2 and -Os -fomit-frame-pointers.
But "-Os -fomit-frame-pointers" isn't a configuration that's normally used, so I'm not entirely sure it was a conscious decision.

Anyway, if there's consensus that we need to always be precise, the code is already in place, we just need to flip the switch - but I'm afraid of the size impact.

-----Original Message-----
From: Rafael Espíndola [mailto:rafael.espindola at gmail.com<mailto:rafael.espindola at gmail.com>]
Sent: Tuesday, November 03, 2015 18:09
To: Kuperstein, Michael M
Cc: llvm-commits
Subject: Re: [llvm] r251904 - [X86] Generate .cfi_adjust_cfa_offset correctly when pushing arguments

On 3 November 2015 at 10:55, Kuperstein, Michael M <michael.m.kuperstein at intel.com<mailto:michael.m.kuperstein at intel.com>> wrote:
> GCC is always precise, but that seems unnecessary when we only care about performing unwinding for synchronous EH (since in this case, we only need to be right at call sites), and inflates the module size.
>
> It's actually a bit hard to compare apples-to-apples here, since for -O2, there's no definitely harm in emitting extra CFI, but clang doesn't use pushes, and for -Os, GCC defaults to -no-omit-frame-pointer, so the issue does not arise.

-Os -fomit-frame-pointers?

I think it is incorrect to say that we don't care about asynchronous unwinding (not exceptions). The .eh_frame is part of the ABI and any tool wanting to unwind can depend on it being precise.

Cheers,
Rafael
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151105/2c9cf12e/attachment.html>


More information about the llvm-commits mailing list