Commit Graph

352531 Commits

Author SHA1 Message Date
Eric Schweitz 5339029ff7 [flang] Support for making unique internal names.
Differential Revision: https://reviews.llvm.org/D78838
2020-04-24 17:27:31 -07:00
Sam McCall 226b045b1f [clangd] Look for compilation database in `build` subdirectory of parents.
Summary:
This matches the conventional location of cmake build directories.
It also allows creating a `build` symlink, which seems more flexible than the
compile_commands.json symlinks.

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78629
2020-04-25 02:18:17 +02:00
Benjamin Kramer bc1ea2a2c5 Replicate attributes on definition to make MSVC less noisy
warning C4565: 'llvm::allocate_buffer': redefinition; the symbol was previously declared with __declspec(restrict)
2020-04-25 02:02:00 +02:00
Adrian Prantl 06e4f69b22 Add a getter to retrieve the XcodeSDK from Module and unit-test it. (NFC)
This API is used by swift-lldb.

(Recommit with missing file git-added)
2020-04-24 17:00:34 -07:00
Adrian Prantl af015c1a33 Revert "Add a getter to retrieve the XcodeSDK from Module and unit-test it. (NFC)"
This reverts commit 345df863ce.

(Forgot to git-add the new file)
2020-04-24 16:59:48 -07:00
Adrian Prantl 345df863ce Add a getter to retrieve the XcodeSDK from Module and unit-test it. (NFC)
This API is used by swift-lldb.
2020-04-24 16:51:54 -07:00
Volodymyr Sapsai 65f58878e7 [ObjC generics] Fix not inheriting type bounds in categories/extensions.
When a category/extension doesn't repeat a type bound, corresponding
type parameter is substituted with `id` when used as a type argument. As
a result, in the added test case it was causing errors like

> type argument 'T' (aka 'id') does not satisfy the bound ('id<NSCopying>') of type parameter 'T'

We are already checking that type parameters should be consistent
everywhere (see `checkTypeParamListConsistency`) and update
`ObjCTypeParamDecl` to have correct underlying type. And when we use the
type parameter as a method return type or a method parameter type, it is
substituted to the bounded type. But when we use the type parameter as a
type argument, we check `ObjCTypeParamType` that wasn't updated and
remains `id`.

Fix by updating not only `ObjCTypeParamDecl` UnderlyingType but also
TypeForDecl as we use the underlying type to create a canonical type for
`ObjCTypeParamType` (see `ASTContext::getObjCTypeParamType`).

This is a different approach to fixing the issue. The previous one was
02c2ab3d88 which was reverted in
4c539e8da1. The problem with the previous
approach was that `ObjCTypeParamType::desugar` was returning underlying
type for `ObjCTypeParamDecl` without applying any protocols stored in
`ObjCTypeParamType`. It caused inconsistencies in comparing types before
and after desugaring.

Re-applying after fixing intermittent test failures.

rdar://problem/54329242

Reviewed By: erik.pilkington

Differential Revision: https://reviews.llvm.org/D72872
2020-04-24 16:32:28 -07:00
Sean Silva 57a7cd7a13 [shape] Add inferReturnTypes to a couple ops.
- ShapeOfOp
- BroadcastOp

Differential Revision: https://reviews.llvm.org/D78822
2020-04-24 16:10:20 -07:00
Sean Silva 5fff169daa [shape] More constant folding
- shape split_at
- shape.broadcast
- shape.concat
- shape.to_extent_tensor

Differential Revision: https://reviews.llvm.org/D78821
2020-04-24 16:10:19 -07:00
Eric Christopher 6a9edce257 Fix a dangling-gsl warning and avoid transitively including string. 2020-04-24 16:03:17 -07:00
Adrian Prantl d8fb631d13 Relax testcase. The Clang module debug info may return additional
attributes such as __unsafe_unretained that is not present in DWARF.
2020-04-24 15:50:26 -07:00
Sean Silva d1ad267a56 [shape] Basic constant folding.
- Implement a first constant fold for shape.shape_of (more ops coming in subsequent patches)
- Implement the right builder interfaces for ShapeType and other types
- Splits shape.constant into shape.const_size and shape.const_shape which plays better with dyn_cast and building vs one polymorphic op.

Also, fix the RUN line in ops.mlir to properly verify round-tripping.
2020-04-24 15:49:35 -07:00
Craig Topper e4a9190ad7 [X86][ArgumentPromotion] Allow Argument Promotion if caller and callee disagree on 512-bit vectors support if the arguments are scalar.
If one of caller/callee has disabled ZMM registers due to
prefer-vector-width=256, we were previously
disabling argument promotion as the ABI might be incompatible since
one side will split 512-bit vectors in this case.

