Revert r308867 (which was originally committed in the clang390-import

project branch):

  Work around LLVM PR30879, which is about a bad interaction between
  X86 Call Frame Optimization on i386 and libunwind, by disallowing the
  optimization for i386-freebsd12.

  This should fix some instances of broken exception handling when
  frame pointers are omitted, in particular some unittests run during
  the build of editors/libreoffice.

  This hack will be removed as soon as upstream has implemented a more
  permanent fix for this problem.

And indeed, after r345018 and r345019, which updated LLVM libunwind to
the most recent version, the above workaround is no longer needed.  The
upstream commit which fixed this is:

  https://llvm.org/viewvc/llvm-project?view=revision&revision=292723

Specifically, 32 bit (i386-freebsd) executables optimized with omitted
frame pointers and Call Frame Optimization should now behave correctly
when a C++ exception is thrown, and the stack is unwound.

Upstream PR:	https://llvm.org/bugs/show_bug.cgi?id=30879
PR:		236062
MFC after:	1 month
X-MFC-With:	r344779
This commit is contained in:
Dimitry Andric 2019-03-12 18:19:44 +00:00
parent dad0dd21cc
commit 4cc79e8968
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=345073

View File

@ -139,11 +139,6 @@ bool X86CallFrameOptimization::isLegal(MachineFunction &MF) {
if (NoX86CFOpt.getValue())
return false;
// Work around LLVM PR30879 (bad interaction between CFO and libunwind)
if (STI->isTargetFreeBSD() && STI->is32Bit() &&
STI->getTargetTriple().getOSMajorVersion() >= 12)
return false;
// We can't encode multiple DW_CFA_GNU_args_size or DW_CFA_def_cfa_offset
// in the compact unwind encoding that Darwin uses. So, bail if there
// is a danger of that being generated.