platform/upstream/llvm.git
3 years agoNFC: Migrate SimpleLoopUnswitch to work on InstructionCost
Sander de Smalen [Tue, 2 Feb 2021 12:28:20 +0000 (12:28 +0000)]
NFC: Migrate SimpleLoopUnswitch to work on InstructionCost

This patch migrates cost values and arithmetic to work on InstructionCost.
When the interfaces to TargetTransformInfo are changed, any InstructionCost
state will propagate naturally.

See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

Reviewed By: david-arm

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

3 years ago[ASTMatchers] Fix matching after generic top-level matcher
Stephen Kelly [Sat, 30 Jan 2021 01:36:40 +0000 (01:36 +0000)]
[ASTMatchers] Fix matching after generic top-level matcher

With a matcher like

  expr(anyOf(integerLiteral(equals(42)), unless(expr())))

and code such as

  struct B {
    B(int);
  };

  B func1() { return 42; }

the top-level expr() would match each of the nodes which are not spelled
in the source and then ignore-traverse to match the integerLiteral node.
This would result in multiple results reported for the integerLiteral.

Fix that by only running matching logic on nodes which are not skipped
with the top-level matcher.

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

3 years ago[mlir][Linalg] Fix and properly test CodegenStrategy API
Nicolas Vasilache [Tue, 2 Feb 2021 12:16:51 +0000 (12:16 +0000)]
[mlir][Linalg] Fix and properly test CodegenStrategy API

Fix a bug that was introduced where calling the codegen strategy with actual concrete C++ Op types did not trigger the expected behavior.
Also introduce a test for the behavior that was missing.

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

3 years agoRevert "[test] Default clang/test to FileCheck --allow-unused-prefixes=false"
Nico Weber [Tue, 2 Feb 2021 12:38:44 +0000 (07:38 -0500)]
Revert "[test] Default clang/test to FileCheck --allow-unused-prefixes=false"

This reverts commit 80f539526eec31f03aadd96753648686312b1ad1.
Many test failures on mac: http://45.33.8.238/macm1/2772/summary.html
One on win: http://45.33.8.238/win/32442/summary.html

3 years ago[clangd] Report only decl of overridding method in xref.
Utkarsh Saxena [Mon, 1 Feb 2021 20:17:53 +0000 (21:17 +0100)]
[clangd] Report only decl of overridding method in xref.

See: https://github.com/clangd/clangd/issues/668

```
struct A { virtual void foo() = 0; };
struct B : A { void foo() override; };
```

Find refs on `A::foo()` will show:
- decls of `A::foo()`
- decls of `B::foo()`
- refs to `A::foo()`
- no refs to `B::foo()`.

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

3 years ago[mlir][Linalg] Fix unused variable warning in Release builds. NFC.
Benjamin Kramer [Tue, 2 Feb 2021 11:59:41 +0000 (12:59 +0100)]
[mlir][Linalg] Fix unused variable warning in Release builds. NFC.

3 years ago[AMDGPU][MC] Corrected parsing of optional modifiers
Dmitry Preobrazhensky [Tue, 2 Feb 2021 11:49:59 +0000 (14:49 +0300)]
[AMDGPU][MC] Corrected parsing of optional modifiers

Fixed bugs in parsing of "no*" modifiers and improved errors handling.
See https://bugs.llvm.org/show_bug.cgi?id=41282.

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

3 years ago[X86][AVX512] Support variable-index vector insertion on AVX512 targets (PR47924)
Simon Pilgrim [Tue, 2 Feb 2021 11:40:39 +0000 (11:40 +0000)]
[X86][AVX512] Support variable-index vector insertion on AVX512 targets (PR47924)

With predicate masks, AVX512 can efficiently perform variable-index vector insertion with 2 broadcasts + 1 comparison, avoiding a lot of aliased memory traffic.

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

3 years ago[X86] Fix disassembly of x86-64 GDTLS code sequence
Andrew Ng [Wed, 27 Jan 2021 16:47:21 +0000 (16:47 +0000)]
[X86] Fix disassembly of x86-64 GDTLS code sequence

For x86-64 the REX.w prefix takes precedence over any other size
override (i.e. 0x66). Therefore, for x86-64 when REX.w is present set
'hasOpSize' to false to ensure that any size override is ignored.

Fixes PR48901.

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

3 years ago[mlir][Linalg] Refactor Linalg vectorization for better reuse and extensibility.
Nicolas Vasilache [Tue, 2 Feb 2021 11:19:21 +0000 (11:19 +0000)]
[mlir][Linalg] Refactor Linalg vectorization for better reuse and extensibility.

This revision unifies Linalg vectorization and paves the way for vectorization of Linalg ops with mixed-precision operations.
The new algorithm traverses the ops in the linalg block in order and avoids recursion.
It uses a BlockAndValueMapping to keep track of vectorized operations.

The revision makes the following modifications but is otherwise NFC:
1. vector.transfer_read are created eagerly and may appear in a different order than the original order.
2. a more progressive vectorization to vector.contract results in only the multiply operation being converted to `vector.contract %a, %b, %zero`, where `%zero` is a
constant of the proper type. Later vector canonicalizations are assumed to rewrite vector.contract %a, %b, %zero + add to a proper accumulate form.

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

