platform/upstream/llvm.git
3 years ago[AMDGPU] Better codegen for i64 bitreverse
Jay Foad [Fri, 26 Feb 2021 13:40:03 +0000 (13:40 +0000)]
[AMDGPU] Better codegen for i64 bitreverse

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

3 years ago[llvm][utils] Rename lldb dict variables to internal_dict
Dave Lee [Fri, 26 Feb 2021 15:45:04 +0000 (07:45 -0800)]
[llvm][utils] Rename lldb dict variables to internal_dict

Most lldb scripts use `internal_dict`. Also, `dict` is a builtin constructor,
it's good habit to avoid using it as a variable name.

3 years ago[llvm][utils] Support dereferencing llvm::Optional lldb formatter
Dave Lee [Mon, 22 Feb 2021 05:45:04 +0000 (21:45 -0800)]
[llvm][utils] Support dereferencing llvm::Optional lldb formatter

Add deref support to `llvm::Optional` in `lldbDataFormatters.py`.

This creates a synthetic provider that adds dereference support, but otherwise proxies all access to the underlying value.

With this change, an optional value can be displayed by running `v *someOptional`, and its contents can be accessed with the arrow `operator->`, for example `v someOpt->HasThing`. This matches expressions usable from expression evaluation.

See also D97165 and D97524.

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

3 years ago[lldb] Add deref support to libc++ unique_ptr synthetic
Dave Lee [Thu, 25 Feb 2021 21:27:22 +0000 (13:27 -0800)]
[lldb] Add deref support to libc++ unique_ptr synthetic

Add frame variable dereference suppport to libc++ `std::unique_ptr`.

This change allows for commands like `v *thing_up` and `v thing_up->m_id`. These commands now work the same way they would with raw pointers, and as they would with expression. This is done by adding an unaccounted for child member named `$$dereference$$`.