But if we can see that the types are all scalar this shouldn't be
a problem.

This patch assumes that pointer element type reflects the type that
the argument will be promoted to.

Differential Revision: https://reviews.llvm.org/D78770
2020-04-24 15:47:02 -07:00
Stephen Neuendorffer fef4ddf2f4 [MLIR] Fix typo in lib/Interfaces
This broke BUILD_SHARED_LIBS=on
2020-04-24 15:39:19 -07:00
Adrian Prantl b9c7e276bd Disable path-sensitive test on Windows. 2020-04-24 15:21:54 -07:00
Snehasish Kumar 0cc063a8ff Use .text.unlikely and .text.eh prefixes for MachineBasicBlock sections.
Summary:
Instead of adding a ".unlikely" or ".eh" suffix for machine basic blocks,
this change updates the behaviour to use an appropriate prefix
instead. This allows lld to group basic block sections together
when -z,keep-text-section-prefix is specified and matches the behaviour
observed in gcc.

Reviewers: tmsriram, mtrofin, efriedma

Reviewed By: tmsriram, efriedma

Subscribers: eli.friedman, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78742
2020-04-24 15:07:38 -07:00
Fangrui Song 10bc12588d [XRay] Change Sled.Function to PC-relative for sled version 2 and make llvm-xray support sled version 2 addresses
Follow-up of D78082 and D78590.

Otherwise, because xray_instr_map is now read-only, the absolute
relocation used for Sled.Function will cause a text relocation.
2020-04-24 14:41:56 -07:00
peter klausler fc0262419a [flang] More CHARACTER runtime support + unit test
Summary:
This is a continuation of development of the runtime support library's functions for
CHARACTER data; specifically, it implements CHARACTER comparisons.
It includes a new unit test, and moves an #include directive to the
runtime's unit testing main header.

Reviewers: tskeith, sscalpone, DavidTruby, jdoerfert

Reviewed By: tskeith

Subscribers: flang-commits, mgorny, llvm-commits

Tags: #llvm, #flang

Differential Revision: https://reviews.llvm.org/D78826
2020-04-24 14:34:51 -07:00
Amara Emerson dbb0356771 [AArch64][GlobalISel] Fix sub-64b stack parameter passing on Darwin.
A previous bug fix for varargs introduced a regression where we would
incorrectly widen some stores to memory when passing i8/i16 parameters on the
stack. This didn't show up seemingly because it only happens when there is
no signext/zeroext parameter attribute, which I think for Darwin clang adds.

Swift however seems to be a different story, and a plain anyext on the parameter
triggered the bug.

To fix this, I've added a new ValueHandler::assignValueToAddress type override
which lets us distiguish between varargs and fixed args (we still need this
widening behaviour for varargs to fix the original bug in 2018).

rdar://61353552
2020-04-24 13:56:43 -07:00
Louis Dionne 38a9528ca2 [libc++] NFC: Expose a top-level parseScript function in the new format 2020-04-24 16:55:38 -04:00
Jean-Michel Gorius 505685a67a [llvm][CodeGen] Check for memory instructions when querying for alias status
Summary:
Add a check to make sure that MachineInstr::mayAlias returns prematurely if at least one of its instruction parameters does not access memory. This prevents calls to TargetInstrInfo::areMemAccessesTriviallyDisjoint with incompatible instructions.

A side effect of this change is to render the mayAlias helper in the AArch64 load/store optimizer obsolete. We can now directly call the MachineInstr::mayAlias member function.

Reviewers: hfinkel, t.p.northover, mcrosier, eli.friedman, efriedma

Reviewed By: efriedma

Subscribers: efriedma, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78823
2020-04-24 22:54:46 +02:00
Yaxun (Sam) Liu b46b1a916d recommit c77a4078e0 2020-04-24 16:53:18 -04:00
David Blaikie a8e5dcb072 Fix bug in SmallBitVector::find_next_unset
Summary: find_next_unset was returning size() instead of -1 in small-mode, when no unset bits are found.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D77985
2020-04-24 13:50:30 -07:00
Alexandre Ganea 65fe71be48 Revert "[MC] Fix quadratic behavior in addPendingLabel()"
This reverts commit e98f73a629.
2020-04-24 16:43:10 -04:00
Craig Topper 03aa967c0d [CostModel][X86][ARM] Teach getCastInstrCost to include the splitting factor when handling operations that type legalize to the same number of subvectors or scalar components
Previously, we just always returned 1. But that ignores that we have to do the operation for each subvector or scalar component.

