Commit Graph

389303 Commits

Author SHA1 Message Date
Florian Hahn c2d44bd230
[X86] Lower calls with clang.arc.attachedcall bundle
This patch adds support for lowering function calls with the
`clang.arc.attachedcall` bundle. The goal is to expand such calls to the
following sequence of instructions:

    callq   @fn
    movq  %rax, %rdi
    callq   _objc_retainAutoreleasedReturnValue / _objc_unsafeClaimAutoreleasedReturnValue

This sequence of instructions triggers Objective-C runtime optimizations,
hence we want to ensure no instructions get moved in between them.
This patch achieves that by adding a new CALL_RVMARKER ISD node,
which gets turned into the CALL64_RVMARKER pseudo, which eventually gets
expanded into the sequence mentioned above.

The ObjC runtime function to call is determined by the
argument in the bundle, which is passed through as a
target constant to the pseudo.

@ahatanak is working on using this attribute in the front- & middle-end.

Together with the front- & middle-end changes, this should address
PR31925 for X86.

This is the X86 version of 46bc40e502,
which added similar support for AArch64.

Reviewed By: ab

Differential Revision: https://reviews.llvm.org/D94597
2021-05-21 16:33:58 +01:00
Jon Chesterfield d54712ab4d [libomptarget][amdgpu] Mark alloc, free weak to facilitate local experimentation
[libomptarget][amdgpu] Mark alloc, free weak to facilitate local experimentation

There are a lot of different ways we might implement the devicertl local alloc
and free functions. Via host, local buffers (stack or arena), specialising per
kernel etc. It is not yet clear what the right design is. This change makes the
alloc and free functions weak, so one can override them from local tests while
comparing options.

Not strictly necessary, as a comparable patch can be applied locally each time,
but would be convenient for out of tree dev. Plan would be to drop the weak
attribute at the same time as introducing a working allocator to trunk.

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D102499
2021-05-21 16:09:22 +01:00
Jim Lin 4456805938 [X86] Don't fold (fneg (fma (fneg X), Y, (fneg Z))) to (fma X, Y, Z)
Check if it has no signed zeros flag (nsz) in getNegatedExpression for x86.
This patch fixed miscompilation: https://alive2.llvm.org/ce/z/XxwBAJ

Reviewed By: RKSimon, spatel

Differential Revision: https://reviews.llvm.org/D90901
2021-05-21 23:02:19 +08:00
Jim Lin 35e5c3310f [X86] Pre-commit test for D90901
Differential Revision: https://reviews.llvm.org/D102621
2021-05-21 23:02:19 +08:00
maekawatoshiki cea7a3fe3d [LoopUnrollAndJam] Change LoopUnrollAndJamPass to LoopNest pass
This patch changes LoopUnrollAndJamPass from FunctionPass to LoopNest pass.
The next patch will utilize LoopNest to effectively handle loop nests.

Reviewed By: Whitney

Differential Revision: https://reviews.llvm.org/D99149
2021-05-21 23:57:39 +09:00
Matt Arsenault 7521fcd269 AMDGPU/GlobalISel: Add subtarget to a test
SelectionDAG forces us to have a weird ABI for 16-bit values without
legal 16-bit operations, but currently GlobalISel bypasses this and
sometimes ends up using the gfx8+ ABI in some contexts. Make sure
we're testing the normal ABI to avoid a test change in a future patch.
2021-05-21 23:57:38 +09:00
Alexey Bataev 8dab25954b [SLP]Improve handling of compensate external uses cost.
External insertelement users can be represented as a result of shuffle
of the vectorized element and noconsecutive insertlements too. Added
support for handling non-consecutive insertelements.

Differential Revision: https://reviews.llvm.org/D101555
2021-05-21 07:45:31 -07:00
Stephan Herhut 90e55dfcf4 [mlir][memref] Improve canonicalization of memref.clone
The previous implementation did not handle casting behavior properly and
did not consider aliases.

Differential Revision: https://reviews.llvm.org/D102785
2021-05-21 16:34:50 +02:00
Alexey Bataev 117a247e8e [SLP][NFC]Add a test for diamond match of broadcast tree nodes. 2021-05-21 07:05:48 -07:00
Matthias Springer 8fb4897934 [mlir] Disallow tensor types in VectorToSCF
Support for tensor types can be added if needed.