Without this change, the command would have to be written as `v *thing_up.__value_` or v thing_up.__value_->m_id` which exposes internal structure and is more clumsy to type.

Additionally, the existing tests were updated. See also https://reviews.llvm.org/D97165 which added deref support for `std::shared_ptr`.

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

3 years ago[ADT][NFC] Add extra typedefs to `ArrayRef` and `MutableArrayRef`
Vladislav Vinogradov [Thu, 28 Jan 2021 12:51:58 +0000 (15:51 +0300)]
[ADT][NFC] Add extra typedefs to `ArrayRef` and `MutableArrayRef`

* `value_type`
* `pointer`
* `const_pointer`
* `reference`
* `const_reference`
* `const_reverse_iterator`
* `size_type`
* `difference_type`

It makes `ArrayRef` and `MutableArrayRef` types fully compliant with STL Container concept.

Reviewed By: lattner, courbet

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

3 years ago[libc++] Remove the now unused macos-trunk and macos-backdeployment CI scripts
Louis Dionne [Fri, 26 Feb 2021 15:26:33 +0000 (10:26 -0500)]
[libc++] Remove the now unused macos-trunk and macos-backdeployment CI scripts

We use the run-buildbot script everywhere now.

3 years ago[mlir][linalg] Add pooling ops to Linalg TC ops.
Hanhan Wang [Fri, 26 Feb 2021 15:17:02 +0000 (07:17 -0800)]
[mlir][linalg] Add pooling ops to Linalg TC ops.

- Add EDSC builders for std_cmpf_ogt and std_cmpf_olt.
- Add pooling_nhwc_min/max/sum ops

Depends On D97384

Reviewed By: nicolasvasilache

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

3 years ago[Utils] collectBitParts - bail for integers > 128-bits
Simon Pilgrim [Fri, 26 Feb 2021 14:55:02 +0000 (14:55 +0000)]
[Utils] collectBitParts - bail for integers > 128-bits

collectBitParts uses int8_t for the bit indices, leaving a 128-bit limit.

We already test for this before calling collectBitParts, but rGb94c215592bd added truncate handling which meant we could end up processing wider integers.

Thanks to @manojgupta for the repro.

3 years ago[mlir][linalg] Allow TC ops taking an unused shaped operand.
Hanhan Wang [Fri, 26 Feb 2021 14:45:08 +0000 (06:45 -0800)]
[mlir][linalg] Allow TC ops taking an unused shaped operand.

If one operand is not used in the formula, it will be considered a
shaped operand. And the result of indexing map of the operand will be the first
reduction dims.

Depends On D97383

Reviewed By: nicolasvasilache

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

3 years ago[mlir] Silence some deprecation warnings after dffc487b07d9a50f8c65eccb9241f72af3486c79
Benjamin Kramer [Fri, 26 Feb 2021 14:14:16 +0000 (15:14 +0100)]
[mlir] Silence some deprecation warnings after dffc487b07d9a50f8c65eccb9241f72af3486c79

3 years ago[libcxxabi] Fewer assumptions about path from libcxx to libcxxabi
Nico Weber [Fri, 26 Feb 2021 14:00:32 +0000 (09:00 -0500)]
[libcxxabi] Fewer assumptions about path from libcxx to libcxxabi

This is useful for projects that pull in libcxx and libcxxabi and build
them using out-of-tree build files, but don't make them sibling
directories (or don't call the sibling directories libcxx and libcxxabi
for some reason).

Fixes PR49313.

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

3 years ago[clangd][remote] Add flag to set idletimeout
Kadir Cetinkaya [Mon, 22 Feb 2021 08:49:08 +0000 (09:49 +0100)]
[clangd][remote] Add flag to set idletimeout

By default gRPC has no idletimeout and some firewalls might drop idle
connections after a certain period. This results in idle clients
shouting into void until server resets the connection.

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

3 years ago[X86] Allow PTILEZEROV and PTILELOADDV to be rematerializable
Wang, Pengfei [Fri, 26 Feb 2021 13:20:03 +0000 (21:20 +0800)]
[X86] Allow PTILEZEROV and PTILELOADDV to be rematerializable

Spilling and reloading AMX registers are expensive. We allow PTILEZEROV
and PTILELOADDV to be rematerializable to avoid the register spilling.

Reviewed By: LuoYuanke

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

3 years ago[mlir] Replace deprecated 'getAttrs'
Marius Brehler [Fri, 26 Feb 2021 13:28:32 +0000 (13:28 +0000)]
[mlir] Replace deprecated 'getAttrs'

'getAttrs' has been explicitly marked deprecated. This patch refactors
to use Operation::getAttrs().

Reviewed By: csigg

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

3 years ago[InstCombine] Avoid redundant or out-of-order debug value sinking
Stephen Tozer [Fri, 26 Feb 2021 13:04:33 +0000 (13:04 +0000)]
[InstCombine] Avoid redundant or out-of-order debug value sinking

This patch modifies TryToSinkInstruction in the InstCombine pass, to prevent
redundant debug intrinsics from being produced, and also prevent the intrinsics
from being emitted in an incorrect order. It does this by ensuring that when
this pass sinks an instruction and creates clones of the debug intrinsics that
use that instruction, it inserts those debug intrinsics in their original order,
and only inserts the last debug intrinsic for each variable in the Instruction's
block.

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

3 years agoRevert "[NARY-REASSOCIATE] Support reassociation of min/max"
Evgeniy Brevnov [Fri, 26 Feb 2021 12:23:32 +0000 (19:23 +0700)]
Revert "[NARY-REASSOCIATE] Support reassociation of min/max"

This reverts commit 83d134c3c4222e8b8d3d90c099f749a3b3abc8e0.

3 years ago[clang][cli] Implement '-cuid=' marshalling
Jan Svoboda [Thu, 25 Feb 2021 12:20:59 +0000 (13:20 +0100)]
[clang][cli] Implement '-cuid=' marshalling

This patch adds marshalling to the `-cuid=` option introduced in D95007.

Reviewed By: Bigcheese

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

3 years ago[clang][cli] Fix build failure in CompilerInvocation
Jan Svoboda [Fri, 26 Feb 2021 11:54:42 +0000 (12:54 +0100)]
[clang][cli] Fix build failure in CompilerInvocation

There is a report that https://reviews.llvm.org/D96280 causes a build failure with error: too few template arguments for class template 'SmallVector'. This patch attempts to fix that by explicitly specifying N for SmallVector<T, N>.

3 years ago[Orc] Use extensible RTTI for the orc::ObjectLayer class hierarchy
Stefan Gränitz [Fri, 26 Feb 2021 12:11:57 +0000 (13:11 +0100)]
[Orc] Use extensible RTTI for the orc::ObjectLayer class hierarchy

So far we had no way to distinguish between JITLink and RuntimeDyld in lli. Instead, we used implicit knowledge that RuntimeDyld would be used for linking ELF. In order to get D97337 to work with lli though, we have to move on and allow JITLink for ELF. This patch uses extensible RTTI to allow external clients to add their own layers without touching the LLVM sources.

Reviewed By: lhames

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

3 years ago[X86] Remove unnecessary custom lowering of vXi1 SADDSAT/SSUBSAT/UADDSAT/USUBSAT
Simon Pilgrim [Fri, 26 Feb 2021 12:10:10 +0000 (12:10 +0000)]
[X86] Remove unnecessary custom lowering of vXi1 SADDSAT/SSUBSAT/UADDSAT/USUBSAT

As discussed on D97478. The removal of the custom tag causes some changes in the add/sub-overflow expansion as it no longer expands to sat-arith codegen.

3 years ago[Driver] Flush file in locked area
Serge Pavlov [Fri, 26 Feb 2021 10:44:29 +0000 (17:44 +0700)]
[Driver] Flush file in locked area

When writing report file by option -proc-stat-report some part of output
can be written to unlocked file because destructor of raw_fd_ostream
calls `flush()`. In high thread contention environment it can result in
file operation failure. With this change `flush` is called explicitly when
file is locked, so call of `flush()` in the destructor does not cause
write to file.

3 years ago[docs][JITLink] Few typo fixes in JITLink design/API doc
Stefan Gränitz [Fri, 26 Feb 2021 11:56:31 +0000 (12:56 +0100)]
[docs][JITLink] Few typo fixes in JITLink design/API doc

3 years ago[DAG] Fold vXi1 multiplies -> and
Simon Pilgrim [Fri, 26 Feb 2021 11:45:59 +0000 (11:45 +0000)]
[DAG] Fold vXi1 multiplies -> and

This allows us to remove X86 custom lowering of vXi1 MUL, which helps simplify a load of mask math.

Mentioned in D97478 post review.

3 years ago[X86] Remove unnecessary custom lowering of v16i1/v32i1 ADD/SUB
Simon Pilgrim [Fri, 26 Feb 2021 11:10:54 +0000 (11:10 +0000)]
[X86] Remove unnecessary custom lowering of v16i1/v32i1 ADD/SUB

These were missed in D97478

3 years ago[mlir] Mark OpState::removeAttr() deprecated.
Christian Sigg [Fri, 26 Feb 2021 09:08:40 +0000 (10:08 +0100)]
[mlir] Mark OpState::removeAttr() deprecated.

Fix call sites.

The method will be removed 2 weeks later.

Reviewed By: rriddle

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

3 years ago[DAG] expandAddSubSat - break if-else chain. NFCI.
Simon Pilgrim [Fri, 26 Feb 2021 10:59:54 +0000 (10:59 +0000)]
[DAG] expandAddSubSat - break if-else chain. NFCI.

Fix styleguide issue - each if() block always returns so we don't need to make them a if-else chain.

3 years ago[Test] Two more interesting test cases & their codegen counterparts
Max Kazantsev [Fri, 26 Feb 2021 10:19:50 +0000 (17:19 +0700)]
[Test] Two more interesting test cases & their codegen counterparts

3 years ago[MLIR][affine] Certain Call Ops to prevent fusion
Vinayaka Bandishti [Fri, 26 Feb 2021 09:56:12 +0000 (15:26 +0530)]
[MLIR][affine] Certain Call Ops to prevent fusion

Fixes a bug in affine fusion pipeline where an incorrect fusion is performed
despite a Call Op that potentially modifies memrefs under consideration
exists between source and target.

Fixes part of https://bugs.llvm.org/show_bug.cgi?id=49220

Reviewed By: bondhugula, dcaballe

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

3 years ago[RISCV] Use existing method for the LMUL1 type. NFCI.
Fraser Cormack [Thu, 25 Feb 2021 14:23:59 +0000 (14:23 +0000)]
[RISCV] Use existing method for the LMUL1 type. NFCI.

Reviewed By: craig.topper

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

3 years ago[llvm-exegesis][X86] Ignore a few unmeasurable opcodes.
Clement Courbet [Mon, 2 Nov 2020 14:01:21 +0000 (15:01 +0100)]
[llvm-exegesis][X86] Ignore a few unmeasurable opcodes.

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

3 years ago[Sema] Fix MSVC "attribute is not recognized" warning (NFC)
Yang Fan [Fri, 26 Feb 2021 09:27:44 +0000 (17:27 +0800)]
[Sema] Fix MSVC "attribute is not recognized" warning (NFC)

MSVC warning:
```
\llvm-project\clang\lib\Sema\SemaChecking.cpp(10323): warning C5030: attribute 'clang::fallthrough' is not recognized
```

3 years ago[Test] Add one more test with corner cases for non-wrapping IVs
Max Kazantsev [Fri, 26 Feb 2021 08:44:06 +0000 (15:44 +0700)]
[Test] Add one more test with corner cases for non-wrapping IVs

3 years ago[Basic] Fix Wreturn-type gcc warning (NFC)
Yang Fan [Fri, 26 Feb 2021 09:14:13 +0000 (17:14 +0800)]
[Basic] Fix Wreturn-type gcc warning (NFC)

3 years ago[clang][NFC] Extract Target and AuxTarget creation in CompilerInstance to new function
Yu-Hsun Chiang [Fri, 26 Feb 2021 08:12:32 +0000 (09:12 +0100)]
[clang][NFC] Extract Target and AuxTarget creation in CompilerInstance to new function

As @sammccall mentioned in [[ https://reviews.llvm.org/D97109 | D97109 ]], I've extract the logic of creating Target and AuxTarget into a new function called `createTargetAndAuxTarget`.

Since there are many similar code in clang or other related tools, consolidating them into a single function may help others to maintain the logic handling target related things.

Reviewed By: sammccall

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

3 years ago[clang-format] [PR19056] Add support for access modifiers indentation
Jakub Budiský [Fri, 26 Feb 2021 08:05:35 +0000 (09:05 +0100)]
[clang-format] [PR19056] Add support for access modifiers indentation

Adds support for coding styles that make a separate indentation level for access modifiers, such as Code::Blocks or QtCreator.

The new option, `IndentAccessModifiers`, if enabled, forces the content inside classes, structs and unions (“records”) to be indented twice while removing a level for access modifiers. The value of `AccessModifierOffset` is disregarded in this case, aiming towards an ease of use.

======
The PR (https://bugs.llvm.org/show_bug.cgi?id=19056) had an implementation attempt by @MyDeveloperDay already (https://reviews.llvm.org/D60225) but I've decided to start from scratch. They differ in functionality, chosen approaches, and even the option name. The code tries to re-use the existing functionality to achieve this behavior, limiting possibility of breaking something else.

Reviewed By: MyDeveloperDay, curdeius, HazardyKnusperkeks

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

3 years ago[mlir] Remove some rarely used OpState members and use Operation members instead.
Christian Sigg [Thu, 25 Feb 2021 21:20:45 +0000 (22:20 +0100)]
[mlir] Remove some rarely used OpState members and use Operation members instead.

Skipping the deprecation dance here.

Reviewed By: rriddle

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

3 years ago[Driver] Don't pass -ffile-compilation-dir through to cc1
Petr Hosek [Fri, 26 Feb 2021 06:27:18 +0000 (22:27 -0800)]
[Driver] Don't pass -ffile-compilation-dir through to cc1

This is a driver only flag so it has to be expanded when invoking cc1.

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

3 years ago[RISCV] Add test cases for fixed vector extract element with non-constant index. NFC
Craig Topper [Fri, 26 Feb 2021 05:16:47 +0000 (21:16 -0800)]
[RISCV] Add test cases for fixed vector extract element with non-constant index. NFC

3 years ago[MC] Allow .cfi_sections with empty section list
Fangrui Song [Fri, 26 Feb 2021 06:29:49 +0000 (22:29 -0800)]
[MC] Allow .cfi_sections with empty section list

GNU as supports this. This mode silently ignores
.cfi_startproc/.cfi_endproc and .cfi_* in between.

Also drop a diagnostic `in '.cfi_sections' directive`: the diagnostic
already includes the line and it is clear the line is a `.cfi_sections` directive.

3 years ago[Driver] Rename -fprofile-{prefix-map,compilation-dir} to -fcoverage-{prefix-map...
Petr Hosek [Thu, 25 Feb 2021 03:04:36 +0000 (19:04 -0800)]
[Driver] Rename -fprofile-{prefix-map,compilation-dir} to -fcoverage-{prefix-map,compilation-dir}

These flags affect coverage mapping (-fcoverage-mapping), not
-fprofile-[instr-]generate so it makes more sense to use the
-fcoverage-* prefix.

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

3 years ago[Driver] Create -ffile-compilation-dir alias
Petr Hosek [Thu, 25 Feb 2021 01:48:27 +0000 (17:48 -0800)]
[Driver] Create -ffile-compilation-dir alias

We introduce -ffile-compilation-dir shorthand to avoid having to set
-fdebug-compilation-dir and -fprofile-compilation-dir separately. This
is similar to -ffile-prefix-map.

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

3 years ago[X86] Use correct padding when in 16-bit mode
Bill Wendling [Tue, 23 Feb 2021 20:39:39 +0000 (12:39 -0800)]
[X86] Use correct padding when in 16-bit mode

In 16-bit mode, some of the nop patterns used in 32-bit mode can end up
mangling other instructions. For instance, an aligned "movz" instruction
may have the 0x66 and 0x67 prefixes omitted, because the nop that's used
messes things up.

       xorl    %ebx, %ebx
       .p2align 4, 0x90
       movzbl  (%esi,%ebx), %ecx

Use instead nop patterns we know 16-bit mode can handle.

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

3 years ago[llvm-dwarfdump] StringMap -> MapVector to make iteration order stable
Fangrui Song [Fri, 26 Feb 2021 04:05:05 +0000 (20:05 -0800)]
[llvm-dwarfdump] StringMap -> MapVector to make iteration order stable

Exposed by D97396

3 years ago[Scalar] Use range-based for loops (NFC)
Kazu Hirata [Fri, 26 Feb 2021 03:54:38 +0000 (19:54 -0800)]
[Scalar] Use range-based for loops (NFC)

3 years ago[TableGen] Use ListSeparator (NFC)
Kazu Hirata [Fri, 26 Feb 2021 03:54:36 +0000 (19:54 -0800)]
[TableGen] Use ListSeparator (NFC)

3 years ago[flang][fir] Add array value operations.
Eric Schweitz [Wed, 24 Feb 2021 16:02:58 +0000 (08:02 -0800)]
[flang][fir] Add array value operations.

We lower expressions with rank > 0 to a set of high-level array operations.
These operations are then analyzed and refined to more primitve
operations in subsequent pass(es).

This patch upstreams these array operations and some other helper ops.

Authors: Eric Schweitz, Rajan Walia, Kiran Chandramohan, et.al.

https://github.com/flang-compiler/f18-llvm-project/pull/565

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

3 years agoFix signed-compare warning.
Justin Lebar [Fri, 26 Feb 2021 02:14:40 +0000 (18:14 -0800)]
Fix signed-compare warning.

Introduced in my c90dac27e94ec354a3e8919556ac5bc89b62c731.

3 years agoRevert [MLIR][TOSA] Added Tosa to Standard/SCF Lowerings (const, if, while)
Rob Suderman [Fri, 26 Feb 2021 02:04:34 +0000 (18:04 -0800)]
Revert [MLIR][TOSA] Added Tosa to Standard/SCF Lowerings (const, if, while)

This reverts commit a813e9be5bc91203508bde239c1a15c5b8f8c0cc.

Results in an ASAN failure due to bypassing rewriter.

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

3 years ago[debug-info] refactor emitDwarfUnitLength
Chen Zheng [Fri, 26 Feb 2021 01:39:45 +0000 (20:39 -0500)]
[debug-info] refactor emitDwarfUnitLength

remove `Hi` `Lo` argument from `emitDwarfUnitLength`, so we
can make caller of emitDwarfUnitLength easier.

Reviewed By: MaskRay, dblaikie, ikudrin

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

3 years ago[clang] Print 32 candidates on the first failure, with -fshow-overloads=best.
Justin Lebar [Sun, 31 Jan 2021 03:00:24 +0000 (19:00 -0800)]
[clang] Print 32 candidates on the first failure, with -fshow-overloads=best.

Previously, -fshow-overloads=best always showed 4 candidates.  The
problem is, when this isn't enough, you're kind of up a creek; the only
option available is to recompile with different flags.  This can be
quite expensive!

With this change, we try to strike a compromise.  The *first* error with
more than 4 candidates will show up to 32 candidates.  All further
errors continue to show only 4 candidates.

The hope is that this way, users will have *some chance* of making
forward progress, without facing unbounded amounts of error spam.

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

3 years agoRevert 7a0da8894348, "scudo: Support memory tagging in the secondary allocator."
Peter Collingbourne [Fri, 26 Feb 2021 00:50:02 +0000 (16:50 -0800)]
Revert 7a0da8894348, "scudo: Support memory tagging in the secondary allocator."

We measured a 2.5 seconds (17.5%) regression in Android boot time
performance with this change.

3 years ago[RISCV] Support fixed vector extract_element for FP types.
Craig Topper [Fri, 26 Feb 2021 00:30:21 +0000 (16:30 -0800)]
[RISCV] Support fixed vector extract_element for FP types.

3 years ago[ELF] Add -z start-stop-gc to let __start_/__stop_ not retain C identifier name sections
Fangrui Song [Thu, 25 Feb 2021 23:46:37 +0000 (15:46 -0800)]
[ELF] Add -z start-stop-gc to let __start_/__stop_ not retain C identifier name sections

For one metadata section usage, each text section references a metadata section.
The metadata sections have a C identifier name to allow the runtime to collect them via `__start_/__stop_` symbols.

Since `__start_`/`__stop_` references are always present from live sections, the
C identifier name sections appear like GC roots, which means they cannot be
discarded by `ld --gc-sections`.

To make such sections GCable, either SHF_LINK_ORDER or a section group is needed.

SHF_LINK_ORDER is not suitable for the references can be inlined into other functions
(See D97430:
Function A (in the section .text.A) references its `__sancov_guard` section.
Function B inlines A (so now .text.B references `__sancov_guard` - this is invalid with the semantics of SHF_LINK_ORDER).

In the linking stage,
if `.text.A` gets discarded, and `__sancov_guard` is retained via the reference from `.text.B`,
the output will be invalid because `__sancov_guard` references the discarded `.text.A`.
LLD errors "sh_link points to discarded section".
)

A section group have size overhead, and is cumbersome when there is just one metadata section.

Add `-z start-stop-gc` to drop the "__start_/__stop_ references retain
non-SHF_LINK_ORDER non-SHF_GROUP C identifier name sections" rule.
We reserve the rights to switch the default in the future.

Reviewed By: phosek, jrtc27

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

3 years agoBPF: Add LLVMTransformUtils in CMakefile LINK_COMPONENTS
Yonghong Song [Thu, 25 Feb 2021 23:34:48 +0000 (15:34 -0800)]
BPF: Add LLVMTransformUtils in CMakefile LINK_COMPONENTS

Commit 1959ead525b8 ("BPF: Implement TTI.getCmpSelInstrCost()
properly") introduced a dependency on LLVMTransformUtils
library. Let us encode this dependency explicitly in
CMakefile to avoid build error.

3 years ago[Android] Use -l:libunwind.a with --rtlib=compiler-rt
Ryan Prichard [Wed, 10 Feb 2021 09:25:58 +0000 (01:25 -0800)]
[Android] Use -l:libunwind.a with --rtlib=compiler-rt

On Android, the unwinder isn't part of the C++ STL and isn't (in older
versions) exported from libc.so. Instead, the driver links the static
unwinder archive implicitly. Currently, the Android NDK implicitly
links libgcc.a to provide both builtins and the unwinder.

To support switching to compiler-rt builtins and libunwind, make
--rtlib=compiler-rt behave the same way on Android, and implicitly pass
-l:libunwind.a to the linker.

Adjust the -ldl logic. For the Android NDK, the unwinder (whether
libgcc.a or libunwind.a) is linked statically and calls a function in
the dynamic loader for finding unwind tables (e.g. dl_iterate_phdr).
On Android, this function is in libc.a for static executables and
libdl.so otherwise, so -ldl is needed. (glibc doesn't need -ldl because
its libc.so exports dl_iterate_phdr.)

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

3 years ago[dfsan] Conservative solution to atomic load/store
Jianzhou Zhao [Tue, 23 Feb 2021 16:48:26 +0000 (16:48 +0000)]
[dfsan] Conservative solution to atomic load/store

DFSan at store does store shadow data; store app data; and at load does
load shadow data; load app data.

When an application data is atomic, one overtainting case is

thread A: load shadow
thread B: store shadow
thread B: store app
thread A: load app

If the application address had been used by other flows, thread A reads
previous shadow, causing overtainting.

The change is similar to MSan's solution.
1) enforce ordering of app load/store
2) load shadow after load app; store shadow before shadow app
3) do not track atomic store by reseting its shadow to be 0.
The last one is to address a case like this.

Thread A: load app
Thread B: store shadow
Thread A: load shadow
Thread B: store app

This approach eliminates overtainting as a trade-off between undertainting
flows via shadow data race.

Note that this change addresses only native atomic instructions, but
does not support builtin libcalls yet.
   https://llvm.org/docs/Atomics.html#libcalls-atomic

Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D97310

3 years ago[Clang][ASan] Correct AsanDtorKindToString to return non-void in default case
Kostya Kortchinsky [Thu, 25 Feb 2021 21:30:40 +0000 (13:30 -0800)]
[Clang][ASan] Correct AsanDtorKindToString to return non-void in default case

Post D96572, a warning started showing up for me:
`clang/lib/Basic/Sanitizers.cpp:73:1: warning: control reaches end of non-void function [-Wreturn-type]`

So this adds a default to the case to return invalid, which seems appropriate,
and appears to correct the issue.

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

3 years agoAdd Alignment argument to IRBuilder CreateAtomicRMW and CreateAtomicCmpXchg.
James Y Knight [Tue, 9 Feb 2021 04:07:12 +0000 (23:07 -0500)]
Add Alignment argument to IRBuilder CreateAtomicRMW and CreateAtomicCmpXchg.

And then push those change throughout LLVM.

Keep the old signature in Clang's CGBuilder for now -- that will be
updated in a follow-on patch (D97224).

The MLIR LLVM-IR dialect is not updated to support the new alignment
attribute, but preserves its existing behavior.

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

3 years ago[gn build] Port 4753a69a316b
LLVM GN Syncbot [Thu, 25 Feb 2021 23:16:39 +0000 (23:16 +0000)]
[gn build] Port 4753a69a316b

3 years ago[Remarks] Provide more information about auto-init calls
Francis Visoiu Mistrih [Thu, 25 Feb 2021 17:49:53 +0000 (09:49 -0800)]
[Remarks] Provide more information about auto-init calls

This now analyzes calls to both intrinsics and functions.

For intrinsics, grab the ones we know and care about (mem* family) and
analyze the arguments.

For calls, use TLI to get more information about the libcalls, then
analyze the arguments if known.

```
auto-init.c:4:7: remark: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 4096 bytes. [-Rpass-missed=annotation-remarks]
  int var[1024];
      ^
