platform/upstream/llvm.git
2 years ago[clang][dataflow] Merge distinct pointer values in Environment::join
Stanislav Gatev [Fri, 28 Jan 2022 16:23:01 +0000 (16:23 +0000)]
[clang][dataflow] Merge distinct pointer values in Environment::join

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D118480

2 years ago[OpenMP] Fix link error on Windows caused by `interop` functions
Shilei Tian [Sat, 29 Jan 2022 16:29:19 +0000 (11:29 -0500)]
[OpenMP] Fix link error on Windows caused by `interop` functions

This patch fixes the link error on Windows caused by `interop`
functions.

Reviewed By: mstorsjo

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

2 years ago[VPlan] Handle IV vector splat using VPWidenCanonicalIV.
Florian Hahn [Sat, 29 Jan 2022 16:22:18 +0000 (16:22 +0000)]
[VPlan] Handle IV vector splat using VPWidenCanonicalIV.

This patch tries to use an existing VPWidenCanonicalIVRecipe
instead of creating another step-vector for canonical
induction recipes in widenIntOrFpInduction.

This has the following benefits:

 1. First step to avoid setting both vector and scalar values for the
    same induction def.
 2. Reducing complexity of widenIntOrFpInduction through making things
    more explicit in VPlan
 3. Only need to splat the vector IV for block in masks.

Reviewed By: Ayal

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

2 years ago[X86] LowerFunnelShift - enable v8i16 lowering
Simon Pilgrim [Sat, 29 Jan 2022 16:20:36 +0000 (16:20 +0000)]
[X86] LowerFunnelShift - enable v8i16 lowering

2 years ago[X86] lowerShuffleAsBlend - pull out repeated getVectorNumElements() calls. NFC.
Simon Pilgrim [Tue, 25 Jan 2022 22:52:09 +0000 (22:52 +0000)]
[X86] lowerShuffleAsBlend - pull out repeated getVectorNumElements() calls. NFC.

2 years ago[libc++] Fix the last instances of `namespace ranges::inline...`. NFC.
Arthur O'Dwyer [Sat, 29 Jan 2022 16:02:23 +0000 (11:02 -0500)]
[libc++] Fix the last instances of `namespace ranges::inline...`. NFC.

Make these look the same as everywhere else.

2 years ago[WebAssembly] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr
Simon Pilgrim [Sat, 29 Jan 2022 16:08:06 +0000 (16:08 +0000)]
[WebAssembly] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr

The pointers are dereferenced immediately, so assert the cast is correct instead of returning nullptr

2 years ago[lldb] TypeSystemClang - use castAs/cast<> instead of getAs/dyn_cast<> to avoid deref...
Simon Pilgrim [Sat, 29 Jan 2022 15:34:26 +0000 (15:34 +0000)]
[lldb] TypeSystemClang - use castAs/cast<> instead of getAs/dyn_cast<> to avoid dereference of nullptr

The pointers are dereferenced immediately, so assert the cast is correct instead of returning nullptr

2 years ago[clang][NFC] Change some ->getType()->isPlaceholderType() to just ->hasPlaceholderType()
Arthur O'Dwyer [Sat, 29 Jan 2022 00:50:48 +0000 (19:50 -0500)]
[clang][NFC] Change some ->getType()->isPlaceholderType() to just ->hasPlaceholderType()

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