Differential Revision: https://reviews.llvm.org/D102749
2021-05-21 22:45:14 +09:00
Stephan Herhut 884a6291f0 [mlir][linalg] Add scalar operands inlining pattern
This pattern inlines operands to a linalg.generic operation that use a constant
index and hence are loop-invariant scalars. This reduces the number of
linalg.generic operands and unlocks some canonicalizations that rely on seeing
an explicit tensor.extract.

Differential Revision: https://reviews.llvm.org/D102682
2021-05-21 15:23:28 +02:00
Adrian Kuegel 28844212fe [mlir] Add additional traits to EqualOp and NotEqualOp.
This matches the traits of the other binary ops.

Differential Revision: https://reviews.llvm.org/D102916
2021-05-21 15:04:26 +02:00
OCHyams 35a7c4b4b1 [dexter] Add REQUIRES: lldb to the test label_offset.cpp
The test feature_tests/subtools/test/label_offset.cpp was added in 723a8ae5
for D101147.
2021-05-21 13:51:43 +01:00
Florian Hahn 4efb4f674c [VectorCombine] Add positive test for scalarizing multiple extracts.
As suggested in D100273. Also adds an out-of-bound access test
2021-05-21 13:39:37 +01:00
Djordje Todorovic cd49b3ae1a [DebugInfo] Salvage dbg.value() during ADCE
This has been found by using the [0].

[0] https://llvm.org/docs/HowToUpdateDebugInfo.html#\
    test-original-debug-info-preservation-in-optimizations

 Differential Revision: https://reviews.llvm.org/D100844
2021-05-21 05:25:59 -07:00
Daniil Fukalov e1cb98be2d [TTI] NFC: Change getCostOfKeepingLiveOverCall to return InstructionCost.
This patch migrates the TTI cost interfaces to return an InstructionCost.

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: sdesmalen

Differential Revision: https://reviews.llvm.org/D102831
2021-05-21 15:18:12 +03:00
Daniil Fukalov e8e88c3353 [TTI] NFC: Change getRegUsageForType to return InstructionCost.
This patch migrates the TTI cost interfaces to return an InstructionCost.

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: sdesmalen

Differential Revision: https://reviews.llvm.org/D102541
2021-05-21 15:17:23 +03:00
Anton Zabaznov 826905787a [OpenCL] Add support of OpenCL C 3.0 __opencl_c_fp64
There already exists cl_khr_fp64 extension. So OpenCL C 3.0
and higher should use the feature, earlier versions still
use the extension. OpenCL C 3.0 API spec states that extension
will be not described in the option string if corresponding
optional functionality is not supported (see 4.2. Querying Devices).
Due to that fact the usage of features for OpenCL C 3.0 must
be as follows:

```
$ clang -Xclang -cl-ext=+cl_khr_fp64,+__opencl_c_fp64 ...

$ clang -Xclang -cl-ext=-cl_khr_fp64,-__opencl_c_fp64 ...
```

e.g. the feature and the equivalent extension (if exists)
must be set to the same values

Reviewed By: Anastasia

Differential Revision: https://reviews.llvm.org/D96524
2021-05-21 15:01:19 +03:00
OCHyams 469833f418 [dexter] Add hit_count keyword arg to DexLimitSteps
The DexLimitSteps command leading breakpoint will be deleted after triggering
'hit_count' number of times if the argument is provided.

All the lit tests pass on linux (with lldb), and I've tested this on windows
(with vs2017) manually as the lit tests for DexLimitSteps are currently
unsupported on windows.

Reviewed By: StephenTozer, chrisjackson

Differential Revision: https://reviews.llvm.org/D101527
2021-05-21 12:45:02 +01:00
Simon Pilgrim 3ae7f7ae0a [CostModel][X86] Tweak fptoui v4f32->v4i32 + v8f32->v8i32 SSE/AVX costs
Adjust for worst case for atom/slm (SSE), btver2/sandybridge (AVX1) and haswell/znver* (AVX2)
2021-05-21 12:09:31 +01:00
Simon Pilgrim 4865ed3020 [CostModel][X86] Match SSE41 legalized conversion costs as well as SSE2 2021-05-21 11:42:22 +01:00
Nicolas Vasilache 8eb18a0f3e [mlir][Standard] NFC - Drop remaining EDSC usage
Drop the remaining EDSC subdirectories and update all uses.

