platform/upstream/llvm.git
3 years ago[RISCV][Clang] Add RVV Vector Indexed Load intrinsic functions.
Zakk Chen [Thu, 18 Mar 2021 03:25:32 +0000 (20:25 -0700)]
[RISCV][Clang] Add RVV Vector Indexed Load intrinsic functions.

Support Complex type transformer to define more complexity legal type.

Overall our downstream implementation there are only four instructions need to
use complex type transformer, it's not a common case.
I still feel using a string for prototypes is simple and clear.

Reviewed By: craig.topper

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

3 years ago[NFC] Clang-format includes
Vitaly Buka [Wed, 24 Mar 2021 02:11:11 +0000 (19:11 -0700)]
[NFC] Clang-format includes

3 years ago[InstSimplify] Fix unused variable warning (NFC)
Yang Fan [Wed, 24 Mar 2021 01:56:36 +0000 (09:56 +0800)]
[InstSimplify] Fix unused variable warning (NFC)

GCC warning:
```
/llvm-project/llvm/lib/Analysis/InstructionSimplify.cpp: In function ‘llvm::Value* SimplifyWithOpReplaced(llvm::Value*, llvm::Value*, llvm::Value*, const llvm::SimplifyQuery&, bool, unsigned int)’:
/llvm-project/llvm/lib/Analysis/InstructionSimplify.cpp:3993:15: warning: unused variable ‘SI’ [-Wunused-variable]
 3993 |     if (auto *SI = dyn_cast<SelectInst>(I))
      |               ^~
```

3 years ago[OpenMP] Misc. changes that add or remove pointer/bound checks
Hansang Bae [Thu, 11 Mar 2021 23:34:06 +0000 (17:34 -0600)]
[OpenMP] Misc. changes that add or remove pointer/bound checks

-- Added or moved checks to appropriate places.
-- Removed ineffective null check where the pointer is already being
   dereferenced around the code.
-- Initialized variables that can be used without definitions.
-- Added call to dlclose/FreeLibrary in OMPT tool activation.
-- Added a new build compiler definition.

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

3 years agoSupport #__private_macro and #__public_macro in local submodule
Richard Smith [Tue, 23 Mar 2021 23:41:05 +0000 (16:41 -0700)]
Support #__private_macro and #__public_macro in local submodule
visibility mode.

3 years agoImprove const-correctness. NFC.
Richard Smith [Tue, 23 Mar 2021 22:45:40 +0000 (15:45 -0700)]
Improve const-correctness. NFC.

3 years ago[CGAtomic] Lift stronger requirements on cmpxch and support acquire failure mode
Bruno Cardoso Lopes [Tue, 23 Mar 2021 23:13:29 +0000 (16:13 -0700)]
[CGAtomic] Lift stronger requirements on cmpxch and support acquire failure mode

- Fix `emitAtomicCmpXchgFailureSet` to support release/acquire (succ/fail) memory order.
- Remove stronger checks for cmpxch.

Effectively, this addresses http://wg21.link/p0418

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

3 years ago[Coverage] Load records immediately
Choongwoo Han [Tue, 23 Mar 2021 22:59:45 +0000 (15:59 -0700)]
[Coverage] Load records immediately

The current implementation keeps buffers generated for each object file
until it completes loading of all files. This approach requires a lot of memory
if there are a lot of huge object files. Thus, make it to load coverage records
immediately rather than waiting for other binaries to be loaded.

This reduces memory usage of llvm-cov from >128GB to 5GB when
loading Chromium binaries in Windows.

Additional testing: check-profile, check-llvm

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

3 years ago[lld] Fix test to work with and without a vendor string
Shoaib Meenai [Tue, 23 Mar 2021 23:16:02 +0000 (16:16 -0700)]
[lld] Fix test to work with and without a vendor string

3 years ago[AArch64][GlobalISel] Add test for G_FSHR legalization.
Amara Emerson [Tue, 23 Mar 2021 23:11:45 +0000 (16:11 -0700)]
[AArch64][GlobalISel] Add test for G_FSHR legalization.

3 years ago[AArch64][GlobalISel] Lower G_FSHL and G_FSHR.
Amara Emerson [Tue, 23 Mar 2021 22:56:03 +0000 (15:56 -0700)]
[AArch64][GlobalISel] Lower G_FSHL and G_FSHR.

Codegen isn't as good as we need it, but that'll be done later.

3 years ago[mlir][tosa] Add tosa.argmax to linalg lowering
Rob Suderman [Tue, 23 Mar 2021 01:22:30 +0000 (18:22 -0700)]
[mlir][tosa] Add tosa.argmax to linalg lowering

Tosa's argmax lowering is representable as a linalg.indexed_generic
operation. Include the lowering to this type for both integer and
floating point types.

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

3 years ago[ValueTracking] Handle increasing mul recurrence in isKnownNonZero()
Jingu Kang [Mon, 22 Mar 2021 10:12:39 +0000 (10:12 +0000)]
[ValueTracking] Handle increasing mul recurrence in isKnownNonZero()

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

3 years ago[Sanitizer] Remove refactoring leftover [NFC]
Julian Lettner [Tue, 23 Mar 2021 22:09:13 +0000 (15:09 -0700)]
[Sanitizer] Remove refactoring leftover [NFC]

3 years agoAdd register size info back to MCRegisterClass
Rafael Auler [Wed, 3 Mar 2021 22:31:57 +0000 (14:31 -0800)]
Add register size info back to MCRegisterClass

This patch addresses the removal of register size information done in
commit c8b782c.

Without this change, there is no viable option to get register size
information outside libTarget. We need this information to run
analysis that know the register size from the MC layer, used by
BOLT.

Discussion D50285 and D47199.

Reviewed By: kparzysz

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

