freebsd-dev/contrib
Dimitry Andric 6a5eebc190 Apply clang fix for assertion failure building putty 0.77 on i386
Merge commit 45084eab5e63 from llvm git (by Arthur Eubanks):

  [clang] Fix some clang->llvm type cache invalidation issues

  Take the following as an example

    struct z {
      z (*p)();
    };

    z f();

  When we attempt to get the LLVM type of f, we recurse into z. z itself
  has a function pointer with the same type as f. Given the recursion,
  Clang simply treats z::p as a pointer to an empty struct `{}*`. The
  LLVM type of f is as expected. So we have two different potential
  LLVM types for a given Clang type. If we store one of those into the
  cache, when we access the cache with a different context (e.g. we
  are/aren't recursing on z) we may get an incorrect result. There is some
  attempt to clear the cache in these cases, but it doesn't seem to handle
  all cases.

  This change makes it so we only use the cache when we are not in any
  sort of function context, i.e. `noRecordsBeingLaidOut() &&
  FunctionsBeingProcessed.empty()`, which are the cases where we may
  decide to choose a different LLVM type for a given Clang type. LLVM
  types for builtin types are never recursive so they're always ok.

  This allows us to clear the type cache less often (as seen with the
  removal of one of the calls to `TypeCache.clear()`). We
  still need to clear it when we use a placeholder type then replace it
  later with the final type and other dependent types need to be
  recalculated.

  I've added a check that the cached type matches what we compute. It
  triggered in this test case without the fix. It's currently not
  check-clang clean so it's not on by default for something like expensive
  checks builds.

  This change uncovered another issue where the LLVM types for an argument
  and its local temporary don't match. For example in type-cache-3, when
  expanding z::dc's argument into a temporary alloca, we ConvertType() the
  type of z::p which is `void ({}*)*`, which doesn't match the alloca GEP
  type of `{}*`.

  No noticeable compile time changes:
  https://llvm-compile-time-tracker.com/compare.php?from=3918dd6b8acf8c5886b9921138312d1c638b2937&to=50bdec9836ed40e38ece0657f3058e730adffc4c&stat=instructions

  Fixes #53465.

  Reviewed By: rnk

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

PR:		264318
Reported by:	mandree
MFC after:	3 days
2022-05-28 23:26:37 +02:00
..
arm-optimized-routines Import Arm Optimized Routines v21.02 2021-07-06 11:05:34 +01:00
atf Import atf 0.22 snapshot 55c21b2c5fb189bbdfccb2b297bfa89236502542 2021-09-10 17:08:42 -06:00
bc contrib/bc: update to version 5.2.5 2022-05-10 15:16:19 +02:00
bearssl Merge bearssl-20220418 2022-04-18 14:52:30 -07:00
blacklist
bmake Merge bmake-20220418 2022-04-22 13:42:11 -07:00
bsddialog bsddialog(3): fix disabled shadow 2022-04-20 17:52:04 +02:00
bsnmp bsnmp: Use mkstemp when creating clients local socket 2022-03-15 08:20:13 +00:00
byacc Revert "wpa: Import wpa 2.10." 2022-01-18 08:10:33 -08:00
bzip2 Remove FREEBSD-vendor files 2021-12-06 16:36:44 -05:00
capsicum-test Re-enable network ioctls in capability mode 2021-04-23 09:22:49 -04:00
com_err
cortex-strings
dialog dialog: fix macro redefinition 2021-03-01 16:01:44 +01:00
diff Fix macro-redefined warning in gnu/diff for fputc_unlocked 2021-01-19 21:23:25 +00:00
dma dma: use canonical getline() loop 2022-02-05 21:55:03 -05:00
ee ee: restore the stdin/stdout terminal check 2021-04-12 00:48:45 +03:00
elftoolchain x86: Add a NT_X86_SEGBASES register set. 2022-03-24 11:36:19 -07:00
expat MFV 45916e7c91: libbsdxml (expat) 2.4.7 2022-03-27 22:22:07 -07:00
file file: upgrade to 5.41. 2022-01-03 22:03:39 -08:00
flex contrib/flex: Drop local __dead2 patch 2021-04-21 10:54:59 +01:00
gdtoa
googletest
hyperv/tools
jemalloc powerpc: enable initial-exec TLS 2022-02-22 19:34:28 +01:00
kyua
ldns
ldns-host
less less: upgrade to v590. 2021-07-17 22:20:44 -07:00
lib9p
libarchive libarchive: import changes from upstream 2022-04-12 20:14:04 +02:00
libbegemot
libc-pwcache
libc-vis vis(3): avoid out-of-bounds stack buffer reads 2021-06-16 16:27:13 +01:00
libcbor Import libcbor at 'contrib/libcbor/' 2021-10-06 20:26:10 -04:00
libcxxrt libcxxrt: Insert padding in __cxa_dependent_exception 2022-04-27 09:41:26 -04:00
libdivsufsort
libedit libedit: import version of 2022-04-11 2022-04-14 16:46:47 +02:00
libevent
libexecinfo
libfido2 libfido2: Address CHERI compatibility 2021-10-06 21:40:26 -04:00
libpcap
libucl Fix build post a040967612. 2021-03-22 08:42:18 -07:00
libxo
llvm-project Apply clang fix for assertion failure building putty 0.77 on i386 2022-05-28 23:26:37 +02:00
lua contrib/lua: update to 5.4.2 2021-01-13 23:56:18 -06:00
lutok
mandoc mandoc: import version 1.14.6 2021-11-15 16:58:58 +01:00
mknod
mtree fts_read: Handle error from a NULL return better. 2020-12-08 23:38:26 +00:00
ncurses ncurses: Apply a tputs() fix from patch 20210403 2021-08-11 13:08:23 -04:00
netbsd-tests sysv test: properly wait for children 2022-05-13 11:38:26 -05:00
netcat Remove FREEBSD-vendor files 2021-12-06 16:36:44 -05:00
ngatm
ntp ntp: Revert "Disable ntpd stack gap. When ASLR with STACK GAP != 0 ntpd suffers SIGSEGV." 2021-10-15 16:06:26 -07:00
nvi Allow building usr.bin/vi with MK_ASAN 2021-07-19 15:04:19 +01:00
ofed irdma: Add RDMA driver for Intel(R) Ethernet Controller E810 2022-05-23 16:52:49 -07:00
one-true-awk Awk: Add error file 2021-11-06 16:24:36 -06:00
openbsm close_range: add audit support 2021-02-23 17:47:07 +00:00
opencsd/decoder
openpam
openresolv
opie
pam_modules/pam_passwdqc
pf ftp-proxy: Revert incorrect migration to libpfctl 2021-07-01 21:34:40 +02:00
pjdfstest
pnglite pnglite: should use ntohl 2021-01-12 00:56:35 +02:00
pnpinfo
processor-trace
sendmail Update commit instructions. Still more TBD as I plan out the first 2022-01-30 22:20:12 +00:00
smbfs
sqlite3 sqlite3: Vendor import of sqlite3 3.38.5 2022-05-12 12:25:36 -07:00
tcp_wrappers tcp_wrappers: remove duplicate errno declarations 2022-02-23 16:26:14 +01:00
tcpdump pf: Introduce ridentifier 2021-11-05 09:39:56 +01:00
tcsh tcsh: update to version 6.22.04. 2021-05-20 00:12:27 +03:00
telnet telnet(1): add quiet mode ("telnet -Q") 2021-06-21 17:11:57 +01:00
terminus contrib/terminus: update to terminus-font-4.49.1 2022-02-02 15:42:18 +02:00
tnftp
traceroute
tzcode ctime.3: Add a cross-reference to clock_gettime(2) 2022-03-04 17:49:34 +01:00
tzdata contrib/tzdata: import tzdata 2022a 2022-03-17 11:30:12 +08:00
unbound unbound: Vendor import 1.15.0 2022-02-17 16:05:15 -08:00
unvis
vis Merge tag 'vendor/NetBSD/vis/20210621' into vis 2021-06-21 18:04:17 -06:00
wpa wpa: Correctly call pcap_next_ex() 2022-04-14 06:16:45 -07:00
xz