platform/upstream/llvm.git
13 months ago[AMDGPU] Remove integer division in VOPD checks
Stanislav Mekhanoshin [Sat, 10 Jun 2023 08:10:16 +0000 (01:10 -0700)]
[AMDGPU] Remove integer division in VOPD checks

There is no way any compiler can simplify this division, while
the check is done rather often.

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

13 months ago[lldb] Remove lldb's DWARFAbbreviationDeclarationSet in favor of llvm's
Alex Langford [Wed, 24 May 2023 21:08:33 +0000 (14:08 -0700)]
[lldb] Remove lldb's DWARFAbbreviationDeclarationSet in favor of llvm's

lldb's and llvm's implementations of DWARFAbbreviationDeclarationSet are
now close enough (almost the same, actually) to replace lldb's with
llvm's wholesale. llvm's is also tested against the same kinds of
scenarios that lldb's is tested against so we can remove lldb's tests
here. (see: llvm/unittests/DebugInfo/DWARF/DWARFDebugAbbrevTest.cpp).

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

13 months agoSpeculative fix for windows test
Adrian Prantl [Mon, 12 Jun 2023 21:51:10 +0000 (14:51 -0700)]
Speculative fix for windows test

13 months ago[mlir][sparse][gpu] fixed whitespace in tbgen
Aart Bik [Mon, 12 Jun 2023 18:50:48 +0000 (11:50 -0700)]
[mlir][sparse][gpu] fixed whitespace in tbgen

Reviewed By: K-Wu

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

13 months agoCodeGen: hand two tests to the care of update_cc_test_checks
Augie Fackler [Wed, 5 Apr 2023 22:03:14 +0000 (18:03 -0400)]
CodeGen: hand two tests to the care of update_cc_test_checks

These two tests were pretty challenging to manage by hand, and in
rebasing the next change in my stack I finally ran out of patience and
decided to just embrace automation. This change _only_ changes the tests
so that it's obvious what's new in the next change.

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

13 months ago[Sanitizer] Add munmap interceptor in sanitizer_common
Kirill Stoimenov [Sat, 10 Jun 2023 00:07:53 +0000 (00:07 +0000)]
[Sanitizer] Add munmap interceptor in sanitizer_common

Reviewed By: vitalybuka

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

13 months ago[NFC][SLP] Fix a few minor formatting issues
Ivan Kelarev [Mon, 12 Jun 2023 21:21:43 +0000 (14:21 -0700)]
[NFC][SLP] Fix a few minor formatting issues

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

13 months ago[sanitizer][test] Remove no-op REQUIRES:
Fangrui Song [Mon, 12 Jun 2023 21:15:03 +0000 (14:15 -0700)]
[sanitizer][test] Remove no-op REQUIRES:

Some patches around D109843 added `REQUIRES: freebsd` but they have no effects
due to sanitizer_common/TestCases/Linux/lit.local.cfg.py . I informed the author
but don't plan to move the tests.

13 months ago[RDF] Allow RegisterRef to contain register unit
Krzysztof Parzyszek [Thu, 1 Jun 2023 19:00:47 +0000 (12:00 -0700)]
[RDF] Allow RegisterRef to contain register unit

Recommit with the fix for incorrect `constexpr` with `hash` from a later
commit, and a fix for "std::swap(std::less<RegisterRef>...)" issue with
MSVC's `std::map`.

13 months ago[bazel] Repair clang_headers_gen when run on macOS.
James Knight [Mon, 12 Jun 2023 20:05:35 +0000 (16:05 -0400)]
[bazel] Repair clang_headers_gen when run on macOS.

The antique version of bash (3.2.57, from 2007) which is available on
macOS cannot deal with quoted slashes in a `${x/...}`
substitution. Since only prefix-removal is required here, switch to a
`${x#...}` substitution instead.

(E.g. `src="foo/bar/baz.h"; echo ${src/"foo/bar"}` echos `bar/bar/baz.h`
instead of `/baz.h` on old bash versions).

Originally broken by 459420c33a2c80525bc73ad1ff89fdf4dd079d6c.
Fixes #63222

13 months ago[RISCV] Use TU vmv.v.v instead of vslideup.vi N,M,0 for insert vector_shuffles
Luke Lau [Mon, 12 Jun 2023 16:12:28 +0000 (16:12 +0000)]
[RISCV] Use TU vmv.v.v instead of vslideup.vi N,M,0 for insert vector_shuffles

This applies the same technique in https://reviews.llvm.org/D152565 to
vslideups when lowering vector_shuffles that have an insert pattern in
their mask.

Reviewed By: reames

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

13 months ago[libc] Fix floating point test failing to build on the GPU
Joseph Huber [Mon, 12 Jun 2023 19:17:56 +0000 (14:17 -0500)]
[libc] Fix floating point test failing to build on the GPU

A patch enabled this test which uses that `add_fp_unittest`.
Unfortunately we do not support these on the GPU because it attempts to
link in the floating point utils which are not built supporting
hermetic tests. This was attempted to be fixed in D151123 but that had
to be reverted. For now disable these so the tests pass.

Reviewed By: tra

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

13 months ago[docs] Improve UndefinedBehaviorSanitizer.rst
Fangrui Song [Mon, 12 Jun 2023 20:04:29 +0000 (13:04 -0700)]
[docs] Improve UndefinedBehaviorSanitizer.rst

* Mention that -fsanitize= and -fno-sanitize= apply to check groups.
* Mention "all" can be used as a check group.
* Mention that -fsanitize-trap= and -fsanitize-recover= lead to no unused command line option warning.
* Mention that trap mode typically causes the program to terminate due to a `SIGILL` or `SIGTRAP` signal.

Reviewed By: #sanitizers, vitalybuka

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

13 months ago[Driver] Mark m_x86_Features_Group options as TargetSpecific
Fangrui Song [Mon, 12 Jun 2023 19:47:33 +0000 (12:47 -0700)]
[Driver] Mark m_x86_Features_Group options as TargetSpecific

so that they get an error on non-x86 targets.
Follow-up to D151590.

As a workaround for https://github.com/llvm/llvm-project/issues/63270, we don't
report an error for -msse4.2.