3 years ago[lld-macho] Fixed lld-version expectation in test so it works on Fuchsia.
Vy Nguyen [Tue, 23 Mar 2021 21:51:52 +0000 (17:51 -0400)]
[lld-macho] Fixed lld-version expectation in test so it works on Fuchsia.

On Fuchsia, it's called Fuchsia LLD

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

3 years ago[MSSA] Extending IsGuaranteedLoopInvariant to support an instruction defined in the...
Matteo Favaro [Tue, 23 Mar 2021 21:31:25 +0000 (21:31 +0000)]
[MSSA] Extending IsGuaranteedLoopInvariant to support an instruction defined in the entry block

As mentioned in [[ https://reviews.llvm.org/D96979 | D96979 ]], I'm extending the **IsGuaranteedLoopInvariant** check also to the `MemorySSA.cpp` file.

@fhahn For now I didn't unify the function into `MemorySSA.h` because, as you mentioned, it's not directly MSSA related. I'm open to suggestions to find a better place so we can improve the unification process.

Reviewed By: fhahn

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

3 years ago[NFC][LLDB] Removing extra semicolons to silence -Wc++98-compat-extra-semi diagnostics
Shafik Yaghmour [Tue, 23 Mar 2021 21:31:40 +0000 (14:31 -0700)]
[NFC][LLDB] Removing extra semicolons to silence -Wc++98-compat-extra-semi diagnostics

3 years ago[Analysis]Add getPointersDiff function to improve compile time.
Alexey Bataev [Tue, 23 Mar 2021 20:22:58 +0000 (13:22 -0700)]
[Analysis]Add getPointersDiff function to improve compile time.

Added getPointersDiff function to LoopAccessAnalysis and used it instead
direct calculatoin of the distance between pointers and/or
isConsecutiveAccess function in SLP vectorizer to improve compile time
and detection of stores consecutive chains.

Part of D57059

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

3 years ago[mlir][tosa] Add tosa.pad to linalg.pad operation
Rob Suderman [Fri, 19 Mar 2021 23:04:50 +0000 (16:04 -0700)]
[mlir][tosa] Add tosa.pad to linalg.pad operation

Lowers from tosa's pad op to the linalg equivalent for floating,
integer, and quantized values.

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

3 years agoRevert "[lld-macho][nfc] minor clean up, follow up to D98559"
Vy Nguyen [Tue, 23 Mar 2021 21:14:27 +0000 (17:14 -0400)]
Revert "[lld-macho][nfc] minor clean up, follow up to D98559"

This reverts commit 1bc33eb6a32bdb193a8b838df823b4563450f6b3.
tests failed on windows

3 years ago[mlir][Pattern] Add better support for using interfaces/traits to match root operatio...
River Riddle [Tue, 23 Mar 2021 20:44:14 +0000 (13:44 -0700)]
[mlir][Pattern] Add better support for using interfaces/traits to match root operations in rewrite patterns

To match an interface or trait, users currently have to use the `MatchAny` tag. This tag can be quite problematic for compile time for things like the canonicalizer, as the `MatchAny` patterns may get applied to  *every* operation. This revision adds better support by bucketing interface/trait patterns based on which registered operations have them registered. This means that moving forward we will only attempt to match these patterns to operations that have this interface registered. Two simplify defining patterns that match traits and interfaces, two new utility classes have been added: OpTraitRewritePattern and OpInterfaceRewritePattern.

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

3 years ago[ODS] Implement a new 'hasCanonicalizeMethod' bit for cann patterns.
Chris Lattner [Tue, 23 Mar 2021 05:15:39 +0000 (22:15 -0700)]
[ODS] Implement a new 'hasCanonicalizeMethod' bit for cann patterns.

This provides a simplified way to implement 'matchAndRewrite' style
canonicalization patterns for ops that don't need the full power of
RewritePatterns.  Using this style, you can implement a static method
with a signature like:

```
LogicalResult AssertOp::canonicalize(AssertOp op, PatternRewriter &rewriter) {
  return success();
}
```

instead of dealing with defining RewritePattern subclasses.  This also
adopts this for a few canonicalization patterns in the std dialect to
show how it works.

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

3 years ago[test] Add --sysroot= to make gcc-toolchain.cpp stable
Fangrui Song [Tue, 23 Mar 2021 20:32:30 +0000 (13:32 -0700)]
[test] Add --sysroot= to make gcc-toolchain.cpp stable

3 years ago[HWASan] Refactor in preparation for x86 aliasing mode. NFC
Matt Morehouse [Tue, 23 Mar 2021 18:57:12 +0000 (11:57 -0700)]
[HWASan] Refactor in preparation for x86 aliasing mode. NFC

Reviewed By: vitalybuka, eugenis

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

3 years ago[BasicAA] Handle assumes with operand bundles
Nikita Popov [Tue, 23 Mar 2021 20:18:30 +0000 (21:18 +0100)]
[BasicAA] Handle assumes with operand bundles

This fixes a regression reported on D99022: If a call has operand
bundles, then the inaccessiblememonly attribute on the function
will be ignored, as operand bundles can affect modref behavior in
the general case. However, for assume operand bundles in particular
this is not the case.

Adjust getModRefBehavior() to always report inaccessiblememonly
for assumes, regardless of presence of operand bundles.

3 years ago[BasicAA] Add test for assume with operand bundles (NFC)
Nikita Popov [Tue, 23 Mar 2021 20:07:36 +0000 (21:07 +0100)]
[BasicAA] Add test for assume with operand bundles (NFC)

3 years agoRevert "[Analysis]Add getPointersDiff function to improve compile time."
Alexey Bataev [Tue, 23 Mar 2021 20:17:26 +0000 (13:17 -0700)]
Revert "[Analysis]Add getPointersDiff function to improve compile time."

This reverts commit 065a14a12d2694f26f4e894641f5ab8cfc5da8bd to
investigate and fix crash in SLP vectorizer.

3 years ago[mlir][tosa] Add tosa.tile to linalg.generic lowering
Rob Suderman [Mon, 22 Mar 2021 21:38:39 +0000 (14:38 -0700)]
[mlir][tosa] Add tosa.tile to linalg.generic lowering

Tiling operations are generic operations with modified indexing. Updated to to
linalg lowerings to perform this lowering.

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

3 years ago[lld-macho][nfc] minor clean up, follow up to D98559
Vy Nguyen [Tue, 23 Mar 2021 19:54:01 +0000 (15:54 -0400)]
[lld-macho][nfc] minor clean up, follow up to D98559

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

3 years ago[mlir][tosa] Add tosa.matmul and tosa.fully_connected lowering
natashaknk [Tue, 23 Mar 2021 20:00:38 +0000 (13:00 -0700)]
[mlir][tosa] Add tosa.matmul and tosa.fully_connected lowering

Adds lowerings for matmul and fully_connected. Only supports 2D tensors for inputs and weights, and 1D tensors for bias.

Reviewed By: rsuderman

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

3 years ago[Analysis]Add getPointersDiff function to improve compile time.
Alexey Bataev [Fri, 19 Mar 2021 14:19:17 +0000 (07:19 -0700)]
[Analysis]Add getPointersDiff function to improve compile time.

Added getPointersDiff function to LoopAccessAnalysis and used it instead
direct calculatoin of the distance between pointers and/or
isConsecutiveAccess function in SLP vectorizer to improve compile time
and detection of stores consecutive chains.

Part of D57059

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

3 years ago[AArch64][GlobalISel] Lower G_CTLZ_ZERO_UNDEF.
Amara Emerson [Tue, 23 Mar 2021 18:31:13 +0000 (11:31 -0700)]
[AArch64][GlobalISel] Lower G_CTLZ_ZERO_UNDEF.

This adds some missing legalizer tests, which uncovered a v2s64 selection
test that wasn't working since there's no legalization or instruction for that.

3 years ago[ValueTracking] Teach canCreateUndefOrPoison that ctpop does not create undef or...
Craig Topper [Tue, 23 Mar 2021 19:20:04 +0000 (12:20 -0700)]
[ValueTracking] Teach canCreateUndefOrPoison that ctpop does not create undef or poison.

This select of ctpop with 0 pattern can get left behind after
loop idiom recognize converts a loop to ctpop. LLVM 10 was able
to optimize this, but LLVM 11 and later is not. The difference
seems to be that some select transforms are now limited based
on canCreateUndefOrPoison.

Teaching canCreateUndefOrPoison about ctpop restores the
LLVM 10 codegen.

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

3 years ago[libcxxabi] Use cxx-headers target to consume libcxx headers
Petr Hosek [Wed, 10 Mar 2021 19:21:41 +0000 (11:21 -0800)]
[libcxxabi] Use cxx-headers target to consume libcxx headers

Rather than including libc++ include dir, use the cxx-headers target.

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

3 years ago[sanitizer] Implement MapDynamicShadowAndAliases.
Matt Morehouse [Tue, 23 Mar 2021 18:21:08 +0000 (11:21 -0700)]
[sanitizer] Implement MapDynamicShadowAndAliases.

The function works like MapDynamicShadow, except that it creates aliased
memory to the right of the shadow.  The main use case is for HWASan
aliasing mode, which gets fast IsAlias() checks by exploiting the fact
that the upper bits of the shadow base and aliased memory match.

Reviewed By: vitalybuka, eugenis

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

3 years agoRevert "Revert "Revert "Revert "Revert "Revert "[lld-macho] Implement -dependency_inf...
Vy Nguyen [Tue, 23 Mar 2021 02:05:46 +0000 (22:05 -0400)]
Revert "Revert "Revert "Revert "Revert "Revert "[lld-macho] Implement -dependency_info (partially - more opcodes needed)""""""

This reverts commit 4876ba5b2d6a1264ec73e5cf3fcad083f6927d19.

Third-attemp relanding D98559, new change:
  - explicitly cast enum to underlying type to avoid ambiguity (workaround to clang's bug).

3 years ago[libc++] Remove old cache file that was left behind by accident
Louis Dionne [Tue, 23 Mar 2021 18:15:28 +0000 (14:15 -0400)]
[libc++] Remove old cache file that was left behind by accident

3 years agoscudo: Preserve no-memtag attribute on cached secondary allocations.
Peter Collingbourne [Mon, 22 Mar 2021 19:29:51 +0000 (12:29 -0700)]
scudo: Preserve no-memtag attribute on cached secondary allocations.

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

3 years ago[C++20] [P1825] Fix bugs with implicit-move from variables of reference type.
Arthur O'Dwyer [Fri, 19 Mar 2021 17:55:28 +0000 (13:55 -0400)]
[C++20] [P1825] Fix bugs with implicit-move from variables of reference type.

Review D88220 turns out to have some pretty severe bugs, but I *think*
this patch fixes them.

Paper P1825 is supposed to enable implicit move from "non-volatile objects
and rvalue references to non-volatile object types." Instead, what was committed
seems to have enabled implicit move from "non-volatile things of all kinds,
except that if they're rvalue references then they must also refer to non-volatile
things." In other words, D88220 accidentally enabled implicit move from
lvalue object references (super yikes!) and also from non-object references
(such as references to functions).

These two cases are now fixed and regression-tested.

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

3 years ago[libc++] Simpler Python script for generating a graph of libc++'s header dependencies
Arthur O'Dwyer [Mon, 22 Mar 2021 21:38:28 +0000 (17:38 -0400)]
[libc++] Simpler Python script for generating a graph of libc++'s header dependencies

My attempts to play around with the old graph_header_deps.py were mostly fruitless;
I needed to modify it in various ways to make it work, and then even when I got it
working, it generated pretty ugly graphs.

Old graph_header_deps.py (after my local changes to simplify the usage)
(producing https://i.imgur.com/zATrsaP.jpg )

    mkdir foo
    time ./graph_header_deps.py --libcxx-only -o foo --clang-command ~/llvm-project/build/bin/clang++
    dot -Tpng < foo/all_headers.dot > old.png
    file old.png

    real    0m37.453s
    old.png: PNG image data, 25882 x 3035, 8-bit/color RGBA, non-interlaced

New graph_header_deps.py
(producing https://i.imgur.com/ZU0G52U.png )

    time ./graph_header_deps.py | dot -Tpng > new.png
    file new.png

    real    0m1.063s
    new.png: PNG image data, 6162 x 1344, 8-bit/color RGBA, non-interlaced

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

3 years ago[test] Enable check-lsan on aarch64-*-linux
Fangrui Song [Tue, 23 Mar 2021 18:11:26 +0000 (11:11 -0700)]
[test] Enable check-lsan on aarch64-*-linux

`check-lsan` passed on an aarch64-*-linux machine.

Unsupport `many_tls_keys_pthread.cpp` for now: it requires GetTls to include
`specific_1stblock` and `specific` in `struct pthread`.

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

3 years ago[libc++] NFC: nodebug => no-debug in the CI configurations
Louis Dionne [Tue, 23 Mar 2021 18:09:52 +0000 (14:09 -0400)]
[libc++] NFC: nodebug => no-debug in the CI configurations

3 years ago[mlir] silence -Wunused-variable in release mode in Linalg transforms
Alex Zinenko [Tue, 23 Mar 2021 17:59:12 +0000 (18:59 +0100)]
[mlir] silence -Wunused-variable in release mode in Linalg transforms

3 years ago[dsymutil] Only look for ThinLTO suffixes if we failed to find symbol.
Jonas Devlieghere [Tue, 23 Mar 2021 17:52:01 +0000 (10:52 -0700)]
[dsymutil] Only look for ThinLTO suffixes if we failed to find symbol.

Only look for symbols with the ThinLTO suffix if we fail to find the
symbol.

3 years ago[NFC][AMDGPU] Reserve AMD GPU ELF machine number 0x41
Tony [Tue, 23 Mar 2021 15:27:51 +0000 (15:27 +0000)]
[NFC][AMDGPU] Reserve AMD GPU ELF machine number 0x41

Reviewed By: foad

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

3 years ago[MLIR][Linalg] Hoist padding across multiple levels of tiling
Nicolas Vasilache [Tue, 23 Mar 2021 17:17:30 +0000 (17:17 +0000)]
[MLIR][Linalg] Hoist padding across multiple levels of tiling

This revision introduces proper backward slice computation during the hoisting of
PadTensorOp. This allows hoisting padding even across multiple levels of tiling.
Such hoisting requires the proper handling of loop bounds that may depend on enclosing
loop variables.

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

3 years agoDocument -fcrash-diagnostics-dir
Paul Robinson [Thu, 18 Mar 2021 15:28:38 +0000 (08:28 -0700)]
Document -fcrash-diagnostics-dir

This was added in LLVM 7.0 but without help text or other docs.

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

3 years ago[libc++] [C++20] [P0482] Add missing tests and synopses for char8_t.
Marek Kurdej [Tue, 23 Mar 2021 16:15:07 +0000 (17:15 +0100)]
[libc++] [C++20] [P0482] Add missing tests and synopses for char8_t.

Left to finish P0482:
* <cuchar> header.
* Parts of <memory_resource> concerning char8_t. Also, tests for hash<pmr::*string>.

Reviewed By: ldionne, #libc, Quuxplusone

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

3 years ago[libc++] Add missing test_macros.h include in tests using TEST_STD_VER.
Marek Kurdej [Tue, 23 Mar 2021 16:13:15 +0000 (17:13 +0100)]
[libc++] Add missing test_macros.h include in tests using TEST_STD_VER.

3 years ago[runtimes] Add the libc project to the list of runtimes.
Siva Chandra [Mon, 22 Mar 2021 18:59:49 +0000 (18:59 +0000)]
[runtimes] Add the libc project to the list of runtimes.

This is possible as the default libc build now works under runtimes build.

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

3 years agoTeach DWARFExpression about DWARF 4+ Location Descriptions
Adrian Prantl [Tue, 23 Mar 2021 01:09:46 +0000 (18:09 -0700)]
Teach DWARFExpression about DWARF 4+ Location Descriptions

DWARFExpression implements the DWARF2 expression model that left
ambiguity on whether the result of an expression was a value or an
address. This patch implements the DWARF location description model
introduces in DWARF 4 and sets the result Value's kind accordingly, if
the expression comes from a DWARF v4+ compile unit. The nomenclature
is taken from DWARF 5, chapter 2.6 "Location Descriptions".

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

3 years ago[mlir] verify that operand/result_segment_sizes attributes have i32 element
Alex Zinenko [Tue, 23 Mar 2021 13:04:52 +0000 (14:04 +0100)]
[mlir] verify that operand/result_segment_sizes attributes have i32 element

This is an assumption that is made in numerous places in the code. In
particular, in the code generated by mlir-tblgen for operand/result accessors
in ops with attr-sized operand or result lists. Make sure to verify this
assumption.

Note that the operation traits are verified before running the custom op
verifier, which can expect the trait verifier to have passed, but some traits
may be verified before the AttrSizedOperand/ResultTrait and should not make
such assumptions.

Reviewed By: mehdi_amini

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

3 years ago[lldb/Plugins] Add ScriptedProcess Process Plugin
Med Ismail Bennani [Tue, 23 Mar 2021 16:22:30 +0000 (16:22 +0000)]
[lldb/Plugins] Add ScriptedProcess Process Plugin

This patch introduces Scripted Processes to lldb.

The goal, here, is to be able to attach in the debugger to fake processes
that are backed by script files (in Python, Lua, Swift, etc ...) and
inspect them statically.

Scripted Processes can be used in cooperative multithreading environments
like the XNU Kernel or other real-time operating systems, but it can
also help us improve the debugger testing infrastructure by writting
synthetic tests that simulates hard-to-reproduce process/thread states.

Although ScriptedProcess is not feature-complete at the moment, it has
basic execution capabilities and will improve in the following patches.

rdar://65508855

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years ago[lldb/bindings] Add Python ScriptedProcess base class to lldb module
Med Ismail Bennani [Tue, 23 Mar 2021 16:22:26 +0000 (16:22 +0000)]
[lldb/bindings] Add Python ScriptedProcess base class to lldb module

In order to facilitate the writting of Scripted Processes, this patch
introduces a `ScriptedProcess` python base class in the lldb module.

The base class holds the python interface with all the - abstract -
methods that need to be implemented by the inherited class but also some
methods that can be overwritten.

This patch also provides an example of a Scripted Process with the
`MyScriptedProcess` class.

rdar://65508855

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years ago[lldb/Interpreter] Add ScriptInterpreter Wrapper for ScriptedProcess
Med Ismail Bennani [Tue, 23 Mar 2021 16:22:18 +0000 (16:22 +0000)]
[lldb/Interpreter] Add ScriptInterpreter Wrapper for ScriptedProcess

This patch adds a ScriptedProcess interface to the ScriptInterpreter and
more specifically, to the ScriptInterpreterPython.

This interface will be used in the C++ `ScriptProcess` Process Plugin to
call the script methods.

At the moment, not all methods are implemented, they will upstreamed in
upcoming patches.

This patch also adds helper methods to the ScriptInterpreter to
convert `SBAPI` Types (SBData & SBError) to `lldb_private` types
(DataExtractor & Status).

rdar://65508855

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years ago[lldb/Commands] Add command options for ScriptedProcess to ProcessLaunch
Med Ismail Bennani [Tue, 23 Mar 2021 16:22:07 +0000 (16:22 +0000)]
[lldb/Commands] Add command options for ScriptedProcess to ProcessLaunch

This patch adds a new command options to the CommandObjectProcessLaunch
for scripted processes.

Among the options, the user need to specify the class name managing the
scripted process. The user can also use a key-value dictionary holding
arbitrary data that will be passed to the managing class.

This patch also adds getters and setters to `SBLaunchInfo` for the
class name managing the scripted process and the dictionary.

rdar://65508855

Differential Review: https://reviews.llvm.org/D95710

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years ago[SystemZ][z/OS] fix lit test related to alignment
Nancy Wang [Tue, 23 Mar 2021 17:09:05 +0000 (13:09 -0400)]
[SystemZ][z/OS] fix lit test related to alignment

This patch is to fix lit test case failure relate to alignment, on z/OS, maximum alignment value for 64 bit mode is 16 and also fixed clang/test/Layout/itanium-union-bitfield.cpp, attribute ((aligned(4))) is needed for bit-field member in Union for z/OS because single bit-field has one byte alignment, this will make sure size and alignment will be correct value on z/OS.

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

3 years ago[sanitizer] Support dynamic premapped R/W range in primary allocator.
Matt Morehouse [Tue, 23 Mar 2021 16:31:19 +0000 (09:31 -0700)]
[sanitizer] Support dynamic premapped R/W range in primary allocator.

The main use case for this change is HWASan aliasing mode, which premaps
the alias space adjacent to the dynamic shadow.  With this change, the
primary allocator can allocate from the alias space instead of a
separate region.

Reviewed By: vitalybuka, eugenis

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

3 years ago[AMDGPU] Simplify AMDGPUAnnotateUniformValues::visitBranchInst. NFC.
Jay Foad [Tue, 23 Mar 2021 16:54:01 +0000 (16:54 +0000)]
[AMDGPU] Simplify AMDGPUAnnotateUniformValues::visitBranchInst. NFC.

A BranchInst is always the terminator of its containing BasicBlock.

3 years ago[NFC] Enable RVALUE_REFERENCE_THIS on MSVC 2019
Nathan James [Tue, 23 Mar 2021 16:40:01 +0000 (16:40 +0000)]
[NFC] Enable RVALUE_REFERENCE_THIS on MSVC 2019

In https://reviews.llvm.org/D72948 This was enabled for all MSVC but reverted as it was determined not to work on some 2017 versions.
The issue is assumed to be fixed on 2019 so enable for 2019 and newer.

Some testing could be done to determine which version of MSVC 2017 support this feature but its safer right now to leave it at 2019.

Reviewed By: aaron.ballman

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

3 years ago[ASTMatchers][NFC] Use SmallVector when building variadic matcher descriptor
Nathan James [Tue, 23 Mar 2021 16:38:44 +0000 (16:38 +0000)]
[ASTMatchers][NFC] Use SmallVector when building variadic matcher descriptor

Saves having to manually deallocate storage and keeps InnerArgs will have good cache locality.

Reviewed By: aaron.ballman

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

3 years ago[flang][driver] Add -fintrinsic-modules-path option
Arnamoy Bhattacharyya [Tue, 23 Mar 2021 16:24:57 +0000 (12:24 -0400)]
[flang][driver] Add -fintrinsic-modules-path option

Reviewed By: awarzynski

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

3 years ago[libcxx] Consistently set CMAKE_STATIC_LIBRARY_PREFIX regardless of LIBCXX_ENABLE_STATIC
Martin Storsjö [Tue, 23 Mar 2021 11:23:16 +0000 (13:23 +0200)]
[libcxx] Consistently set CMAKE_STATIC_LIBRARY_PREFIX regardless of LIBCXX_ENABLE_STATIC

CMAKE_STATIC_LIBRARY_PREFIX affects the naming of all static libs (in
MSVC configurations), including c++experimental, which only is produced
as static regardless of LIBCXX_ENABLE_STATIC.

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

3 years ago[flang][cmake] Fix variable reference (${var} instead of var)
Andrzej Warzynski [Tue, 23 Mar 2021 16:02:58 +0000 (16:02 +0000)]
[flang][cmake] Fix variable reference (${var} instead of var)

This is used for out-of-tree Flang builds when FLANG_BUILD_NEW_DRIVER is
set.

3 years ago[AMDGPU] Refactor DPPCombine
Joe Nash [Mon, 22 Mar 2021 18:34:55 +0000 (14:34 -0400)]
[AMDGPU] Refactor DPPCombine

NFC. Extract IsShrinkable into a helper function, and
make Subtarget a member variable.

Reviewed By: rampitec

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

Change-Id: If4bc97a88a9ae4eb1df47e717345d46a6ed515bf

3 years ago[RISCV] Use selectImm for RV32. NFC
Craig Topper [Tue, 23 Mar 2021 15:32:00 +0000 (08:32 -0700)]
[RISCV] Use selectImm for RV32. NFC

Previously we used selectImm for RV64 and isel patterns for
RV32. This should be NFC, but will allow RV32 and RV64 to share
improvements in the future. For example, it might be useful to
use BSETI from Zbs to make single bit constants.

Reviewed By: luismarques

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

3 years ago[AMDGPU] Set SchedRW on real instructions
Jay Foad [Tue, 23 Mar 2021 14:02:25 +0000 (14:02 +0000)]
[AMDGPU] Set SchedRW on real instructions

Coyp SchedRW from pseudos to real instructions so that llvm-mca has
access to it. This is NFC for normal compiler codegen, which schedules
pseudos not real instructions.

Add an llvm-mca test for some high latency double-precision instructions
as a smoke test.

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

3 years ago[lli] Workaround missing architecture support in LazyCallThroughManager for non-lazy...
Stefan Gränitz [Tue, 23 Mar 2021 15:27:40 +0000 (16:27 +0100)]
[lli] Workaround missing architecture support in LazyCallThroughManager for non-lazy mode

Next attempt to prevent PowerPC/s390x/etc. failures when landing D98931.

3 years ago[PhaseOrdering] add AVX attribute to make test less fragile; NFC
Sanjay Patel [Tue, 23 Mar 2021 15:32:37 +0000 (11:32 -0400)]
[PhaseOrdering] add AVX attribute to make test less fragile; NFC

This doesn't change anything currently, but as discussed in
D98981 and D98152, some tests may fail to vectorize because
the cost model becomes more accurate as we switch over to
using min/max intrinsics.

3 years ago[LV] Add 'fast' flag to test to make sure it will be vectorized.
Florian Hahn [Tue, 23 Mar 2021 15:28:58 +0000 (15:28 +0000)]
[LV] Add 'fast' flag to test to make sure it will be vectorized.

This makes the test more robust with respect to when LV checks if the
floating point instructions in a loop can be vectorized.

3 years ago[SimplifyCFG] 'Fold branch to common dest': don't overestimate the cost
Roman Lebedev [Tue, 23 Mar 2021 15:22:30 +0000 (18:22 +0300)]
[SimplifyCFG] 'Fold branch to common dest': don't overestimate the cost

`FoldBranchToCommonDest()` has a certain budget (`-bonus-inst-threshold=`)
for bonus instruction duplication. And currently it calculates the cost
as-if it will actually duplicate into each predecessor.

But ignoring the budget, it won't always duplicate into each predecessor,
there are some correctness and profitability checks.
So when calculating the cost, we should first check into which blocks
will we *actually* duplicate, and only then use that block count
to do budgeting.

3 years ago[NFC][SimplifyCFG] 'Fold branch to common dest': add test for cost overestimation
Roman Lebedev [Tue, 23 Mar 2021 15:08:23 +0000 (18:08 +0300)]
[NFC][SimplifyCFG] 'Fold branch to common dest': add test for cost overestimation

We should not count the cost of duplication into predecessors into which
we won't ultimately duplicate.

3 years ago[flang][cmake] Improve how CLANG_DIR is handled
Andrzej Warzynski [Mon, 22 Mar 2021 17:04:01 +0000 (17:04 +0000)]
[flang][cmake] Improve how CLANG_DIR is handled

* Added a sanity check with `Clang_FOUND` to verify that find_package
succeeded
* Made sure that find_package won't use any of CMake's standard paths
to guarantee that only the path provided with CLANG_DIR is considered
(implemented through NO_DEFAULT_PATH)
* Made the call to get_filename_component more explicit (so that it is
clear what the base directory is)
* Updated comments to clarify what CLANG_DIR means

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

3 years agoRevert "[MLIR] Canonicalize `shape.assuming` op to yield only inner values"
Frederik Gossen [Tue, 23 Mar 2021 15:05:55 +0000 (16:05 +0100)]
Revert "[MLIR] Canonicalize `shape.assuming` op to yield only inner values"

This reverts commit 5f8acd4fd233cdce5892958df56ed1f000f75f9e.

3 years ago[MCA] Improved handling of negative read-advance cycles.
Andrea Di Biagio [Tue, 23 Mar 2021 14:47:01 +0000 (14:47 +0000)]
[MCA] Improved handling of negative read-advance cycles.

Before this patch, register writes were always invalidated by the
RegisterFile at instruction commit stage. So,
the RegisterFile was often losing the knowledge about the `execute
cycle` of writes already committed. While this was not problematic
for non-delayed reads, this was sometimes leading to inaccurate read
latency computations in the presence of negative read-advance cycles.

This patch fixes the issue by changing how the RegisterFile component
internally keeps track of the `execute cycle` information of each
write. On every instruction executed, the RegisterFile gets notified
by the RetireStage, so that it can internally record the execute
cycle of each executed write.
The `execute cycle` information is stored within WriteRef itself, and
it is not invalidated when the write is committed.

3 years ago[SimplifyCFG] FoldBranchToCommonDest(): properly handle same-block external uses...
Roman Lebedev [Tue, 23 Mar 2021 14:33:40 +0000 (17:33 +0300)]
[SimplifyCFG] FoldBranchToCommonDest(): properly handle same-block external uses (PR49510/PR49689)

We clone bonus instructions to the end of the predecessor block,
and then use `SSAUpdater::RewriteUseAfterInsertions()`.
But that only deals with the cases where the use-to-be-rewritten
are either in different block from the def, or come after the def.

But in some loop cases, the external use may be in the beginning of
predecessor block, before the newly cloned bonus instruction.
`SSAUpdater::RewriteUseAfterInsertions()` does not deal with that.
Notably, the external use can't happen to be both in the same block
and *after* the newly-cloned instruction, because of the fold preconditions.

To properly handle these cases, when the use is in the same block,
we should instead use `SSAUpdater::RewriteUse()`.
TBN, they do the same thing for PHI users.

Fixes https://bugs.llvm.org/show_bug.cgi?id=49510
Likely Fixes https://bugs.llvm.org/show_bug.cgi?id=49689

3 years ago[clang][parser] Don't prohibit attributes on objc @try/@throw
Timm Bäder [Wed, 24 Feb 2021 10:24:28 +0000 (11:24 +0100)]
[clang][parser] Don't prohibit attributes on objc @try/@throw

This line has a TODO comment, but the answer to it seems to be "no"
given that clang itself uses attributes on @try statements in its tests.

This ProhibitAttributes() statement is also dead code since
ProhibitAttributs() does not handle GNU attributes at the moment but
those are the only attributes valid in objc.

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

3 years agoRevert "[Orc] Allow OrcGenericABI variant of LazyCallThroughManager"
Stefan Gränitz [Tue, 23 Mar 2021 14:23:22 +0000 (15:23 +0100)]
Revert "[Orc] Allow OrcGenericABI variant of LazyCallThroughManager"

This reverts commit 61974268269f96b672a50eac40a5a8eeb4acd6d3.

3 years ago[RISCV] Further optimize BUILD_VECTORs with repeated elements
Fraser Cormack [Fri, 19 Mar 2021 12:21:23 +0000 (12:21 +0000)]
[RISCV] Further optimize BUILD_VECTORs with repeated elements

This patch builds upon the initial BUILD_VECTOR work introduced in
D98700. It further optimizes the lowering of BUILD_VECTOR by using
VSELECT operations to effectively insert repeated elements into the
vector with relatively few instructions. This allows us to optimize more
BUILD_VECTORs without significantly increasing the size of the generated
code.

Reviewed By: craig.topper

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

3 years ago[SimplifyCFG] use profile metadata to refine merging branch conditions
Sanjay Patel [Tue, 23 Mar 2021 13:55:04 +0000 (09:55 -0400)]
[SimplifyCFG] use profile metadata to refine merging branch conditions

2nd try (original: 27ae17a6b014) with fix/test for crash. We must make
sure that TTI is available before trying to use it because it is not
required (might be another bug).

Original commit message:

This is one step towards solving:
https://llvm.org/PR49336

In that example, we disregard the recommended usage of builtin_expect,
so an expensive (unpredictable) branch is folded into another branch
that is guarding it.
Here, we read the profile metadata to see if the 1st (predecessor)
condition is likely to cause execution to bypass the 2nd (successor)
condition before merging conditions by using logic ops.

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

3 years ago[gn build] (manually) port d709dcc09097
Nico Weber [Tue, 23 Mar 2021 14:12:53 +0000 (10:12 -0400)]
[gn build] (manually) port d709dcc09097

3 years agoRevert "A new option -print-on-crash that prints the IR as it was upon entering the...
Jamie Schmeiser [Tue, 23 Mar 2021 14:09:27 +0000 (10:09 -0400)]
Revert "A new option -print-on-crash that prints the IR as it was upon entering the last pass when there is a crash."

This reverts commit 9544a32287eccb42a4367cff9b5888855d6b8756.

3 years ago[PowerPC][NFC] Use valid type for offset in altivec.h
Nemanja Ivanovic [Tue, 23 Mar 2021 13:43:16 +0000 (08:43 -0500)]
[PowerPC][NFC] Use valid type for offset in altivec.h

We currently use signed long long instead of ptrdiff_t for offsets
in altivec.h. This has never really presented a problem because
all platforms where we use these are 64-bit. However, now that
we have 32-bit targets, we need to use a meaningful type.

3 years agoA new option -print-on-crash that prints the IR as it was upon entering the last...
Jamie Schmeiser [Tue, 23 Mar 2021 13:27:30 +0000 (09:27 -0400)]
A new option -print-on-crash that prints the IR as it was upon entering the last pass when there is a crash.
Summary:
The IR is saved in its print form before each pass is started and a
signal handler is registered.  If the compilation crashes, the signal
handler will print the saved IR to dbgs().  This option
can be modified using -print-module-scope to get the IR for the complete
module.  Note that this option only works with the new pass manager.

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

3 years agoIntroduce a generic operator to apply complex operations to BitVector
serge-sans-paille [Mon, 8 Mar 2021 13:57:39 +0000 (14:57 +0100)]
Introduce a generic operator to apply complex operations to BitVector

This avoids temporary and memcpy call when computing large expressions.

It's basically some kind of poor man's expression template, but it seems easier
to maintain to have a single generic `apply` call instead of the whole
expression template machinery here.

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

3 years ago[llvm-symbolizer][llvm-nm] Fix AArch64 and ARM mapping symbols handling.
Yvan Roux [Tue, 23 Mar 2021 13:09:49 +0000 (14:09 +0100)]
[llvm-symbolizer][llvm-nm] Fix AArch64 and ARM mapping symbols handling.

Exclude AArch64 mapping symbols ($x and $d) for symtab symbolization as
it was done for ARM since D95916 tom bring bots back to green state.

This is implemented by setting SF_FormatSpecific such that
llvm-symbolizer will ignore them, and use this flag to re-implement
llvm-nm --special-syms option which make it work for both targets.

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

3 years ago[openacc][openmp] Reduce number of generated file and prefer inclusion of .inc
Valentin Clement [Tue, 23 Mar 2021 13:10:04 +0000 (09:10 -0400)]
[openacc][openmp] Reduce number of generated file and prefer inclusion of .inc

Follow up from D92955 and D83636. This patch makes the base cpp files
OMP.cpp and ACC.cpp normal files and they now include the XXX.inc file
generated by tablegen. This reduces the number of file generated by the
DirectiveEmitter backend and makes it closer to the proposal in D83636.

Reviewed By: Meinersbur

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

3 years agoGlobalISel: Lower funnel shifts
Matt Arsenault [Fri, 20 Mar 2020 02:48:13 +0000 (22:48 -0400)]
GlobalISel: Lower funnel shifts

3 years ago[Orc] Allow OrcGenericABI variant of LazyCallThroughManager
Stefan Gränitz [Tue, 23 Mar 2021 12:50:20 +0000 (13:50 +0100)]
[Orc] Allow OrcGenericABI variant of LazyCallThroughManager

Apply the way createLocalIndirectStubsManagerBuilder() deals with unsupported achritectures to createLocalLazyCallThroughManager(). The returned call-through manager is dysfunctional: It runs into an unreachable as soon as a lazy JIT attempts to use it. However, this results in broader platform support for lli in default (greedy) ORC mode where no lazy materialization is required.

3 years ago[RISCV][NFC] Fix RVV intrinsic tests.
Zakk Chen [Mon, 22 Mar 2021 15:20:48 +0000 (08:20 -0700)]
[RISCV][NFC] Fix RVV intrinsic tests.

1. Skip the temporary file
2. Test cc1 with -S to verify codegen work well. Add '-target-feature
   +m' because the backend requires it to calculate the vscaled size/offset.

Reviewed By: craig.topper

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

3 years ago[gn build] Port 274907c0a4d6
LLVM GN Syncbot [Tue, 23 Mar 2021 13:01:57 +0000 (13:01 +0000)]
[gn build] Port 274907c0a4d6

3 years ago[ASTImporter] Split out Objective-C related unit tests
Raphael Isemann [Tue, 23 Mar 2021 12:55:44 +0000 (13:55 +0100)]
[ASTImporter] Split out Objective-C related unit tests

This moves the two tests we have for importing Objective-C nodes to their own
file. The motivation is that this means I can add more Objective-C tests without
making the compilation time of ASTImporterTest even longer. Also it seems nice
to separate the Apple-specific stuff from the ASTImporter test.

Reviewed By: martong

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

3 years ago[SLP] allow matching integer min/max intrinsics as reduction ops
Sanjay Patel [Tue, 23 Mar 2021 12:30:19 +0000 (08:30 -0400)]
[SLP] allow matching integer min/max intrinsics as reduction ops

As noted in D98152, we need to patch SLP to avoid regressions when
we start canonicalizing to integer min/max intrinsics.
Most of the real work to make this possible was in:
7202f47508

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

3 years ago[NFC] clang-format llvm/lib/Transforms/Utils/CloneFunction.cpp
Luke Drummond [Tue, 23 Mar 2021 11:40:49 +0000 (11:40 +0000)]
[NFC] clang-format llvm/lib/Transforms/Utils/CloneFunction.cpp

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

3 years ago[NFC] Minor refactor
Luke Drummond [Tue, 23 Mar 2021 11:31:59 +0000 (11:31 +0000)]
[NFC] Minor refactor

- Give unwieldy repeated expression a name
- Use a ranged `for` basic block iterator

Reviewed by: nikic, dexonsmith
Differential Revisision: https://reviews.llvm.org/D98957

3 years ago[NFCI] cleanup CloneFunctionInto
Luke Drummond [Tue, 23 Mar 2021 11:27:29 +0000 (11:27 +0000)]
[NFCI] cleanup CloneFunctionInto

Hoist early return for decl-only clones to before DIFinder
calculation.
Also fix an out of date assert message after invariants changed in
22a52dfddce.

Reviewed by: nikic, dexonsmith
Differential Revisision: https://reviews.llvm.org/D98957

3 years ago[AArch64] Fix unused variable warning
Benjamin Kramer [Tue, 23 Mar 2021 12:42:14 +0000 (13:42 +0100)]
[AArch64] Fix unused variable warning

3 years ago[LangRef] Fix typos in the vector-type memory layout section
Fraser Cormack [Tue, 23 Mar 2021 09:42:26 +0000 (09:42 +0000)]
[LangRef] Fix typos in the vector-type memory layout section

Reviewed By: bjope

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

3 years ago[llvm-opt] Bug fix within combining FP vectors
Nashe Mncube [Tue, 9 Mar 2021 12:18:20 +0000 (12:18 +0000)]
[llvm-opt] Bug fix within combining FP vectors

A bug was found within InstCombineCasts where a function call
is only implemented to work with FixedVectors. This caused a
crash when a ScalableVector was passed to this function.
This commit introduces a regression test which recreates the
failure and a bug fix.

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