3 years ago[X86][AVX] Add missing VEX_WIG tags from VPACKUSDW/VPHSUBD/VPCMPISTRI/VPCMPISTRM...
Simon Pilgrim [Tue, 2 Feb 2021 10:53:28 +0000 (10:53 +0000)]
[X86][AVX] Add missing VEX_WIG tags from VPACKUSDW/VPHSUBD/VPCMPISTRI/VPCMPISTRM/VPCMPESTRI/VPCMPESTRM

Fixes PR48877

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

3 years ago[OpenCL] Change extension handling for -fdeclare-opencl-builtins
Sven van Haastregt [Tue, 2 Feb 2021 11:15:29 +0000 (11:15 +0000)]
[OpenCL] Change extension handling for -fdeclare-opencl-builtins

Until now, the `-fdeclare-opencl-builtins` option behaved differently
compared to inclusion of `opencl-c.h`: builtins that are part of an
extension were only available if the extension was enabled using the
corresponding pragma.

Builtins that belong to an extension are guarded using a preprocessor
macro (that is named after the extension) in `opencl-c.h`.  Align the
behaviour of `-fdeclare-opencl-builtins` with this.

Co-authored-by: Anastasia Stulova
Differential Revision: https://reviews.llvm.org/D95616

3 years ago[ARM] Remove DLS lr, lr
David Green [Tue, 2 Feb 2021 11:09:31 +0000 (11:09 +0000)]
[ARM] Remove DLS lr, lr

A DLS lr, lr instruction only moves lr to itself. It need not be emitted
on it's own to save a instruction in the loop preheader.

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

3 years agoRevert "[CSSPGO] Factor out common part for CSSPGO inline and AFDO inline"
Adrian Kuegel [Tue, 2 Feb 2021 10:46:54 +0000 (11:46 +0100)]
Revert "[CSSPGO] Factor out common part for CSSPGO inline and AFDO inline"

This reverts commit 9a03058d6322edb8abc803ba3e436cc62647d979.

3 years agoRevert "Fix build break from D95024"
Adrian Kuegel [Tue, 2 Feb 2021 10:46:32 +0000 (11:46 +0100)]
Revert "Fix build break from D95024"

This reverts commit 09cd849fdef2b2d3de2d0b0a5c512100957e0ef6.

3 years ago[ARM] Regenerate LowOverheadLoops mir tests. NFC
David Green [Tue, 2 Feb 2021 10:28:58 +0000 (10:28 +0000)]
[ARM] Regenerate LowOverheadLoops mir tests. NFC

3 years ago[flang][driver] Disallow non-existent input files in the frontend driver
Andrzej Warzynski [Tue, 2 Feb 2021 09:07:33 +0000 (09:07 +0000)]
[flang][driver] Disallow non-existent input files in the frontend driver

This patch adds a check that verifies that the input file used when
calling the frontend driver (i.e. `flang-new -fc1`) actually exists.
This was not required for the compiler driver, `flang-new`, as that's
already handled in libclangDriver.

Once all input/output file management is moved to the driver, we should
also check that for input from `stdin` the corresponding file descriptor
was successfully acquired.

This patch also makes sure that the default action in the frontend is
`ParseSyntaxOnly`. This is consistent with Clang. Before this change
`flang-new -fc1` would do nothing, which makes testing changes like the
one introduced here a bit tricky.

Reviewed By: SouraVX

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

3 years ago[SVE][LoopVectorize] Add masked load/store and gather/scatter support for SVE
David Sherwood [Fri, 22 Jan 2021 16:53:21 +0000 (16:53 +0000)]
[SVE][LoopVectorize] Add masked load/store and gather/scatter support for SVE

This patch updates IRBuilder::CreateMaskedGather/Scatter to work
with ScalableVectorType and adds isLegalMaskedGather/Scatter functions
to AArch64TargetTransformInfo. In addition I've fixed up
isLegalMaskedLoad/Store to return true for supported scalar types,
since this is what the vectorizer asks for.

In LoopVectorize.cpp I've changed
LoopVectorizationCostModel::getInterleaveGroupCost to return an invalid
cost for scalable vectors, since currently this relies upon using shuffle
vector for reversing vectors. In addition, in
LoopVectorizationCostModel::setCostBasedWideningDecision I have assumed
that the cost of scalarising memory ops is infinitely expensive.

I have added some simple masked load/store and gather/scatter tests,
including cases where we use gathers and scatters for conditional invariant
loads and stores.

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

3 years agoFold one-use variable into assert. NFCI.
Benjamin Kramer [Tue, 2 Feb 2021 09:50:48 +0000 (10:50 +0100)]
Fold one-use variable into assert. NFCI.

Avoids a warning in Release builds.

3 years ago[mlir] Keep track of region signature conversions as argument replacements
Alex Zinenko [Fri, 29 Jan 2021 18:41:10 +0000 (19:41 +0100)]
[mlir] Keep track of region signature conversions as argument replacements

In dialect conversion, signature conversions essentially perform block argument
replacement and are added to the general value remapping. However, the replaced
values were not tracked, so if a signature conversion was rolled back, the
construction of operand lists for the following patterns could have obtained
block arguments from the mapping and give them to the pattern leading to
use-after-free. Keep track of signature conversions similarly to normal block
argument replacement, and erase such replacements from the general mapping when
the conversion is rolled back.

