platform/upstream/llvm.git
2 years ago[sanitizer] Clang-format sanitizer_platform.h
Vitaly Buka [Thu, 16 Dec 2021 21:21:06 +0000 (13:21 -0800)]
[sanitizer] Clang-format sanitizer_platform.h

2 years agoInstall test mailer for github bugs
Anton Korobeynikov [Thu, 16 Dec 2021 21:25:55 +0000 (00:25 +0300)]
Install test mailer for github bugs

2 years agoRevert "AMDGPU: Remove AMDGPUFixFunctionBitcasts pass"
Ron Lieberman [Thu, 16 Dec 2021 21:21:32 +0000 (21:21 +0000)]
Revert "AMDGPU: Remove AMDGPUFixFunctionBitcasts pass"

Offload abort in Nekbone

This reverts commit 2b4876157562bc76e86f193d371348993905bc61.

2 years agoAllow calls with known writes when trying to remove allocas [part 2]
Philip Reames [Thu, 16 Dec 2021 21:05:55 +0000 (13:05 -0800)]
Allow calls with known writes when trying to remove allocas [part 2]

This is a slight generalization of D115829. I noticed this while restructuring code for a follow up patch to perform the same optimizations in DSE.

If we have a call whose only visible effect is writing to an alloca, and we're removing the alloca anyways, we don't care if the call also reads from the same alloca. That read will be unobservable and thus doesn't block removal of the call.

Worth noting is that this observation generalizes for non-argument reads. It just happens that case reduces to a readonly call, and is already handled separately.

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

2 years ago[compiler-rt][NFC] add note to interface_symbols_linux.cpp about darwin
Emily Shi [Thu, 16 Dec 2021 21:05:51 +0000 (13:05 -0800)]
[compiler-rt][NFC] add note to interface_symbols_linux.cpp about darwin