```

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

3 years ago[Remarks] Provide more information about auto-init stores
Francis Visoiu Mistrih [Wed, 24 Feb 2021 21:19:39 +0000 (13:19 -0800)]
[Remarks] Provide more information about auto-init stores

This adds support for analyzing the instruction with the !annotation
"auto-init" in order to generate a more user-friendly remark.

For now, support the store size, and whether it's atomic/volatile.

Example:

```
auto-init.c:4:7: remark: Store inserted by -ftrivial-auto-var-init.Store size: 4 bytes. [-Rpass-missed=annotation-remarks]
  int var;
      ^
```

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

3 years ago[Remarks] Emit remarks for "auto-init" !annotations
Francis Visoiu Mistrih [Wed, 24 Feb 2021 19:17:19 +0000 (11:17 -0800)]
[Remarks] Emit remarks for "auto-init" !annotations

Using the !annotation metadata, emit remarks pointing to code added by
`-ftrivial-auto-var-init` that survived the optimizer.

Example:

```
auto-init.c:4:7: remark: Initialization inserted by -ftrivial-auto-var-init. [-Rpass-missed=annotation-remarks]
  int buf[1024];
      ^
```

The tests are testing various situations like calls/stores/other
instructions, with debug locations, and extra debug information on
purpose: more patches will come to improve the reporting to make it more
user-friendly, and these tests will show how the reporting evolves.

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

3 years agoAdd more historic DWARF vendor extensions
Adrian Prantl [Wed, 24 Feb 2021 01:52:21 +0000 (17:52 -0800)]
Add more historic DWARF vendor extensions

The maintainer of libdwarf kindly provided this patch with a bunch of
historic DWARF extensions that are missing from Dwarf.def. This list
is helpful to avoid potential conflicts in the user-defined vendor
extension space in the future.

Patch by David Anderson!

[Relanded with an updated test.]

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

3 years ago[Clang][Attributes] Allow not_tail_called attribute to be applied to virtual function.
Zequan Wu [Wed, 17 Feb 2021 02:45:56 +0000 (18:45 -0800)]
[Clang][Attributes] Allow not_tail_called attribute to be applied to virtual function.

It would be beneficial to allow not_tail_called attribute to be applied to
virtual functions. I don't see any drawback of allowing this.

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

3 years agoBPF: Implement TTI.getCmpSelInstrCost() properly
Yonghong Song [Wed, 24 Feb 2021 18:02:48 +0000 (10:02 -0800)]
BPF: Implement TTI.getCmpSelInstrCost() properly

The Select insn in BPF is expensive as BPF backend
needs to resolve with conditionals.  This patch set
the getCmpSelInstrCost() to SCEVCheapExpansionBudget
for Select insn to prevent some Select insn related
optimizations.

This change is motivated during bcc code review for
   https://github.com/iovisor/bcc/pull/3270
where IndVarSimplifyPass eventually caused generating
the following asm code:
  ;       for (i = 0; (i < VIRTIO_MAX_SGS) && (i < num); i++) {
      14:       16 05 40 00 00 00 00 00 if w5 == 0 goto +64 <LBB0_6>
      15:       bc 51 00 00 00 00 00 00 w1 = w5
      16:       04 01 00 00 ff ff ff ff w1 += -1
      17:       67 05 00 00 20 00 00 00 r5 <<= 32
      18:       77 05 00 00 20 00 00 00 r5 >>= 32
      19:       a6 01 01 00 05 00 00 00 if w1 < 5 goto +1 <LBB0_4>
      20:       b7 05 00 00 06 00 00 00 r5 = 6
  00000000000000a8 <LBB0_4>:
      21:       b7 02 00 00 00 00 00 00 r2 = 0
      22:       b7 01 00 00 00 00 00 00 r1 = 0
  ;       for (i = 0; (i < VIRTIO_MAX_SGS) && (i < num); i++) {
      23:       7b 1a e0 ff 00 00 00 00 *(u64 *)(r10 - 32) = r1
      24:       7b 5a c0 ff 00 00 00 00 *(u64 *)(r10 - 64) = r5
Note that insn #15 has w1 = w5 and w1 is refined later but r5(w5) is
eventually saved on stack at insn #24 for later use. This cause
later verifier failures.

With this change, IndVarSimplifyPass won't do the above
transformation any more.

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

3 years ago[www] Add cxx_status tracking for C++23.
Richard Smith [Thu, 25 Feb 2021 22:47:02 +0000 (14:47 -0800)]
[www] Add cxx_status tracking for C++23.

Convert the list of standards to a table; it's starting to get unwieldy.

3 years ago[MLIR][TOSA] Added Tosa to Standard/SCF Lowerings (const, if, while)
Rob Suderman [Thu, 25 Feb 2021 22:34:49 +0000 (14:34 -0800)]
[MLIR][TOSA] Added Tosa to Standard/SCF Lowerings (const, if, while)

Includes a lowering for tosa.const, tosa.if, and tosa.while to Standard/SCF dialects. TosaToStandard is
used for constant lowerings and TosaToSCF handles the if/while ops.

Reviewed By: silvas

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

3 years agoFix constructor declarations that are invalid in C++20 onwards.
Richard Smith [Tue, 23 Feb 2021 22:07:13 +0000 (14:07 -0800)]
Fix constructor declarations that are invalid in C++20 onwards.

Under C++ CWG DR 2237, the constructor for a class template C must be
written as 'C(...)' not as 'C<T>(...)'. This fixes a build failure with
GCC in C++20 mode.

In passing, remove some other redundant '<T>' qualification from the
affected classes.

3 years ago[libcxx] Use the allocating form of getcwd() on Glibc and Apple platforms
Martin Storsjö [Thu, 25 Feb 2021 12:12:46 +0000 (14:12 +0200)]
[libcxx] Use the allocating form of getcwd() on Glibc and Apple platforms

This avoids having to query pathconf for a max size for
preallocating a buffer for the return value.

This is an extension to the POSIX getcwd() spec.

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

3 years ago[libcxx] [test] Add a MinGW target
Martin Storsjö [Thu, 22 Oct 2020 18:33:10 +0000 (21:33 +0300)]
[libcxx] [test] Add a MinGW target

This can't easily be autodetected (unless LIBCXX_TARGET_TRIPLE is
specified, or unless we query what the compiler's default target is,
which only is supported by clang), but can be chosen manually via
LIBCXX_TARGET_INFO.

This chooses mingw style lib naming, and uses -nostdlibc++ instead
of -nodefaultlib -nostdlib (as the latter requires specifying a lot of
details manually - this is done in the cmake config though).

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

3 years ago[libcxx] [cmake] Add asm to the runtimes build languages
Martin Storsjö [Wed, 24 Feb 2021 13:51:24 +0000 (15:51 +0200)]
[libcxx] [cmake] Add asm to the runtimes build languages

This fixes building libunwind with a new enough version of cmake.

(libunwind treats its asm sources as C depending on the cmake version
on some platforms; this fixes builds when such workarounds aren't used,
when cmake treats asm correctly on its own.)

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

3 years ago[libcxx] [test] Ifdef out uses of create_fifo on windows
Martin Storsjö [Mon, 19 Oct 2020 07:57:36 +0000 (10:57 +0300)]
[libcxx] [test] Ifdef out uses of create_fifo on windows

Restructure code in directory_entry.obs/file_type_obs.pass.cpp
and directory_entry.obs/hard_link_count.pass.cpp to reduce the
amount of ifdeffery needed.

In file_type_obs.pass.cpp, we can't inline the calls to
env.create_* into the lambda calls (e.g. "test_path(env.create_*())"),
because the lambda removes the referenced file, and the hardlink
must be created while the earlier test file exists.

In hard_link_count.pass.cpp, move restoration of the original
directory permissions to the end of the lambda, so that new
directory entries can be created after the lambda has run once.

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

3 years ago[libcxx] [test] Use string().c_str() to convert a std::filesystem::path to a const...
Martin Storsjö [Thu, 25 Feb 2021 10:53:39 +0000 (12:53 +0200)]
[libcxx] [test] Use string().c_str() to convert a std::filesystem::path to a const char*

On Windows, path::value_type is wchar_t, so one can't pass the return
value of path::c_str() directly to std::remove().

This matches what was done for tests under std/input.output/filesystems
in 81db3c31aafec72f1cfec2a9da4381ece7f97a29 and
3784bdf2176f38cc30134fab776efb43506c0c54.

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

3 years ago[PM] Show the pass argument in pre/post-pass IR dumps
Nicolas Guillemot [Thu, 25 Feb 2021 19:56:48 +0000 (11:56 -0800)]
[PM] Show the pass argument in pre/post-pass IR dumps

This patch adds each pass' pass argument in the header for IR dumps.
For example:

Before:

```
    *** IR Dump Before InstructionSelect ***
