freebsd-dev/lib
Dimitry Andric 0556cfadc2 Recommit r332501, with an additional upstream fix for "Cannot lower
EFLAGS copy that lives out of a basic block!" errors on i386.

Pull in r325446 from upstream clang trunk (by me):

  [X86] Add 'sahf' CPU feature to frontend

  Summary:
  Make clang accept `-msahf` (and `-mno-sahf`) flags to activate the
  `+sahf` feature for the backend, for bug 36028 (Incorrect use of
  pushf/popf enables/disables interrupts on amd64 kernels).  This was
  originally submitted in bug 36037 by Jonathan Looney
  <jonlooney@gmail.com>.

  As described there, GCC also uses `-msahf` for this feature, and the
  backend already recognizes the `+sahf` feature. All that is needed is
  to teach clang to pass this on to the backend.

  The mapping of feature support onto CPUs may not be complete; rather,
  it was chosen to match LLVM's idea of which CPUs support this feature
  (see lib/Target/X86/X86.td).

  I also updated the affected test case (CodeGen/attr-target-x86.c) to
  match the emitted output.

  Reviewers: craig.topper, coby, efriedma, rsmith

  Reviewed By: craig.topper

  Subscribers: emaste, cfe-commits

  Differential Revision: https://reviews.llvm.org/D43394

Pull in r328944 from upstream llvm trunk (by Chandler Carruth):

  [x86] Expose more of the condition conversion routines in the public
  API for X86's instruction information. I've now got a second patch
  under review that needs these same APIs. This bit is nicely
  orthogonal and obvious, so landing it. NFC.

Pull in r329414 from upstream llvm trunk (by Craig Topper):

  [X86] Merge itineraries for CLC, CMC, and STC.

  These are very simple flag setting instructions that appear to only
  be a single uop. They're unlikely to need this separation.

Pull in r329657 from upstream llvm trunk (by Chandler Carruth):

  [x86] Introduce a pass to begin more systematically fixing PR36028
  and similar issues.

  The key idea is to lower COPY nodes populating EFLAGS by scanning the
  uses of EFLAGS and introducing dedicated code to preserve the
  necessary state in a GPR. In the vast majority of cases, these uses
  are cmovCC and jCC instructions. For such cases, we can very easily
  save and restore the necessary information by simply inserting a
  setCC into a GPR where the original flags are live, and then testing
  that GPR directly to feed the cmov or conditional branch.

  However, things are a bit more tricky if arithmetic is using the
  flags.  This patch handles the vast majority of cases that seem to
  come up in practice: adc, adcx, adox, rcl, and rcr; all without
  taking advantage of partially preserved EFLAGS as LLVM doesn't
  currently model that at all.

  There are a large number of operations that techinaclly observe
  EFLAGS currently but shouldn't in this case -- they typically are
  using DF.  Currently, they will not be handled by this approach.
  However, I have never seen this issue come up in practice. It is
  already pretty rare to have these patterns come up in practical code
  with LLVM. I had to resort to writing MIR tests to cover most of the
  logic in this pass already.  I suspect even with its current amount
  of coverage of arithmetic users of EFLAGS it will be a significant
  improvement over the current use of pushf/popf. It will also produce
  substantially faster code in most of the common patterns.

  This patch also removes all of the old lowering for EFLAGS copies,
  and the hack that forced us to use a frame pointer when EFLAGS copies
  were found anywhere in a function so that the dynamic stack
  adjustment wasn't a problem. None of this is needed as we now lower
  all of these copies directly in MI and without require stack
  adjustments.

  Lots of thanks to Reid who came up with several aspects of this
  approach, and Craig who helped me work out a couple of things
  tripping me up while working on this.

  Differential Revision: https://reviews.llvm.org/D45146

Pull in r329673 from upstream llvm trunk (by Chandler Carruth):

  [x86] Model the direction flag (DF) separately from the rest of
  EFLAGS.

  This cleans up a number of operations that only claimed te use EFLAGS
  due to using DF. But no instructions which we think of us setting
  EFLAGS actually modify DF (other than things like popf) and so this
  needlessly creates uses of EFLAGS that aren't really there.

  In fact, DF is so restrictive it is pretty easy to model. Only STD,
  CLD, and the whole-flags writes (WRFLAGS and POPF) need to model
  this.

  I've also somewhat cleaned up some of the flag management instruction
  definitions to be in the correct .td file.

  Adding this extra register also uncovered a failure to use the
  correct datatype to hold X86 registers, and I've corrected that as
  necessary here.

  Differential Revision: https://reviews.llvm.org/D45154