Differential Revision: https://reviews.llvm.org/D102911
2021-05-21 10:40:39 +00:00
Simon Pilgrim eb6429d0fb [CostModel][X86] Add uitpfp v4f32->v4i32 + v8f32->v8i32 SSE/AVX costs
These were using (default) scalarized values.
2021-05-21 11:30:15 +01:00
Zhouyi Zhou e6ec7ab582 NFC: TreeTransform.h: make the function TransformNestedNameSpecifierLoc more beautiful
Hi,
I am new to LLVM, and I really want to get involved in LLVM community.

I guess if the following switch case of function
TransformNestedNameSpecifierLoc could possibly made more beautiful with
'break' stmt moved inside of the right brace.

I think move of 'break' stmt will not change the invoking destructor of
IdInfo.

Thanks for your effort.

I have done make check-all on x86_64-linux
Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D102577
2021-05-21 18:27:23 +08:00
Luke Benes e2815398ce Fix warning: comparison of integer expressions of different signedness. NFC
This patch resolves the Wsign-compare warning that I observed on armv7l and x86 with both gcc and clang.

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D102792
2021-05-21 18:23:27 +08:00
Tony Tye b408efe4ff [NFC][AMDGPU] Mark C code in AMDGPUUsage.rst
Reviewed By: foad

Differential Revision: https://reviews.llvm.org/D102910
2021-05-21 10:08:05 +00:00
Stephen Tozer 36ec97f76a 3rd Reapply "[DebugInfo] Use variadic debug values to salvage BinOps and GEP instrs with non-const operands"
This reapplies c0f3dfb9, which was reverted following the discovery of
crashes on linux kernel and chromium builds - these issues have since
been fixed, allowing this patch to re-land.

This reverts commit 4397b7095d.
2021-05-21 11:06:20 +01:00
Joe Ellis 5a476987f7 [InstSimplify] Properly constrain {insert,extract}_subvector intrinsic fold
The previous rule:

   (insert_vector _, (extract_vector X, 0), 0) -> X

is not quite correct. The correct fold should be:

   (insert_vector Y, (extract_vector X, 0), 0) -> X
   where: Y is X, or Y is undef

This commit updates the pattern.

Reviewed By: peterwaller-arm, paulwalker-arm

Differential Revision: https://reviews.llvm.org/D102699
2021-05-21 10:05:03 +00:00
Djordje Todorovic 35490329cb [NFC][Debugify][Original DI] Use MapVector insted of DenseMap for DI tracking
By using MapVector instead of DenseMap, reporting issues will be in
deterministic order.

Differential Revision: https://reviews.llvm.org/D102841
2021-05-21 02:58:16 -07:00
Andy Wingo 81bc732816 [IR][Verifier] Relax restriction on alloca address spaces
In the WebAssembly target, we would like to allow alloca in two address
spaces.  The alloca instruction already has an address space argument,
but the verifier asserts that the address space of an alloca is the
default alloca address space from the datalayout.  This patch removes
this restriction.  Targets that would like to impose additional
restrictions should do so via target-specific verification passes.

Differential Revision: https://reviews.llvm.org/D101045
2021-05-21 11:52:45 +02:00
Adrian Kuegel a1a429dc1d [mlir] NFC - Use builder.getI1Type() 2021-05-21 11:44:57 +02:00
Balazs Benics 3febf0b507 [analyzer][Z3][NFC] Use GTEST_SKIP instead of hacks
Since @bkramer bumped gtest to 1.10.0 I think it's a good time to clean
up some of my hacks.

Reviewed By: Szelethus

Differential Revision: https://reviews.llvm.org/D102643
2021-05-21 11:35:24 +02:00
Adrian Kuegel 7eb85cdb10 [mlir] Add convenience builders for EqualOp and NotEqualOp.
The result type is always I1. This additional builder allows to omit the result type.

Differential Revision: https://reviews.llvm.org/D102905
2021-05-21 11:32:25 +02:00
Raphael Isemann ebd25fde5e [clang] Fix Wnested-anon-types in ABIArgInfo
D98794 added the DirectAttr/IndirectAttr struct fields to that union, but
declaring anonymous structs in an anonymous union triggers `-Wnested-anon-types`
warnings. We can't just give them a name as they are in an anonymous union, so
this just declares the type outside.

