Commit Graph

406761 Commits

Author SHA1 Message Date
Mehdi Amini 3bed2a7212 Build MLIR with -Werror=mismatched-tags (NFC)
This is a defensive action to catch at build time on Linux failures that
may happen only on Windows otherwise.

Differential Revision: https://reviews.llvm.org/D115316
2021-12-08 05:59:06 +00:00
Chuanqi Xu 60f826663d [C++20] [Modules] Namespace Declaration shouldn't have module linkage
According to [basic.namespace.general]/p2, a namespace declaration
shouldn't have a module linkage.
> A namespace is never attached to a named module and never has a name
> with module linkage.

Without this patch, the compiler would crash for the test in assertion
enabled build due to inconsistent linkage for redeclaration for
namespaces.

Reviewed by: rsmith

Differential Revision: https://reviews.llvm.org/D115132
2021-12-08 13:54:04 +08:00
Vitaly Buka dd1abb1102 [NFC][lsan] Move method implementation up 2021-12-07 21:45:26 -08:00
Vitaly Buka b79ea567cf [NFC][lsan] Clang-format lsan_common.cpp 2021-12-07 21:45:26 -08:00
Chuanqi Xu e587372f85 [C++20] [Module] Support extern C/C++ semantics
According to [module.unit]p7.2.3, a declaration within a linkage-specification
should be attached to the global module.
This let user to forward declare types across modules.

Reviewed by: rsmith, aaron.ballman

Differential Revision: https://reviews.llvm.org/D110215
2021-12-08 13:29:16 +08:00
lh123 ec64d10340 [clangd] Add desugared type to hover
Add desugared type to hover when the desugared type and the pretty-printed type are different.

```c++
template<typename T>
struct TestHover {
  using Type = T;
};

int main() {
  TestHover<int>::Type a;
}
```

```
variable a

Type: TestHover<int>::Type (aka int)
```

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D114522
2021-12-08 13:28:12 +08:00
Mehdi Amini 89ebd35daa Fix flang tests after MLIR changes on the handling of declarative assembly 2021-12-08 04:31:12 +00:00
Vitaly Buka 8ed4d2819d [NFC][lsan] Use kIgnored in MarkInvalidPCCb
kIgnored didn't exist when the code was added, but it should be
equivalent to kReachable.
The goal is to refactor MarkInvalidPCCb to avoid StackDepotGet
in StopTheWorld.
2021-12-07 19:53:08 -08:00
Haohai Wen d2c093e79d [CostModel][X86] Add i64 mul cost for avx512 as 1cy
i64 mul cost is 1cy for all cpu that support avx512. Currently
all X86 cpu uses i64 mul cost in X64 cost table which is not
true for cpu that support avx512 (skx, icx).

Reviewed By: pengfei, RKSimon