Pull in r330264 from upstream llvm trunk (by Chandler Carruth):

  [x86] Fix PR37100 by teaching the EFLAGS copy lowering to rewrite
  uses across basic blocks in the limited cases where it is very
  straight forward to do so.

  This will also be useful for other places where we do some limited
  EFLAGS propagation across CFG edges and need to handle copy rewrites
  afterward. I think this is rapidly approaching the maximum we can and
  should be doing here. Everything else begins to require either heroic
  analysis to prove how to do PHI insertion manually, or somehow
  managing arbitrary PHI-ing of EFLAGS with general PHI insertion.
  Neither of these seem at all promising so if those cases come up,
  we'll almost certainly need to rewrite the parts of LLVM that produce
  those patterns.

  We do now require dominator trees in order to reliably diagnose
  patterns that would require PHI nodes. This is a bit unfortunate but
  it seems better than the completely mysterious crash we would get
  otherwise.

  Differential Revision: https://reviews.llvm.org/D45673

Together, these should ensure clang does not use pushf/popf sequences to
save and restore flags, avoiding problems with unrelated flags (such as
the interrupt flag) being restored unexpectedly.

Requested by:	jtl
PR:		225330
MFC after:	1 week
2018-04-20 18:20:55 +00:00
..
atf DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
clang Recommit r332501, with an additional upstream fix for "Cannot lower 2018-04-20 18:20:55 +00:00
csu lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
lib80211 DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libalias DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libarchive MFV r328323,328324: 2018-01-24 14:24:17 +00:00
libauditd DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libbegemot DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libblacklist DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libblocksruntime DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libbluetooth lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libbsdstat lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libbsm DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libbsnmp DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libbz2 DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libc Rename PROC_PDEATHSIG_SET -> PROC_PDEATHSIG_CTL and PROC_PDEATHSIG_GET 2018-04-20 15:19:27 +00:00
libc_nonshared lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libc++ DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libc++experimental DIRDEPS_BUILD: Connect more libraries. 2017-07-11 00:32:48 +00:00
libcalendar lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libcam SPDX: Small for a license ID tags. 2017-12-27 21:36:37 +00:00
libcapsicum capsicum_helpers: Add EVENT to default stdio rights set 2017-10-08 17:29:43 +00:00
libcasper The gids argument can be declared as const. 2018-03-18 19:50:32 +00:00
libclang_rt Only build tsan and tsan_cxx for amd64, as 32 bit is unsupported. 2017-12-25 13:17:29 +00:00
libcom_err DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libcompat libcompat: Use %hu for unsigned shorts. 2018-02-10 14:45:29 +00:00
libcompiler_rt The routines defined in comparedf2 and comparesf2 are defined in libc 2018-02-02 05:04:43 +00:00
libcrypt lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libcuse DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libcxxrt libcxxrt: Move mangled symbols out of extern "C++" in Version.map 2018-01-23 22:41:13 +00:00
libdevctl DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libdevdctl zfsd: Allow zfsd to work on any type of GEOM provider 2018-02-14 23:52:39 +00:00
libdevinfo Bump number that's an insane number of devices from 1,000 to 10,000. I 2017-12-21 04:21:59 +00:00
libdevstat lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libdl Add libdl to clibs package 2018-03-29 19:43:29 +00:00
libdpv Bump copyright following recent changes 2018-03-14 20:55:28 +00:00
libdwarf DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libedit libedit: sort the Makefile in line with NetBSD's version. 2018-01-29 22:38:23 +00:00
libefivar libefivar: use standard 2-Clause FreeBSD license 2018-03-02 15:12:18 +00:00
libelf DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libelftc
libevent DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libexecinfo DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libexpat DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libfetch SPDX: use the Beerware identifier. 2017-11-30 20:33:45 +00:00
libfigpar Bump copyright following recent changes 2018-03-14 20:55:28 +00:00
libgcc_eh DIRDEPS_BUILD: libgcc now depends on MK_LLVM_LIBUNWIND 2017-10-31 00:03:36 +00:00
libgcc_s Fix build by escaping a line break. 2018-01-31 21:41:42 +00:00
libgeom lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libgpio DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libgssapi lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libiconv_modules iconv: adding missing break 2018-01-21 21:09:08 +00:00
libifconfig Remove support for FDDI and token ring media types in userland utilities. 2018-04-16 18:07:51 +00:00
libipsec Update pfkey_open() function to set socket's write buffer size to 2018-03-11 19:26:34 +00:00
libipt Add new shared library -- libipt. 2018-03-21 14:37:04 +00:00
libjail If a jail parameter isn't found, try loading a related kernel module. 2018-03-21 23:50:46 +00:00
libkiconv lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libkvm lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libldns DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
liblzma DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libmagic LIB32: Avoid linking in unneeded (and invalid lib32) libz for libmagic build tool. 2018-03-09 18:51:24 +00:00
libmd libmd: Remove trailing whitespace from mdXhl.c 2018-04-17 17:23:47 +00:00
libmemstat Implement NUMA support in uma(9) and malloc(9). Allocations from specific 2018-01-12 23:25:05 +00:00
libmilter DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libmp lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libmt Add the LTO-8 Type M density code (0x5d, LTO-8M) to libmt and the 2017-11-03 21:04:22 +00:00
libnandfs lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libnetbsd libnetbsd: Make the function declaration of efopen() match the definition 2018-01-16 21:43:21 +00:00
libnetgraph s/NgSendMsgReply/NgSendReplyMsg/ in man to match the code. 2017-11-08 12:34:47 +00:00
libngatm DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libnv lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libopenbsd Fix a few more speelling errors 2017-12-28 01:31:28 +00:00
libopencsd Add new shared library -- libopencsd. 2018-04-04 14:31:56 +00:00
libopie DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libpam lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libpathconv Disconnect libpathconv tests since they require external perl and do not work with kyua. 2017-10-31 19:52:30 +00:00
libpcap DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libpe
libpjdlog lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libpmc Fix pmcstat exit from kernel introduced by r325275. 2018-01-17 16:41:22 +00:00
libpmcstat Fix bug: increment the value of pmcstat_npmcs instead of moving pointer 2018-01-16 09:31:01 +00:00
libproc Use a global extern declaration to appease gcc. 2017-12-06 17:52:01 +00:00
libprocstat lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libradius lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libregex libregex: Mark gnuext test as an expected fail 2018-01-29 14:00:33 +00:00
librpcsec_gss lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
librpcsvc spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
librss DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
librt lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
librtld_db lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libsbuf DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libsdp lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libsm
libsmb DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libsmdb
libsmutil
libsqlite3 DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libstdbuf lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libstdthreads lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libsysdecode Share Linux errno table with libsysdecode 2018-03-22 12:58:49 +00:00
libtacplus lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libtelnet Remove redundant include directories which expand to a noop, 2017-07-31 19:07:45 +00:00
libthr Ensure thread library is initialized in pthread_testcancel(). 2018-03-21 21:13:26 +00:00
libthread_db lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libucl DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libufs Don't put multiple names on a single .Nm line. This fixes apropos(1) 2018-04-17 09:05:46 +00:00
libugidfw lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libulog lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libunbound DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libusb Allow the libusb20_dev_get_port_path() function to be called when the 2018-03-23 09:40:41 +00:00
libusbhid lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libutil open.3: Use .Fa where appropriate 2018-03-04 18:00:32 +00:00
libvgl lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libvmmapi Add the ability to control the CPU topology of created VMs 2018-04-08 19:24:49 +00:00
libwrap DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libxo DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
liby General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
libypclnt lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libz DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libzstd lib(private)zstd: Fix riscv build 2018-03-18 03:42:57 +00:00
msun Replace SOFTFLOAT with __riscv_float_abi_*. 2018-04-19 20:36:15 +00:00
ncurses General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
tests
Makefile Add new shared library -- libopencsd. 2018-04-04 14:31:56 +00:00
Makefile.inc