13 months ago[KCFI] Fix hash offset calculation in Thumb mode
Sami Tolvanen [Mon, 12 Jun 2023 16:24:54 +0000 (16:24 +0000)]
[KCFI] Fix hash offset calculation in Thumb mode

ARM stores the Thumb state in the least significant bit of the
function pointers. When compiling for ARM or Thumb, as all
instructions are at least 16-bit aligned, ignore the LSB when
computing the prefix hash location, so we can support both
pure Thumb and mixed ARM/Thumb binaries.

Fixes #62936

Reviewed By: MaskRay, simon_tatham

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

13 months ago[libc++][NFC] Refactor filesystem namespace test
Louis Dionne [Mon, 12 Jun 2023 19:43:04 +0000 (12:43 -0700)]
[libc++][NFC] Refactor filesystem namespace test

13 months ago[Driver] Mark many target-specific driver-only options as TargetSpecific
Fangrui Song [Mon, 12 Jun 2023 19:34:08 +0000 (12:34 -0700)]
[Driver] Mark many target-specific driver-only options as TargetSpecific

so that they get an error on other targets. This change uses let statements to
apply `Flags = [TargetSpecific]` to options (mostly -m*) without specifying `Flags`.
Follow-up to D151590.

For some options, e.g. -mdefault-build-attributes (D31813), -mbranch-likely
(D38168), -mfpu=/-mabi= (6890b9b71e525020ab58d436336664beede71575), a warning
seems desired in at least certain cases. This is not the best practice, but this
change works around them by not applying `Flags = [TargetSpecific]`.

Some m_x86_Features_Group options are popular. We make them TargetSpecific in a
future patch.

(
For Intel CPU errata -malign-branch= family options, we also drop the unneeded
NotXarchOption flag (was confuslingly named DriverOption). This flag reports an
error if the option is used with -Xarch_*. This error reporting does not seem
correct/useful.
)

13 months ago[libc++][spaceship] P1614R2: Removed `operator!=` from `weekday`s
Hristo Hristov [Mon, 12 Jun 2023 11:29:12 +0000 (14:29 +0300)]
[libc++][spaceship] P1614R2: Removed `operator!=` from `weekday`s

Implements parts of P1614R2. Removed `operator!=` from:
- `weekday`
- `weekday_indexed`
- `weekday_last`
- `month_weekday`
- `month_weekday_last`
- `year_month_weekday`
- `year_month_weekday_last`

Note these operators were added and removed in C++20.

Reviewed By: #libc, Mordante

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

13 months ago[RISCV] Fix an unused variable warning
Kazu Hirata [Mon, 12 Jun 2023 19:21:05 +0000 (12:21 -0700)]
[RISCV] Fix an unused variable warning

This patch fixes:

  llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp:3214:12: error: unused
  variable 'TSFlags' [-Werror,-Wunused-variable]

13 months ago[RISCV] Remove HasDummyMask from tablegen files.
Craig Topper [Mon, 12 Jun 2023 18:57:44 +0000 (11:57 -0700)]
[RISCV] Remove HasDummyMask from tablegen files.

This isn't needed after D152050.

Reviewed By: reames

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

13 months ago[RISCV] Begin removing hasDummyMask.
Craig Topper [Mon, 12 Jun 2023 18:57:40 +0000 (11:57 -0700)]
[RISCV] Begin removing hasDummyMask.

This was used to know if we need to insert a dummy operand during
MCInstLowering. We can use the operand info from MCInstrDesc to
figure this out without needing a separate flag.

I'll remove the tablegen bits if there is consensus this is a good
idea.

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

13 months ago[InstCombine] Factor out power of 2 comparison patterns to helper; NFC
Noah Goldstein [Mon, 12 Jun 2023 18:18:31 +0000 (13:18 -0500)]
[InstCombine] Factor out power of 2 comparison patterns to helper; NFC

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

13 months ago[DAGCombine] Use `IsKnownNeverZero` to see if we need zero-check in is_pow2 setcc...
Noah Goldstein [Mon, 12 Jun 2023 18:17:27 +0000 (13:17 -0500)]
[DAGCombine] Use `IsKnownNeverZero` to see if we need zero-check in is_pow2 setcc patern

`ctpop(X) eq/ne 1` is checking if X is a non-zero power of 2. Power of
2 check including zero is `(X & (X-1)) eq/ne 0` and unfortunately
there is no good pattern for checking a power of 2 while excluding
zero. So, when lowering `ctpop(X) eq/ne 1`, explicitly check
`IsKnownNeverZero(X)` to maybe be able to optimize out the extra zero
check.

We need this explicitly as DAGCombiner does not re-analyze provable
setcc nodes, and the middle-end never finds it beneficially to broaden
`ctpop(X) eq/ne 1` -> `ctpop(X) ule/ugt 1` (power of 2 including
zero).

Reviewed By: RKSimon

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

13 months ago[X86] Add tests for optimizing out zero-check in is_pow2 setcc pattern; NFC
Noah Goldstein [Mon, 12 Jun 2023 03:25:58 +0000 (22:25 -0500)]
[X86] Add tests for optimizing out zero-check in is_pow2 setcc pattern; NFC

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

13 months ago[CMake] Remove unused COMPILER_RT_HAS_MSSE3_FLAG and COMPILER_RT_HAS_WNON_VIRTUAL_DTO...
Fangrui Song [Mon, 12 Jun 2023 18:38:29 +0000 (11:38 -0700)]
[CMake] Remove unused COMPILER_RT_HAS_MSSE3_FLAG and COMPILER_RT_HAS_WNON_VIRTUAL_DTOR_FLAG

D106948 and commit 9c31e12609e1935eb84a2497ac08a49e3139859a removed the last
user, respectively.

13 months ago[clang][dataflow] Support limits on the SAT solver to force timeouts.
Yitzhak Mandelbaum [Mon, 12 Jun 2023 17:38:31 +0000 (17:38 +0000)]
[clang][dataflow] Support limits on the SAT solver to force timeouts.

This patch allows the client of a `WatchedLiteralsSolver` to specify a
computation limit on the use of the solver. After the limit is exhausted, the
SAT solver times out.

Fixes issues #60265.

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

13 months ago[lldb][test] incomplete-tag-type.cpp: fix expected error message
Michael Buch [Mon, 12 Jun 2023 18:31:24 +0000 (19:31 +0100)]
[lldb][test] incomplete-tag-type.cpp: fix expected error message