There were changes made to the linux version of this test that were not made for darwin
(see https://reviews.llvm.org/D115837) and this caused downstream failures.

Adding comment to this test to remind people to edit interface_symbols_darwin.cpp.
There is the reverse of this comment in the darwin file to remind us to edit the linux version already.

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

2 years ago[compiler-rt] removed memory access callback from asan interface for darwin
Emily Shi [Thu, 16 Dec 2021 21:02:47 +0000 (13:02 -0800)]
[compiler-rt] removed memory access callback from asan interface for darwin

These symbols were introduced in https://reviews.llvm.org/D114558 but were not properly guarded for mac which caused downstream CI failures

Reviewed By: kubamracek, yln

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

2 years ago[sanitizer] Portable sanitizer_stoptheworld_test
Clemens Wasser [Thu, 16 Dec 2021 20:48:36 +0000 (12:48 -0800)]
[sanitizer] Portable sanitizer_stoptheworld_test

Part of D115204

2 years ago[sanitizer] Clang format before D115204
Vitaly Buka [Thu, 16 Dec 2021 20:17:52 +0000 (12:17 -0800)]
[sanitizer] Clang format before D115204

2 years ago[Sanitizer] Disable LSan when testing on iOS simulators
Julian Lettner [Wed, 15 Dec 2021 19:21:42 +0000 (11:21 -0800)]
[Sanitizer] Disable LSan when testing on iOS simulators

LSan (`ASAN_OPTIONS=detect_leaks=1`) is supported on macOS, but disabled
by default on Darwin (`SANITIZER_MAC`):
```
COMMON_FLAG(bool, detect_leaks, !SANITIZER_MAC, "Enable memory leak detection.")
```

We enable it here for ASan tests to prevent regressions (per comment).
However, LSan is not supported for the iOS simulator and the tests fail
when it is enabled.

Make this "Is macOS?" check more precise since the current one (`Darwin
&& x86_64`) has two issues:
 * Includes the simulators
 * Excludes macOS on Apple Silicon

This will allow us to (re)enable simulator testing on Green dragon to
give open source better feedback about sanitizer changes:
https://green.lab.llvm.org

rdar://86529234

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

2 years ago[clang-format] add support for branch attribute macros
mydeveloperday [Thu, 16 Dec 2021 20:32:32 +0000 (20:32 +0000)]
[clang-format] add support for branch attribute macros

https://github.com/llvm/llvm-project/issues/49184

clang-format doesn't handle the use of AttributeMacros where `[[unlikely]]` / `[[likely]]` could be used in `if` statements

This was not covered in the original commit {{D80144}}

Fixes #49184

Reviewed By: curdeius, owenpan

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

2 years ago[instcombine Use reference for never-null pointer in isAllocSiteRemovable [nfc]
Philip Reames [Thu, 16 Dec 2021 20:03:03 +0000 (12:03 -0800)]
[instcombine Use reference for never-null pointer in isAllocSiteRemovable [nfc]

2 years ago[Bazel] Add LLVM_BUILD_* variables to llvm-config.h to mirror ec37e0bbafab75fa64f1ddb...
Dmitri Gribenko [Thu, 16 Dec 2021 19:52:20 +0000 (20:52 +0100)]
[Bazel] Add LLVM_BUILD_* variables to llvm-config.h to mirror ec37e0bbafab75fa64f1ddb4cdeceb5400491ef8

2 years ago[lsan] Format CAN_SANITIZE_LEAKS defines
Clemens Wasser [Thu, 16 Dec 2021 19:48:35 +0000 (11:48 -0800)]
[lsan] Format CAN_SANITIZE_LEAKS defines

Reviewed By: vitalybuka

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

2 years ago[libc] Fix problem with using isnan in test/src/math/logf_test.cpp.
Tue Ly [Thu, 16 Dec 2021 19:41:37 +0000 (14:41 -0500)]
[libc] Fix problem with using isnan in test/src/math/logf_test.cpp.

The default isnan returns an int, and hence failing the EXPECT_TRUE tests.

Reviewed By: sivachandra

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

2 years agoAdd a flag to force tsan's background thread
Matt Kulukundis [Thu, 16 Dec 2021 19:45:49 +0000 (11:45 -0800)]
Add a flag to force tsan's background thread

Reviewed By: dvyukov, vitalybuka

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

2 years ago[gn build] Port da816ca0cb3b
LLVM GN Syncbot [Thu, 16 Dec 2021 19:27:34 +0000 (19:27 +0000)]
[gn build] Port da816ca0cb3b

2 years ago[gn build] port ec37e0bbafab
Nico Weber [Thu, 16 Dec 2021 19:27:18 +0000 (14:27 -0500)]
[gn build] port ec37e0bbafab

2 years ago[Debuginfod] Remove f-string from llvm-debuginfod-find lit test.
Noah Shutty [Thu, 16 Dec 2021 19:22:08 +0000 (19:22 +0000)]
[Debuginfod] Remove f-string from llvm-debuginfod-find lit test.

This removes a python3 f-String from the llvm-debuginfod-find lit test script to maximize compatibility with different python versions, as it seemed to cause some issues.

Reviewed By: phosek

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

2 years ago[llvm] Fix small typos in Programmer's Manual and Chrono.h.
Noah Shutty [Thu, 16 Dec 2021 19:20:25 +0000 (19:20 +0000)]
[llvm] Fix small typos in Programmer's Manual and Chrono.h.

The Programmer's Manual guidance on the StringRef class (https://llvm.org/docs/ProgrammersManual.html#the-stringref-class) refers to `iterator StringRef::find(StringRef Key)` which does not exist. Based on context this is surely a small typo meant to be `iterator StringMap::find(StringRef Key)`.

This also corrects some small typos in the comments of llvm/include/llvm/Support/Chrono.h

Reviewed By: phosek

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

2 years ago[SLP]Early exit out of the reordering if shuffled/perfect diamond match found.
Alexey Bataev [Wed, 15 Dec 2021 18:19:29 +0000 (10:19 -0800)]
[SLP]Early exit out of the reordering if shuffled/perfect diamond match found.

Need to early exit out of the reordering process if the perfect/shuffled match is found in the operands. Such pattern will result in not profitable reordering because of (false positive) external use of scalars.

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

2 years ago[mlir][ods] Fix OpFormatGen calling inferReturnTypes before region/segment resolution
Mogball [Wed, 15 Dec 2021 06:22:04 +0000 (06:22 +0000)]
[mlir][ods] Fix OpFormatGen calling inferReturnTypes before region/segment resolution

The generated parser for ops with type inference calls `inferReturnTypes` before region resolution and segment attribute resolution, i.e. regions and the segment attributes are not passed to the `inferReturnTypes` even though it may need that information.

In particular, an op that has sized operand segments which queries those operands in its `inferReturnTypes` function will crash because the segment attributes hadn't been added yet.

Reviewed By: rriddle

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

2 years agoAllow calls with known writes when trying to remove allocas
Philip Reames [Thu, 16 Dec 2021 19:02:27 +0000 (11:02 -0800)]
Allow calls with known writes when trying to remove allocas

isAllocSiteRemovable tracks whether all uses of an alloca are both non-capturing, and non-reading. If so, we can remove said alloca because nothing can depend on its content or address.

This patch extends this reasoning to allow writes from calls where we can prove the call has no side effect other than writing to said allocation. This is a fairly natural fit for the existing code with one subtle detail - the call can write to multiple locations at once which stores can't.

As a follow up, we can likely sink the intrinsic handling into the generic code by allowing readnone arguments as well. I deliberately left that out to minimize conceptual churn.

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

2 years ago[mlir] Fix invalidated reference when loading dependent dialects
Mogball [Thu, 16 Dec 2021 01:19:56 +0000 (01:19 +0000)]
[mlir] Fix invalidated reference when loading dependent dialects

When a dialect is loaded with `getOrLoadDialect`, its constructor may recurse and call `getOrLoadDialect` on a dependent dialect, which may result in an insertion in the dialect map, invalidating the reference to the (previously null) dialect pointer.

Reviewed By: mehdi_amini

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

2 years ago[libc] Implement correctly rounded logf based on RLIBM library.
Tue Ly [Mon, 6 Dec 2021 18:26:16 +0000 (13:26 -0500)]
[libc] Implement correctly rounded logf based on RLIBM library.

Implement correctly rounded logf based on RLIBM library: https://people.cs.rutgers.edu/~sn349/rlibm/.

Reviewed By: sivachandra, santoshn, jpl169, zimmermann6

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

2 years ago[libunwind] Provide a way to conveniently install libunwind headers
PoYao Chang [Thu, 16 Dec 2021 18:32:12 +0000 (13:32 -0500)]
[libunwind] Provide a way to conveniently install libunwind headers

This adds a CMake option (defaults to OFF to not be intrusive) to activate
2 new targets `install-unwind-headers` and `install-unwind-headers-stripped`.
So, for example:

  cmake -S runtimes -B build -G Ninja \
    -DLLVM_ENABLE_RUNTIMES='libunwind' \
    -DLIBUNWIND_INSTALL_HEADERS=ON

And then, `ninja -C build install-unwind` would install headers in addition
to good ol' dylibs and archives, i.e., targets `install-unwind*` `DEPENDS`
on `install-unwind-headers*`. On the other hand,
`ninja -C build install-unwind-headers` gives you headers only.

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

2 years ago[OpenCL] Add pure attribute to vload builtins
Stuart Brady [Thu, 16 Dec 2021 18:30:58 +0000 (18:30 +0000)]
[OpenCL] Add pure attribute to vload builtins

Use the "pure" attribute (or "readonly") for the vload, vload_half and
vloada_half builtins.

Includes test changes to SemaOpenCL/fdeclare-opencl-builtins.cl to avoid
triggering unused-result warnings.

Reviewed By: svenvh

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

2 years agoAdded the ability to cache the finalized symbol tables subsequent debug sessions...
Greg Clayton [Thu, 16 Dec 2021 17:59:25 +0000 (09:59 -0800)]
Added the ability to cache the finalized symbol tables subsequent debug sessions to start faster.

This is an updated version of the https://reviews.llvm.org/D113789 patch with the following changes:
- We no longer modify modification times of the cache files
- Use LLVM caching and cache pruning instead of making a new cache mechanism (See DataFileCache.h/.cpp)
- Add signature to start of each file since we are not using modification times so we can tell when caches are stale and remove and re-create the cache file as files are changed
- Add settings to control the cache size, disk percentage and expiration in days to keep cache size under control

This patch enables symbol tables to be cached in the LLDB index cache directory. All cache files are in a single directory and the files use unique names to ensure that files from the same path will re-use the same file as files get modified. This means as files change, their cache files will be deleted and updated. The modification time of each of the cache files is not modified so that access based pruning of the cache can be implemented.

The symbol table cache files start with a signature that uniquely identifies a file on disk and contains one or more of the following items:
- object file UUID if available
- object file mod time if available
- object name for BSD archive .o files that are in .a files if available

If none of these signature items are available, then the file will not be cached. This keeps temporary object files from expressions from being cached.

When the cache files are loaded on subsequent debug sessions, the signature is compare and if the file has been modified (uuid changes, mod time changes, or object file mod time changes) then the cache file is deleted and re-created.

Module caching must be enabled by the user before this can be used:

symbols.enable-lldb-index-cache (boolean) = false

(lldb) settings set symbols.enable-lldb-index-cache true

There is also a setting that allows the user to specify a module cache directory that defaults to a directory that defaults to being next to the symbols.clang-modules-cache-path directory in a temp directory:

(lldb) settings show symbols.lldb-index-cache-path
/var/folders/9p/472sr0c55l9b20x2zg36b91h0000gn/C/lldb/IndexCache

If this setting is enabled, the finalized symbol tables will be serialized and saved to disc so they can be quickly loaded next time you debug.

Each module can cache one or more files in the index cache directory. The cache file names must be unique to a file on disk and its architecture and object name for .o files in BSD archives. This allows universal mach-o files to support caching multuple architectures in the same module cache directory. Making the file based on the this info allows this cache file to be deleted and replaced when the file gets updated on disk. This keeps the cache from growing over time during the compile/edit/debug cycle and prevents out of space issues.

If the cache is enabled, the symbol table will be loaded from the cache the next time you debug if the module has not changed.

The cache also has settings to control the size of the cache on disk. Each time LLDB starts up with the index cache enable, the cache will be pruned to ensure it stays within the user defined settings:

(lldb) settings set symbols.lldb-index-cache-expiration-days <days>

A value of zero will disable cache files from expiring when the cache is pruned. The default value is 7 currently.

(lldb) settings set symbols.lldb-index-cache-max-byte-size <size>

A value of zero will disable pruning based on a total byte size. The default value is zero currently.
(lldb) settings set symbols.lldb-index-cache-max-percent <percentage-of-disk-space>

A value of 100 will allow the disc to be filled to the max, a value of zero will disable percentage pruning. The default value is zero.

Reviewed By: labath, wallace

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

2 years agoAdapt test to be compatible with AIX
Jake Egan [Thu, 16 Dec 2021 17:34:31 +0000 (12:34 -0500)]
Adapt test to be compatible with AIX

This patch updates the following test, which is falling to match ASM lines on AIX for two reasons:
 - `.debug_info` is mapped to `.dwinfo`, so the test fails to match `debug_info` before `DW_TAG_label` occurs
 - AIX uses inline strings, so `DW_AT_NAME` format is different and does not match `DW_AT_decl_file` in the next line.

Reviewed By: shchenz

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

2 years agoRe-apply "Only define LLVM_EXTERNAL_VISIBILITY when building libLLVM dylib"
Ben Langmuir [Fri, 10 Dec 2021 19:49:04 +0000 (11:49 -0800)]
Re-apply "Only define LLVM_EXTERNAL_VISIBILITY when building libLLVM dylib"

With a fix for BUILD_SHARED_LIBS.

Original commit message:

When building LLVM static libraries, we should not make symbols more
visible than CMAKE_CXX_VISIBILITY_PRESET, since the goal may be to have
a purely hidden llvm embedded in another library. Instead, we only
define LLVM_EXTERNAL_VISIBILITY for the dynamic library build (when
LLVM_BUILD_LLVM_DYLIB=YES or BUILD_SHARED_LIBS=YES).

Original Review: https://reviews.llvm.org/D113610

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

2 years ago[libc] Add documentation about how to add a math function to LLVM-libc.
Tue Ly [Mon, 13 Dec 2021 05:00:49 +0000 (00:00 -0500)]
[libc] Add documentation about how to add a math function to LLVM-libc.

Add documentation about how to add a math function to LLVM-libc.

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

2 years ago[libc++] [test] Simplify sentinel_wrapper and sized_sentinel.
Arthur O'Dwyer [Thu, 7 Oct 2021 01:23:13 +0000 (21:23 -0400)]
[libc++] [test] Simplify sentinel_wrapper and sized_sentinel.

Remove `s.base()`; every test that wants to get the base of a "test sentinel"
should use the ADL `base(s)` from now on.

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

2 years ago[lldb] Silence CMake warnings about missing FindFBSDVMCore
Michał Górny [Thu, 16 Dec 2021 16:11:07 +0000 (17:11 +0100)]
[lldb] Silence CMake warnings about missing FindFBSDVMCore

Pass QUIET to find_package() in order to quiet the warning about missing
FindFBSDVMCore.cmake.  FBSDVMCore always provides native CMake config
files, therefore providing a fallback module serves no purpose.

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

2 years ago[RISCV] Revert Zfhmin related changes that aren't tested and depend on f16 being...
Craig Topper [Thu, 16 Dec 2021 16:48:37 +0000 (08:48 -0800)]
[RISCV] Revert Zfhmin related changes that aren't tested and depend on f16 being a legal type.

Our Zfhmin support is only MC layer, but these are CodeGen layer
interfaces. If f16 isn't a Legal type for CodeGen with Zfhmin, then
these interfaces should keep their non-Zfh behavior.

Reviewed By: luismarques

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

2 years ago[X86] combineAnd - don't demand operand vector elements if the other operand element...
Simon Pilgrim [Thu, 16 Dec 2021 16:46:39 +0000 (16:46 +0000)]
[X86] combineAnd - don't demand operand vector elements if the other operand element is zero

If either operand has a zero element, then we don't need the equivalent element from the other operand, as no bits will be set.

2 years ago[analyzer][ctu] Fix wrong 'multiple definitions' errors caused by space characters...
Ella Ma [Thu, 16 Dec 2021 16:47:59 +0000 (17:47 +0100)]
[analyzer][ctu] Fix wrong 'multiple definitions' errors caused by space characters in lookup names when parsing the ctu index file

This error was found when analyzing MySQL with CTU enabled.

When there are space characters in the lookup name, the current
delimiter searching strategy will make the file path wrongly parsed.
And when two lookup names have the same prefix before their first space
characters, a 'multiple definitions' error will be wrongly reported.

e.g. The lookup names for the two lambda exprs in the test case are
`c:@S@G@F@G#@Sa@F@operator int (*)(char)#1` and
`c:@S@G@F@G#@Sa@F@operator bool (*)(char)#1` respectively. And their
prefixes are both `c:@S@G@F@G#@Sa@F@operator` when using the first space
character as the delimiter.

Solving the problem by adding a length for the lookup name, making the
index items in the format of `USR-Length:USR File-Path`.

Reviewed By: steakhal

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

2 years ago[TSan] Make test fail more predictably
Julian Lettner [Thu, 16 Dec 2021 04:34:39 +0000 (20:34 -0800)]
[TSan] Make test fail more predictably

This test would hang when the system ran out of resources and we fail to
create all 300 threads.

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

2 years ago[clang] Cleanup unneeded Function nullptr checks [NFC]
Mike Rice [Wed, 15 Dec 2021 18:23:21 +0000 (10:23 -0800)]
[clang] Cleanup unneeded Function nullptr checks [NFC]

Add an assert and avoid unneeded checks of Fn in
CodeGenFunction::GenerateCode.

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

2 years agoAMDGPU: Return result from indicatePessimisticFixpoint
Matt Arsenault [Thu, 16 Dec 2021 15:05:00 +0000 (10:05 -0500)]
AMDGPU: Return result from indicatePessimisticFixpoint

I don't think this fixes anything.

2 years ago[X86] combineAnd - pull out repeated getOperand() and SDLoc() calls. NFCI.
Simon Pilgrim [Thu, 16 Dec 2021 16:22:39 +0000 (16:22 +0000)]
[X86] combineAnd - pull out repeated getOperand() and SDLoc() calls. NFCI.

2 years ago[X86] Rename LowerScalarImmediateShift/LowerScalarVariableShift helpers. NFC.
Simon Pilgrim [Thu, 16 Dec 2021 12:14:18 +0000 (12:14 +0000)]
[X86] Rename LowerScalarImmediateShift/LowerScalarVariableShift helpers. NFC.

Rename them to LowerShiftByScalarImmediate/LowerShiftByScalarVariable to make it easier to find them wrt LowerShift()

2 years agoRevert "A new hidden option exec-on-ir-change=exe that calls exe each time IR changes"
Jamie Schmeiser [Thu, 16 Dec 2021 15:51:15 +0000 (10:51 -0500)]
Revert "A new hidden option exec-on-ir-change=exe that calls exe each time IR changes"

This reverts commit dff0e8b4ff13af311512c369d059f1e095e83a60.

Failing build:  https://lab.llvm.org/buildbot/#/builders/42/builds/2800

2 years ago[lldb][docs] Update instructions for building libc++
Tor Arne Vestbø [Thu, 16 Dec 2021 15:46:12 +0000 (16:46 +0100)]
[lldb][docs] Update instructions for building libc++

Reviewed By: sylvestre.ledru

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

2 years ago[CodeGen] Avoid more pointer element type accesses
Nikita Popov [Thu, 16 Dec 2021 14:36:20 +0000 (15:36 +0100)]
[CodeGen] Avoid more pointer element type accesses

This is enough to build sqlite3 with opaque pointers.

2 years ago[llvm][docs] Describe how to work with patch series on Phabricator
David Spickett [Fri, 10 Dec 2021 14:35:50 +0000 (14:35 +0000)]
[llvm][docs] Describe how to work with patch series on Phabricator

Reviewed By: awarzynski, jhenderson

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

2 years agoDefine __STDC_NO_THREADS__ when targeting windows-msvc (PR48704)
Hans Wennborg [Tue, 19 Oct 2021 15:38:28 +0000 (17:38 +0200)]
Define __STDC_NO_THREADS__ when targeting windows-msvc (PR48704)

MSVC's libc doesn't provide thread.h, so we should set the macro to
indicate that.

We could just set it in C mode, but I noticed that Darwin sets it
unconditionally, so perhaps we should do the same here.

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

2 years ago[CodeGen] Always update map entry after adding initializer
Nikita Popov [Thu, 16 Dec 2021 15:15:38 +0000 (16:15 +0100)]
[CodeGen] Always update map entry after adding initializer

With opaque pointers the pointer cast may be a no-op, such that
var and castedAddr are the same. However, we still need to update
the map entry as the underlying global changed. We could explicitly
check whether the global was replaced, but we may as well just
always update the entry.

2 years ago[lld] Add cet-report and bti-report flags
Daniel Kiss [Thu, 16 Dec 2021 15:18:08 +0000 (16:18 +0100)]
[lld] Add cet-report and bti-report flags

Implement cet-report as supported in binutils.
bti-report has the same behaviour for AArch64-BTI.

Fixes https://github.com/llvm/llvm-project/issues/44828

Reviewed By: MaskRay

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

2 years agoAvoid by-value copies of referenced objects
Nathan Sidwell [Tue, 12 Oct 2021 16:28:20 +0000 (09:28 -0700)]
Avoid by-value copies of referenced objects

These were detected by the new -Wauto-by-value-copy (D114989) warning, these by-value
constant copies need only be references.

Reviewed By: aaron.ballman

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

2 years ago[clang] p2085 out-of-class comparison operator defaulting
Nathan Sidwell [Wed, 16 Jun 2021 17:43:43 +0000 (10:43 -0700)]
[clang] p2085 out-of-class comparison operator defaulting

This implements p2085, allowing out-of-class defaulting of comparison
operators, primarily so they need not be inline, IIUC intent. this was
mostly straigh forward, but required reimplementing
Sema::CheckExplicitlyDefaultedComparison, as now there's a case where
we have no a priori clue as to what class a defaulted comparison may
be for. We have to inspect the parameter types to find out. Eg:

class X { ... };
bool operator==(X, X) = default;

Thus reimplemented the parameter type checking, and added 'is this a
friend' functionality for the above case.

Reviewed By: mizvekov

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

2 years agoRevert "[OpenCL] Add pure attribute to vload builtins"
Stuart Brady [Thu, 16 Dec 2021 15:16:41 +0000 (15:16 +0000)]
Revert "[OpenCL] Add pure attribute to vload builtins"

This reverts commit 1a376bc285358037a5edc48b0d125f91bf5a69ca.

This broke clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl

2 years ago[fir] Move Factory.h to flang/Optimizer/Builder
Valentin Clement [Thu, 16 Dec 2021 15:08:17 +0000 (16:08 +0100)]
[fir] Move Factory.h to flang/Optimizer/Builder

Move the Factory.h header file to flang/Optimizer/Builder.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: kiranchandramohan

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

2 years ago[OpenCL] Add pure attribute to vload builtins
Stuart Brady [Thu, 16 Dec 2021 14:55:31 +0000 (14:55 +0000)]
[OpenCL] Add pure attribute to vload builtins

Use the "pure" attribute (or "readonly") for the vload, vload_half and
vloada_half builtins.

Reviewed By: svenvh

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

2 years ago[mlir] Add canonicalization for extract(tensor.from_elements) in 0d case.
Alexander Belyaev [Thu, 16 Dec 2021 14:46:08 +0000 (15:46 +0100)]
[mlir] Add canonicalization for extract(tensor.from_elements) in 0d case.

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

2 years ago[mlir][spirv] Perform partial conversion in VectorToSPIRVPass
Lei Zhang [Thu, 16 Dec 2021 14:35:47 +0000 (09:35 -0500)]
[mlir][spirv] Perform partial conversion in VectorToSPIRVPass

This allows the pass to participate in progressive lowering
and it also allows us to write tests better.

Along the way, cleaned up the tests.

Reviewed By: ThomasRaoux

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

2 years ago[CodeGen] Store element type in ParamValue
Nikita Popov [Thu, 16 Dec 2021 14:29:26 +0000 (15:29 +0100)]
[CodeGen] Store element type in ParamValue

ParamValue is basically a union between an Address and a Value*.
To be able to reconstruct the Address, we now need to store the
pointer element type.

2 years ago[VPlan] Add VPBlockBase::successors() returning an iterator_range (NFC).
Florian Hahn [Thu, 16 Dec 2021 14:28:39 +0000 (14:28 +0000)]
[VPlan] Add VPBlockBase::successors() returning an iterator_range (NFC).

This will also be helpful for D115793.

2 years ago[CodeGen] Avoid more pointer element type accesses
Nikita Popov [Thu, 16 Dec 2021 11:59:45 +0000 (12:59 +0100)]
[CodeGen] Avoid more pointer element type accesses

2 years ago[CodeGen] use saturating FP casts when compiling with "no-strict-float-cast-overflow"
Sanjay Patel [Thu, 16 Dec 2021 13:37:44 +0000 (08:37 -0500)]
[CodeGen] use saturating FP casts when compiling with "no-strict-float-cast-overflow"

We got an unintended consequence of the optimizer getting smarter when
compiling in a non-standard mode, and there's no good way to inhibit
those optimizations at a later stage. The test is based on an example
linked from D92270.

We allow the "no-strict-float-cast-overflow" exception to normal C
cast rules to preserve legacy code that does not expect overflowing
casts from FP to int to produce UB. See D46236 for details.

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

2 years ago[z/OS] Implement prologue and epilogue generation for z/OS target.
Neumann Hon [Wed, 15 Dec 2021 22:02:31 +0000 (17:02 -0500)]
[z/OS]  Implement prologue and epilogue generation for z/OS target.

This patch adds support for prologue and epilogue generation for the z/OS target under the XPLINK64 ABI for functions with a stack size of less than 1048576 bytes (huge stack frames).

Reviewed By: uweigand

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

2 years agoA new hidden option exec-on-ir-change=exe that calls exe each time IR changes
Jamie Schmeiser [Thu, 16 Dec 2021 14:00:09 +0000 (09:00 -0500)]
A new hidden option exec-on-ir-change=exe that calls exe each time IR changes

Summary:
A new option exec-on-ir-changed is defined that allows one to specify an
exe that is called after each pass in the opt pipeline that changes the IR.
The exec-on-ir-change=exe option saves the IR in a temporary file and calls exe
with the name of the file and the name of the pass that just changed it after
each pass alters the IR. exe is also called with the initial IR. This
can be used, for example, to determine which pass corrupts the IR by having
exe as a script that calls llc and runs a test to see after which pass the
results change. The print-changed filtering options are respected.  Note that
this is only supported with the new pass manager.

Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: aeubanks (Arthur Eubanks)
Differential Revision: https://reviews.llvm.org/D110776

2 years ago[mlir] Extend `tensor.from_elements` to support N-D case.
Alexander Belyaev [Thu, 16 Dec 2021 13:42:27 +0000 (14:42 +0100)]
[mlir] Extend `tensor.from_elements` to support N-D case.

RFC: https://llvm.discourse.group/t/rfc-extend-tensor-fromelementsop-to-n-d/4715

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

2 years ago[Flang][NFC] Add test with shape for allocmem and freemem
Kiran Chandramohan [Thu, 16 Dec 2021 13:39:29 +0000 (13:39 +0000)]
[Flang][NFC] Add test with shape for allocmem and freemem

Reviewed By: awarzynski

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

2 years ago[Dexter] Remove the Windows dependency on lld from CMake
OCHyams [Thu, 16 Dec 2021 13:41:29 +0000 (13:41 +0000)]
[Dexter] Remove the Windows dependency on lld from CMake

Currently, lld is marked as a dependency on Windows in
cross-project-tests/CMakeLists.txt which means CMake will fail if lld isn't
enabled. The idea of the cross-project-tests is that tests that don't have
their dependencies met should just be unsupported.

Remove the depenency from the CMake step and check whether Dexter's
platform-specific dependencies have been met in
cross-project-tests/lit.cfg.py. If the dependencies are met then add 'dexter'
to the available_features, otherwise don't and the dexter tests will be
"UNSUPPORTED".

Reviewed By: jhenderson

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

2 years ago[clang][dataflow] Fix unused-variable warning.
Yitzhak Mandelbaum [Thu, 16 Dec 2021 13:30:48 +0000 (13:30 +0000)]
[clang][dataflow] Fix unused-variable warning.

2 years ago[libc++] Add GCC workaround in std::char_traits<char>::length()
Nikolas Klauser [Wed, 15 Dec 2021 20:12:24 +0000 (21:12 +0100)]
[libc++] Add GCC workaround in std::char_traits<char>::length()

GCC currently does not allow `__builtin_strlen()` during constant evaluation. This PR adds a workaround in `std::char_traits<char>::length()`

Reviewed By: Quuxplusone, ldionne, #libc, Mordante

Spies: Mordante, libcxx-commits

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

2 years agoAllow disabling integer to floating-point narrowing conversions for cppcoreguidelines...
Paul Altin [Thu, 16 Dec 2021 13:24:09 +0000 (08:24 -0500)]
Allow disabling integer to floating-point narrowing conversions for cppcoreguidelines-narrowing-conversions

This change adds an option to disable warnings from the
cppcoreguidelines-narrowing-conversions check on integer to floating-
point conversions which may be narrowing.

An example of a case where this might be useful:
```
std::vector<double> v = {1, 2, 3, 4};
double mean = std::accumulate(v.cbegin(), v.cend(), 0.0) / v.size();
```
The conversion from std::size_t to double is technically narrowing on
64-bit systems, but v almost certainly does not have enough elements
for this to be a problem.

This option would allow the cppcoreguidelines-narrowing-conversions
check to be enabled on codebases which might otherwise turn it off
because of cases like the above.

2 years agoFix crash on invalid code involving late parsed inline methods
Aaron Ballman [Thu, 16 Dec 2021 12:57:14 +0000 (07:57 -0500)]
Fix crash on invalid code involving late parsed inline methods

When parsing the following construct, we parse it as an erroneous
deduction guide declaration and correctly diagnose the issues with it.

template<class> struct B;
struct A { B() noexcept(false); };

However, we then go on to finish late parsing the declaration and this
expects that what we've parsed is a CXXMethodDecl. A
CXXDeductionGuideDecl is not a CXXMethodDecl (it's a FunctionDecl), and
so we assert on the cast.

This fixes the crash by switching from cast<> to dyn_cast<> and not
setting up a "this" scope when the declaration is not a CXXMethodDecl.

This fixes PR49735.

2 years ago[lldb] (Semi-automatically) format .swig files
Pavel Labath [Tue, 14 Dec 2021 16:20:23 +0000 (17:20 +0100)]
[lldb] (Semi-automatically) format .swig files

I've found my recent ventures into the swig land painful because
of the strange way they are formatted. This patch attempts to alleviate
future headaches by formatting these files into something resembling the
normal llvm style.

Unfortunately, completely formatting these files automatically does not
work because clang format gets confused by swigs % syntax, so I have
employed a hybrid approach where I formatted blocks of c++ code with
clang-format and then manually massaged the code until it looked
reasonable (and compiled).

I don't expect these files to remain perfectly formatted (although, if
one's editor is configured to configure the current line/block on
request, one can get pretty good results by using it judiciously), but
at least it will prevent the (mangled form of the) old lldb style being
proliferated endlessly.

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

2 years agoRevert "[FuncSpec] Decouple cost/benefit analysis, allowing sorting of candidates."
Sjoerd Meijer [Thu, 16 Dec 2021 12:56:11 +0000 (12:56 +0000)]
Revert "[FuncSpec] Decouple cost/benefit analysis, allowing sorting of candidates."

This reverts commit 20b03d65364d963585bf16f175b367f3842f223a.

This shows some failed tests on a bot with expensive checks enabled that I need
to look at.

2 years ago[mlir] Fix Bazel build after 32fe1a8a2594
Diego Caballero [Thu, 16 Dec 2021 12:11:50 +0000 (12:11 +0000)]
[mlir] Fix Bazel build after 32fe1a8a2594

Adding missing dependences.

2 years ago[FuncSpec] Decouple cost/benefit analysis, allowing sorting of candidates.
Sjoerd Meijer [Thu, 16 Dec 2021 11:15:53 +0000 (11:15 +0000)]
[FuncSpec] Decouple cost/benefit analysis, allowing sorting of candidates.

This mostly is the same code that is refactored to decouple the cost and
benefit analysis. The biggest change is top-level function specializeFunctions
that now drives the transformation more like this:

  specializeFunctions() {
    Cost = getSpecializationCost(F);
    calculateGains(F, Cost);
    specializeFunction(F);
  }

while this is just a restructuring, it helps the functional change in
calculateGains. I.e., we now sort the candidates based on the expected
specialisation gain, which we didn't do before. For this, a book keeping struct
ArgInfo was introduced. If we have a list of N candidates, but we only want
specialise less than N as set by option -func-specialization-max-constants, we
sort the list and discard the candidates that give the least benefit.

Given a formal argument, this change results in selecting the best actual
argument(s). This is NFC'ish in that this shouldn't change the current output
(hence no test change here), but in follow ups starting with D115509, it
should and I want to go one step further and compare all functions and all
arguments, which will mostly build on top of this refactoring and change.

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

2 years ago[mlir][GPU] Extend GPU kernel outlining to generate DL specification
Diego Caballero [Thu, 16 Dec 2021 09:47:41 +0000 (09:47 +0000)]
[mlir][GPU] Extend GPU kernel outlining to generate DL specification

This patch extends the GPU kernel outlining pass so that it can take in
an optional data layout specification that will be attached to the GPU
module operation generated. If the data layout specification is not provided
the default data layout is used instead.

Reviewed By: herhut, mehdi_amini

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

2 years ago[PPC] Update test after f5f421e0eefa492.
Florian Hahn [Thu, 16 Dec 2021 11:28:26 +0000 (11:28 +0000)]
[PPC] Update test after f5f421e0eefa492.

2 years ago[CodeGen] Avoid more pointer element type accesses
Nikita Popov [Thu, 16 Dec 2021 10:12:00 +0000 (11:12 +0100)]
[CodeGen] Avoid more pointer element type accesses

2 years ago[SCEV] Apply loop guards in reverse order.
Florian Hahn [Thu, 16 Dec 2021 10:52:37 +0000 (10:52 +0000)]
[SCEV] Apply loop guards in reverse order.

This patch updates applyLoopGuards to first collect all conditions and
then applies them in reverse order. This ensures the SCEVs with the
shortest dependency chains are constructed first, limiting the required
stack size.

This fixes a crash reported in D113578.

Note that the order conditions are applied can impact the accuracy of
the result, mostly due to missing min/max simplifications when
constructing SCEVs.

The changed test highlights the impact of the evaluation order. I will
follow up with a SCEV patch to improve min/max simplifications to get
the same results for both orders.

2 years ago[CodeGen] Remove an unused MakeAddrLValue() overload (NFC)
Nikita Popov [Thu, 16 Dec 2021 10:26:13 +0000 (11:26 +0100)]
[CodeGen] Remove an unused MakeAddrLValue() overload (NFC)

This is unused and we should prefer the overloads accepting Address.

2 years ago[WebAssembly] Fix typechecking for else MCInst
Paulo Matos [Thu, 16 Dec 2021 09:45:48 +0000 (10:45 +0100)]
[WebAssembly] Fix typechecking for else MCInst

When hitting an else clause the type Stack should be reset to as it was at the start of the if, without taking into account the Type inserted into the Stack during the then branch of the if.

Reviewed By: aardappel

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

2 years agoRevert "[LoopVersioning] Allow versionLoop to create plain branch inst when no runtim...
eopXD [Thu, 16 Dec 2021 10:06:11 +0000 (02:06 -0800)]
Revert "[LoopVersioning] Allow versionLoop to create plain branch inst when no runtime check is specified"

This reverts commit fbf6c8ac1589a4be68ee549257f1d528937ac582.

2 years ago[RISCV] Precommit a test for vector copy conversion under implicit-def.
Hsiangkai Wang [Thu, 16 Dec 2021 09:14:53 +0000 (17:14 +0800)]
[RISCV] Precommit a test for vector copy conversion under implicit-def.

2 years ago[MachineVerifier] Undef subreg operands do not require subranges
Jay Foad [Wed, 8 Dec 2021 17:35:49 +0000 (17:35 +0000)]
[MachineVerifier] Undef subreg operands do not require subranges

D112556 added verification that the live interval for a subreg operand
must have subranges. This patch fixes a corner case, where if all subreg
operands for a particular register are undef uses then no subranges
are required. This matches how LiveIntervalCalc would build the live
intervals in the first place, since an undef use is not considered
to read the register.

Before this patch, CodeGen/AMDGPU/no-remat-indirect-mov.mir would fail
with -early-live-intervals:

 # After Live Interval Analysis
...
*** Bad machine code: Live interval for subreg operand has no subranges ***
- function:    index_vgpr_waterfall_loop
- basic block: %bb.1  (0x6a9a968) [352B;496B)
- instruction: 432B %24:vgpr_32 = V_MOV_B32_e32 undef %18.sub0:vreg_512, implicit $exec, implicit %18:vreg_512, implicit $m0
- operand 1:   undef %18.sub0:vreg_512

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

2 years ago[mlir][vector] Remove default value in populateVectorMultiReductionLoweringPatterns
Diego Caballero [Thu, 16 Dec 2021 09:45:34 +0000 (09:45 +0000)]
[mlir][vector] Remove default value in populateVectorMultiReductionLoweringPatterns

Having a default value for the lowering strategy of the multi-reduction op has proven
to be unexpected by users. This patch is dropping the default value so that users have
to explicitly choose the lowering strategy to be applied.

Reviewed By: nicolasvasilache

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

2 years ago[Inline] Disable deferred inlining
Nikita Popov [Fri, 10 Dec 2021 08:08:57 +0000 (09:08 +0100)]
[Inline] Disable deferred inlining

After the switch to the new pass manager, we have observed multiple
instances of catastrophic inlining, where the inliner produces huge
functions with many hundreds of thousands of instructions from small
input IR. We were forced to back out the switch to the new pass
manager for this reason. This patch fixes at least one of the root
cause issues.

LLVM uses a bottom-up inliner, and the fact that functions are processed
bottom-up is not just a question of optimality -- it is an imporant
requirement to prevent runaway inlining. The premise of the current
inlining approach and cost model is that after all calls inside a function
have been inlined, it may get large enough that inlining it into its
callers is no longer considered profitable. This safeguard does not
exist if inlining doesn't happen bottom-up, as inlining the callees,
and their callees, and their callees etc. will always seem individually
profitable, and the inliner can easily flatten the whole call tree.

There are instances where we necessarily have to deviate from bottom-up
inlining: When inlining in an SCC there is no natural "bottom", so
inlining effectively happens top-down. This requires special care,
and the inliner avoids exponential blowup by ensuring that functions
in the SCC grow in a balanced way and will eventually hit the threshold.

However, there is one instance where the inlining advisor explicitly
violates the bottom-up principle: Deferred inlining tries to "defer"
inlining a call if it determines that inlining the caller into all
its call-sites would be more profitable. Something very important to
understand about deferred inlining is that it doesn't make one inlining
choice in place of another -- it effectively chooses to do both. If we
have a call chain A -> B -> C and cost modelling tells us that inlining
B -> C is profitable, but we defer this and instead inline A -> B first,
then we'll now have a call A -> C, and the cost model will (a few special
cases notwithstanding) still tell us that this is profitable. So the end
result is that we inlined *both* B and C, even though under the usual
cost model function B would have been too large to further inline after
C has been integrated into it.

Because deferred inlining violates the bottom-up invariant of the inliner,
it can result in exponential inlining. The exponential-deferred-inlining.ll
test case illustrates this on a simple example (see
https://gist.github.com/nikic/1262b5f7d27278e1b34a190ae10947f5 for a
much more catastrophic case with about 5000x size blowup). If the call
chain A -> B -> C is not a chain but a tree of calls, then we end up
deferring inlining across the tree and end up flattening everything into
the root node.

This patch proposes to address this by disabling deferred inlining
entirely (currently still behind an option). Beyond the issue of
exponential inlining, I don't think that the whole concept makes sense,
at least as long as deferred inlining still ends up inlining both call
edges.

I believe the motivation for having deferred inlining in the first place
is that you might have a small wrapper function with local linkage that
could be eliminated if inlined. This would automatically happen if there
was a single caller, due to the large "last call to local" bonus. However,
this bonus is not extended if there are multiple callers, even if we
would eventually end up inlining into all of them (if the bonus were
extended).

Now, unlike the normal inlining cost model, the deferred inlining cost
model does look at all callers, and will extend the "last call to local"
bonus if it determines that we could inline all of them as long as we
defer the current inlining decision. This makes very little sense.
The "last call to local" bonus doesn't really cost model anything.
It's basically an "infinite" bonus that ensures we always inline the
last call to a local. The fact that it's not literally infinite just
prevents inlining of huge functions, which can easily result in
scalability issues. I very much doubt that it was an intentional
cost-modelling choice to say that getting rid of a small local function
is worth adding 15000 instructions elsewhere, yet this is exactly how
this value is getting used here.

The main alternative I see to complete removal is to change deferred
inlining to an actual either/or decision. That is, to mark deferred
calls as noinline so we're actually trading off one inlining decision
against another, and not just adding a side-channel to the cost model
to do both.

Apart from fixing the catastrophic inlining case, the effect on rustc
is a modest compile-time improvement on average (up to 8% for a
parsing-type crate, where tree-like calls are expected) and pretty
neutral where run-time performance is concerned (mix of small wins
and losses, usually in the sub-1% category).

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

2 years ago[clang][deps] Squash caches for original and minimized files
Jan Svoboda [Thu, 16 Dec 2021 08:27:12 +0000 (09:27 +0100)]
[clang][deps] Squash caches for original and minimized files

The minimizing and caching filesystem used by the dependency scanner keeps minimized and original files in separate caches.

This setup is not well suited for dealing with files that are sometimes minimized and sometimes not. Such files are being stat-ed and read twice, which is wasteful and also means the two versions of the file can get "out of sync".

This patch squashes the two caches together. When a file is stat-ed or read, its original contents are populated. If a file needs to be minimized, we give the minimizer the already loaded contents instead of reading the file again.

Reviewed By: dexonsmith

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

2 years ago[ORC] Add custom object interface support to StaticLibaryDefinitionGenerator.
Lang Hames [Thu, 16 Dec 2021 06:55:02 +0000 (17:55 +1100)]
[ORC] Add custom object interface support to StaticLibaryDefinitionGenerator.

This adds a GetObjectFileInterface callback member to
StaticLibraryDefinitionGenerator, and adds an optional argument for initializing
that member to StaticLibraryDefinitionGenerator's named constructors. If not
supplied, it will default to getObjectFileInterface from ObjectFileInterface.h.

To enable testing a `-hidden-l<x>` option is added to the llvm-jitlink tool.
This allows archives to be loaded with all contained symbol visibilities demoted
to hidden.

The ObjectLinkingLayer::setOverrideObjectFlagsWithResponsibilityFlags method is
(belatedly) hooked up, and enabled in llvm-jitlink when `-hidden-l<x>` is used
so that the demotion is also applied at symbol resolution time (avoiding any
"mismatched symbol flags" crashes).

2 years ago[llvm-jitlink] Fix a typo.
Lang Hames [Wed, 15 Dec 2021 05:58:43 +0000 (16:58 +1100)]
[llvm-jitlink] Fix a typo.

2 years ago[llvm-jitlink] Remove unused struct member.
Lang Hames [Wed, 15 Dec 2021 05:56:06 +0000 (16:56 +1100)]
[llvm-jitlink] Remove unused struct member.

2 years ago[LoopVersioning] Allow versionLoop to create plain branch inst when no runtime check...
Yueh-Ting Chen [Thu, 16 Dec 2021 08:26:20 +0000 (00:26 -0800)]
[LoopVersioning] Allow versionLoop to create plain branch inst when no runtime check is specified

After this function call, the LLVM IR would look like the following:

```
if (true)
  /* NonVersionedLoop */
else
  /* VersionedLoop */
```

Reviewed By: Whitney

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

2 years ago[llvm-c] Make LLVMConstGEP/LLVMConstInBoundsGEP opaque pointer compatible
Nikita Popov [Wed, 15 Dec 2021 08:10:18 +0000 (09:10 +0100)]
[llvm-c] Make LLVMConstGEP/LLVMConstInBoundsGEP opaque pointer compatible

Weirdly, the opaque pointer compatible variants LLVMConstGEP2 and
LLVMConstInBoundsGEP2 were already declared in the header, but not
actually implemented. This adds the missing implementations and
deprecates the incompatible functions.

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

2 years ago[clang-format] Fix tabs when using BreakBeforeTernaryOperators=false.
Marek Kurdej [Wed, 15 Dec 2021 15:34:53 +0000 (16:34 +0100)]
[clang-format] Fix tabs when using BreakBeforeTernaryOperators=false.

Fixes https://github.com/llvm/llvm-project/issues/52724.

This is rather a workaround than a correct fix. To properly fix it, we'd need to find a better way to tell when not to decrease the StartOfTokenColumn.

Reviewed By: MyDeveloperDay, owenpan

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

2 years ago[ELF] maybeReportUndefined: move sym.isUndefined() check to the caller. NFC
Fangrui Song [Thu, 16 Dec 2021 08:27:19 +0000 (00:27 -0800)]
[ELF] maybeReportUndefined: move sym.isUndefined() check to the caller. NFC

Avoid a function call in the majority of cases.

2 years ago[CodeGen] Store ElementType in LValue
Nikita Popov [Wed, 15 Dec 2021 11:08:11 +0000 (12:08 +0100)]
[CodeGen] Store ElementType in LValue

Store the pointer element type inside LValue so that we can
preserve it when converting it back into an Address. Storing the
pointer element type might not be strictly required here in that
we could probably re-derive it from the QualType (which would
require CGF access though), but storing it seems like the simpler
solution.

The global register case is special and does not store an element
type, as the value is not a pointer type in that case and it's not
possible to create an Address from it.

This is the main remaining part from D103465.

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

2 years ago[sanitizer] Update global_symbols.txt
Vitaly Buka [Thu, 16 Dec 2021 08:13:57 +0000 (00:13 -0800)]
[sanitizer] Update global_symbols.txt

2 years ago[ELF] parseSymbolVersion: remove unussed pos == 0 check
Fangrui Song [Thu, 16 Dec 2021 07:59:55 +0000 (23:59 -0800)]
[ELF] parseSymbolVersion: remove unussed pos == 0 check

2 years ago[gn build] Port db5aceb97939
LLVM GN Syncbot [Thu, 16 Dec 2021 07:22:17 +0000 (07:22 +0000)]
[gn build] Port db5aceb97939

2 years ago[NFC] Expose the ReleaseModeModelRunner
Mircea Trofin [Wed, 15 Dec 2021 00:15:32 +0000 (16:15 -0800)]
[NFC] Expose the ReleaseModeModelRunner

The type was pretty much generic, just needed a bit of parameterization.

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

2 years ago[RISCV] Fold (and (not (srl X, C)), 1) to (xor (bexti X, C), 1) when have Zbs extension.
jacquesguan [Mon, 13 Dec 2021 12:46:15 +0000 (20:46 +0800)]
[RISCV] Fold (and (not (srl X, C)), 1) to (xor (bexti X, C), 1) when have Zbs extension.

When have Zbs extension, we could use bexti to fold (and (not (srl X, C)), 1) to (xor (bexti X, C), 1).

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

2 years ago[ELF] SharedFile::parse: cache symbols size for a loop. NFC
Fangrui Song [Thu, 16 Dec 2021 06:45:27 +0000 (22:45 -0800)]
[ELF] SharedFile::parse: cache symbols size for a loop. NFC

2 years ago[libc] Disable signal.h API and its users.
Siva Chandra Reddy [Wed, 15 Dec 2021 23:24:17 +0000 (23:24 +0000)]
[libc] Disable signal.h API and its users.

The signal.h header file from LLVM libc is incorrect. The signal API and
its users will be enabled once signal.h is fixed.

2 years ago[ELF] Move -l -L canonical and --library-path --library aliases
Fangrui Song [Thu, 16 Dec 2021 05:49:53 +0000 (21:49 -0800)]
[ELF] Move -l -L canonical and --library-path --library aliases

Everyone uses -l -L instead of the long option counterparts.
Make help messages attach to -L -l and (--reproduce) use them for response.txt
command line options.

2 years ago[LoopIdiom] Use utility from SE instead of local rewriter
eopXD [Wed, 15 Dec 2021 07:00:01 +0000 (23:00 -0800)]
[LoopIdiom] Use utility from SE instead of local rewriter

ScalarEvolution::applyLoopGuards shall do the work.

Reviewed By: reames

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