2 years ago[X86] combinePredicateReduction - always use PMOVMSKB(PCMPEQB()) for allof(icmp_eq...
Simon Pilgrim [Sat, 29 Jan 2022 15:16:47 +0000 (15:16 +0000)]
[X86] combinePredicateReduction - always use PMOVMSKB(PCMPEQB()) for allof(icmp_eq()) reductions

This greatly simplifies the codegen for recognising PTEST patterns and matches the codegen from the very similar LowerVectorAllZero

2 years ago[libc++] [test] Mark two ranges tests with libcpp-has-no-incomplete-ranges.
Arthur O'Dwyer [Sat, 29 Jan 2022 15:14:02 +0000 (10:14 -0500)]
[libc++] [test] Mark two ranges tests with libcpp-has-no-incomplete-ranges.

Should fix the Apple build CI, e.g.
https://buildkite.com/llvm-project/libcxx-ci/builds/8227

2 years agoSpeculatively fix the sphinx build for Clang's attribute reference
Aaron Ballman [Sat, 29 Jan 2022 14:38:57 +0000 (09:38 -0500)]
Speculatively fix the sphinx build for Clang's attribute reference

2 years ago[X86] SimplifyDemandedBits - add X86ISD::BLENDV SimplifyMultipleUseDemandedBits handling
Simon Pilgrim [Sat, 29 Jan 2022 14:26:41 +0000 (14:26 +0000)]
[X86] SimplifyDemandedBits - add X86ISD::BLENDV SimplifyMultipleUseDemandedBits handling

Lets us see through multiple use operands

2 years ago[X86] LowerFunnelShift - allow non-constant vXi8 unpack(y,x) << zext(z) lowering...
Simon Pilgrim [Sat, 29 Jan 2022 13:58:25 +0000 (13:58 +0000)]
[X86] LowerFunnelShift - allow non-constant vXi8 unpack(y,x) << zext(z) lowering pre-AVX512

Without AVX512 (which can efficiently extend/truncate to vXi16/vXi32), unpacking/packing to vXi16 is more efficient that relying on the (uops-heavy) PBLENDV shift expansion

2 years agoRevert fad7e491a0770ac4336934030ac67d77e7af5520 with fixes applied
Aaron Ballman [Sat, 29 Jan 2022 13:11:14 +0000 (08:11 -0500)]
Revert fad7e491a0770ac4336934030ac67d77e7af5520 with fixes applied

fad7e491a0770ac4336934030ac67d77e7af5520 was a revert of
86797fdb6f51d32f285e48b6d3e0fc5b8b852734 due to build failures. This
hopefully fixes them.

2 years ago[M68k] Add addressing modes ARIPI and ARIPD support for BTST
Jim Lin [Fri, 28 Jan 2022 05:26:15 +0000 (13:26 +0800)]
[M68k] Add addressing modes ARIPI and ARIPD support for BTST

BTST missed ARIPI and ARIPD addressing modes support.

Reviewed By: myhsu

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

2 years ago[SVE] Remove AArch64ISD::PFALSE.
Paul Walker [Fri, 28 Jan 2022 14:40:50 +0000 (14:40 +0000)]
[SVE] Remove AArch64ISD::PFALSE.

AArch64ISD::PFALSE does not provide any value, in fact it can
prevent common combines from firing.  We only needed to lower
to PFALSE until ISD::SPLAT_VECTOR became generally available.

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

2 years ago[AArch64] Add isel for bitcasting between bfloat and half types.
Paul Walker [Fri, 28 Jan 2022 00:29:09 +0000 (00:29 +0000)]
[AArch64] Add isel for bitcasting between bfloat and half types.

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

2 years agoRaise the minimum Visual Studio version to VS2019
Simon Pilgrim [Sat, 29 Jan 2022 10:56:41 +0000 (10:56 +0000)]
Raise the minimum Visual Studio version to VS2019

As raised here: https://lists.llvm.org/pipermail/llvm-dev/2021-November/153881.html

Now that VS2022 is on general release, LLVM is expected to build on VS2017, VS2019 and VS2022, which is proving hazardous to maintain due to changes in behaviour including preprocessor and constexpr changes. Plus of the few developers that work with VS, many have already moved to VS2019/22.

This patch proposes to raise the minimum supported version to VS2019 (16.x) - I've made the hard limit 16.0 or later, with the soft limit VS2019 16.7 - older versions of VS2019 are "allowed" (at your own risk) via the LLVM_FORCE_USE_OLD_TOOLCHAIN cmake flag.

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

2 years ago[IR] Require matching signature in getCalledFunction()
Nikita Popov [Fri, 9 Jul 2021 20:56:53 +0000 (22:56 +0200)]
[IR] Require matching signature in getCalledFunction()

With opaque pointers, it's possible to directly call a function with
a different signature, without an intermediate bitcast. However,
lot's of code using getCalledFunction() reasonably assumes that the
signatures match (which is always true without opaque pointers).
Add an explicit check to that effect.

The test case is from D105313, where I ran into the problem, but on
further investigation this also affects lots of other code, we just
have little coverage with mismatching signatures. The change from
D105313 is still desirable for other reasons, but this patch
addresses the root problem when it comes to opaque pointers.

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

2 years ago[RISCV] Correct predicate orc.b pattern to not include Zbkb.
Craig Topper [Sat, 29 Jan 2022 08:09:03 +0000 (00:09 -0800)]
[RISCV] Correct predicate orc.b pattern to not include Zbkb.

This was incorrectly lumped in when the predicate was changed for
the rotate instructions.

2 years ago[WebAssembly][NFC] Refactor WasmSymbol type setting code
Paulo Matos [Fri, 28 Jan 2022 11:02:30 +0000 (12:02 +0100)]
[WebAssembly][NFC] Refactor WasmSymbol type setting code

This refactors some code dealing with setting Wasm symbol types.
Some of the code dealing with types was moved from
`WebAssemblyUtilities` to  `WebAssemblyTypeUtilities`.

Reviewed By: sbc100

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

2 years ago[RISCV] Custom legalize BITREVERSE with Zbkb.
Craig Topper [Sat, 29 Jan 2022 06:55:37 +0000 (22:55 -0800)]
[RISCV] Custom legalize BITREVERSE with Zbkb.

With Zbkb, a bitreverse can be split into a rev8 and a brev8.

Reviewed By: VincentWu

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

2 years ago[NFC] Add missing doxygen file tag in llvm/include/llvm/ADT/ headers
Shivam Gupta [Fri, 28 Jan 2022 15:12:54 +0000 (20:42 +0530)]
[NFC] Add missing doxygen file tag in llvm/include/llvm/ADT/ headers

Few header file don't have file tag in them. This patch can be help
in viewing doxygen documentation. When we hover on the included header
file, small description will display.

Reviewed By: aaron.ballman, xgupta

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

2 years ago[TableGen] Detect multiple Processors with the same name.
Craig Topper [Sat, 29 Jan 2022 06:37:00 +0000 (22:37 -0800)]
[TableGen] Detect multiple Processors with the same name.

Due to a bad merge we ended up with duplicate entries in our
downstream repo. I was surprised that nothing caught it. I wrote
this check so I could fix our downstream repo and figured I might
as well share it.

Reviewed By: RKSimon, spatel

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

2 years ago[libc++][ranges][NFC] Small cleanup to the Ranges status page.
Konstantin Varlamov [Sat, 29 Jan 2022 06:39:12 +0000 (22:39 -0800)]
[libc++][ranges][NFC] Small cleanup to the Ranges status page.

- add a few missing links to code reviews;
- reorder the views to follow the same order as in the Standard.

2 years ago[ELF][test] Improve INSERT [AFTER|BEFORE] and adjustSectionsBeforeSorting tests
Fangrui Song [Sat, 29 Jan 2022 06:21:12 +0000 (22:21 -0800)]
[ELF][test] Improve INSERT [AFTER|BEFORE] and adjustSectionsBeforeSorting tests

2 years ago[cmake] Partially deduplicate `{llvm,compiler_rt}_check_linker_flag` for runtime...
John Ericson [Sat, 22 Jan 2022 00:21:19 +0000 (19:21 -0500)]
[cmake] Partially deduplicate `{llvm,compiler_rt}_check_linker_flag` for runtime libs and llvm

We previously had a few varied definitions of this floating around.

I had tried to make the one installed with LLVM handle all the cases, and then made the others use it, but this ran into issues with `HandleOutOfTreeLLVM` not working for compiler-rt, and also `CMAKE_EXE_LINKER_FLAGS` not working right without `CMP0056` set to the new behavior.

 My compromise solution is this:

 - No not completely deduplicate: the runtime libs will instead use a version that still exists as part of the internal and not installed common shared CMake utilities. This avoids `HandleOutOfTreeLLVM` or a workaround for compiler-rt.

- Continue to use `CMAKE_REQUIRED_FLAGS`, which effects compilation and linking. Maybe this is unnecessary, but it's safer to leave that as a future change. Also means we can avoid `CMP0056` for now, to try out later, which is good incrementality too.

- Call it `llvm_check_compiler_linker_flag` since it, in fact is about both per its implementation (before and after this patch), so there is no name collision.

In the future, we might still enable CMP0056 and make compiler-rt work with HandleOutOfTreeLLVM, which case we delete `llvm_check_compiler_flag` and go back to the old way (as these are, in fact, linking related flags), but that I leave for someone else as future work.

The original issue was reported to me in https://reviews.llvm.org/D116521#3248117 as
D116521 made clang and LLVM use the common cmake utils.

Reviewed By: sebastian-ne, phosek, #libunwind, #libc, #libc_abi, ldionne

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

2 years ago[OpenMP] Fix wrong number in openmp/runtime/src/dllexports
Shilei Tian [Sat, 29 Jan 2022 05:22:57 +0000 (00:22 -0500)]
[OpenMP] Fix wrong number in openmp/runtime/src/dllexports

This patch fixes the issue that numbers assigned to `interop` functions were already taken in `openmp/runtime/src/dllexports`.

Reviewed By: jdoerfert

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

2 years ago[ELF] Change the search order for dependent libraries
Petr Hosek [Fri, 28 Jan 2022 09:50:49 +0000 (01:50 -0800)]
[ELF] Change the search order for dependent libraries

When processing dependent libraries, if there's a directory of the same
name as the library being searched for, either in the current directory
or earlier in the search order, LLD will try to open it and report an
error. This is because LLD uses file existence check. To address this
issue we reverse the order, searching the library by basename first
and only considering search paths later, and current directory last.

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

2 years agoRecommit "[InstCombine] Fold and-reduce idiom"
Max Kazantsev [Sat, 29 Jan 2022 04:01:35 +0000 (11:01 +0700)]
Recommit "[InstCombine] Fold and-reduce idiom"

Checks of original vector types made more thorough.

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

2 years ago[libc++][ranges][NFC] Update and slightly cleanup Ranges status page.
Konstantin Varlamov [Sat, 29 Jan 2022 04:13:53 +0000 (20:13 -0800)]
[libc++][ranges][NFC] Update and slightly cleanup Ranges status page.

- add missing links to sections of the Standard and to patches;
- update the status on a couple of items.

2 years agoDelete dead code
Sanjoy Das [Fri, 28 Jan 2022 19:04:31 +0000 (11:04 -0800)]
Delete dead code

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

2 years ago[X86][avx512fp16] Promote fp16 to fp32 for frem.
Luo, Yuanke [Fri, 28 Jan 2022 14:54:17 +0000 (22:54 +0800)]
[X86][avx512fp16] Promote fp16 to fp32 for frem.

Promote fp16 to fp32 for frem.

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

2 years ago[gn build] (manually) port 99217fa8a02
Nico Weber [Sat, 29 Jan 2022 03:33:19 +0000 (22:33 -0500)]
[gn build] (manually) port 99217fa8a02

2 years ago[OpenMP] disable build of old nvptx device runtime
Ye Luo [Sat, 29 Jan 2022 03:24:29 +0000 (21:24 -0600)]
[OpenMP] disable build of old nvptx device runtime

Fully respect LIBOMPTARGET_BUILD_NVPTX_BCLIB. There is no CUDA toolchain dependency. Complement D118268.

Reviewed By: jdoerfert

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

2 years ago[Test] Add pointer comparison test that crashed with D118317
Max Kazantsev [Sat, 29 Jan 2022 03:12:28 +0000 (10:12 +0700)]
[Test] Add pointer comparison test that crashed with D118317

2 years ago[RISCV] Improve extract_vector_elt for fixed mask registers.
jacquesguan [Sat, 15 Jan 2022 09:14:38 +0000 (17:14 +0800)]
[RISCV] Improve extract_vector_elt for fixed mask registers.

Now the backend promotes mask vector to an i8 vector and extract element from that. We could bitcast to a widen element vector, and extract from it to GPR, then use I instruction to extract the certain bit.

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

2 years ago[Test] Recommit tests that were reverted by mistake along with other patch
Max Kazantsev [Sat, 29 Jan 2022 02:53:36 +0000 (09:53 +0700)]
[Test] Recommit tests that were reverted by mistake along with other patch

2 years ago[M68k][GlobalISel] Legalize more instruction in M68k Legalizer.
Sheng [Sat, 29 Jan 2022 01:59:58 +0000 (09:59 +0800)]
[M68k][GlobalISel] Legalize more instruction in M68k Legalizer.

This patch legalizes more instructions and data types.

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

2 years agoAdd 'clangd' prefix to remote index proto targets
Sam McCall [Sat, 29 Jan 2022 01:19:43 +0000 (02:19 +0100)]
Add 'clangd' prefix to remote index proto targets

Some pieces of build infrastructure (shlib, debian package) classify
targets based on whether they begin with "clang".

2 years agoRevert "[UpdateTestChecks] Add --filter and --filter-out options"
David Greene [Sat, 29 Jan 2022 01:06:51 +0000 (17:06 -0800)]
Revert "[UpdateTestChecks] Add --filter and --filter-out options"

Broke some update-test-checks tests.  Reverting while developing a fix.

This reverts commit 030f71698d52f228929da5e3148602f4a3daff7d.

2 years agoMove LLVM Proposal to doc directory, create index
Jeff Bailey [Sat, 29 Jan 2022 00:27:34 +0000 (00:27 +0000)]
Move LLVM Proposal to doc directory, create index

The LLVM Libc project is no longer just a proposal and should have
a webpage tracking the status of the project.  This changes
puts the pieces into the right place so that the webpage can be
created.

Reviewed By: sivachandra

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

2 years ago[flang] Implement a runtime routine to report fatal errors with source position
Peter Steinfeld [Fri, 28 Jan 2022 21:21:29 +0000 (13:21 -0800)]
[flang] Implement a runtime routine to report fatal errors with source position

The title says it all.

I implemented a routine called "Crash" and added a test.

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

2 years ago[OpenMP] Accept shortened triples for -Xopenmp-target=
Joseph Huber [Fri, 28 Jan 2022 18:28:28 +0000 (13:28 -0500)]
[OpenMP] Accept shortened triples for -Xopenmp-target=

This patch builds on the change in D117634 that expanded the short
triples when passed in by the user. This patch adds the same
functionality for the `-Xopenmp-target=` flag. Previously it was
unintuitive that passing `-fopenmp-targets=nvptx64
-Xopenmp-target=nvptx64 <arg>` would not forward the arg because the
triples did not match on account of `nvptx64` being expanded to
`nvptx64-nvidia-cuda`.

Reviewed By: jdoerfert

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

2 years agoRevert "Add BITINT_MAXWIDTH support"
Jan Korous [Fri, 28 Jan 2022 23:08:45 +0000 (15:08 -0800)]
Revert "Add BITINT_MAXWIDTH support"

This reverts commit 86797fdb6f51d32f285e48b6d3e0fc5b8b852734.

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

2 years ago[mlir][sparse] Adding standard pipeline for tests.
wren romano [Thu, 27 Jan 2022 00:44:32 +0000 (16:44 -0800)]
[mlir][sparse] Adding standard pipeline for tests.

Addresses https://bugs.llvm.org/show_bug.cgi?id=52409 aka https://github.com/llvm/llvm-project/issues/51751

Reviewed By: aartbik, mehdi_amini

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

2 years ago[clang-tidy] Recognize labelled statements when simplifying boolean exprs
Richard [Thu, 30 Dec 2021 22:41:27 +0000 (15:41 -0700)]
[clang-tidy] Recognize labelled statements when simplifying boolean exprs

Inside a switch the caseStmt() and defaultStmt() have a nested statement
associated with them.  Similarly, labelStmt() has a nested statement.
These statements were being missed when looking for a compound-if of the
form "if (x) return true; return false;" when the if is nested under one
of these labelling constructs.

Enhance the matchers to look for these nested statements using some
private matcher hasSubstatement() traversal matcher on case, default
and label statements.  Add the private matcher hasSubstatementSequence()
to match the compound "if (x) return true; return false;" pattern.

- Add unit tests for private matchers and corresponding test
  infrastructure
- Add corresponding test file readability-simplify-bool-expr-case.cpp.
- Fix variable name copy/paste error in readability-simplify-bool-expr.cpp.
- Drop the asserts, which were used only for debugging matchers.
- Run clang-format on the whole check.
- Move local functions out of anonymous namespace and declare state, per
  LLVM style guide
- Declare labels constexpr
- Declare visitor arguments as pointer to const
- Drop braces around simple control statements per LLVM style guide
- Prefer explicit arguments over default arguments to methods

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

Fixes #27078

2 years ago[Driver] Remove -fno-experimental-new-pass-manager
Fangrui Song [Fri, 28 Jan 2022 22:58:26 +0000 (14:58 -0800)]
[Driver] Remove -fno-experimental-new-pass-manager

to give users a final warning that they need to migrate away. They could still
use -flegacy-pass-manager for Clang 14.0.0, but the functionality may not work
for 15.0.0.

-fexperimental-new-pass-manager is a no-op for default builds, so not urgent to
be removed for 14.0.0.

clang/test/Frontend/optimization-remark-with-hotness.c is removed because its
new PM replacement optimization-remark-with-hotness-new-pm.c exists.

Reviewed By: aeubanks, nikic

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

2 years ago[MLIR][GPU] Add missing #include to SerializeToHsaco.cpp
Krzysztof Drewniak [Fri, 28 Jan 2022 21:05:02 +0000 (21:05 +0000)]
[MLIR][GPU] Add missing #include to SerializeToHsaco.cpp

llvm/Support/Path.h was likely previously implicitly included, and a
refactoring removed that inclusion, breaking the pass.

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

2 years ago[MLIR] Factor out common parts of the TLike constraint
Krzysztof Drewniak [Thu, 27 Jan 2022 16:48:44 +0000 (16:48 +0000)]
[MLIR] Factor out common parts of the TLike constraint

Type constraints such as BoolLike and SignlessIntegerLike appear to
have been defined by copy-paste and all share an underlying TypesLike
structure that can be factored out.

This also allows for defining additional constraints of a similar
form, such as F32Like.

Reviewed By: rriddle

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

2 years agoUpdate module map for 4ce1f3d47c33daccfb7f4e906c3f57b404900036
Adrian Prantl [Fri, 28 Jan 2022 22:51:46 +0000 (14:51 -0800)]
Update module map for 4ce1f3d47c33daccfb7f4e906c3f57b404900036

2 years ago[Driver] Add CUDA support for --offload param
Daniele Castagna [Fri, 28 Jan 2022 22:49:48 +0000 (14:49 -0800)]
[Driver] Add CUDA support for --offload param

The --offload option was added in D110622 to "override the default
device target". When it landed it supported only HIP.  This patch
extends that option to support SPIR-V targets for CUDA.

Reviewed By: tra

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

2 years ago[ScalarEvolution] Handle <= and >= in non infinite loops
William S. Moses [Tue, 25 Jan 2022 01:02:53 +0000 (20:02 -0500)]
[ScalarEvolution] Handle <= and >= in non infinite loops

Extend scalar evolution to handle >= and <= if a loop is known to be finite and the induction variable guards the condition. Specifically, with these assumptions lhs <= rhs is equivalent to lhs < rhs + 1 and lhs >= rhs to lhs > rhs -1.

In the case of lhs <= rhs, this is true since the only case these are not equivalent
is when rhs == unsigned/signed intmax, which would have resulted in an infinite loop.

In the case of lhs >= rhs, this is true since the only case these are not equivalent
is when rhs == unsigned/signed intmin, which would again have resulted in an infinite loop.

Reviewed By: lebedev.ri

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

2 years ago[AttrDocs] Fix docs for the sycl_special_class attribute after D114483
Fangrui Song [Fri, 28 Jan 2022 22:30:49 +0000 (14:30 -0800)]
[AttrDocs] Fix docs for the sycl_special_class attribute after D114483

Fixes `AttributeReference.rst:6628:Explicit markup ends without a blank line; unexpected unindent.`
for `ninja docs-clang-html`

2 years ago[mlir] Fix build after 83d59e05b201
Alexandre Ganea [Fri, 28 Jan 2022 22:21:15 +0000 (17:21 -0500)]
[mlir] Fix build after 83d59e05b201

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

2 years ago[UpdateTestChecks] Add --filter and --filter-out options
David Greene [Wed, 19 Jan 2022 17:33:17 +0000 (09:33 -0800)]
[UpdateTestChecks] Add --filter and --filter-out options

Enhance the various update_*_test_checks.py tools to allow filtering the tool
output with regular expressions.  The --filter option will emit only tool output
lines matching the given regular expression while the --filter-out option will
emit only tools output lines not matching the given regular expression.  Filters
are applied in order of appearance on the command line (or in UTC_ARGS) and the
first matching filter terminates the search.

This allows test authors to create more focused tests by removing irrelevant
tool output and checking only the pieces of output necessary to test the desired
functionality.

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

2 years ago[flang] Initial lowering for empty program
Valentin Clement [Fri, 28 Jan 2022 21:39:44 +0000 (22:39 +0100)]
[flang] Initial lowering for empty program

This patch enable lowering from Fortran to FIR for a basic empty
program. It brings all the infrastructure needed for that. As discussed
previously, this is the first patch for lowering and follow up patches
should be smaller.

With this patch we can lower the following code:

```
program basic
end program
```

To a the FIR equivalent:

```
func @_QQmain() {
  return
}
```

Follow up patch will add lowering of more complex constructs.

Reviewed By: kiranchandramohan, schweitz, PeteSteinfeld

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

2 years ago[flang][NFC] Remove obsolete IntrinsicCall helper
Valentin Clement [Fri, 28 Jan 2022 21:37:36 +0000 (22:37 +0100)]
[flang][NFC] Remove obsolete IntrinsicCall helper

Remove obsolete code that has moved to the
`flang/Optimizer/Builder/Intrinsic` directory.

`genMin` is inlined in the code since it's not available
in the builder.

Reviewed By: kiranchandramohan, schweitz

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

2 years ago[mlir][sparse][pytaco] enable dimension ordering syntax
Aart Bik [Fri, 28 Jan 2022 18:52:28 +0000 (10:52 -0800)]
[mlir][sparse][pytaco] enable dimension ordering syntax

Reviewed By: bixia

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

2 years ago[clang-format] Fix misaligned trailing comments in the presence of an empty block...
Marek Kurdej [Fri, 28 Jan 2022 09:37:22 +0000 (10:37 +0100)]
[clang-format] Fix misaligned trailing comments in the presence of an empty block comment.

Fixes https://github.com/llvm/llvm-project/issues/53441.

Expected code:
```
/**/   //
int a; //
```

was before misformatted to:
```
/**/     //
int a; //
```

Because the "remaining length" (after the starting `/*`) of an empty block comment `/**/` was computed to be 0 instead of 2.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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

2 years agoRemove reference type when checking const structs
Weverything [Fri, 14 Jan 2022 23:42:36 +0000 (15:42 -0800)]
Remove reference type when checking const structs

ConstStructBuilder::Finalize in CGExprConstant.ccp assumes that the
passed in QualType is a RecordType.  In some instances, the type is a
reference to a RecordType and the reference needs to be removed first.

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

2 years ago[CUDA][HIP] Do not treat host var address as constant in device compilation
Yaxun (Sam) Liu [Tue, 25 Jan 2022 04:49:07 +0000 (23:49 -0500)]
[CUDA][HIP] Do not treat host var address as constant in device compilation

Currently clang treats host var address as constant in device compilation,
which causes const vars initialized with host var address promoted to
device variables incorrectly and results in undefined symbols.

This patch fixes that.

Reviewed by: Artem Belevich

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

Fixes: SWDEV-309881

Change-Id: I0a69357063c6f8539ef259c96c250d04615f4473

2 years ago[polly][unittests] Link DeLICMTests with libLLVMCore
Rainer Orth [Fri, 28 Jan 2022 20:58:40 +0000 (21:58 +0100)]
[polly][unittests] Link DeLICMTests with libLLVMCore

A `-DBUILD_SHARED_LIBS=ON` build on Solaris/amd64 failed with

  Undefined                       first referenced
   symbol                             in file
  _ZNK4llvm3cfg6UpdateIPNS_10BasicBlockEE4dumpEv tools/polly/unittests/DeLICM/CMakeFiles/DeLICMTests.dir/DeLICMTest.cpp.o  (symbol belongs to implicit dependency /var/llvm/local-amd64-release-stage2-shared-A/bin/../lib/libLLVMCore.so.14git)
  ld: fatal: symbol referencing errors

Solaris `ld` requires to directly link with dependant libraries, so this
patch explicitly adds `libLLVMCore`.

Tested on `amd64-pc-solaris2.11` and `x86_64-pc-linux-gnu`.

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

2 years ago[SLP] Use moveBefore to simplify code [NFC]
Philip Reames [Fri, 28 Jan 2022 20:43:56 +0000 (12:43 -0800)]
[SLP] Use moveBefore to simplify code [NFC]

2 years ago[ObjCARC] Require the function argument in the clang.arc.attachedcall bundle.
Ahmed Bougacha [Fri, 28 Jan 2022 19:55:53 +0000 (11:55 -0800)]
[ObjCARC] Require the function argument in the clang.arc.attachedcall bundle.

Currently, the clang.arc.attachedcall bundle takes an optional function
argument.  Depending on whether the argument is present, calls with this
bundle have the following semantics:

- on x86, with the argument present, the call is lowered to:
    call _target
    mov rax, rdi
    call _objc_retainAutoreleasedReturnValue

- on AArch64, without the argument, the call is lowered to:
    bl _target
    mov x29, x29

  and the objc runtime call is expected to be emitted separately.

That's because, on x86, the objc runtime checks for both the mov and
the call on x86, and treats the combination as the ARC autorelease elision
marker.

But on AArch64, it only checks for the dedicated NOP marker, as that's
historically been sufficiently unique.  Thanks to that, the runtime call
wasn't required to be adjacent to the NOP marker, so it wasn't emitted
as part of the bundle sequence.

This patch unifies both architectures: on AArch64, we now emit all
3 instructions for the bundle.  This guarantees that the runtime call
is adjacent to the marker in the sequence, and that's information the
runtime can use to further optimize this.

This helps simplify some of the handling, in particular
BundledRetainClaimRVs, which no longer needs to know whether the bundle
is sufficient or not: it now always should be.

Note that this does not include an AutoUpgrade for the nullary bundles,
as they are only produced in ObjCContract as part of the obj/asm emission
pipeline, and are not expected to be in bitcode.

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

2 years ago[BOLT] Imported llvm-bolt-wrapper script
Amir Ayupov [Wed, 24 Feb 2021 20:46:53 +0000 (12:46 -0800)]
[BOLT] Imported llvm-bolt-wrapper script

Commit history in chronological order:

[BOLT] llvm-bolt-wrapper: added wrapper for bolt binary matching

Summary:
Wrapper to compare two versions of BOLT to see if they produce the same output
binary given the same input.

(cherry picked from FBD26626137)

[BOLT] llvm-bolt-wrapper: support for no-output tests and heatmap mode

Summary:
- Added an option `skip_binary_cmp` to support invocations that don't output
  a binary
- Minor fixes for heatmap mode, timeout, log comparison
- Rearranged in-line config example to be copy-pasteable

(cherry picked from FBD26822016)

[BOLT] llvm-bolt-wrapper: merge stdout/stderr, search for config in script dir

(cherry picked from FBD27529335)

[BOLT] llvm-bolt-wrapper: handle /dev/null

Summary:
Fixed the wrapper to preserve `-o /dev/null` and skip binary matching for such
invocations.

(cherry picked from FBD28013747)

[BOLT] llvm-bolt-wrapper: handle cases where output binary doesn't exist

Summary:
Handle invocations where output binary is not generated (e.g. due to an expected
assertion or exit with BOLT-ERROR) and skip binary comparison in such cases.

(cherry picked from FBD28080158)

[BOLT] llvm-bolt-wrapper: handle boltdiff mode

Summary:
Handle `llvm-boltdiff` invocation similarly to `perf2bolt`

(cherry picked from FBD28080157)

[BOLT] llvm-bolt-wrapper: find section with mismatch

Summary:
For mismatching ELF files, find section with mismatch and print sections table
with highlighted mismatch section.

(cherry picked from FBD28087231)

[BOLT] llvm-bolt-wrapper: ignore-build-id in perf2bolt mode

Summary:
When perf2bolt fails to match build-id from perf output for cmp binary, we need
to use -ignore-build-id option to override the strict checking behavior.

(cherry picked from FBD28087232)

[BOLT] llvm-bolt-wrapper: suppress -bolt-info=0 in heatmap mode

Summary:
Heatmap mode is incompatible with `-bolt-info=0` used to suppress binary
differences. Remove it.

(cherry picked from FBD28087230)

[BOLT] llvm-bolt-wrapper: add config-generator mode

Summary:
llvm-bolt-wrapper config can be generated by the script itself.
It makes the workflow more reliable compared to preparing the config manually.

(cherry picked from FBD28358939)

[BOLT] llvm-bolt-wrapper: fix mismatch reporting

Summary:
1. Fixed header comparison issue where headers were skipped due to
  `skip_end == 0` (`lst[:-n]` does not work if n==0).
2. Detect color support while printing mismatching section:
  - use bold color if terminal supports ANSI escape codes,
  - otherwise print ">" at mismatching section.
3. Remove extra 0x before mismatching offset.

(cherry picked from FBD28691979)

[BOLT] llvm-bolt-wrapper: handle perf2bolt tests with ignore-build-id

Summary:
`ignore-build-id` must be passed not more than once. Account for that.

(cherry picked from FBD29830266)

[BOLT] llvm-bolt-wrapper: fix running subprocesses in parallel

Summary:
The commands were running sequentially due to the use of blocking `communicate`
call, which is needed when stdout/stderr are directed to a pipe.
Fix this behavior by directing the output to a file.

(cherry picked from FBD29951863)

2 years ago[GVN] Add tests with redundant load of pointer select.
Florian Hahn [Fri, 28 Jan 2022 20:15:32 +0000 (20:15 +0000)]
[GVN] Add tests with redundant load of pointer select.

Additional test cases for D118144.

2 years ago[libc] Add missing sqrt deps for layering checks
Jordan Rupprecht [Fri, 28 Jan 2022 20:07:19 +0000 (12:07 -0800)]
[libc] Add missing sqrt deps for layering checks

2 years agoRevert "[SLP] Add a clarifying assert in block scheduling [NFC]"
Philip Reames [Fri, 28 Jan 2022 20:07:39 +0000 (12:07 -0800)]
Revert "[SLP] Add a clarifying assert in block scheduling [NFC]"

This reverts commit db49a78900f5e4b59714565876b5dbb5e2dfe840.  The reasoning in the patch applied to a downstream branch, and I got myself confused when trying to split apart pieces.  Thankfully, the assert was simply weaker than the actual invariant currently upstream which is that ReadyInsts is not empty.

2 years agoAdd vector.scan op
harsh [Fri, 28 Jan 2022 20:07:35 +0000 (20:07 +0000)]
Add vector.scan op

This patch adds the vector.scan op which computes the
scan for a given n-d vector. It requires specifying the operator,
the identity element and whether the scan is inclusive or
exclusive.

TEST: Added test in ops.mlir

Reviewed By: ThomasRaoux

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

2 years ago[libc] Enable creat, fsync, open, openat, read and write for aarch64.
Siva Chandra [Fri, 28 Jan 2022 19:41:26 +0000 (11:41 -0800)]
[libc] Enable creat, fsync, open, openat, read and write for aarch64.

2 years agoAdd BITINT_MAXWIDTH support
Aaron Ballman [Fri, 28 Jan 2022 20:00:20 +0000 (15:00 -0500)]
Add BITINT_MAXWIDTH support

Part of the _BitInt feature in C2x
(http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2763.pdf) is a new
macro in limits.h named BITINT_MAXWIDTH that can be used to determine
the maximum width of a bit-precise integer type. This macro must expand
to a value that is at least as large as ULLONG_WIDTH.

This adds an implementation-defined macro named __BITINT_MAXWIDTH__ to
specify that value, which is used by limits.h for the standard macro.

This also limits the maximum bit width to 128 bits because backends do
not currently support all mathematical operations (such as division) on
wider types yet. This maximum is expected to be increased in the future.

2 years ago[flang][NFC] Remove obsolete ComplexExpr helper
Valentin Clement [Fri, 28 Jan 2022 20:01:39 +0000 (21:01 +0100)]
[flang][NFC] Remove obsolete ComplexExpr helper

Functionality present in `flang/include/flang/Lower/ComplexExpr.h` are
available in `flang/include/flang/Optimizer/Builder/Complex.h`. This patch removes
the obsolete files.

Reviewed By: kiranchandramohan, schweitz

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

2 years ago[clang][NFC] Fix Typo
Jacob Lambert [Fri, 28 Jan 2022 19:55:46 +0000 (11:55 -0800)]
[clang][NFC] Fix Typo

2 years ago[IRSim][IROutliner] Allowing Intrinsic Calls to be Used in Similarity Matching and...
Andrew Litteken [Thu, 23 Dec 2021 00:07:43 +0000 (18:07 -0600)]
[IRSim][IROutliner] Allowing Intrinsic Calls to be Used in Similarity Matching and Outlined Regions

Due to some complications with lifetime, and assume-like intrinsics, intrinsics were not included as outlinable instructions. This patch opens up most intrinsics, excluding lifetime and assume-like intrinsics, to be outlined. For similarity, it is required that the intrinsic IDs, and the intrinsics names match exactly, as well as the function type. This puts intrinsics in a different class than normal call instructions (https://reviews.llvm.org/D109448), where the name will no longer have to match.

This also adds an additional command line flag debug option to disable outlining intrinsics.

Recommit of: 8de76bd569732acae6a10fdcb0152a49f7d4cd39
Adds extra checking of intrinsic function calls names to avoid taking the address of intrinsic calls when extracting function calls.

Reviewers: paquette, jroelofs

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

2 years ago[lld] Add module name to LTO inline asm diagnostic
Fangrui Song [Fri, 28 Jan 2022 19:32:42 +0000 (11:32 -0800)]
[lld] Add module name to LTO inline asm diagnostic

Close #52781: for LTO, the inline asm diagnostic uses `<inline asm>` as the file
name (lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp) and it is unclear which
module has the issue.

With this patch, we will see the module name (say `asm.o`) before `<inline asm>` with ThinLTO.

```
% clang -flto=thin -c asm.c && myld.lld asm.o -e f
ld.lld: error: asm.o <inline asm>:1:2: invalid instruction mnemonic 'invalid'
        invalid
        ^~~~~~~
```

For regular LTO, unfortunately the original module name is lost and we only get
ld-temp.o.

Reviewed By: #lld-macho, ychen, Jez Ng

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

2 years ago[libc] Add implementations of the POSIX creat and openat functions.
Siva Chandra Reddy [Thu, 27 Jan 2022 23:47:50 +0000 (23:47 +0000)]
[libc] Add implementations of the POSIX creat and openat functions.

Reviewed By: michaelrj

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

2 years ago[gn build] Port f489e86a24d3
LLVM GN Syncbot [Fri, 28 Jan 2022 19:20:50 +0000 (19:20 +0000)]
[gn build] Port f489e86a24d3

2 years agoRemove Waymarking.h as it is unused
Aaron Ballman [Fri, 28 Jan 2022 19:19:18 +0000 (14:19 -0500)]
Remove Waymarking.h as it is unused

This file was added in https://reviews.llvm.org/D74415. There was no
justification as to why it was added, and after about a year of being
in-tree, it's still unused, so this removes it.

2 years ago[ScalarEvolution] Mark a loop as finite if in a willreturn function
William S. Moses [Fri, 28 Jan 2022 04:52:40 +0000 (23:52 -0500)]
[ScalarEvolution] Mark a loop as finite if in a willreturn function

A limited version of (https://reviews.llvm.org/D118090) that only marks a loop as finite if in a willreturn function.

Reviewed By: jdoerfert

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

2 years ago[GVN] Add additional tests for PRE with pointer selects.
Florian Hahn [Fri, 28 Jan 2022 19:11:35 +0000 (19:11 +0000)]
[GVN] Add additional tests for PRE with pointer selects.

Additional tests for D118143.

2 years ago[SLP] Add a clarifying assert in block scheduling [NFC]
Philip Reames [Fri, 28 Jan 2022 18:34:16 +0000 (10:34 -0800)]
[SLP] Add a clarifying assert in block scheduling [NFC]

The fact we could have a block with a valid scheduling window, but nothing to schedule was surprising to me.  After digging through the code, this can only happen if we don't find anything to directly vectorize.  However, the reduction handling code relies on this mode, so we can't simply consider such trees unvectorizeable.  The assert conveys both that this situation can happen, but also that it can *only* happen for an immediate gather.

Context: We built the bundle before deciding that vectorization of a bundle is possible.  A side effect of bundle construction is manipulating the scheduling window, so a bundle which isn't vectorizable can cause the creation or expansion of a scheduling window.

2 years agoGCC ABI Compatibility: Preserve alignment of non-pod members in packed structs
David Blaikie [Tue, 18 Jan 2022 22:28:14 +0000 (14:28 -0800)]
GCC ABI Compatibility: Preserve alignment of non-pod members in packed structs

This matches GCC: https://godbolt.org/z/sM5q95PGY

I realize this is an API break for clang+clang - so I'm totally open to
discussing how we should deal with that. If Apple wants to keep the
Clang layout indefinitely, if we want to put a flag on this so non-Apple
folks can opt out of this fix/new behavior.

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

2 years ago[lld][Macho] Include dead-stripped symbols in mapfile
Roger Kim [Fri, 28 Jan 2022 18:51:27 +0000 (10:51 -0800)]
[lld][Macho] Include dead-stripped symbols in mapfile

ld64 outputs dead stripped symbols when using the -dead-strip flag. This change mimics that behavior for lld.

ld64's -dead_strip flag outputs:
```
$ ld -map map basics.o -o out -dead_strip -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lSystem
$ cat map
# Path: out
# Arch: x86_64
# Object files:
[  0] linker synthesized
[  1] basics.o
# Sections:
# Address       Size            Segment Section
0x100003F97     0x00000021      __TEXT  __text
0x100003FB8     0x00000048      __TEXT  __unwind_info
0x100004000     0x00000008      __DATA_CONST    __got
0x100008000     0x00000010      __DATA  __ref_section
0x100008010     0x00000001      __DATA  __common
# Symbols:
# Address       Size            File  Name
0x100003F97     0x00000006      [  1] _ref_local
0x100003F9D     0x00000001      [  1] _ref_private_extern
0x100003F9E     0x0000000C      [  1] _main
0x100003FAA     0x00000006      [  1] _no_dead_strip_globl
0x100003FB0     0x00000001      [  1] _ref_from_no_dead_strip_globl
0x100003FB1     0x00000006      [  1] _no_dead_strip_local
0x100003FB7     0x00000001      [  1] _ref_from_no_dead_strip_local
0x100003FB8     0x00000048      [  0] compact unwind info
0x100004000     0x00000008      [  0] non-lazy-pointer-to-local: _ref_com
0x100008000     0x00000008      [  1] _ref_data
0x100008008     0x00000008      [  1] l_ref_data
0x100008010     0x00000001      [  1] _ref_com

# Dead Stripped Symbols:
#               Size            File  Name
<<dead>>        0x00000006      [  1] _unref_extern
<<dead>>        0x00000001      [  1] _unref_local
<<dead>>        0x00000007      [  1] _unref_private_extern
<<dead>>        0x00000001      [  1] _ref_private_extern_u
<<dead>>        0x00000008      [  1] _unref_data
<<dead>>        0x00000008      [  1] l_unref_data
<<dead>>        0x00000001      [  1] _unref_com
```

Reviewed By: int3, #lld-macho, thevinster

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

2 years ago[libc] Refactor sqrt implementations and add tests for generic sqrt implementations.
Tue Ly [Tue, 25 Jan 2022 20:11:15 +0000 (15:11 -0500)]
[libc] Refactor sqrt implementations and add tests for generic sqrt implementations.

Re-apply https://reviews.llvm.org/D118173 with fix for aarch64.

Reviewed By: michaelrj

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

2 years ago[mlir][taco] Accept an integer list for the ordering when defining a tensor format.
Bixia Zheng [Fri, 28 Jan 2022 00:17:26 +0000 (16:17 -0800)]
[mlir][taco] Accept an integer list for the ordering when defining a tensor format.

The unit tests for PyTACO hasn't been upstreamed yet. A unit test for this
change will be added when we upstream all the unit tests for PyTACO.

Reviewed By: aartbik

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

2 years ago[AIX][clang] include_next through clang provided float.h
David Tenty [Mon, 17 Jan 2022 20:32:33 +0000 (15:32 -0500)]
[AIX][clang] include_next through clang provided float.h

AIX provides additional definitions in the system libc float.h that we
would like to be available to users, so we need to include_next through,
similar to what is done on some other platforms.

We also adjust the guards for some definitions which are restricted
based on language level to also be provide with the _ALL_SOURCE feature
test macro on AIX, similar to what is done by the platform float.h
header, so we don't run into cases where we don't provide the compiler
macro but still have a different definition from the system.

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

2 years agoReapply "[llvm-libtool-darwin] Print a warning if object file names are repeated"
Shoaib Meenai [Fri, 28 Jan 2022 07:40:30 +0000 (23:40 -0800)]
Reapply "[llvm-libtool-darwin] Print a warning if object file names are repeated"

Loosen the test to make it pass on Windows.

This reapplies commit 4993eff3e253a1c04e1a1a2fa5d68f6b33423419.
This reverts commit 96c66040125e87808b23410632b1a6a34547b4e3.

2 years ago[lldb] Update the lldb build instructions on Windows
Stella Stamenova [Fri, 28 Jan 2022 18:18:19 +0000 (10:18 -0800)]
[lldb] Update the lldb build instructions on Windows

The existing instructions for lldb on Windows can be more explicit. This adds a few details on how to install various components and the easiest way to get to a working build.

Reviewed By: JDevlieghere

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

2 years agoEmit swift5 reflection section data in dsym bundle generated by dsymutil in the Dwarf...
Shubham Sandeep Rastogi [Wed, 17 Nov 2021 23:05:58 +0000 (15:05 -0800)]
Emit swift5 reflection section data in dsym bundle generated by dsymutil in the Dwarf section.

Add support for Swift reflection metadata to dsymutil.

This patch adds support for copying Swift reflection metadata (__swift5_.* sections) from .o files to into the symbol-rich binary in the output .dSYM. The functionality is automatically enabled only if a .o file has reflection metadata sections and the binary doesn't. When copying dsymutil moves the section from the __TEXT segment to the __DWARF segment.

rdar://76973336

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

2 years ago[mlir] Only build mlir-cpu-runner when the native arch is targeted
Stella Stamenova [Fri, 28 Jan 2022 18:09:09 +0000 (10:09 -0800)]
[mlir] Only build mlir-cpu-runner when the native arch is targeted

mlir-cpu-runner has a dependency on ExecutionEngine which is only built for the native arch. So currently mlir-cpu-runner does not link correctly when the native arch is not targeted.

Reviewed By: mehdi_amini

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

2 years ago[ADT] support fixed-width output with `utohexstr`
Yuanfang Chen [Fri, 28 Jan 2022 18:07:37 +0000 (10:07 -0800)]
[ADT] support fixed-width output with `utohexstr`

Will use it to output a hash value that needs fixed-width.

Reviewed By: dblaikie

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

2 years ago[AMDGPU] SILoadStoreOptimizer: break lists on instructions with side effects
Jay Foad [Thu, 27 Jan 2022 16:58:00 +0000 (16:58 +0000)]
[AMDGPU] SILoadStoreOptimizer: break lists on instructions with side effects

This just helps to keep the lists shorter and faster to sort. NFCI.

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

2 years ago[RISCV] Update comments about getInstSizeInBytes hard-coding the number of bytes.
Craig Topper [Fri, 28 Jan 2022 17:43:00 +0000 (09:43 -0800)]
[RISCV] Update comments about getInstSizeInBytes hard-coding the number of bytes.

After D118175, we get the information from the tablegen definition.

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

2 years ago[NFC][AIX]Disable new pcm tests on AIX
Steven Wan [Fri, 28 Jan 2022 17:38:50 +0000 (12:38 -0500)]
[NFC][AIX]Disable new pcm tests on AIX

Same as D114481, the PCH reader looks for a `__clangast` section in the precompiled module file, which isn't present on AIX, and we don't support writing this custom section in XCOFF yet.

Reviewed By: Jake-Egan, daltenty, sfertile

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

2 years ago[RISCV] Preserve VL when truncating i64 gather/scatter indices on RV32.
Craig Topper [Fri, 28 Jan 2022 17:21:52 +0000 (09:21 -0800)]
[RISCV] Preserve VL when truncating i64 gather/scatter indices on RV32.

We were creating a truncate with the default for the type, but for
VP intrinsics we have a VL that we should use.

Reviewed By: frasercrmck

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

2 years ago[InstrProf][NFC] Move function out of InstrProf.h
Ellis Hoag [Fri, 28 Jan 2022 01:40:19 +0000 (17:40 -0800)]
[InstrProf][NFC] Move function out of InstrProf.h

`createIRLevelProfileFlagVar()` seems to be only used in
`PGOInstrumentation.cpp` so we move it to that file. Then it can also
take advantage of directly using options rather than passing them as
arguments.

Reviewed By: kyulee, phosek

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

2 years ago[RISCV] Use tablegen size for getInstSizeInBytes.
Craig Topper [Fri, 28 Jan 2022 17:12:10 +0000 (09:12 -0800)]
[RISCV] Use tablegen size for getInstSizeInBytes.

Fix the pseudos to have the correct size in the MCInstrDesc description.

Inspired by D118009 and D117970.

Reviewed By: asb

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

2 years ago[SLP]Do not reorder top nodes if they do not require reordering.
Alexey Bataev [Thu, 6 Jan 2022 17:46:16 +0000 (09:46 -0800)]
[SLP]Do not reorder top nodes if they do not require reordering.

No need to reorder the top nodes, if they are not stores or
insertelement instructions and each node should be analized only
once, when the bottom-to-top analysis is performed.
We still endup with extractelements for the top node scalars and
the final shuffle just adds an extra cost and currently
crashes the compiler for PHI nodes.

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