```
clang/include/clang/CodeGen/CGFunctionInfo.h:97:5: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
    struct {
    ^
clang/include/clang/CodeGen/CGFunctionInfo.h:101:5: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
    struct {
    ^
```

Reviewed By: chill

Differential Revision: https://reviews.llvm.org/D102903
2021-05-21 11:18:43 +02:00
Melvin Fox b5b3843f8d [clang] Fix for "Bug 27113 - MSVC-compat __identifier implementation incomplete"
this patch fixes Bug 27113 by adding support for string literals to the
implementation of the MS extension __identifier.

Differential revision: https://reviews.llvm.org/D100252
2021-05-21 11:14:01 +02:00
Djordje Todorovic b9076d119a Recommit: "[Debugify][Original DI] Test dbg var loc preservation""
[Debugify][Original DI] Test dbg var loc preservation

    This is an improvement of [0]. This adds checking of
    original llvm.dbg.values()/declares() instructions in
    optimizations.

    We have picked a real issue that has been found with
    this (actually, picked one variable location missing
    from [1] and resolved the issue), and the result is
    the fix for that -- D100844.

    Before applying the D100844, using the options from [0]
    (but with this patch applied) on the compilation of GDB 7.11,
    the final HTML report for the debug-info issues can be found
    at [1] (please scroll down, and look for
    "Summary of Variable Location Bugs"). After applying
    the D100844, the numbers has improved a bit -- please take
    a look into [2].

    [0] https://llvm.org/docs/HowToUpdateDebugInfo.html#\
        test-original-debug-info-preservation-in-optimizations
    [1] https://djolertrk.github.io/di-check-before-adce-fix/
    [2] https://djolertrk.github.io/di-check-after-adce-fix/

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

The Unit test was failing because the pass from the test that
modifies the IR, in its runOnFunction() didn't return 'true',
so the expensive-check configuration triggered an assertion.
2021-05-21 02:04:29 -07:00
Adrian Kuegel fb8b2b86d3 [mlir] Add conversion from Complex to Standard dialect for NotEqualOp.
Differential Revision: https://reviews.llvm.org/D102902
2021-05-21 10:46:50 +02:00
David Green e7a6df68a6 [ARM] Fix the operand used for WLS in ARMLowOverheadLoops
The Loop start instruction handled by the ARMLowOverheadLoops are:
$lr = t2DoLoopStart $r0
$lr = t2DoLoopStartTP $r1, $r0
$lr = t2WhileLoopStartLR $r0, %bb, implicit-def dead $cpsr
All three of these will have LR as the 0 argument, the trip count as the
1 argument.

This patch updated a few places in ARMLowOverheadLoops where the 0th arg
was being used for t2WhileLoopStartLR instructions as the trip count.
One place was entirely removed as it does not seem valid any more, the
case the code is trying to protect against should not be able to occur
with our correct-by-construction low overhead loops.

Differential Revision: https://reviews.llvm.org/D102620
2021-05-21 09:29:30 +01:00
Konrad Kleine 0297506d20 [mlir] Rename MlirLspServerLib -> MLIRLspServerLib
I noticed while packaging mlir that most mlir library names start
with `libMLIR`. The only different libary was `libMlirLspServerLib.a`.

That's why I changed the library to be similarly named to the others.

Differential Revision: https://reviews.llvm.org/D102881
2021-05-21 10:25:54 +02:00
Jan Svoboda 89ea60f392 [clang][deps] Explicitly enable C++ modules in a test
In Apple Clang, enabling modules for C++ input requires additional flag: -fcxx-modules.
2021-05-21 10:25:02 +02:00
Vassil Vassilev 49f9532165 [clang-repl] Tell the LLJIT the exact target triple we use.
Some systems use a different data layout. For instance, s390x the layout of
machines with vector registers is different from the ones without. In such
cases, the JIT will automatically detect the vector registers and go out of
sync.

This patch tells the JIT what is the target triple of the generated code so that
both ends are in sync.

Discussion available in https://reviews.llvm.org/D96033. Thanks to @uweigand for
helping understand the issue.