Differential Revision: https://reviews.llvm.org/D115016
2021-12-08 11:29:08 +08:00
Lang Hames ae73f3fdd6 [ORC] Add a MaterializationUnit::Interface struct.
MaterializationUnit::Interface holds the values that make up the interface
(for ORC's purposes) of a materialization unit: the symbol flags map and
initializer symbol.

Having a type for this will make functions that build materializer interfaces
more readable and maintainable.
2021-12-08 13:41:15 +11:00
Chen Zheng c16c99ab03 [Powerpc] testcases for D111485; nfc 2021-12-08 02:22:00 +00:00
Alex Lorenz 0756aa3978 [macho] add support for emitting macho files with two build version load commands
This patch extends LLVM IR to add metadata that can be used to emit macho files with two build version load commands.
It utilizes "darwin.target_variant.triple" and "darwin.target_variant.SDK Version" metadata names for that,
which will be set by a future patch in clang.

MachO uses two build version load commands to represent an object file / binary that is targeting both the macOS target,
and the Mac Catalyst target. At runtime, a dynamic library that supports both targets can be loaded from either a native
macOS or a Mac Catalyst app on a macOS system. We want to add support to this to upstream to LLVM to be able to build
compiler-rt for both targets, to finish the complete support for the Mac Catalyst platform, which is right now targetable
by upstream clang, but the compiler-rt bits aren't supported because of the lack of this multiple build version support.

Differential Revision: https://reviews.llvm.org/D112189
2021-12-07 18:17:47 -08:00
Vitaly Buka 5ff52be5d9 [sanitizer] Restore __thumb__ workaround
It was removed in D114934 and failed clang-thumbv7-full-2stage.
2021-12-07 18:04:06 -08:00
Mehdi Amini ee0908703d Change the printing/parsing behavior for Attributes used in declarative assembly format
The new form of printing attribute in the declarative assembly is eliding the `#dialect.mnemonic` prefix to only keep the `<....>` part.

Differential Revision: https://reviews.llvm.org/D113873
2021-12-08 02:02:37 +00:00
Chen Zheng 63cd1842a7 [PowerPC] use lvx + splat directly for aligned splat load
Reviewed By: nemanjai

Differential Revision: https://reviews.llvm.org/D114062
2021-12-08 02:02:18 +00:00
Nico Weber 8720247f60 Reland "[gn build] (manually) port 1ee32055ea (benchmark move)"
This reverts commit bbccf49922.
1ee32055ea relanded in 5dda2efde5.
2021-12-07 20:51:25 -05:00
Phoebe Wang 4a2c827b17 [X86][clang] Emit diagnostic for float and double when we have features -x87 and -sse on 64-bits
A follow up of D114162.

Reviewed By: asavonic

Differential Revision: https://reviews.llvm.org/D114782
2021-12-08 09:50:26 +08:00
Mircea Trofin 5dda2efde5 Re-Reland "[benchmarks] Move libcxx's fork of google/benchmark and llvm/utils'"
This reverts commit b2fbd45d23. D114922
fixed the reason of the 2nd revert.

This patch also re-applies 39e9f5d368.

Differential Revision: https://reviews.llvm.org/D112012
2021-12-07 17:10:41 -08:00
Kirill Stoimenov 572d1ecccc [ASan] Missed some SHADOW_XYZ uses on non-Linux platforms.
Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D115307
2021-12-08 00:39:26 +00:00
Kirill Stoimenov ad56941a57 [ASan] Renamed SHADOW_XYZ to ASAN_SHADOW_XYZ.
Follow up from D115271.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D115293
2021-12-08 00:22:56 +00:00
Jez Ng 8a1f2d6580 [lld-macho] Include archive name in bitcode files
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D115281
2021-12-07 19:11:23 -05:00
Michael Jones 5b3a51fda1 [libc][obvious] fix missed rename
In https://reviews.llvm.org/D114302 I renamed ForLoopCopy to
for_loop_copy, but these got missed.

Differential Revision: https://reviews.llvm.org/D115303
2021-12-07 16:09:37 -08:00
Petr Hosek bda3f2dd76 [compiler-rt] Use the runtimes build for custom libc++
Some of the compiler-rt runtimes use custom instrumented libc++ build.
Use the runtimes build for building this custom libc++.

Differential Revision: https://reviews.llvm.org/D114922
2021-12-07 16:08:16 -08:00
Michael Jones 2b197888e0 [libc] fix the .yaml files not being tracked
adds the .yaml files clang-tidy generates as byproducts, which means
that they will be updated properly and cleaned by `ninja -t clean`

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D115290
2021-12-07 16:04:46 -08:00
Aart Bik e1b9d80532 [mlir][sparse] add a few more sparse output tests (for generated IR)
also fixes two typos in IR doc

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D115288
2021-12-07 15:31:29 -08:00
James Farrell 219672b8dd Revert "Revert "Use VersionTuple for parsing versions in Triple, fixing issues that caused the original change to be reverted. This makes it possible to distinguish between "16" and "16.0" after parsing, which previously was not possible.""
This reverts commit 63a6348cad.

Differential Revision: https://reviews.llvm.org/D115254
2021-12-07 23:15:21 +00:00
Michael Berg 3e363f14e1 Revert "[RISCV] Add target specific loop unrolling and peeling preferences"
This reverts commit 8487981a72.
2021-12-07 15:13:42 -08:00
Yaxun (Sam) Liu d55f05d9f7 [CUDA][HIP] Add pre-defined macro `__CLANG_RDC__`
nvcc defines __CUDACC_RDC__ for both host and
device compilation when -rdc=true is specified
(https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#nvcc-identification-macro)

This patch defines __CLANG_RDC__ when -fgpu-rdc
is specified for CUDA/HIP.

Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D114812
2021-12-07 18:08:16 -05:00
Jim Ingham f75885977c Fix error reporting for "process load" and add a test for it.
Differential Revision: https://reviews.llvm.org/D115017
2021-12-07 15:08:05 -08:00
Michael Berg 8487981a72 [RISCV] Add target specific loop unrolling and peeling preferences
Both these preference helper functions have initial support with
this change. The loop unrolling preferences are set with initial
settings to control thresholds, size and attributes of loops to
unroll with some tuning done.  The peeling preferences may need
some tuning as well as the initial support looks much like what
other architectures utilize.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D113798
2021-12-07 15:06:42 -08:00
Carlo Bertolli 6de698bf10 [OpenMP][AMDGPU] Switch host-device memory copy to asynchronous version
Prepare amdgpu plugin for asynchronous implementation. This patch switches to using HSA API for asynchronous memory copy.
Moving away from hsa_memory_copy means that plugin is responsible for locking/unlocking host memory pointers.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D115279
2021-12-07 23:05:23 +00:00
AlexisPerry c2acd45393 Convert fir.allocmem and fir.freemem operations to calls to malloc and free, respectively
This patch is part of the upstreaming effort from the fir-dev branch.

Address review comments
- move CHECK blocks to after the mlir code in the test file
- fix style with respect to anonymous namespaces: only include class definitions in the namespace and make functions static and outside the namespace
- fix a few nits
- remove TODO in favor of notifyMatchFailure
- removed unnecessary CHECK line from convert-to-llvm.fir
- rebase on main - add TODO back in
- get successfull test of TODO in AllocMemOp converion of derived type with LEN params
- clearer comments and reduced use of auto
- move defintion of computeDerivedTypeSize to fix build error

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>

Reviewed By: awarzynski, clementval, kiranchandramohan, schweitz

Differential Revision: https://reviews.llvm.org/D114104
2021-12-07 15:59:10 -07:00
Kirill Stoimenov 8421fa5d53 [ASan] Removed ASAN_SHADOW_SCALE.
This is additional cleanup as follow-up of D104279.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D115271
2021-12-07 22:55:48 +00:00
Martin Storsjö 317dc31e53 Reapply [runtimes] Fix building initial libunwind+libcxxabi+libcxx with compiler implied -lunwind
This does mostly the same as D112126, but for the runtimes cmake files.
Most of that is straightforward, but the interdependency between
libcxx and libunwind is tricky:

Libunwind is built at the same time as libcxx, but libunwind is not
installed yet. LIBCXXABI_USE_LLVM_UNWINDER makes libcxx link directly
against the just-built libunwind, but the compiler implicit -lunwind
isn't found. This patch avoids that by adding --unwindlib=none if
supported, if we are going to link explicitly against a newly built
unwinder anyway.

Reapplying this after
db32c4f456, which should fix the issues
that were reported last time this was applied.

Differential Revision: https://reviews.llvm.org/D113253
2021-12-08 00:32:40 +02:00
Kiran Chandramohan fa51755542 [Flang] Upstream conversion of the XRebox Op
The XRebox Op is formed by the codegen rewrite which makes it easier to
convert the operation to LLVM. The XRebox op includes the information
from the rebox op and the associated slice, shift, and shape ops.

During the conversion process a new descriptor is created for reboxing.

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Val Donaldson <vdonaldson@nvidia.com>

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D114709
2021-12-07 22:22:39 +00:00
Kirill Stoimenov 36529a28c7 Revert "[ASan] Removed ASAN_SHADOW_SCALE."
This reverts commit e4800fc099.

Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D115286
2021-12-07 22:19:50 +00:00
Kirill Stoimenov e4800fc099 [ASan] Removed ASAN_SHADOW_SCALE.
This is additional cleanup as follow-up of D104279.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D115271
2021-12-07 22:11:40 +00:00
Nikolas Klauser 4955095fe6 [libc++] Remove _LIBCPP_DEFAULT
clang has `= default` as an extension in c++03, so just use it.

Reviewed By: ldionne, Quuxplusone, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D115275
2021-12-07 22:18:38 +01:00
LLVM GN Syncbot 6914af05b2 [gn build] Port 02940d6d22 2021-12-07 21:08:05 +00:00
Jonas Devlieghere 02940d6d22 Revert "CycleInfo: Introduce cycles as a generalization of loops"
This reverts commit 0fe61ecc2c because it
breaks the modules build.

https://green.lab.llvm.org/green/job/clang-stage2-rthinlto/4858/
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/39112/
2021-12-07 13:06:34 -08:00
Carlo Bertolli d9b1d827d2 [NFC][OpenMP] Prepare amdgpu plugin for asynchronous implementation of target region launch
At present, amdgpu plugin merges both asynchronous and synchronous kernel launch implementations into a single synchronous version.
This patch prepares the plugin for asynchronous implementation by:
- Privatizing actual kernel launch code (valid in both cases) into an anonymous namespace base function

Actual separation of kernel launch code (async vs sync) is a following patch.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D115267
2021-12-07 21:02:45 +00:00
Sanjay Patel f65be726ab [InstCombine] try to fold rem with constant dividend and select-of-constants divisor
We avoid this fold in the more general cases where we use `FoldOpIntoSelect`.
That's because -- unlike most binary opcodes -- 'rem' can't usually be
speculated with a variable divisor since it can have immediate UB. But in
the case where both arms of the select are constants, we can safely evaluate
both sides and eliminate 'rem' completely.

This should fix:
https://llvm.org/PR52102

The same optimization for 'div' is planned as a follow-up patch.

Differential Revision: https://reviews.llvm.org/D115173
2021-12-07 15:48:45 -05:00
Sanjay Patel 51d3cb0ab1 [InstCombine] add tests for div/rem with 0 select arm; NFC
More coverage for D115173 and its div sibling. These are
existing transforms handled by simplifyDivRemOfSelectWithZeroOp().
2021-12-07 15:30:06 -05:00
Sanjay Patel cfde8a6c9d [InstCombine] add tests for div with select-of-constants divisor; NFC
Similar patterns as tests for:
D115173
(and we might want to make a single patch for all of these).
2021-12-07 15:30:06 -05:00
Martin Storsjö db32c4f456 [OpenMP] Disable libomptarget profiling by default if built via the "runtimes" setup
In the "runtimes" setup, the runtime (e.g. OpenMP) can be built for
a target entirely different from the current host build (where LLVM
and Clang are built). If profiling is enabled, libomptarget links
against LLVMSupport (which only has been built for the host).

Thus, don't enable profiling by default in this setup.

This should allow relanding D113253.

Differential Revision: https://reviews.llvm.org/D114083
2021-12-07 22:23:50 +02:00
Valentin Clement 6116ff297f
[flang][runtime] Add ragged array runtime functions
This patch adds the runtime function to allocate and
deallocate ragged arrays.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: klausler

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2021-12-07 21:22:34 +01:00
Greg Clayton 220854a47b Fix buildbots after https://reviews.llvm.org/D115073. 2021-12-07 12:19:00 -08:00
Greg Clayton cfe5d768be Fix buildbot after https://reviews.llvm.org/D115073. 2021-12-07 12:03:45 -08:00
Bill Wendling c4582a689c [Analysis] Ignore casts and unary ops for uninitialized values
A series of unary operators and casts may obscure the variable we're
trying to analyze. Ignore them for the uninitialized value analysis.
Other checks determine if the unary operators result in a valid l-value.

Link: https://github.com/ClangBuiltLinux/linux/issues/1521

Reviewed By: nickdesaulniers

Differential Revision: https://reviews.llvm.org/D114848
2021-12-07 11:49:18 -08:00
Kirill Stoimenov 84dbfe1642 [ASan] Replaced constants for SHADOW_OFFSET with defines.
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D115214
2021-12-07 19:34:17 +00:00