```

After:

```
    *** IR Dump Before InstructionSelect (instruction-select) ***
```

The goal is to make it easier to know what argument to pass to
command line options like `debug-only` or `run-pass` to further
investigate a given pass.

3 years ago[OpenMP] libomp minor cleanup
AndreyChurbanov [Thu, 25 Feb 2021 21:44:51 +0000 (00:44 +0300)]
[OpenMP] libomp minor cleanup

Cleanup changes:
- check value read from file;
- remove dead code;
- make unsigned variable to read hexadecimal number to;
- add debug assertion to check ref count.

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

3 years ago[lldb/Core] Change large function threshold variable into a setting.
Med Ismail Bennani [Thu, 25 Feb 2021 21:28:51 +0000 (21:28 +0000)]
[lldb/Core] Change large function threshold variable into a setting.

This patch replaces the static large function threshold variable with a
global debugger setting (`stop-disassembly-max-size`).

The default threshold is now set to 32KB (instead of 8KB) and can be modified.

rdar://74726362

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years ago[NFC] Switch to auto marshalling infrastructure for `-fsanitize-address-destructor...
Dan Liew [Sat, 13 Feb 2021 00:10:33 +0000 (16:10 -0800)]
[NFC] Switch to auto marshalling infrastructure for `-fsanitize-address-destructor-kind=` flag.