Differential revision https://reviews.llvm.org/D102756
2021-05-21 08:16:42 +00:00
OCHyams 2348b5c943 [dexter] Remove accidentally committed .rej file
The file was added in 98e7911f95.
2021-05-21 09:10:18 +01:00
OCHyams 98e7911f95 [dexter] Change line label reference syntax to enable label-relative offsets (2/2)
Update dexter tests to use the new line label reference syntax introduced in D101147.

Updated with:
https://gist.github.com/OCHyams/8255efe7757cac266440ed2ba55f1442

Reviewed By: chrisjackson, jmorse

Differential Revision: https://reviews.llvm.org/D101148
2021-05-21 08:58:58 +01:00
OCHyams 723a8ae5da [dexter] Change line label reference syntax to enable label-relative offsets (1/2)
This patch changes how line labels are resolved in order to enable
label-relative offsets to be used in commands. This is a breaking change in
dexter. Instead of using label references directly as argument values, labels
will instead be referenced through a function `ref(str)`.

    // No way to use offsets currently.
    Currently: DexExpectWatchValue('x', '1', on_line='labled_line')
    Patched:   DexExpectWatchValue('x', '1', on_line=ref('labled_line'))
    Patched:   DexExpectWatchValue('x', '1', on_line=ref('labled_line') + 3)

A dexter command is "parsed" by finding the whole command and sending it off to
`eval`. This change adds a function called `ref` to the `eval` globals map that
simply looks up the name and returns an int. If the line name hasn't been
defined, or a name is defined more than once, an error is reported (see
err_bad_label_ref.cpp and err_duplicate_label.cpp). Label offsets can be
achieved by simply writing the desired expression.

The rationale behind removing the existing label referencing mechanic is for
consistency and to simplify the code required to make labels work.

I've separated the update to llvm's dexter tests into another patch for ease of
review here (D101148). Here is a small python script which can be used to
update tests to use the new syntax:
https://gist.github.com/OCHyams/8255efe7757cac266440ed2ba55f1442

If it helps anyone using dexter on downstream tests we can come up with a
deprecation plan instead out outright removing the existing syntax.

Reviewed By: jmorse

Differential Revision: https://reviews.llvm.org/D101147
2021-05-21 08:58:58 +01:00
Daniel Rodríguez Troitiño 5e327785da [lldb] Match test dependencies name to other LLVM projects.
Other LLVM projects use the suffix `-depends` for the test dependencies,
however LLDB uses `-deps` and seems to be the only project under the
LLVM to do so.

In order to make the projects more homogeneous, switch all the
references to `lldb-test-deps` to `lldb-test-depends`.

Additionally, provide a compatibility target with the old name and
depending on the new name, in order to not break anyone workflow.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D102889
2021-05-21 00:10:27 -07:00
Yevgeny Rouban e3eaff10b2 Allow incomplete template types in unique_function arguments
We can't declare unique_function that has in its arguments a reference to
a template type with an incomplete argument.
For instance, we can't declare unique_function<void(SmallVectorImpl<A>&)>
when A is forward declared.

This is because SFINAE will trigger a hard error in this case, when instantiating
IsSizeLessThanThresholdT with the incomplete type.

This patch specialize AdjustedParamT for references to remove this error.

Committed on behalf of: @math-fehr (Fehr Mathieu)

Reviewed By: DaniilSuchkov, yrouban
2021-05-21 14:09:33 +07:00
Igor Kudrin 5bbf1feab5 [unittests][CodeGen] Mark tests that cannot be executed with GTEST_SKIP()
This helps to distinguish such tests from successfully passed ones.

Differential Revision: https://reviews.llvm.org/D102754
2021-05-21 13:39:52 +07:00
Igor Kudrin 21b40f02d2 [lit][gtest] Support SKIPPED tests
This updates the googletest format to support tests that use GTEST_SKIP(),
which is now available with the updated googletest framework.

Differential Revision: https://reviews.llvm.org/D102694
2021-05-21 13:39:52 +07:00
Timm Bäder 95423c7c99 [clang][driver] Treat -flto=[auto,jobserver] as -flto
Instead of ignoring flto=auto and -flto=jobserver, treat them as -flto
and pass -flto=full along.

Differential Revision: https://reviews.llvm.org/D102479
2021-05-21 08:38:41 +02:00
Vitaly Buka 53ec41a49c [scudo][NFC] Split BasicTest further
It's still the slowest test under our emulator.
2021-05-20 23:28:08 -07:00