Differential Revision: https://reviews.llvm.org/D78824
2020-04-24 13:36:26 -07:00
Ron Lieberman ee9c53d271 [libomptarget] Initialize reference parameter IsNew within Device::getOrAllocTgtPtr
The two locals IsNew and Pointer_IsNew were uninitialized at declaration, and then passed by
reference to Device.getOrAllocTgtPtr which in turn did not assign on all
paths within the function. This resulted in occasional runtime failures in one application.
Device::getOrAllocTgtPtr will now initialize IsNew to false on entry to function.

Differential Revision: https://reviews.llvm.org/D78744
2020-04-24 15:33:37 -05:00
Pengxuan Zheng 79702dd349 [RISCV] Add instruction definition for dret
Summary:
The instruction dret is used to return from debug mode and is defined in the
RISC-V debug mode spec.

https://github.com/riscv/riscv-opcodes/blob/master/opcodes-system

Reviewers: apazos, asb, lenary, luismarques

Reviewed By: apazos

Subscribers: jfb, hiraditya, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, s.egerton, sameer.abuasal, evandro, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78583
2020-04-24 13:27:43 -07:00
Tyker 97ecd91e20 [NFC] Refactor SimplifyCFG to make propagating information easier.
Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77742
2020-04-24 22:22:20 +02:00
Adrian Prantl 79feafa514 Add an internal bit to the XcodeSDK class.
For developing the OS itself there exists an "internal" variant of
each SDK. This patch adds support for these SDK directories to the
XcodeSDK class.

Differential Revision: https://reviews.llvm.org/D78675
2020-04-24 12:55:53 -07:00
Matt Arsenault 35e6a9c839 AMDGPU: Break read2/write2 search range on a memory fence
This is to fix performance regressions introduced by
86c944d790.

The old search would collect all potentially mergeable instructions in
the entire block. In this case, the same address is written in
multiple places in the block on the other side of a fence. When sorted
by offset, the two unmergeable, identical addresses would be next to
each other and the merge would give up.

Break the search space when we encounter an instruction we won't be
able to merge across. This will keep the identical addresses in
different merge attempts.

This may also improve compile time by reducing the merge list size.
2020-04-24 15:53:30 -04:00
Jonas Devlieghere 0d671dbca9 [lldb/Driver] Remove level of indentation (NFC)
Use an early return for when we couldn't create a pipe to source the
commands.
2020-04-24 12:50:53 -07:00
Louis Dionne a9104f89b1 [libc++] Properly import lit.formats from the new format 2020-04-24 15:47:48 -04:00
Fangrui Song bea5a958d3 [gold] Simplify with StringRef::consume_front. NFC
Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D78819
2020-04-24 12:39:35 -07:00
River Riddle 0816de167a [mlir][DialectConversion] Add support for properly tracking replaceUsesOfBlockArgument
The current implementation of this method performs the replacement directly, and thus doesn't support proper back tracking.

Differential Revision: https://reviews.llvm.org/D78790
2020-04-24 12:37:32 -07:00
Louis Dionne 4de60d955a [libc++] NFC: Refactor the new format substitutions into its own method
This way, we can reuse the substitution logic in the new DSL.
2020-04-24 15:35:57 -04:00
Lei Zhang 60f1d26366 Revert "[mlir][drr] NFC: avoid SmallVector when collecting substitution values"
This reverts commit 2f8b164ca2, which
causes a breakage on Clang 5.
2020-04-24 15:33:03 -04:00
Louis Dionne 4fd92cc475 [libc++] Get rid of pipe in command to check whether verify is supported 2020-04-24 15:30:25 -04:00
Alexandre Ganea 0e13a0331f [llvm-cov] Prevent llvm-cov from using too many threads
As reported here: https://reviews.llvm.org/D75153#1987272

Before, each instance of llvm-cov was creating one thread per hardware core, which wasn't needed probably because the number of inputs were small. This was probably causing a thread rlimit issue on large core count systems.

After this patch, the previous behavior is restored (to what was before rG8404aeb5):

If --num-threads is not specified, we create one thread per input, up to num.cores.
When specified, --num-threads indicates any number of threads, with no upper limit.