Reviewed By: rriddle

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

3 years ago[dllimport] Honor always_inline when deciding whether a dllimport function should...
Hans Wennborg [Fri, 29 Jan 2021 09:54:40 +0000 (10:54 +0100)]
[dllimport] Honor always_inline when deciding whether a dllimport function should be available for inlining (PR48925)

Normally, Clang will not make dllimport functions available for inlining
if they reference non-imported symbols, as this can lead to confusing
link errors. But if the function is marked always_inline, the user
presumably knows what they're doing and the attribute should be honored.

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

3 years ago[AMDGPU] Mark epilog restores as frame-destroy
Sebastian Neubauer [Mon, 1 Feb 2021 15:02:09 +0000 (16:02 +0100)]
[AMDGPU] Mark epilog restores as frame-destroy

I guess instructions were marked as frame-setup by accident, they are
restores as part of the epilog.

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

3 years ago[AMDGPU] Clarify calling conv about inactive lanes
Sebastian Neubauer [Thu, 28 Jan 2021 13:53:22 +0000 (14:53 +0100)]
[AMDGPU] Clarify calling conv about inactive lanes

So far, it was not specified what happens with the VGPRs of inactive
lanes when functions are called. This patch explicitely mentions that
the VGPR values of inactive lanes need to be preserved for all
registers.

This describes the current behavior, as only active lanes of registers
are saved to scratch. Also, as the multi-lane nature of VGPRs is not
properly modeled, we cannot determine the live VGPRs from inactive lanes
at calls. So we cannot save them, even if we intended to do so.

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

3 years agoFix build break from D95024
Wenlei He [Tue, 2 Feb 2021 09:00:24 +0000 (01:00 -0800)]
Fix build break from D95024

3 years ago[CSSPGO] Factor out common part for CSSPGO inline and AFDO inline
Wenlei He [Wed, 20 Jan 2021 07:29:14 +0000 (23:29 -0800)]
[CSSPGO] Factor out common part for CSSPGO inline and AFDO inline

Refactoring SampleProfileLoader::inlineHotFunctions to use helpers from CSSPGO inlining and reduce similar code in the inlining loop, plus minor cleanup for AFDO path.

Test Plan:

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

3 years ago[AMDGPU] Add new short clamp pattern in GlobalISel.
Thomas Symalla [Tue, 2 Feb 2021 08:32:25 +0000 (09:32 +0100)]
[AMDGPU] Add new short clamp pattern in GlobalISel.

3 years agoRemoved Diff file.
Thomas Symalla [Tue, 2 Feb 2021 07:50:30 +0000 (08:50 +0100)]
Removed Diff file.

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

3 years agoFixed includes.
Thomas Symalla [Mon, 1 Feb 2021 16:58:51 +0000 (17:58 +0100)]
Fixed includes.

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

3 years agoFixed includes.
Thomas Symalla [Mon, 1 Feb 2021 15:59:57 +0000 (16:59 +0100)]
Fixed includes.

3 years agoReverted whitespace changes.
Thomas Symalla [Mon, 1 Feb 2021 08:19:44 +0000 (09:19 +0100)]
Reverted whitespace changes.

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

3 years agoAdded missing includes.
Thomas Symalla [Mon, 1 Feb 2021 08:17:33 +0000 (09:17 +0100)]
Added missing includes.

3 years agoRenamed med3 opcode, removed superfluous copy.
Thomas Symalla [Tue, 26 Jan 2021 10:26:50 +0000 (11:26 +0100)]
Renamed med3 opcode, removed superfluous copy.

3 years agoRemoved the generic virtual register creations. Reworked the tests.
Thomas Symalla [Mon, 25 Jan 2021 14:20:24 +0000 (15:20 +0100)]
Removed the generic virtual register creations. Reworked the tests.

3 years agoImplemented a MED3_S32 GIR opcode.
Thomas Symalla [Mon, 18 Jan 2021 15:05:00 +0000 (16:05 +0100)]
Implemented a MED3_S32 GIR opcode.

3 years agoAdded and used new target pseudo for v_cvt_pk_i16_i32, changes due to code review.
Thomas Symalla [Wed, 13 Jan 2021 14:23:45 +0000 (15:23 +0100)]
Added and used new target pseudo for v_cvt_pk_i16_i32, changes due to code review.

3 years agoFormatting changes
Thomas Symalla [Tue, 12 Jan 2021 12:02:49 +0000 (13:02 +0100)]
Formatting changes

3 years agoFormatting changes.
Thomas Symalla [Tue, 12 Jan 2021 12:01:04 +0000 (13:01 +0100)]
Formatting changes.

3 years agoUpdating formatting changes.
Thomas Symalla [Tue, 12 Jan 2021 11:58:36 +0000 (12:58 +0100)]
Updating formatting changes.

3 years agoResolve formatting changes.
Thomas Symalla [Tue, 12 Jan 2021 11:50:04 +0000 (12:50 +0100)]
Resolve formatting changes.

3 years agoCode changes yielded from review.
Thomas Symalla [Tue, 12 Jan 2021 08:40:21 +0000 (09:40 +0100)]
Code changes yielded from review.

3 years agoFixed tests.
Thomas Symalla [Mon, 11 Jan 2021 14:09:47 +0000 (15:09 +0100)]
Fixed tests.