This change simplifies `clang/lib/Frontend/CompilerInvocation.cpp`
because we no longer need to manually parse the flag and set codegen
options in the frontend. However, we still need to manually parse the
flag in the driver because:

* The marshalling infrastructure doesn't operate there.
* We need to do some platform specific checks in the driver
  that will likely never be supported by any kind of marshalling
  infrastructure.

rdar://71609176

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

3 years ago[OpenMP] libomp: fix ittnotify stack stitching for teams construct
AndreyChurbanov [Thu, 25 Feb 2021 21:23:24 +0000 (00:23 +0300)]
[OpenMP] libomp: fix ittnotify stack stitching for teams construct

Stitching id could be overridden causing reference of destroyed object
when number of teams is 1. The patch separates stitching id store
location for teams and parallel nested in teams.

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

3 years agoRewrite MSVC toolchain discovery with VFS
Arthur Eubanks [Thu, 25 Feb 2021 03:58:40 +0000 (19:58 -0800)]
Rewrite MSVC toolchain discovery with VFS

This fixes an issue where the toolchain discovery doesn't respect the
VFS's current working directory, specifically clangd not respecting a
relative /winsysroot.

Reviewed By: rnk

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

3 years ago[clang,NFC] Fix typos in file headers
Vitaly Buka [Thu, 25 Feb 2021 20:45:46 +0000 (12:45 -0800)]
[clang,NFC] Fix typos in file headers