Follow up to 133c3eaac0a532380c3d6ad21a60da1490f51fb8

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

13 months agosanitizers: enable pthread_getaffinity_np interception on freebsd.
David Carlier [Mon, 12 Jun 2023 18:25:43 +0000 (19:25 +0100)]
sanitizers: enable pthread_getaffinity_np interception on freebsd.

Reviewers: mevler

Reviewed-By: mevler
Differential Revision: https://reviews.llvm.org/D152735

13 months ago[RISCV] Fold binary op into select if profitable.
Mikhail Gudim [Mon, 12 Jun 2023 15:15:15 +0000 (11:15 -0400)]
[RISCV] Fold binary op into select if profitable.

Consider the following pattern `binOp (select cond, x, c0), c1`.
Where `c0` and `c1` are constants.
We can transform it to `select cond, binOp(x, c1), binOp(c0, c1)`.

If `binOp(c0, c1)` ends up being `0` or `-1` we can turn the select into
a more profitable sequence.

13 months ago[libc][docs] Add undefined behavior doc to site
Michael Jones [Fri, 9 Jun 2023 22:12:25 +0000 (15:12 -0700)]
[libc][docs] Add undefined behavior doc to site

This document is based on the RFC posted to discourse:
https://discourse.llvm.org/t/rfc-defining-undefined-behavior-in-libc/

Reviewed By: sivachandra, lntue

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

13 months ago[libc] Add qsort_r
Michael Jones [Thu, 8 Jun 2023 21:04:55 +0000 (14:04 -0700)]
[libc] Add qsort_r

This patch adds the reentrent qsort entrypoint, qsort_r. This is done by
extending the qsort functionality and moving it to a shared utility
header. For this reason the qsort_r tests focus mostly on the places
where it differs from qsort, since they share the same sorting code.

Reviewed By: sivachandra, lntue

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

13 months agoRevert "[SCCP] Replace new value's value state with removed value's"
Vitaly Buka [Mon, 12 Jun 2023 18:03:09 +0000 (11:03 -0700)]
Revert "[SCCP] Replace new value's value state with removed value's"

Breaks all sanitizers bootstrap bots:
https://lab.llvm.org/buildbot/#/waterfall?tags=sanitizer

This reverts commit cf79773a9006a7e22f3919268b7db381ddcb3abc.

13 months ago[flang][openacc] Add parser support for the force modifier in the collapse clause
Valentin Clement [Mon, 12 Jun 2023 17:59:05 +0000 (10:59 -0700)]
[flang][openacc] Add parser support for the force modifier in the collapse clause

This patch adds parser support for the force modifier on the collapse clause
introduced in OpenACC 3.3.
Lowering will currently hit a TODO as the MLIR representation of the acc.loop
might need some update.

Reviewed By: kiranchandramohan

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

13 months ago[test][HWASAN] Trim leading zeros from hex value
Vitaly Buka [Mon, 12 Jun 2023 17:58:03 +0000 (10:58 -0700)]
[test][HWASAN] Trim leading zeros from hex value

Match like [[#T2]] does not include leading zeroes.

13 months ago[BOLT] Fix handling of code references from unmodified code
Maksim Panchenko [Wed, 7 Jun 2023 01:25:46 +0000 (18:25 -0700)]
[BOLT] Fix handling of code references from unmodified code

In lite mode (default for X86), BOLT optimizes and relocates functions
with profile. The rest of the code is preserved, but if it references
relocated code such references have to be updated. The update is handled
by scanExternalRefs() function. Note that we cannot solely rely on
relocations written by the linker, as not all code references are
exposed to the linker. Additionally, the linker can modify certain
instructions and relocations will no longer match the code.

With this change, start using symbolic disassembler for scanning code
for references in scanExternalRefs(). Unlike the previous approach, the
symbolizer properly detects and creates references for instructions with
multiple/ambiguous symbolic operands and handles cases where a
relocation doesn't match any operand. See test cases for examples.

Reviewed By: Amir

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

13 months ago[RDF] Stop looking when reached code node in getNextRef with NextOnly
Krzysztof Parzyszek [Tue, 6 Jun 2023 19:14:49 +0000 (12:14 -0700)]
[RDF] Stop looking when reached code node in getNextRef with NextOnly

NextOnly tells getNextRef to only check the next node in the chain, and
stop iterating. The loop didn't stop though when the next link pointed
back to the beginning of the circular list.

Recommit this one right now, because it fixes a latent bug.

13 months ago[gn build] Port 11e5a0d290ba
LLVM GN Syncbot [Mon, 12 Jun 2023 17:33:51 +0000 (17:33 +0000)]
[gn build] Port 11e5a0d290ba

13 months agoStreamline expression parser error messages.
Adrian Prantl [Fri, 9 Jun 2023 22:29:28 +0000 (15:29 -0700)]
Streamline expression parser error messages.

Currently the expression parser prints a mostly useless generic error before printing the compiler error:

  (lldb) p 1+x)
  error: expression failed to parse:
  error: <user expression 18>:1:3: use of undeclared identifier 'x'
  1+x)
     ^

This is distracting and as far as I can tell only exists to work
around the fact that the first "error: " is unconditionally injected
by CommandReturnObject. The solution is not very elegant, but the
result looks much better.