3 years agoMove step to PreLegalizer
Thomas Symalla [Mon, 11 Jan 2021 13:50:45 +0000 (14:50 +0100)]
Move step to PreLegalizer

3 years agoMove Combiner to PreLegalize step
Thomas Symalla [Mon, 11 Jan 2021 13:50:28 +0000 (14:50 +0100)]
Move Combiner to PreLegalize step

3 years agoRenamed identifiers in lit
Thomas Symalla [Tue, 5 Jan 2021 10:24:27 +0000 (11:24 +0100)]
Renamed identifiers in lit

3 years agoReverted unintended git-format change.
Thomas Symalla [Tue, 5 Jan 2021 08:59:17 +0000 (09:59 +0100)]
Reverted unintended git-format change.

3 years agoFixed the lit tests and a bug in the implementation.
Thomas Symalla [Tue, 5 Jan 2021 08:58:00 +0000 (09:58 +0100)]
Fixed the lit tests and a bug in the implementation.

3 years agoRefactored the pattern matching.
Thomas Symalla [Mon, 4 Jan 2021 14:23:44 +0000 (15:23 +0100)]
Refactored the pattern matching.

3 years agoRenames
Thomas Symalla [Mon, 4 Jan 2021 10:27:30 +0000 (11:27 +0100)]
Renames

3 years agoAdded early exit.
Thomas Symalla [Tue, 22 Dec 2020 15:04:26 +0000 (16:04 +0100)]
Added early exit.

3 years agoAdded comments.
Thomas Symalla [Tue, 22 Dec 2020 13:49:24 +0000 (14:49 +0100)]
Added comments.

3 years agoclang-format
Thomas Symalla [Tue, 22 Dec 2020 13:40:07 +0000 (14:40 +0100)]
clang-format

3 years agoAdded clamp i64 to i16 global isel pattern.
Thomas Symalla [Tue, 22 Dec 2020 13:37:49 +0000 (14:37 +0100)]
Added clamp i64 to i16 global isel pattern.

3 years ago[RISCV] Replace NoX0 SDNodeXForm with a ComplexPattern to do the selection of the...
Craig Topper [Tue, 2 Feb 2021 07:53:54 +0000 (23:53 -0800)]
[RISCV] Replace NoX0 SDNodeXForm with a ComplexPattern to do the selection of the VL operand.

I think this is a more standard way of doing this.

Reviewed By: rogfer01

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

3 years ago[CSSPGO] Call site prioritized inlining for sample PGO
Wenlei He [Mon, 4 Jan 2021 00:43:06 +0000 (16:43 -0800)]
[CSSPGO] Call site prioritized inlining for sample PGO

This change implemented call site prioritized BFS profile guided inlining for sample profile loader. The new inlining strategy maximize the benefit of context-sensitive profile as mentioned in the follow up discussion of CSSPGO RFC. The change will not affect today's AutoFDO as it's opt-in. CSSPGO now defaults to the new FDO inliner, but can fall back to today's replay inliner using a switch (`-sample-profile-prioritized-inline=0`).

Motivation

With baseline AutoFDO, the inliner in sample profile loader only replays previous inlining, and the use of profile is only for pruning previous inlining that turned out to be cold. Due to the nature of replay, the FDO inliner is simple with hotness being the only decision factor. It has the following limitations that we're improving now for CSSPGO.
 - It doesn't take inline candidate size into account. Since it's doing replay, the size growth is bounded by previous CGSCC inlining. With context-sensitive profile, FDO inliner is no longer limited by previous inlining, so we need to take size into account to avoid significant size bloat.
 - The way it looks at hotness is not accurate. It uses total samples in an inlinee as proxy for hotness, while what really matters for an inline decision is the call site count. This is an unfortunate fall back because call site count and callee entry count are not reliable due to dwarf based correlation, especially for inlinees. Now paired with pseudo-probe, we have accurate call site count and callee's entry count, so we can use that to gauge hotness more accurately.
 - It treats all call sites from a block as hot as long as there's one call site considered hot. This is normally true, but since total samples is used as hotness proxy, this transitiveness within block magnifies the inacurate hotness heuristic. With pseduo-probe and the change above, this is no longer an issue for CSSPGO.

New FDO Inliner

Putting all the requirement for CSSPGO together, we need a top-down call site prioritized BFS inliner. Here're reasons why each component is needed.
 - Top-down: We need a top-down inliner to better leverage context-sensitive profile, so inlining is driven by accurate context profile, and post-inline is also accurate. This is already implemented in https://reviews.llvm.org/D70655.
 - Size Cap: For top-down inliner, taking function size into account for inline decision alone isn't sufficient to control size growth. We also need to explicitly cap size growth because with top-down inlining, we can grow inliner size significantly with large number of smaller inlinees even if each individually passes the cost/size check.
 - Prioritize call sites: With size cap, inlining order also becomes important, because if we stop inlining due to size budget limit, we'd want to use budget towards the most beneficial call sites.
 - BFS inline: Same as call site prioritization, if we stop inlining due to size budget limit, we want a balanced inline tree, rather than going deep on one call path.

Note that the new inliner avoids repeatedly evaluating same set of call site, so it should help with compile time too. For this reason, we could transition today's FDO inliner to use a queue with equal priority to avoid wasted reevaluation of same call site (TODO).