3 years ago[scudo][standalone] Compact pointers for Caches/Batches
Kostya Kortchinsky [Wed, 10 Feb 2021 18:17:18 +0000 (10:17 -0800)]
[scudo][standalone] Compact pointers for Caches/Batches

This CL introduces configuration options to allow pointers to be
compacted in the thread-specific caches and transfer batches. This
offers the possibility to have them use 32-bit of space instead of
64-bit for the 64-bit Primary, thus cutting the size of the caches
and batches by nearly half (and as such the memory used in size
class 0). The cost is an additional read from the region information
in the fast path.

This is not a new idea, as it's being used in the sanitizer_common
64-bit primary. The difference here is that it is configurable via
the allocator config, with the possibility of not compacting at all.

This CL enables compacting pointers in the Android and Fuchsia default
configurations.

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

3 years ago[CodeGen] Call ConvertTypeForMem instead of ConvertType
Akira Hatanaka [Thu, 25 Feb 2021 20:11:18 +0000 (12:11 -0800)]
[CodeGen] Call ConvertTypeForMem instead of ConvertType

This fixes a crash that occurs when the type passed to the method is
`_Bool`.

rdar://74493389

3 years ago[Clang][ASan] Teach Clang to not emit ASan module destructors when compiling with...
Dan Liew [Fri, 12 Feb 2021 02:56:14 +0000 (18:56 -0800)]
[Clang][ASan] Teach Clang to not emit ASan module destructors when compiling with `-mkernel` or `-fapple-kext`.