(Partially addresses rdar://110492710)

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

13 months ago[RISCV] Use tail undisturbed vmv.v.v instead of vadd.vi with 0 for vp.merge with...
Craig Topper [Mon, 12 Jun 2023 17:27:08 +0000 (10:27 -0700)]
[RISCV] Use tail undisturbed vmv.v.v instead of vadd.vi with 0 for vp.merge with all ones mask.

No idea what I was thinking when I suggested vadd.vi.

Reviewed By: reames, frasercrmck, fakepaper56

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

13 months ago[dsymutil] Use a regex in the static-archive-collision.test
Jonas Devlieghere [Mon, 12 Jun 2023 17:21:07 +0000 (10:21 -0700)]
[dsymutil] Use a regex in the static-archive-collision.test

Windows and Unix use different epochs: 1970-01-01 00:00:00.000000000 and
1969-12-31 16:00:00.000000000 respectively.

13 months ago[AMDGPU] Add basic support for gfx11xx
Giuseppe Rossini [Mon, 12 Jun 2023 16:56:08 +0000 (16:56 +0000)]
[AMDGPU] Add basic support for gfx11xx

This patch fixes a minor issue in AMDGPUToROCDL to add gfx11 support in MLIR

Reviewed By: krzysz00

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

13 months ago[RISCV] Use tail undisturbed vmv.v.v instead of vslideup.vi vN, vM, 0 for subvector...
Craig Topper [Mon, 12 Jun 2023 17:01:34 +0000 (10:01 -0700)]
[RISCV] Use tail undisturbed vmv.v.v instead of vslideup.vi vN, vM, 0 for subvector insertion

vslideup has a vector overlap constraint that vmv.v.v doesn't.
vmv.v.v is also a simpler instruction so may have better
throughput and/or latency in some CPUs.

This is an alternative to D152298, D152368, and D152496.

Reviewed By: luke, reames

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

13 months ago[dsymutil] Skip duplicates files with identical time stamps in the debug map
Jonas Devlieghere [Mon, 12 Jun 2023 16:57:01 +0000 (09:57 -0700)]
[dsymutil] Skip duplicates files with identical time stamps in the debug map

Static archives can contain multiple files with the same file name, in
which case the timestamp is used to disambiguate. Because timestamps are
expressed in seconds since epoch timestamp collisions are far from
impossible. Furthermore, to facilitate reproducible builds, the static
linker can be told to emit no timestamps at all.

dsymutil already detects timestamp mismatches between the debug map and
the object files. However, it does not handle timestamp collisions
within the debug maps (STABS). Currently, we arbitrarily pick the first
debug map entry and ignore the rest. This is incorrect: if a symbol
exists in multiple object files, the linker might not have picked the
one from the first object file. This also results in missing symbol
warnings for all the symbols not defined in the first object file.

Given that in this scenario, dsymutil does not have enough information
to disambiguate, it should print a single informative warning and skip
the ambiguous debug map objects.

rdar://110374836

Differential revision: https://reviews.llvm.org/D152585

13 months ago[libc] Fix argument types for {f,}truncate specs
Alfred Persson Forsberg [Mon, 12 Jun 2023 16:58:29 +0000 (17:58 +0100)]
[libc] Fix argument types for {f,}truncate specs

The current argument types are currently switched around for ftruncate
and truncate. Currently passes tests because the internal definitions
inside the __llvm_libc namespace are fine.

Reviewed By: michaelrj, thesamesam, sivachandra

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

13 months ago[libc++][format] Make public functions nodiscard.
Mark de Wever [Sun, 4 Jun 2023 12:37:20 +0000 (14:37 +0200)]
[libc++][format] Make public functions nodiscard.

This is an extension and only adds the functions that are a considered a
but when called and ignoring the result.

Drive-by sort all nodiscard extensions in the documentation.

Reviewed By: #libc, philnik

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

13 months ago[BOLT][NFC] Const-ify getDynamicRelocationAt
Amir Ayupov [Mon, 12 Jun 2023 16:54:42 +0000 (09:54 -0700)]
[BOLT][NFC] Const-ify getDynamicRelocationAt

Reviewed By: #bolt, maksfb

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

13 months ago[libc++][spaceship] P1614R2: Added `operator==` to `file_status`
Hristo Hristov [Sun, 11 Jun 2023 07:54:14 +0000 (10:54 +0300)]
[libc++][spaceship] P1614R2: Added `operator==` to `file_status`

Implemented parts of P1614R2:
- Added `operator==` to `file_status`

Reviewed By: #libc, Mordante

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

13 months ago[RISCV] Don't use (ADD (SLLI C, 32), C) to materialize constants when optimizing...
Craig Topper [Mon, 12 Jun 2023 16:52:35 +0000 (09:52 -0700)]
[RISCV] Don't use (ADD (SLLI C, 32), C) to materialize constants when optimizing for size.

Addresses post-commit feedback from D152236.

Reviewed By: asb, dtcxzyw

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

13 months ago[libc++][spaceship] P1614R2: Removed `operator!=` from `scoped_allocator_adaptor`
Hristo Hristov [Mon, 12 Jun 2023 06:56:15 +0000 (09:56 +0300)]
[libc++][spaceship] P1614R2: Removed `operator!=` from `scoped_allocator_adaptor`

Implements parts of P1614R2
- Removed `operator!=` from `scoped_allocator_adaptor`

Reviewed By: #libc, Mordante

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

13 months ago[libc++][spaceship] P1614R2: Removed `operator!=` from `functional`
Hristo Hristov [Mon, 12 Jun 2023 12:17:02 +0000 (15:17 +0300)]
[libc++][spaceship] P1614R2: Removed `operator!=` from `functional`

Implements parts of P1614R2:
- Removed `operator!=` from `functional`

Reviewed By: #libc, Mordante

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

13 months ago[DebugMetadata] Simplify handling subprogram's retainedNodes field. NFCI (1/7)
Vladislav Dzhidzhoev [Mon, 12 Jun 2023 14:01:18 +0000 (16:01 +0200)]
[DebugMetadata] Simplify handling subprogram's retainedNodes field. NFCI (1/7)

RFC https://discourse.llvm.org/t/rfc-dwarfdebug-fix-and-improve-handling-imported-entities-types-and-static-local-in-subprogram-and-lexical-block-scopes/68544

Currently, `retainedNodes` tracks function-local variables and labels.
To support function-local import, types and static variables (which are globals
in LLVM IR), subsequent patches use the same field. So this patch makes
preliminary refactoring of the code tracking local entities to apply future
functional changes lucidly and cleanly.

No functional changes intended.

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

Authored-by: Kristina Bessonova <kbessonova@accesssoftek.com>
13 months ago[RISCV] Merge RISCVMCInstLower.cpp into RISCVAsmPrinter.cpp.
Craig Topper [Mon, 12 Jun 2023 16:36:57 +0000 (09:36 -0700)]
[RISCV] Merge RISCVMCInstLower.cpp into RISCVAsmPrinter.cpp.

The separation here doesn't make much sense. I think it's a
leftover from the creation of the MC layer that has been
replicated to new targets.

By merging them we can avoid passing the AsmPrinter to the
MCInstLowering functions. We can make them member functions instead.

I think we can still do more integration of lowerSymbolOperand
and lowerRISCVVMachineInstrToMCInst, but I wanted to get feedback
on the direction first.

Reviewed By: asb, barannikov88

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

13 months ago[mlir][sparse] add support for direct prod/and/min/max reductions
Aart Bik [Fri, 9 Jun 2023 19:48:45 +0000 (12:48 -0700)]
[mlir][sparse] add support for direct prod/and/min/max reductions

We recently fixed a bug in "sparsifying" such reductions, since
it incorrectly changed this into reductions over stored elements
only , which only works for add/sub/or/xor. However, we still want
to be able to "sparsify" the reductions even in the general case,
and this is a first step by rewriting them into a custom reduction
that feeds in the implicit zeros. NOTE HOWEVER, that in the long run
we want to do this better and feed in any implicit zero only ONCE
for efficiency.

Reviewed By: Peiming

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

13 months ago[SelectionDAG][AArch64] Legalize FMAXIMUM/FMINIMUM
Anna Thomas [Mon, 12 Jun 2023 15:55:05 +0000 (11:55 -0400)]
[SelectionDAG][AArch64] Legalize FMAXIMUM/FMINIMUM

The missing legalization in SelectionDAG was identified when adding the
intrinsic support for vector reduction for maximum/minimum (D152370).

Fixes part of PR: https://github.com/llvm/llvm-project/issues/63267

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

13 months ago[DebugInfo] Add DW_ATE_complex_float case to assert in isUnsignedDIType
OCHyams [Mon, 12 Jun 2023 16:06:50 +0000 (17:06 +0100)]
[DebugInfo] Add DW_ATE_complex_float case to assert in isUnsignedDIType

Without this patch a `DW_ATE_complex_float` encoding trips an assertion in
`DebugHandlerBase::isUnsignedDIType` with the message `"Unsupported
encoding"`.

By adding a case to the `assert` for `DW_ATE_complex_float` it becomes
supported, behaving in the same way as the already supported `DW_ATE_float`
type (return false).

Note: For the reported reproducer:

    #include <complex.h>
    int main() {
      long double complex r1;
    }

The assertion isn't tripped without assignment tracking because instcombine
deletes everything, including the `dbg.declare`, without recovering any
location information. Whereas with assignment tracking we track a zeroing
memset that is emitted by clang.

Reviewed By: probinson

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

13 months ago[ConstraintElim] Extend monotonic phi test coverage.
Florian Hahn [Mon, 12 Jun 2023 16:07:01 +0000 (17:07 +0100)]
[ConstraintElim] Extend monotonic phi test coverage.

Add additional tests which exposed some crashes in upcoming patches and
test for and-implied-by-operands handling.

13 months agoRevert "[RDF] Allow RegisterRef to contain register unit" and follow-ups
Nico Weber [Mon, 12 Jun 2023 15:32:29 +0000 (11:32 -0400)]
Revert "[RDF] Allow RegisterRef to contain register unit" and follow-ups

This reverts commit 859b05b02d3fd9ab6b77f2bed8df6902fe704806.

Also reverts these follow-ups:

Revert "[RDF] Remove `constexpr` from `hash"
This reverts commit 621507ce20ad8eef2986be2712631165e53b7d91.

Revert "[RDF] Do not use trailing return type after all, NFC"
This reverts commit 46e19e3a2c45e7fb5f501bdb983a7151c158304f.

Revert "[RDF] Stop looking when reached code node in getNextRef with NextOnly"
This reverts commit a049ce9d1bd5a7c1c4fcccc6a801b72b00ea8e0f.

Revert "[RDF] Use trailing return type syntax, NFC"
This reverts commit d3b34b7f3a7cbfc96aea897419f167b5ee19e61a.

Revert "[RDF] Define short type names: NodeAddr<XyzNode*> -> Xyz, NFC"
This reverts commit f8ed60b56d1948422dda924fcf450560591e8a19.

13 months agoRevert "[Driver] Mark many target-specific driver-only options as TargetSpecific"
Hans Wennborg [Mon, 12 Jun 2023 15:02:37 +0000 (17:02 +0200)]
Revert "[Driver] Mark many target-specific driver-only options as TargetSpecific"

This broke building the TSan runtime on Mac, see comment on
https://github.com/llvm/llvm-project/commit/5548843d692a92a7840f14002debc3cebcb3cdc3

> so that they get an error on other targets. This change uses let statements to
> apply `Flags = [TargetSpecific]` to options (mostly -m*) without specifying `Flags`.
> Follow-up to D151590.
>
> For some options, e.g. -mdefault-build-attributes (D31813), -mbranch-likely
> (D38168), -mfpu=/-mabi= (6890b9b71e525020ab58d436336664beede71575), a warning
> seems desired in at least certain cases. This is not the best practice, but this
> change works around them by not applying `Flags = [TargetSpecific]`.
>
> (
> For Intel CPU errata -malign-branch= family options, we also drop the unneeded
> NotXarchOption flag. This flag reports an error if the option is used with
> -Xarch_*. This error reporting does not seem very useful.
> )

This reverts commit 5548843d692a92a7840f14002debc3cebcb3cdc3.

13 months ago[test][ASAN] Fix incorrect REQUIRES directive for scandir.c
Justin Cady [Mon, 12 Jun 2023 14:58:38 +0000 (10:58 -0400)]
[test][ASAN] Fix incorrect REQUIRES directive for scandir.c

The missing colon caused the test to run on unintended platforms.

Reviewed By: emaste

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

13 months ago[FlowSensitive] Use {DenseMapBase,StringMap}::lookup (NFC)
Kazu Hirata [Mon, 12 Jun 2023 15:11:01 +0000 (08:11 -0700)]
[FlowSensitive] Use {DenseMapBase,StringMap}::lookup (NFC)

13 months ago[IR] Remove getABITypeAlignment
Kazu Hirata [Mon, 12 Jun 2023 15:10:59 +0000 (08:10 -0700)]
[IR] Remove getABITypeAlignment

The last use of getABITypeAlignment was removed by:

  commit 26bd6476c61f08fc8c01895caa02b938d6a37221
  Author: Guillaume Chatelet <gchatelet@google.com>
  Date:   Fri Jan 13 15:05:24 2023 +0000

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

13 months ago[AMDGPU] Fix resource-usage-pal.ll
Kazu Hirata [Mon, 12 Jun 2023 15:06:46 +0000 (08:06 -0700)]
[AMDGPU] Fix resource-usage-pal.ll

13 months ago[OpenMP][OMPIRBuilder] Migrate emitOffloadingArrays and EmitNonContiguousDescriptor...
Akash Banerjee [Mon, 12 Jun 2023 14:00:17 +0000 (15:00 +0100)]
[OpenMP][OMPIRBuilder] Migrate emitOffloadingArrays and EmitNonContiguousDescriptor from Clang

This patch migrates the emitOffloadingArrays and EmitNonContiguousDescriptor functions from Clang codegen to OpenMPIRBuilder.

Reviewed By: jdoerfert

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

13 months agoRemove unused variable 's32' in X86LegalizerInfo.cpp (NFC)
Jie Fu [Mon, 12 Jun 2023 14:34:08 +0000 (22:34 +0800)]
Remove unused variable 's32' in X86LegalizerInfo.cpp (NFC)

/data/llvm-project/llvm/lib/Target/X86/X86LegalizerInfo.cpp:470:13: error: unused variable 's32' [-Werror,-Wunused-variable]
  const LLT s32 = LLT::scalar(32);
            ^
1 error generated.

13 months ago[GlobalIsel][X86] Move G_SITOFP/G_FPTOSI getActionDefinitionsBuilder out of setLegali...
Simon Pilgrim [Mon, 12 Jun 2023 14:26:05 +0000 (15:26 +0100)]
[GlobalIsel][X86] Move G_SITOFP/G_FPTOSI getActionDefinitionsBuilder out of setLegalizerInfo64bit and add basic 32-bit support

We were using x86_64-only support as a SSE2 proxy - vector support is still missing.

13 months ago[mlir][linalg] Add scalar broadcast load case to the vectoriser
Andrzej Warzynski [Fri, 2 Jun 2023 07:45:16 +0000 (08:45 +0100)]
[mlir][linalg] Add scalar broadcast load case to the vectoriser

This patch extends the Linalg vectoriser so that scalar loads are
correctly identified as scalar rather than gather loads. Below is an
example of a scalar load (note that both indices are loop invariant):
```
func.func @example(%arg0: tensor<80x16xf32>, %arg2: tensor<1x4xf32>) -> tensor<1x4xf32> {
%c8 = arith.constant 8 : index
%c16 = arith.constant 16 : index
%1 = linalg.generic {
    indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>],
    iterator_types = ["parallel", "parallel"]
  } outs(%arg2 : tensor<1x4xf32>) {
  ^bb0(%out: f32):
    %2 = linalg.index 0 : index
    %extracted = tensor.extract %arg0[%2, %c16] : tensor<80x16xf32>
    linalg.yield %extracted : f32
  } -> tensor<1x4xf32>
  return %1 : tensor<1x4xf32>
}
```

This patch also makes sure that these scalar loads are indeed lowered to
a scalar load followed by a broadcast:
```
    %extracted = tensor.extract %arg0[%1, %c16] : tensor<80x16xf32>
    %2 = vector.broadcast %extracted : f32 to vector<1x4xf32>
```

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

13 months ago[AMDGPU] Do not assume stack size for PAL code object indirect calls
Baptiste [Mon, 12 Jun 2023 14:12:54 +0000 (10:12 -0400)]
[AMDGPU] Do not assume stack size for PAL code object indirect calls

There is no need to set a big default stack size for PAL code object indirect
calls. The driver knows the max recursion depth, so it can compute a more
accurate value from the minimum scratch size.

Reviewed By: arsenm

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

13 months ago[gn] Mac support for check-asan target
Leonard Grey [Fri, 9 Jun 2023 22:04:48 +0000 (18:04 -0400)]
[gn] Mac support for check-asan target

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

13 months ago[libc] Improve memcmp latency and codegen
Guillaume Chatelet [Mon, 12 Jun 2023 13:30:50 +0000 (13:30 +0000)]
[libc] Improve memcmp latency and codegen

This is based on ideas from @nafi to:
 - use a branchless version of 'cmp' for 'uint32_t',
 - completely resolve the lexicographic comparison through vector
   operations when wide types are available. We also get rid of byte
   reloads and serializing '__builtin_ctzll'.

I did not include the suggestion to replace comparisons of 'uint16_t'
with two 'uint8_t' as it did not seem to help the codegen. This can
be revisited in sub-sequent patches.

The code been rewritten to reduce nested function calls, making the
job of the inliner easier and preventing harmful code duplication.

Reviewed By: nafi3000

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

13 months ago[clang][tests] Replace a %clang++ with %clang
Timm Bäder [Mon, 12 Jun 2023 13:41:34 +0000 (15:41 +0200)]
[clang][tests] Replace a %clang++ with %clang

%clang++ does not work on windows, see e.g.:

https://lab.llvm.org/staging/#/builders/204/builds/2141

13 months ago[MC][MachO]Do not emit DWARF for no-personality case
oontvoo [Mon, 12 Jun 2023 12:16:08 +0000 (08:16 -0400)]
[MC][MachO]Do not emit DWARF for no-personality case

Detail: Follow up to D144999, where we emitted DWARF for non-canonical personality.

Reviewed By: jyknight

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

13 months ago[libc] Add platform independent floating point rounding mode checks.
Tue Ly [Tue, 6 Jun 2023 15:50:26 +0000 (11:50 -0400)]
[libc] Add platform independent floating point rounding mode checks.

Many math functions need to check for floating point rounding modes to
return correct values.  Currently most of them use the internal implementation
of `fegetround`, which is platform-dependent and blocking math functions to be
enabled on platforms with unimplemented `fegetround`.  In this change, we add
platform independent rounding mode checks and switching math functions to use
them instead. https://github.com/llvm/llvm-project/issues/63016

Reviewed By: sivachandra

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

13 months ago[GVN] Fix verifyRemoved() verification
Nikita Popov [Mon, 12 Jun 2023 13:14:27 +0000 (15:14 +0200)]
[GVN] Fix verifyRemoved() verification

Fix the verification failure reported in
https://reviews.llvm.org/D141712#4413647. We need to remove the
load from the VN table as well, not just the leader table.

Also make sure that this verification always runs when assertions
are enabled, rather than only when -debug is passed.

13 months ago[LoopVectorize] Convert test to opaque pointers (NFC)
Nikita Popov [Mon, 12 Jun 2023 12:49:02 +0000 (14:49 +0200)]
[LoopVectorize] Convert test to opaque pointers (NFC)

I'm keeping the bitcast in the input here, because without it
we end up introducing a stride 1 assumption and end up testing
a different case.

13 months ago[LoopVectorize] Convert test to opaque pointers (NFC)
Nikita Popov [Mon, 12 Jun 2023 12:29:52 +0000 (14:29 +0200)]
[LoopVectorize] Convert test to opaque pointers (NFC)

13 months ago[LoopVectorize] Regenerate test checks (NFC)
Nikita Popov [Mon, 12 Jun 2023 12:29:31 +0000 (14:29 +0200)]
[LoopVectorize] Regenerate test checks (NFC)

13 months ago[clang-tidy] run-clang-tidy: forward warnings-as-errors argument
indev [Mon, 12 Jun 2023 11:16:10 +0000 (11:16 +0000)]
[clang-tidy] run-clang-tidy: forward warnings-as-errors argument

Forward `warnings-as-errors` argument to clang-tidy.

Reviewed By: PiotrZSL

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

13 months ago[clang][dataflow] Model pointer value for builtin functions.
Martin Braenne [Mon, 12 Jun 2023 08:11:03 +0000 (08:11 +0000)]
[clang][dataflow] Model pointer value for builtin functions.

This fixes a false positive in the Crubit nullability verification.

Reviewed By: gribozavr2

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

13 months ago[AMDGPU][GFX11] Add test coverage for cases involving conversions from and to fp16...
Ivan Kosarev [Mon, 12 Jun 2023 11:39:21 +0000 (12:39 +0100)]
[AMDGPU][GFX11] Add test coverage for cases involving conversions from and to fp16 values.

Other such tests, of which there are many, are to be updated with
separate patches.

Reviewed By: arsenm

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

13 months ago[RFC][clangd] Move preamble index out of document open critical path
Kugan Vivekanandarajah [Mon, 12 Jun 2023 11:55:29 +0000 (12:55 +0100)]
[RFC][clangd] Move preamble index out of document open critical path

We would like to move the preamble index out of the critical path.
This patch is an RFC to get feedback on the correct implementation and potential pitfalls to keep into consideration.

I am not entirely sure if the lazy AST initialisation would create using Preamble AST in parallel. I tried with tsan enabled clangd but it seems to work OK (at least for the cases I tried)

Reviewed By: kadircet

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

13 months ago[MISched] Require asserts and AArch64 registered target for test.
Francesco Petrogalli [Mon, 12 Jun 2023 11:51:19 +0000 (13:51 +0200)]
[MISched] Require asserts and AArch64 registered target for test.

Fixes failure at https://lab.llvm.org/buildbot/#/builders/124/builds/7472:

```
llc: Unknown command line argument '-debug-only=machine-scheduler'. Try: '/home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1/bin/llc --help'
```

Reviewed By: fhahn

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

13 months ago[GlobalIsel][X86] Rename x86_64-select-fcmp.mir to select-fcmp.mir and add 32-bit...
Simon Pilgrim [Mon, 12 Jun 2023 11:31:27 +0000 (12:31 +0100)]
[GlobalIsel][X86] Rename x86_64-select-fcmp.mir to select-fcmp.mir and add 32-bit test coverage

x86_64 was being used as shorthand for SSE2

13 months ago[OpenMP][Flang][MLIR] Add MLIR support for OpenMP requires directive
Sergio Afonso [Wed, 29 Mar 2023 16:45:24 +0000 (17:45 +0100)]
[OpenMP][Flang][MLIR] Add MLIR support for OpenMP requires directive

This patch introduces an MLIR attribute to the OpenMP dialect
representing the clauses that a 'requires' directive can define.

The `OffloadModuleInterface` is also updated to provide methods to get
and set a new dialect attribute `omp.requires`, to allow storing and using this
information during the lowering stages to LLVM IR.

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

13 months ago[MLIR][Quant] Fix equations in `Quantization.md`
rikhuijzer [Mon, 12 Jun 2023 11:28:39 +0000 (13:28 +0200)]
[MLIR][Quant] Fix equations in `Quantization.md`

This patch fixes the equations on the Quantization page
(https://mlir.llvm.org/docs/Quantization/).

I don't know what caused the equations to be broken, it
might be https://github.com/llvm/mlir-www/pull/152, but
I'm not sure. Irregardless, let's just fix it and be
done with it.

I've fixed the equations by moving some subscripts to
the text. For some reason, the large number of subscripts
caused Mathjax to fail. I've also tried KaTeX, which
failed at exactly the same number of subscripts.

The workflow to inspect the fix is as follows:

```
$ git clone --depth=1 https://github.com/llvm/mlir-www.git /some/path/mlir-www

$ git clone --depth=1 https://github.com/llvm/llvm-project.git /some/path/llvm-project

$ cp /some/path/llvm-project/mlir/docs/Quantization.md \
    /some/path/mlir-www/website/content/Quantization.md

$ cd /some/path/mlir-www/website

$ hugo serve
[...]
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
```
and view the page at http://localhost:1313/Quantization/.

Reviewed By: stellaraccident

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

13 months agoRemove unused variable 's8' in X86LegalizerInfo.cpp (NFC)
Jie Fu [Mon, 12 Jun 2023 11:24:56 +0000 (19:24 +0800)]
Remove unused variable 's8' in X86LegalizerInfo.cpp (NFC)

/data/llvm-project/llvm/lib/Target/X86/X86LegalizerInfo.cpp:443:13: error: unused variable 's8' [-Werror,-Wunused-variable]
  const LLT s8 = LLT::scalar(8);
            ^
1 error generated.

13 months ago[GlobalIsel][X86] Move G_FCMP getActionDefinitionsBuilder out of setLegalizerInfo64bi...
Simon Pilgrim [Mon, 12 Jun 2023 10:25:48 +0000 (11:25 +0100)]
[GlobalIsel][X86] Move G_FCMP getActionDefinitionsBuilder out of setLegalizerInfo64bit and add 32-bit support

We were using x86_64-only support as a SSE2 proxy

13 months ago[GlobalIsel][X86] Regenerate legalize-fcmp.mir
Simon Pilgrim [Mon, 12 Jun 2023 10:07:45 +0000 (11:07 +0100)]
[GlobalIsel][X86] Regenerate legalize-fcmp.mir

13 months ago[GlobalIsel][X86] Rename x86_64-legalize-fcmp to legalize-fcmp
Simon Pilgrim [Mon, 12 Jun 2023 10:01:08 +0000 (11:01 +0100)]
[GlobalIsel][X86] Rename x86_64-legalize-fcmp to legalize-fcmp

32-bit support will be added shortly - x86_64 was being used a shorthand for SSE2

13 months ago[LoopVectorize] Convert most tests to opaque pointers (NFC)
Nikita Popov [Mon, 12 Jun 2023 10:22:01 +0000 (12:22 +0200)]
[LoopVectorize] Convert most tests to opaque pointers (NFC)

The unsized-pointee-crash.ll and zero-sized-pointee-crash.ll tests
have been removed, because these issues are not relevant for opaque
pointers.

13 months ago[clang][Driver] Add -fcaret-diagnostics-max-lines= as a driver option
Timm Bäder [Sun, 4 Jun 2023 05:49:36 +0000 (07:49 +0200)]
[clang][Driver] Add -fcaret-diagnostics-max-lines= as a driver option

Since https://reviews.llvm.org/D147875 landed, setting different values
(or reverting to the old default of 1) is more important than before,
so promote this option to a driver flag.

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

13 months ago[Clang] Remove uses of PointerType::getWithSamePointeeType (NFC)
Nikita Popov [Mon, 12 Jun 2023 10:14:02 +0000 (12:14 +0200)]
[Clang] Remove uses of PointerType::getWithSamePointeeType (NFC)

No longer relevant with opaque pointers.

13 months ago[mlir][Linalg] Apply ClangTidy finding (NFC)
Adrian Kuegel [Mon, 12 Jun 2023 10:02:23 +0000 (12:02 +0200)]
[mlir][Linalg] Apply ClangTidy finding (NFC)

13 months ago[DAGCombine] Move setcc of freeze fold to brcond
Nikita Popov [Fri, 9 Jun 2023 15:07:15 +0000 (17:07 +0200)]
[DAGCombine] Move setcc of freeze fold to brcond

This fold goes against the usual approach of pushing freeze into
operands. The idea behind the fold is that if the setcc feeds into
a brcond, the freeze can be dropped entirely.

Move the fold to brcond, where we can remove the freeze directly.
This ensures that there can be no infinite combine loops due to
conflicting transforms.

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

13 months ago[clangd] Enforce strict unused includes by default
Kadir Cetinkaya [Fri, 9 Jun 2023 16:16:45 +0000 (18:16 +0200)]
[clangd] Enforce strict unused includes by default

Depends on D152685

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

13 months ago[clangd] Decouple IncludeCleaner implementation from Config
Kadir Cetinkaya [Fri, 9 Jun 2023 15:53:39 +0000 (17:53 +0200)]
[clangd] Decouple IncludeCleaner implementation from Config

This should help managing tests as we change defaults in configs.

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

13 months ago[LegalizeTypes][VP] Widen load/store of fixed length vectors to VP ops
Luke Lau [Tue, 6 Jun 2023 09:29:40 +0000 (09:29 +0000)]
[LegalizeTypes][VP] Widen load/store of fixed length vectors to VP ops

If we have a load/store with an illegal fixed length vector result type that
needs widened, e.g. `x:v6i32 = load p`
Instead of just widening it to: `x:v8i32 = load p`
We can widen it to the equivalent VP operation and set the EVL to the
exact number of elements needed: `x:v8i32 = vp_load a, b, mask=true, evl=6`
Provided that the target supports vp_load/vp_store on the widened type.

Scalable vectors are already widened this way where possible, so this
largely reuses the same logic.

Reviewed By: craig.topper

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

13 months ago[clang][dataflow][NFC] Expand comments on losing values in optional checker.
Martin Braenne [Wed, 7 Jun 2023 13:23:54 +0000 (13:23 +0000)]
[clang][dataflow][NFC] Expand comments on losing values in optional checker.

While working on the ongoing migration to strict handling of value
categories (see https://discourse.llvm.org/t/70086), I ran into issues related
to losing the value associated with an optional.

This issue is hinted at in the existing comments, but the issue didn't become
sufficiently clear to me from those, so I thought it would be worth capturing
more details, along with ideas for how this issue might be fixed.

Reviewed By: ymandel

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

13 months agoRevert D148717 "[libc] Improve memcmp latency and codegen"
Guillaume Chatelet [Mon, 12 Jun 2023 08:32:00 +0000 (08:32 +0000)]
Revert D148717 "[libc] Improve memcmp latency and codegen"

This broke aarch64 debug buildbot https://lab.llvm.org/buildbot/#/builders/223/builds/21703
This reverts commit bd4f978754758d5ef29d1f10370f45362da3de37.

13 months agosanitizers: intercept FreeBSD's cpuset_getaffinity call.
David Carlier [Mon, 12 Jun 2023 08:05:31 +0000 (09:05 +0100)]
sanitizers: intercept FreeBSD's cpuset_getaffinity call.

Reviewed By: melver

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

13 months ago[libc] Improve memcmp latency and codegen
Guillaume Chatelet [Mon, 12 Jun 2023 07:55:13 +0000 (07:55 +0000)]
[libc] Improve memcmp latency and codegen

This is based on ideas from @nafi to:
 - use a branchless version of 'cmp' for 'uint32_t',
 - completely resolve the lexicographic comparison through vector
   operations when wide types are available. We also get rid of byte
   reloads and serializing '__builtin_ctzll'.

I did not include the suggestion to replace comparisons of 'uint16_t'
with two 'uint8_t' as it did not seem to help the codegen. This can
be revisited in sub-sequent patches.

The code been rewritten to reduce nested function calls, making the
job of the inliner easier and preventing harmful code duplication.

Reviewed By: nafi3000

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