Differential Revision: https://reviews.llvm.org/D78408
2020-04-24 15:28:25 -04:00
River Riddle 0e2bd49370 [mlir][DictionaryAttr] Add a new getWithSorted and use it when possible
The elements of a DictionaryAttr are sorted by name. In many situations, e.g NamedAttributeList, we can guarantee that the elements are sorted on construction and remove the need to perform extra checks. In places with lots of calls to attribute methods, this leads to a good performance improvement.

Differential Revision: https://reviews.llvm.org/D78781
2020-04-24 12:23:32 -07:00
Petr Hosek 063128f979 [Fuchsia] Build compiler-rt builtins for 32-bit x86
While we don't support 32-bit architectures in Fuchsia, these are needed
in the early boot phase on x86, so we build just these to satisfy that
use case.

Differential Revision: https://reviews.llvm.org/D78687
2020-04-24 12:18:30 -07:00
Michael Liao 495bb8feb9 Fix `-Wparentheses` warnings. NFC. 2020-04-24 15:04:01 -04:00
Yaxun (Sam) Liu 7eae00477f Revert "[CUDA][HIP] Fix host/device based overload resolution"
This reverts commit c77a4078e0.
2020-04-24 14:57:10 -04:00
Yaxun (Sam) Liu c77a4078e0 [CUDA][HIP] Fix host/device based overload resolution
Currently clang fails to compile the following CUDA program in device compilation:

__host__ int foo(int x) {
     return 1;
}

template<class T>
__device__ __host__ int foo(T x) {
    return 2;
}

__device__ __host__ int bar() {
    return foo(1);
}

__global__ void test(int *a) {
    *a = bar();
}

This is due to foo is resolved to the __host__ foo instead of __device__ __host__ foo.
This seems to be a bug since __device__ __host__ foo is a viable callee for foo whereas
clang is unable to choose it.

This patch fixes that.

Differential Revision: https://reviews.llvm.org/D77954
2020-04-24 14:55:18 -04:00
Adrian Prantl 304ba5d4c6 Delete cargo-cult code that doesn't affect the testsuite. 2020-04-24 11:54:52 -07:00
Louis Dionne 7f48246175 [libc++] Quietly scp tarballs over with the remote executor
Otherwise, the progress-meter is printed.
2020-04-24 14:47:56 -04:00
Tyker 42431da895 [AssumeBundles] Use assume bundles in isKnownNonZero
Summary: Use nonnull and dereferenceable from an assume bundle in isKnownNonZero

Reviewers: jdoerfert, nikic, lebedev.ri, reames, fhahn, sstefan1

Reviewed By: jdoerfert

Subscribers: fhahn, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D76149
2020-04-24 20:41:51 +02:00
Vedant Kumar c0fa447e02 AArch64: Remove reversedInstructionsWithoutDebug helper
When using reversedInstructionsWithoutDebug to construct a range from a
pair of MachineInstrBundleIterators, the range unexpectedly leaves out an
element. This results in mis-optimization as @mstorsjo points out in
https://reviews.llvm.org/D78157.

The problem is that when we convert a MachineInstrBundleIterator to a
reverse iterator, the result gets incremented:

  MachineInstrBundleIterator(++I.getReverse())

The comment there explains that the "resulting iterator will dereference
... to the previous node, which is somewhat unexpected; but converting
the two endpoints in a range will give the same range in reverse". This
makes it hard to understand what reversedInstructionsWithoutDebug will
do: I've removed the helper to prevent similar mistakes in the future.
2020-04-24 11:28:17 -07:00
Adrian Prantl ef423a3ba5 Add Objective-C property accessors loaded from Clang module DWARF to lookup
This patch fixes a bug when synthesizing an ObjC property from
-gmodules debug info. Because the method declaration that is injected
via the non-modular property implementation is not added to the
ObjCInterfaceDecl's lookup pointer, a second copy of the accessor
would be generated when processing the ObjCPropertyDecl. This can be
avoided by finding the existing method decl in
ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName() and
adding it to the LookupPtr.

Differential Revision: https://reviews.llvm.org/D78333
2020-04-24 11:10:50 -07:00
Mircea Trofin fdbf493a70 [llvm][NFC][CallSite] Remove {Immutable}CallSite and CallSiteBase
Reviewers: dblaikie, craig.topper

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78794
2020-04-24 11:03:35 -07:00
Craig Topper 0ed5b0d517 [X86] Don't use types when getting the intrinsic declaration for x86_avx512_mask_vcvtph2ps_512.
This intrinsic isn't overloaded so we should query with types.
Doing so causes the backend to miss the intrinsic and not codegen it.
This eventually leads to a linker error.
2020-04-24 11:01:22 -07:00