rdar://71609176

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

3 years ago[Clang][ASan] Introduce `-fsanitize-address-destructor-kind=` driver & frontend option.
Dan Liew [Wed, 10 Feb 2021 07:02:50 +0000 (23:02 -0800)]
[Clang][ASan] Introduce `-fsanitize-address-destructor-kind=` driver & frontend option.

The new `-fsanitize-address-destructor-kind=` option allows control over how module
destructors are emitted by ASan.

The new option is consumed by both the driver and the frontend and is propagated into
codegen options by the frontend.

Both the legacy and new pass manager code have been updated to consume the new option
from the codegen options.

It would be nice if the new utility functions (`AsanDtorKindToString` and
`AsanDtorKindFromString`) could live in LLVM instead of Clang so they could be
consumed by other language frontends. Unfortunately that doesn't work because
the clang driver doesn't link against the LLVM instrumentation library.

rdar://71609176

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

3 years agoAdd a nullptr check.
Adrian Prantl [Thu, 25 Feb 2021 19:54:58 +0000 (11:54 -0800)]
Add a nullptr check.

This doesn't actually reproduce with a dbg.declare(i8* null, ...)
which produces a non-null null Value, but I have seen this show up in
crash logs. I'm suspecting that there may be another pass forcibly
setting the operand to a nullptr.

3 years ago[SanitizerCoverage] Drop !associated on metadata sections
Fangrui Song [Thu, 25 Feb 2021 19:59:23 +0000 (11:59 -0800)]
[SanitizerCoverage] Drop !associated on metadata sections

In SanitizerCoverage, the metadata sections (`__sancov_guards`,
`__sancov_cntrs`, `__sancov_bools`) are referenced by functions.  After
inlining, such a `__sancov_*` section can be referenced by more than one
functions, but its sh_link still refers to the original function's section.
(Note: a SHF_LINK_ORDER section referenced by a section other than its linked-to
section violates the invariant.)

If the original function's section is discarded (e.g. LTO internalization +
`ld.lld --gc-sections`), ld.lld may report a `sh_link points to discarded section` error.

This above reasoning means that `!associated` is not appropriate to be called by
an inlinable function. Non-interposable functions are inline candidates, so we
have to drop `!associated`. A `__sancov_pcs` is not referenced by other sections
but is expected to parallel a metadata section, so we have to make sure the two
sections are retained or discarded at the same time. A section group does the
trick.  (Note: we have a module ctor, so `getUniqueModuleId` guarantees to
return a non-empty string, and `GetOrCreateFunctionComdat` guarantees to return
non-null.)

For interposable functions, we could keep using `!associated`, but
LTO can change the linkage to `internal` and allow such functions to be inlinable,
so we have to drop `!associated`, too. To not interfere with section
group resolution, we need to use the `noduplicates` variant (section group flag 0).
(This allows us to get rid of the ModuleID parameter.)
In -fno-pie and -fpie code (mostly dso_local), instrumented interposable
functions have WeakAny/LinkOnceAny linkages, which are rare. So the
section group header overload should be low.

