freebsd-skq/contrib
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
..
amd amd: correct formatting of 'SEE ALSO' 2018-04-14 21:54:22 +00:00
apr
apr-util
atf atf-sh(3): document atf_init_test_cases(3) fully 2017-06-30 05:49:12 +00:00
binutils Fix clang 6.0.0 compiler warnings in binutils 2017-12-24 16:51:59 +00:00
blacklist blacklist: Fix minor memory leak in configuration parsing error case 2018-03-20 00:16:24 +00:00
bmake Update to bmake-201802222 2018-03-02 01:53:50 +00:00
bsnmp Don't put multiple names on a single .Nm line. This fixes apropos(1) 2018-04-17 09:05:46 +00:00
byacc MFV: r319352 2017-05-31 19:37:23 +00:00
bzip2
com_err
compiler-rt Do not include float interfaces when using libsa. 2018-02-23 04:04:25 +00:00
cortex-strings Work around a bug in QEMU when loading data with a load pair instruction 2017-08-26 15:08:27 +00:00
dialog
diff
dma Split body of mails not respecting RFC2822 2017-12-06 22:08:35 +00:00
dtc
ee
elftoolchain elftoolchain nm(1): Initialize allocated memory before use 2018-03-16 22:25:33 +00:00
expat
file MFV r323678: file 5.32 2017-09-17 19:14:38 +00:00
flex
gcc Use a workaround to compile the crt init functions correctly with clang. 2018-02-06 17:01:10 +00:00
gcclibs
gdb Commit forgotten change in gdb allowing to use libedit 2018-02-06 12:17:03 +00:00
gdtoa
gperf
hyperv/tools hyperv: Add VF bringup scripts and devd rules. 2017-07-31 07:18:15 +00:00
ipfilter loadpoolfile() implements a -R (NORESOLVE) option which is not listed 2017-08-05 06:46:06 +00:00
jemalloc Account for the fact that jemalloc 5.0.0 dropped STATIC_PAGE_SHIFT 2018-01-31 21:56:23 +00:00
ldns
ldns-host
less MFV r329552: less v530. 2018-02-19 05:10:22 +00:00
libarchive MFV r328323,328324: 2018-01-24 14:24:17 +00:00
libbegemot
libc-pwcache
libc-vis Update vis(3) the latest from NetBSD. 2017-11-28 01:35:28 +00:00
libc++ Pull in r321963 from upstream libc++ trunk (by me): 2018-01-07 18:33:19 +00:00
libcxxrt
libdivsufsort
libexecinfo
libgnuregex
libpcap Clear clang warning: 2017-07-03 19:49:25 +00:00
libstdc++ libstdc++: fix symbol version script for LLD 2017-04-19 19:06:47 +00:00
libucl
libxo Update from libxo-0.8.1 to 0.8.4: 2017-08-03 15:47:42 +00:00
llvm Recommit r332501, with an additional upstream fix for "Cannot lower 2018-04-20 18:20:55 +00:00
lua When the LUA_FLOAT_TYPE != LUA_FLOAT_INT64, we can't reference float 2018-02-23 04:04:18 +00:00
mdocml mdoc(7): Update .Dd for previous commit 2017-12-05 23:06:15 +00:00
mknod
mtree
ncurses
netbsd-tests Fix build post r330299 2018-03-02 23:31:55 +00:00
netcat
ngatm
ntp MFV r330102: ntp 4.2.8p11 2018-02-28 07:59:55 +00:00
nvi
ofed ofed: Define barriers for mips and arm. 2017-12-11 11:59:45 +00:00
one-true-awk Don't display empty error context. 2017-09-24 05:04:06 +00:00
openbsm Commit the 64-bit inode project. 2017-05-23 09:29:05 +00:00
opencsd/decoder Import OpenCSD -- an ARM CoreSight(tm) Trace Decode Library. 2018-04-04 12:55:31 +00:00
openpam Upgrade to OpenPAM Resedacea. 2017-05-05 13:31:25 +00:00
openresolv
opie Revert r328492: 2018-01-28 03:16:54 +00:00
pam_modules/pam_passwdqc
pf
pjdfstest Pull down pjdfstest 0.1 2017-06-28 09:22:45 +00:00
pnpinfo
processor-trace Import Intel Processor Trace decoder library from 2018-03-19 18:59:15 +00:00
sendmail Don't declare union semun in userspace unless _WANT_SEMUN is defined. 2018-03-02 22:32:53 +00:00
serf
smbfs Fix SMBFS when saved passwords are greater than 18 characters 2017-06-08 00:48:26 +00:00
sqlite3 Update from sqlite3-3.14.1 to sqlite3-3.20.0. This is a private lib. 2017-08-11 00:00:01 +00:00
subversion Add Pull Request to the Subversion commit template 2018-01-09 21:02:39 +00:00
tcp_wrappers remove bogus declaration of malloc from tcp_wrappers 2017-06-20 16:40:31 +00:00
tcpdump Update tcpdump to 4.9.2 2017-12-06 02:21:11 +00:00
tcsh
telnet telnetd(8): Fix dereference of uninitialized value 'IF' 2018-03-16 20:59:56 +00:00
tnftp ftp(1): Use closefrom() instead of individual close()s. 2018-01-29 01:05:57 +00:00
top top: fix warnings from clang/gcc 2018-04-18 13:17:14 +00:00
traceroute When using SCTP for sending probe packets, use INIT chunks for payloads 2018-01-27 19:23:42 +00:00
tzcode
tzdata Import tzdata 2018d 2018-03-24 04:52:29 +00:00
unbound Merge upstream r4302 to support multiple concurrently valid anchors. 2017-08-31 12:02:14 +00:00
unvis
vis
wpa Update wpa_supplicant/hostapd for 2017-01 vulnerability release. 2017-10-17 17:22:36 +00:00
xz xz: set noexec stack flag on FreeBSD 2017-06-03 02:42:49 +00:00
zlib MFV: r323381 2017-09-10 01:25:15 +00:00