Speculative indirect call promotion and inlining is also supported now with CSSPGO just like baseline AutoFDO.

Tunings and knobs

I created tuning knobs for size growth/cap control, and for hot threshold separate from CGSCC inliner. The default values are selected based on initial tuning with CSSPGO.

Results

Evaluated with an internal LLVM fork couple months ago, plus another change to adjust hot-threshold cutoff for context profile (will send up after this one), the new inliner show ~1% geomean perf win on spec2006 with CSSPGO, while reducing code size too. The measurement was done using train-train setup, MonoLTO w/ new pass manager and pseudo-probe. Note that this is just a starting point - we hope that the new inliner will open up more opportunity with CSSPGO, but it will certainly take more time and effort to make it fully calibrated and ready for bigger workloads (we're working on it).

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

3 years ago[mlir][Standard] Extend n-D vector lowering to LLVM to [s|z]exti ops.
Nicolas Vasilache [Tue, 2 Feb 2021 07:41:07 +0000 (07:41 +0000)]
[mlir][Standard] Extend n-D vector lowering to LLVM to [s|z]exti ops.

[s|z]exti ops do not have the same operand and result type.
As a consequence, the lowering of the n-D vector form needs to be relaxed a bit.
This revision additionally performs a few NFC renamings of variables to make them more intuitive.

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

3 years ago[SelectionDAG] Prevent scalable vector warning from ComputeNumSignBits on extract_vec...
Craig Topper [Tue, 2 Feb 2021 07:08:46 +0000 (23:08 -0800)]
[SelectionDAG] Prevent scalable vector warning from ComputeNumSignBits on extract_vector_elt on a scalable vector.

3 years ago[NFC][Docs] Fix RAVFrontendAction doc's CMakelists.txt for Shared build
xgupta [Tue, 2 Feb 2021 07:23:45 +0000 (12:53 +0530)]
[NFC][Docs] Fix RAVFrontendAction doc's CMakelists.txt for Shared build

[[ https://clang.llvm.org/docs/RAVFrontendAction.html | Example tutorial ]] giving undefine reference error while building with BUILD_SHARED_LIBS=ON.

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

3 years agoRevert "[AArch64] Homogeneous Prolog and Epilog Size Optimization"
Puyan Lotfi [Tue, 2 Feb 2021 07:33:44 +0000 (02:33 -0500)]
Revert "[AArch64] Homogeneous Prolog and Epilog Size Optimization"

This reverts commit 0426be3df6180747bd68706db87a70580f064f0f.

Reverting due to some expensive-checks failures in tests.

3 years ago[test] Fix unused FileCheck prefixes in test/Reduce
Fangrui Song [Tue, 2 Feb 2021 07:05:46 +0000 (23:05 -0800)]
[test] Fix unused FileCheck prefixes in test/Reduce

3 years ago[test] Fix unused FileCheck prefixes in clang-tidy and one llvm/test/Reduce test
Fangrui Song [Tue, 2 Feb 2021 06:51:29 +0000 (22:51 -0800)]
[test] Fix unused FileCheck prefixes in clang-tidy and one llvm/test/Reduce test

3 years ago[ORC] Clear unused materializing info entries.
Lang Hames [Tue, 2 Feb 2021 06:44:12 +0000 (17:44 +1100)]
[ORC] Clear unused materializing info entries.

Once a symbol is Ready its MaterializingInfo entry is unused and can be removed
to free up some memory.

3 years ago[test] Fix unused FileCheck prefixes in compiler-rt
Fangrui Song [Tue, 2 Feb 2021 06:32:13 +0000 (22:32 -0800)]
[test] Fix unused FileCheck prefixes in compiler-rt

3 years ago[SCEV] Apply loop guards to divisibility tests
Gil Rapaport [Fri, 11 Dec 2020 08:09:51 +0000 (10:09 +0200)]
[SCEV] Apply loop guards to divisibility tests

Extend applyLoopGuards() to take into account conditions/assumes proving some
value %v to be divisible by D by rewriting %v to (%v / D) * D. This lets the
loop unroller and the loop vectorizer identify more loops as not requiring
remainder loops.

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

3 years ago[test] Default clang/test to FileCheck --allow-unused-prefixes=false
Fangrui Song [Tue, 2 Feb 2021 06:02:59 +0000 (22:02 -0800)]
[test] Default clang/test to FileCheck --allow-unused-prefixes=false

3 years ago[test] Fix unused FileCheck prefixes in lldb
Fangrui Song [Tue, 2 Feb 2021 05:45:51 +0000 (21:45 -0800)]
[test] Fix unused FileCheck prefixes in lldb

3 years ago[MLIR][TOSA] Comparison based elementwise operations for tosa-to-linalg
natashaknk [Tue, 2 Feb 2021 05:37:23 +0000 (21:37 -0800)]
[MLIR][TOSA] Comparison based elementwise operations for tosa-to-linalg

Comitted log, exp, maximum, minimum, comparison, ceil and floor conversions from TOSA to LinAlg. Support for signless integer and floating point.

Reviewed By: rsuderman

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

3 years ago[AArch64] Homogeneous Prolog and Epilog Size Optimization
Kyungwoo Lee [Tue, 2 Feb 2021 03:32:32 +0000 (22:32 -0500)]
[AArch64] Homogeneous Prolog and Epilog Size Optimization

Prologs and epilogs handle callee-save registers and tend to be irregular with
different immediate offsets that are not often handled by the MachineOutliner.
Commit D18619/a5335647d5e8 (combining stack operations) stretched irregularity
further.

This patch tries to emit homogeneous stores and loads with the same offset for
prologs and epilogs respectively. We have observed that this canonicalizes
(homogenizes) prologs and epilogs significantly and results in a greatly
increased chance of outlining, resulting in a code size reduction.

Despite the above results, there are still size wins to be had that the
MachineOutliner does not provide due to the special handling X30/LR. To handle
the LR case, his patch custom-outlines prologs and epilogs in place. It does
this by doing the following:

  * Injects HOM_Prolog and HOM_Epilog pseudo instructions during a Prolog and
    Epilog Injection Pass.
  * Lowers and optimizes said pseudos in a AArchLowerHomogneousPrologEpilog Pass.
  * Outlined helpers are created on demand. Identical helpers are merged by the linker.
  * An opt-in flag is introduced to enable this feature. Another threshold flag
    is also introduced to control the aggressiveness of outlining for application's need.

This reduced an average of 4% of code size on LLVM-TestSuite/CTMark targeting arm64/-Oz.

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

3 years ago[test] Fix unused FileCheck prefixes in compiler-rt/test
Fangrui Song [Tue, 2 Feb 2021 05:24:58 +0000 (21:24 -0800)]
[test] Fix unused FileCheck prefixes in compiler-rt/test

3 years agoclang-extra: fix incorrect use of std::lock_guard by adding variable name (identified...
Conrad Poelman [Tue, 2 Feb 2021 04:59:38 +0000 (05:59 +0100)]
clang-extra: fix incorrect use of std::lock_guard by adding variable name (identified by MSVC [[nodiscard]] error)

`std::lock_guard` is an RAII class that needs a variable name whose scope determines the guard's lifetime. This particular usage lacked a variable name, meaning the guard could be destroyed before the line that it was indented to protect.

This line was identified by building clang with the latest MSVC preview release, which declares the std::lock_guard constructor to be `[[nodiscard]]` to draw attention to such issues.

Reviewed By: kadircet

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

3 years ago[VFS] Add support to RedirectingFileSystem for mapping a virtual directory to one...
Nathan Hawes [Fri, 15 Jan 2021 07:33:52 +0000 (17:33 +1000)]
[VFS] Add support to RedirectingFileSystem for mapping a virtual directory to one in the external FS.

Previously file entries in the -ivfsoverlay yaml could map to a file in the
external file system, but directories had to list their contents in the form of
other file entries or directories. Allowing directory entries to map to a
directory in the external file system makes it possible to present an external
directory's contents in a different location and (in combination with the
'fallthrough' option) overlay one directory's contents on top of another.

rdar://problem/72485443
Differential Revision: https://reviews.llvm.org/D94844

3 years ago[TableGen] Use range-based for loops (NFC)
Kazu Hirata [Tue, 2 Feb 2021 04:55:08 +0000 (20:55 -0800)]
[TableGen] Use range-based for loops (NFC)

3 years ago[TableGen] Use ListSeparator (NFC)
Kazu Hirata [Tue, 2 Feb 2021 04:55:07 +0000 (20:55 -0800)]
[TableGen] Use ListSeparator (NFC)

3 years ago[llvm] Use pop_back_val (NFC)
Kazu Hirata [Tue, 2 Feb 2021 04:55:05 +0000 (20:55 -0800)]
[llvm] Use pop_back_val (NFC)

3 years ago[test] Fix unuses FileCheck prefixes in lld
Fangrui Song [Tue, 2 Feb 2021 04:52:33 +0000 (20:52 -0800)]
[test] Fix unuses FileCheck prefixes in lld

3 years ago[test] Fix unuses FileCheck prefixes in clang/test/Modules
Fangrui Song [Tue, 2 Feb 2021 03:46:23 +0000 (19:46 -0800)]
[test] Fix unuses FileCheck prefixes in clang/test/Modules

3 years ago[LoopVectorize] Relax a FCmpInst assert to dyn_cast after D95690
Fangrui Song [Tue, 2 Feb 2021 03:28:45 +0000 (19:28 -0800)]
[LoopVectorize] Relax a FCmpInst assert to dyn_cast after D95690

The instruction may be `icmp eq i32`. Noticed in an internal Halide+wasm JIT test.

3 years agoAMDGPU: Fix dbg_value handling when forming soft clause bundles
Matt Arsenault [Sat, 30 Jan 2021 22:10:51 +0000 (17:10 -0500)]
AMDGPU: Fix dbg_value handling when forming soft clause bundles

DBG_VALUES placed between memory instructions would change
codegen. Skip over these and re-insert them after the bundle instead
of giving up on bundling.

3 years ago[mlir] Add custom directive hooks for printing mixed integer or value operands.
MaheshRavishankar [Tue, 2 Feb 2021 03:03:12 +0000 (19:03 -0800)]
[mlir] Add custom directive hooks for printing mixed integer or value operands.

Add printer and parser hooks for a custom directive that allows
parsing and printing of idioms that can represent a list of values
each of which is either an integer or an SSA value. For example in

`subview %source[%offset_0, 1] [4, %size_1] [%stride_0, 3]`

each of the list (which represents offset, size and strides) is a mix
of either statically know integer values or dynamically computed SSA
values. Since this is used in many places adding a custom directive to
parse/print this idiom allows using assembly format on operations
which use this idiom.

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

3 years ago[Utils] Add a switch controlling prefix warnings in UpdateTestChecks
Mircea Trofin [Mon, 1 Feb 2021 23:21:55 +0000 (15:21 -0800)]
[Utils] Add a switch controlling prefix warnings in UpdateTestChecks

The switch controls both unused prefix warnings, and warnings about
functions which differ under different runs for a prefix, and, thus, end
up not having asserts for that prefix.

(If the latter case spans to all functions, then the former case kicks
in)

The switch is on by default, and can be disabled.

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

3 years ago[OpenMP][Libomptarget] Remove possible harmful copy constructor call for RTLsTy
Atmn Patel [Mon, 1 Feb 2021 00:18:41 +0000 (19:18 -0500)]
[OpenMP][Libomptarget] Remove possible harmful copy constructor call for RTLsTy

From https://bugs.llvm.org/show_bug.cgi?id=48973, we know that
`std::call_once(PM->RTLs.initFlag, &RTLsTy::LoadRTLs, PM->RTLs)` causes compile
time problems in libstdc++v3 5.3.1. This is because there was a defect in the
standard regarding the `call_once` (LWG 2442). This was fixed in libstdc++ soon
thereafter, but there are likely other standard libraries where this will fail.

By matching this function call with the other one, we fix this bug.

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

3 years ago[x86] introduce no_callee_saved_registers attribute
Philip Reames [Tue, 2 Feb 2021 00:07:01 +0000 (16:07 -0800)]
[x86] introduce no_callee_saved_registers attribute

This is directly analogous to the existing no_caller_saved_registers, but with the opposite intention.  A function or call so marked shifts the responsibility of spilling the usual CSRs to it's caller.

An indirect call site and callee which don't agree on the attribute is ill defined.

The motivation for this change is that being able to prune callee saves (without modifying other details of the calling convention) is sometimes useful when generating stubs and adapters.  There's no intention to expose this as a source language feature; this is expected to be used by frontends to implement adapters where warranted.

Some specific examples of use cases:
* GC compatible compiled code wants to call an externally defined library function without needing to track pointer values through CSRs.
* debug enabled code wants to call precompiled library which doesn't provide enough information to track CSRs while preserving debug quality in caller.
* adapter stub entering hand written assembler which doesn't follow normal calling conventions.

3 years ago[lldb] Use the host architecture in TestAppleSimulatorOSType.py
Jonas Devlieghere [Tue, 2 Feb 2021 00:12:48 +0000 (16:12 -0800)]
[lldb] Use the host architecture in TestAppleSimulatorOSType.py

3 years ago[obj2yaml, yaml2obj] Use Hex64 for BBAddressMap fields.
Rahman Lavaee [Sun, 31 Jan 2021 23:29:37 +0000 (15:29 -0800)]
[obj2yaml, yaml2obj] Use Hex64 for BBAddressMap fields.

This patch let the yaml encoding use Hex64 values for NumBlocks, BB AddressOffset, BB Size, and BB Metadata.
Additionally, it changes the decoded values in elf2yaml to uint64_t to match DataExtractor::getULEB128 return type.

Reviewed By: jhenderson

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

3 years ago[flang][NFC] Rename complex type.
Eric Schweitz [Sat, 30 Jan 2021 23:51:37 +0000 (15:51 -0800)]
[flang][NFC] Rename complex type.

This change renames the CplxType class to ComplexType.

3 years ago[NFC][X86] Use CallBase interface to simplify code
Philip Reames [Mon, 1 Feb 2021 22:02:30 +0000 (14:02 -0800)]
[NFC][X86] Use CallBase interface to simplify code

3 years ago[NFC][X86] Avoid redundant work inspecting callee
Philip Reames [Mon, 1 Feb 2021 21:51:10 +0000 (13:51 -0800)]
[NFC][X86] Avoid redundant work inspecting callee

3 years ago[InstrProfiling] Use !associated metadata for counters, data and values
Petr Hosek [Sat, 13 Jul 2019 21:02:07 +0000 (14:02 -0700)]
[InstrProfiling] Use !associated metadata for counters, data and values

C identifier name input sections such as __llvm_prf_* are GC roots so
they cannot be discarded. In LLD, the SHF_LINK_ORDER flag overrides the
C identifier name semantics.

The !associated metadata may be attached to a global object declaration
with a single argument that references another global object, and it
gets lowered to SHF_LINK_ORDER flag. When a function symbol is discarded
by the linker, setting up !associated metadata allows linker to discard
counters, data and values associated with that function symbol.

Note that !associated metadata is only supported by ELF, it does not have
any effect on non-ELF targets.

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

3 years ago[llvm-objcopy] -O binary: consider SHT_NOBITS sections to be empty
Patrick Oppenlander [Mon, 1 Feb 2021 23:01:25 +0000 (15:01 -0800)]
[llvm-objcopy] -O binary: consider SHT_NOBITS sections to be empty

This is consistent with BFD objcopy.

Previously llvm objcopy would allocate space for SHT_NOBITS sections
often resulting in enormous binary files.

New test case (binary-paddr.test %t6).

Reviewed By: jhenderson, MaskRay

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

3 years ago[AMDGPU] Set s-memtime-inst feature from clang
Stanislav Mekhanoshin [Sat, 30 Jan 2021 09:09:40 +0000 (01:09 -0800)]
[AMDGPU] Set s-memtime-inst feature from clang

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

3 years ago[CSSPGO] Tweaking inlining with pseudo probes.
Hongtao Yu [Mon, 1 Feb 2021 06:31:51 +0000 (22:31 -0800)]
[CSSPGO] Tweaking inlining with pseudo probes.

Fixing up a couple places where `getCallSiteIdentifier` is needed to support pseudo-probe-based callsites.

Also fixing an issue in the extbinary profile reader where the metadata section is not fully scanned based on the number of profiles loaded only for the current module.

Reviewed By: wmi, wenlei

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

3 years ago[clang-format] Add option to control the spaces in a line comment
Björn Schäpers [Fri, 29 Jan 2021 21:01:42 +0000 (22:01 +0100)]
[clang-format] Add option to control the spaces in a line comment

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

3 years ago[mlir][spirv] Add support for OpImageType
Weiwei Li [Mon, 1 Feb 2021 19:30:50 +0000 (14:30 -0500)]
[mlir][spirv] Add support for OpImageType

Support OpImageType in SPIRV Dialect.

This change doesn't support operand AccessQualifier since
it is optinal and only enables under Kernel capability.

co-authored-by: Alan Liu <alanliu.yf@gmail.com>

Reviewed By: antiagainst

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

3 years ago[tests] highlight cornercase w/deref hoisting from D95815
Philip Reames [Mon, 1 Feb 2021 21:25:42 +0000 (13:25 -0800)]
[tests] highlight cornercase w/deref hoisting from D95815

The main point of committing this early is to have a negative test in tree.  Nothing fails in the current tests if we implement this (currently unsound) optimization.

3 years agoNFC: Re-generate out-of-date matchers docs
Stephen Kelly [Mon, 1 Feb 2021 21:23:14 +0000 (21:23 +0000)]
NFC: Re-generate out-of-date matchers docs

3 years ago[LoopVectorize] improve IR fast-math-flags propagation in reductions
Sanjay Patel [Mon, 1 Feb 2021 19:21:24 +0000 (14:21 -0500)]
[LoopVectorize] improve IR fast-math-flags propagation in reductions

This is another step (see D95452) towards correcting fast-math-flags
bugs in vector reductions.

There are multiple bugs visible in the test diffs, and this is still
not working as it should. We still use function attributes (rather
than FMF) to drive part of the logic, but we are not checking for
the correct FP function attributes.

Note that FMF may not be propagated optimally on selects (example
in https://llvm.org/PR35607 ). That's why I'm proposing to union the
FMF of a fcmp+select pair and avoid regressions on existing vectorizer
tests.

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

3 years agoRevert "[libc++][format] Add basic_format_parse_context."
Mehdi Amini [Mon, 1 Feb 2021 21:18:11 +0000 (21:18 +0000)]
Revert "[libc++][format] Add basic_format_parse_context."

This reverts commit 35a57f39b5d126646335183f1ff0f7adb52d63bc.

A build is broken during clang bootstrap with:

In file included from ../libcxx/src/format.cpp:9:
/tmp/ci-nGNyLRM9V3/include/c++/v1/format:153:16: error: no member named 'is_constant_evaluated' in namespace 'std::__1'
    if (_VSTD::is_constant_evaluated() && __id >= __num_args_)
        ~~~~~~~^
1 error generated.

3 years agoAvoid string comparisons on the fast path of MLIR Identifier lookup (NFC)
Mehdi Amini [Mon, 1 Feb 2021 02:57:21 +0000 (02:57 +0000)]
Avoid string comparisons on the fast path of MLIR Identifier lookup (NFC)

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

3 years ago[ConstraintElimination] Add support for EQ predicates.
Florian Hahn [Thu, 28 Jan 2021 10:37:50 +0000 (10:37 +0000)]
[ConstraintElimination] Add support for EQ predicates.

A == B map to A >= B && A <= B
(https://alive2.llvm.org/ce/z/_dwxKn).

This extends the constraint construction to return a list of
constraints, which can be used to properly de-compose nested AND & OR.

3 years agoRevert "[mlir][spirv] Add support for OpImageType"
Lei Zhang [Mon, 1 Feb 2021 20:02:34 +0000 (15:02 -0500)]
Revert "[mlir][spirv] Add support for OpImageType"

This reverts commit 21f1462106b9ee1e646bf409c85528828320b34e.

3 years ago[mlir][spirv] Add support for OpImageType
Lei Zhang [Mon, 1 Feb 2021 19:30:50 +0000 (14:30 -0500)]
[mlir][spirv] Add support for OpImageType

Support OpImageType in SPIRV Dialect.

This change doesn't support operand AccessQualifier since
it is optinal and only enables under Kernel capability.

co-authored-by: Alan Liu <alanliu.yf@gmail.com>

Reviewed By: antiagainst

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