This patch does not change the object file output for COFF (where `!associated` is ignored).

Reviewed By: morehouse, rnk, vitalybuka

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

3 years ago[libc++] Fix incorrect forwarding in tuple's assignment operator
Louis Dionne [Wed, 24 Feb 2021 19:53:21 +0000 (14:53 -0500)]
[libc++] Fix incorrect forwarding in tuple's assignment operator

Also, add a bunch of tests for tuple and pair's assignment operators
involving reference types.

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

3 years ago[mlir] Mark OpState::getAttrs() deprecated.
Christian Sigg [Thu, 25 Feb 2021 18:35:53 +0000 (19:35 +0100)]
[mlir] Mark OpState::getAttrs() deprecated.

Fix call sites.

The method will be removed 2 weeks later.

Reviewed By: rriddle

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

3 years agoadds more checks to -Wfree-nonheap-object
Christopher Di Bella [Fri, 12 Feb 2021 00:24:16 +0000 (00:24 +0000)]
adds more checks to -Wfree-nonheap-object

This commit adds checks for the following:

* labels
* block expressions
* random integers cast to `void*`
* function pointers cast to `void*`

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

3 years ago[test] Improve SanitizerCoverage tests
Fangrui Song [Thu, 25 Feb 2021 19:20:40 +0000 (11:20 -0800)]
[test] Improve SanitizerCoverage tests

3 years ago[OpenMP] Fix accidental addition of use omp_lib_kinds
Peyton, Jonathan L [Thu, 25 Feb 2021 18:47:33 +0000 (12:47 -0600)]
[OpenMP] Fix accidental addition of use omp_lib_kinds

Fortran header accidentally had use omp_lib_kinds added inside a
subroutine and function. This patch removes the lines.

3 years ago[lld-macho] Basic support for linkage and visibility attributes in LTO
Jez Ng [Thu, 25 Feb 2021 18:27:40 +0000 (13:27 -0500)]
[lld-macho] Basic support for linkage and visibility attributes in LTO

When parsing bitcode, convert LTO Symbols to LLD Symbols in order to perform
resolution. The "winning" symbol will then be marked as Prevailing at LTO
compilation time. This is similar to what the other LLD ports do.

This change allows us to handle `linkonce` symbols correctly, and to deal with
duplicate bitcode symbols gracefully. Previously, both scenarios would result in
an assertion failure inside the LTO code, complaining that multiple Prevailing
definitions are not allowed.

While at it, I also added basic logic around visibility. We don't do anything
useful with it yet, but we do check that its value is valid. LLD-ELF appears to
use it only to set FinalDefinitionInLinkageUnit for LTO, which I think is just a
performance optimization.

From my local experimentation, the linker itself doesn't seem to do anything
differently when encountering linkonce / linkonce_odr / weak / weak_odr. So I've
only written a test for one of them. LLD-ELF has more, but they seem to mostly
be testing the intermediate bitcode output of their LTO backend...? I'm far from
an expert here though, so I might very well be missing things.

Reviewed By: #lld-macho, MaskRay, smeenai

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

3 years agoOption to ignore llvm[.compiler].used uses in hasAddressTaken()
Stanislav Mekhanoshin [Thu, 4 Feb 2021 23:35:43 +0000 (15:35 -0800)]
Option to ignore llvm[.compiler].used uses in hasAddressTaken()

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

3 years ago[DAG] Move simplification of SADDSAT/SSUBSAT/UADDSAT/USUBSAT of vXi1 to getNode()
Simon Pilgrim [Thu, 25 Feb 2021 17:49:01 +0000 (17:49 +0000)]
[DAG] Move simplification of SADDSAT/SSUBSAT/UADDSAT/USUBSAT of vXi1 to getNode()

As discussed on D97276 we should be able to always do this in node creation, we don't need a combine.

3 years agoOption to ignore assume like intrinsic uses in hasAddressTaken()
Stanislav Mekhanoshin [Thu, 4 Feb 2021 22:38:40 +0000 (14:38 -0800)]
Option to ignore assume like intrinsic uses in hasAddressTaken()

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

3 years agoSupport `#pragma clang section` directives on MachO targets
Jon Roelofs [Tue, 23 Feb 2021 16:01:27 +0000 (08:01 -0800)]
Support `#pragma clang section` directives on MachO targets

rdar://59560986

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

3 years ago[X86] Remove custom lowering of vXi1 ADD/SUB now that they are canonicalized to XOR...
Craig Topper [Thu, 25 Feb 2021 16:52:39 +0000 (08:52 -0800)]
[X86] Remove custom lowering of vXi1 ADD/SUB now that they are canonicalized to XOR in getNode.

Reviewed By: RKSimon

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

3 years ago[AMDGPU] require s-memtime-inst for __builtin_amdgcn_s_memtime
Stanislav Mekhanoshin [Wed, 24 Feb 2021 23:14:30 +0000 (15:14 -0800)]
[AMDGPU] require s-memtime-inst for __builtin_amdgcn_s_memtime

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

3 years ago[SampleFDO][NFC] Refactor: make SampleProfileLoaderBaseImpl a template class
Rong Xu [Sat, 20 Feb 2021 00:03:20 +0000 (16:03 -0800)]
[SampleFDO][NFC] Refactor: make SampleProfileLoaderBaseImpl a template class

This patch makes SampleProfileLoaderBaseImpl a template class so it
can be used in CodeGen transformation.

Noticeable changes:
 * use one template parameter and use IRTraits to get other used
   types an type specific functions.
 * remove the temporary "inline" keywords in previous refactor
   patch.
 * change the template function findEquivalencesFor to a regular
   function. This function has a single caller with type of
   PostDominatorTree. It's simpler to use the type directly
   because MachinePostDominatorTree is not a derived type of
   template DominatorTreeBase.

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

3 years ago[mlir] Check 'iter_args' in 'isLoopParallel' utility
Diego Caballero [Thu, 25 Feb 2021 15:56:51 +0000 (17:56 +0200)]
[mlir] Check 'iter_args' in 'isLoopParallel' utility

Fix 'isLoopParallel' utility so that 'iter_args' is taken into account
and loops with loop-carried dependences are not classified as parallel.

Reviewed By: tungld, vinayaka-polymage

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