platform/upstream/llvm.git
4 years ago[OpenMP][CMake] Fix version detection of testing compiler
Jonas Hahnfeld [Thu, 2 Jul 2020 17:34:03 +0000 (19:34 +0200)]
[OpenMP][CMake] Fix version detection of testing compiler

When configuring in-tree, the correct names are LLVM_VERSION_MAJOR
and LLVM_VERSION_MINOR. This has been wrong since the code was added
in commits fc473dee98 and 821649229e.

4 years ago[LLD] Add required dependency after shared libs break due to ba5087f13025
Nemanja Ivanovic [Thu, 2 Jul 2020 17:28:17 +0000 (12:28 -0500)]
[LLD] Add required dependency after shared libs break due to ba5087f13025

The dependency on TextAPI was not added and is required for shared
libs builds.

4 years ago[PowerPC] Remove undefs from splat input when changing shuffle mask
Nemanja Ivanovic [Thu, 2 Jul 2020 15:14:54 +0000 (10:14 -0500)]
[PowerPC] Remove undefs from splat input when changing shuffle mask

As of 1fed131660b2c5d3ea7007e273a7a5da80699445, we have code that
changes shuffle masks so that we can put the shuffle in a canonical
form that can be matched to a single instruction. However, it
does not properly account for undef elements in the BUILD_VECTOR
that is the RHS splat so we can end up with undefs where they
shouldn't be. This patch converts the splat input with undefs to
one without.

4 years ago[MLIR][SPIRV] Support two memory access attributes in OpCopyMemory.
ergawy [Thu, 2 Jul 2020 17:14:29 +0000 (13:14 -0400)]
[MLIR][SPIRV] Support two memory access attributes in OpCopyMemory.

This commit augments spv.CopyMemory's implementation to support 2 memory
access operands. Hence, more closely following the spec. The following
changes are introduces:

- Customize logic for spv.CopyMemory serialization and deserialization.
- Add 2 additional attributes for source memory access operand.

Reviewed By: antiagainst

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

4 years ago[MLIR][SPIRVToLLVM] SPIR-V function call conversion pattern
George Mitenkov [Thu, 2 Jul 2020 16:34:27 +0000 (12:34 -0400)]
[MLIR][SPIRVToLLVM] SPIR-V function call conversion pattern

Added conversion pattern for SPIR-V `FunctionCallOp`. Based on
specification, it returns no results or a single result, so
can be mapped directly to LLVM dialect's `llvm.call`.

Reviewed By: antiagainst, ftynse

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

4 years ago[MLIR][SPIRVToLLVM] Implementation of spv.BitFieldInsert pattern
George Mitenkov [Thu, 2 Jul 2020 16:19:05 +0000 (12:19 -0400)]
[MLIR][SPIRVToLLVM] Implementation of spv.BitFieldInsert pattern

This patch introduces conversion pattern for `spv.BitFiledInsert` op,
as well as some utility functions to facilitate code reading.
Since `spv.BitFiledInsert` may take both vector and integer operands,
this case was specifically handled by broadcasting values (`count`
and `offset` here) to vectors. Moreover, the types had to be converted
to same bitwidth in order to conform with LLVM dialect rules.
This was done with `zext` when extending (Note that `count` and
`offset` are treated as unsigned) and `trunc` in the opposite case.
For the latter one, truncation is safe since the op is defined only when
`count`/`offset`/their sum is less than the bitwidth of the result.
This introduces a natural bound of the value of 64, which can be
expressed as `i8`.

Reviewed By: antiagainst, ftynse

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

4 years ago[InstCombine] Add some sext/trunc tests to show missing support for non-uniform vectors
Simon Pilgrim [Thu, 2 Jul 2020 16:11:38 +0000 (17:11 +0100)]
[InstCombine] Add some sext/trunc tests to show missing support for non-uniform vectors

4 years ago[lldb] Fix type conversion in the Scalar getters
Pavel Labath [Mon, 29 Jun 2020 14:17:29 +0000 (16:17 +0200)]
[lldb] Fix type conversion in the Scalar getters

Summary:
The Scalar class claims to follow the C type conversion rules. This is
true for the Promote function, but it is not true for the implicit
conversions done in the getter methods.

These functions had a subtle bug: when extending the type, they used the
signedness of the *target* type in order to determine whether to do
sign-extension or zero-extension. This is not how things work in C,
which uses the signedness of the *source* type. I.e., C does
(sign-)extension before it does signed->unsigned conversion, and not the
other way around.

This means that: (unsigned long)(int)-1
      is equal to (unsigned long)0xffffffffffffffff
      and not (unsigned long)0x00000000ffffffff

Unsurprisingly, we have accumulated code which depended on this
inconsistent behavior. It mainly manifested itself as code calling
"ULongLong/SLongLong" as a way to get the value of the Scalar object in
a primitive type that is "large enough". Previously, the ULongLong
conversion did not do sign-extension, but now it does.

This patch makes the Scalar getters consistent with the declared
semantics, and fixes the couple of call sites that were using it
incorrectly.

Reviewers: teemperor, JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[AArch64][SVE] NFC: Rename isOrig -> isReverseInstr
Sander de Smalen [Thu, 2 Jul 2020 13:40:08 +0000 (14:40 +0100)]
[AArch64][SVE] NFC: Rename isOrig -> isReverseInstr

This is a non-functional to clarify some of the terminology in the
AArch64SVEInstrInfo/SVEInstrFormats.td files around the tables
for mapping an instruction to it's reverse instruction counter part,
and vice versa. e.g. DIV -> DIVR and DIVR -> DIV.

Reviewers: paulwalker-arm, cameron.mcinally, rengolin, efriedma

Reviewed By: paulwalker-arm, efriedma

Tags: #llvm

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

4 years ago[InstCombine] Add (vXi1 trunc(lshr(x,c))) -> icmp_eq(and(x,c')) support for non-unifo...
Simon Pilgrim [Thu, 2 Jul 2020 15:56:33 +0000 (16:56 +0100)]
[InstCombine] Add (vXi1 trunc(lshr(x,c))) -> icmp_eq(and(x,c')) support for non-uniform vectors

As noted on PR46531, we were only performing this transform on uniform vectors as we were using the m_APInt pattern matcher to extract the shift amount.

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

4 years ago[InstCombine] Add some (vXi1 trunc(lshr(x,c))) -> icmp_eq(and(x,c')) tests for vector...
Simon Pilgrim [Thu, 2 Jul 2020 14:09:52 +0000 (15:09 +0100)]
[InstCombine] Add some (vXi1 trunc(lshr(x,c))) -> icmp_eq(and(x,c')) tests for vectors with undef elements

Suggested on D83035

4 years ago[ELF][test] Add some additional .eh_frame/.eh_frame_hdr testing
James Henderson [Tue, 30 Jun 2020 10:17:53 +0000 (11:17 +0100)]
[ELF][test] Add some additional .eh_frame/.eh_frame_hdr testing

This patch adds a few extra cases to the existing testing for eh_frame
and eh_frame_hdr behaviour in LLD. They all come from a private
testsuite we are trying to migrate to lit.

Reviewed by: grimar, MaskRay

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

4 years agoPreserve GlobalsAA analysis result in LowerConstantIntrinsics
Ryan Santhiraraja [Thu, 2 Jul 2020 12:53:20 +0000 (13:53 +0100)]
Preserve GlobalsAA analysis result in LowerConstantIntrinsics

LowerConstantIntrinsics fails to preserve the analysis result of
GlobalsAA. Not preserving the analysis might affect benchmark
performance. This change fixes this issue.

Patch by Ryan Santhiraraja <rsanthir@quicinc.com>

Reviewers: fpetrogalli, joerg, fhahn

Reviewed By: fhahn

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

4 years ago[ASTImporter] Add unittest case for friend decl import
Vince Bridgers [Wed, 1 Jul 2020 21:49:08 +0000 (16:49 -0500)]
[ASTImporter] Add unittest case for friend decl import

Summary:
This change adds a matching test case for the recent bug fix to
VisitFriendDecl in ASTImporterLookup.cpp.

See https://reviews.llvm.org/D82882 for details.

Reviewers: martong, a.sidorin, shafik

Reviewed By: martong

Subscribers: rnkovacs, teemperor, cfe-commits, dkrupp

Tags: #clang

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

4 years ago[MLIR] Exact integer emptiness checks for FlatAffineConstraints
Arjun P [Thu, 2 Jul 2020 13:48:18 +0000 (19:18 +0530)]
[MLIR] Exact integer emptiness checks for FlatAffineConstraints

This patch adds the capability to perform exact integer emptiness checks for FlatAffineConstraints using the General Basis Reduction algorithm (GBR). Previously, only a heuristic was available for emptiness checks, which was not guaranteed to always give a conclusive result.

This patch adds a `Simplex` class, which can be constructed using a `FlatAffineConstraints`, and can find an integer sample point (if one exists) using the GBR algorithm. Additionally, it adds two classes `Matrix` and `Fraction`, which are used by `Simplex`.

The integer emptiness check functionality can be accessed through the new `FlatAffineConstraints::isIntegerEmpty()` function, which runs the existing heuristic first and, if that proves to be inconclusive, runs the GBR algorithm to produce a conclusive result.

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

4 years ago[AMDGPU][CODEGEN] Added support of new inline assembler constraints
Dmitry Preobrazhensky [Thu, 2 Jul 2020 14:16:11 +0000 (17:16 +0300)]
[AMDGPU][CODEGEN] Added support of new inline assembler constraints

Added support for constraints 'I', 'J', 'B', 'C', 'DA', 'DB'.

See https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html#Machine-Constraints.

Reviewers: arsenm, rampitec

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

4 years agoFix missing build dependencies on omp_gen
Jon Roelofs [Thu, 2 Jul 2020 13:54:57 +0000 (07:54 -0600)]
Fix missing build dependencies on omp_gen

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

4 years ago[ASTMatchers] Enhanced support for matchers taking Regex arguments
Nathan James [Thu, 2 Jul 2020 13:52:24 +0000 (14:52 +0100)]
[ASTMatchers] Enhanced support for matchers taking Regex arguments

Added new Macros `AST(_POLYMORPHIC)_MATCHER_REGEX(_OVERLOAD)` that define a matchers that take a regular expression string and optionally regular expression flags. This lets users match against nodes while ignoring the case without having to manually use `[Aa]` or `[A-Fa-f]` in their regex. The other point this addresses is in the current state, matchers that use regular expressions have to compile them for each node they try to match on, Now the regular expression is compiled once when you define the matcher and used for every node that it tries to match against. If there is an error while compiling the regular expression an error will be logged to stderr showing the bad regex string and the reason it couldn't be compiled. The old behaviour of this was down to the Matcher implementation and some would assert, whereas others just would never match. Support for this has been added to the documentation script as well. Support for this has been added to dynamic matchers ensuring functionality is the same between the 2 use cases.

Reviewed By: aaron.ballman

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

4 years ago[lldb] Add a host-independent test for handling -flimit-debug-info
Pavel Labath [Thu, 2 Jul 2020 13:27:25 +0000 (15:27 +0200)]
[lldb] Add a host-independent test for handling -flimit-debug-info

This complements the existing TestLimitDebugInfo.py, which tests this
scenario more comprehensively, but is not able to run on all hosts.
Specifically, it's hard to trigger this code from windows because clang
tries hard to ensure that debug info for types marked with
__declspec(dllexport) is emitted even under -flimit-debug-info (and
dllexport is needed to use a type across shared libraries).

This assembly-based test serves two purposes:
- it tests that -flimit-debug-info code path works for windows binaries
  (even though the aforementioned feature means its less likely to be
  used there)
- it gives basic test coverage for the -flimit-debug-info handling code
  when running the test suite on windows hosts.

4 years agocall ::pthread_detach on llvm_execute_on_thread_impl
Nathan James [Thu, 2 Jul 2020 13:41:03 +0000 (14:41 +0100)]
call ::pthread_detach on llvm_execute_on_thread_impl

Fixes all TSAN bugs in clangd

Reviewed By: sammccall

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

4 years agoRegenerate sext/trunc tests and replace %tmp variable names to silence update_test_ch...
Simon Pilgrim [Thu, 2 Jul 2020 12:21:21 +0000 (13:21 +0100)]
Regenerate sext/trunc tests and replace %tmp variable names to silence update_test_checks warnings

4 years ago[AArch64][SVE] Put zeroing pseudos and patterns under flag.
Sander de Smalen [Thu, 2 Jul 2020 13:14:24 +0000 (14:14 +0100)]
[AArch64][SVE] Put zeroing pseudos and patterns under flag.

This patch puts the _ZERO pseudos and corresponding patterns
under the predicate 'UseExperimentalZeroingPseudos', so that they
can be enabled/disabled through compile flags.

This is done because the zeroing pseudos use MOVPRFX to do merging of
the inactive lanes, but it depends on the uarch whether this operation
is actually merged with the destructive operation. If not, it may be
more profitable to use a SELECT and to give the compiler the freedom to
schedule these instructions as normal, rather than keeping them bundled
together. Additionally, this feature is not yet fully implemented and
there are still known bugs (see D80410) that need to be resolved before
the 'experimental' can be dropped from the name.

Reviewers: paulwalker-arm, cameron.mcinally, efriedma

Reviewed By: paulwalker-arm

Tags: #llvm

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

4 years ago[clang][Serialization] Don't duplicate the body of LambdaExpr during deserialization
Bruno Ricci [Thu, 2 Jul 2020 13:13:35 +0000 (14:13 +0100)]
[clang][Serialization] Don't duplicate the body of LambdaExpr during deserialization

05843dc6ab97a00cbde7aa4f08bf3692eb83109d changed the serialization of the body
of LambdaExpr to avoid a mutation in LambdaExpr::getBody and to avoid a missing
body in LambdaExpr::children.

Unfortunately this replaced one bug by another: we are now duplicating the body
during deserialization; that is after deserialization the identity:

E->getBody() == E->getCallOperator()->getBody() does not hold.

Fix that by instead lazily loading the body from the call operator when needed.

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

Reviewed By: martong, aaron.ballman, vabridgers

4 years ago[flang] Add inliner pass.
Eric Schweitz [Thu, 2 Jul 2020 00:00:02 +0000 (17:00 -0700)]
[flang] Add inliner pass.

This adds a minimalist inliner implementation. Along with the inliner, a
minimum number of support files are also included. These will pave the
way for future diffs to add more transformation passes to flang. A
future diff will add the inline test, which cannot be run successfully
quite yet as some components have not yet been upstreamed.

Differential revision:

4 years ago[flang] Add changes to codegen to convert it to tablegen passes.
Eric Schweitz [Thu, 2 Jul 2020 01:40:32 +0000 (18:40 -0700)]
[flang] Add changes to codegen to convert it to tablegen passes.

This upstreams changes to codegen to convert the passes to the new
tablegen pass support from MLIR.

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

4 years ago[BasicAA] Fix recursive phi MustAlias calculations
David Green [Thu, 2 Jul 2020 09:56:58 +0000 (10:56 +0100)]
[BasicAA] Fix recursive phi MustAlias calculations

With the option -basic-aa-recphi we can detect recursive phis that loop
through constant geps, which allows us to detect more no-alias case for
pointer IV's. If the other phi operand and the other alias value are
MustAlias though, we cannot presume that every element in the loop is
also MustAlias. We need to instead be conservative and return MayAlias.

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

4 years ago[clang] Fix a null-NSS-access crash in DependentNameType.
Haojian Wu [Thu, 2 Jul 2020 12:58:32 +0000 (14:58 +0200)]
[clang] Fix a null-NSS-access crash in DependentNameType.

The DependentNameType must have a non-null NSS. This property could be
violated during typo correction.

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

4 years ago[lldb] Skip TestLimitDebugInfo on windows
Pavel Labath [Thu, 2 Jul 2020 12:28:03 +0000 (14:28 +0200)]
[lldb] Skip TestLimitDebugInfo on windows

The test does not work on windows, because clang will emit full type
information for __declspec(dllexport) types even under
-flimit-debug-info. __declspec(dllexport) is needed to be able to use
the type across shared library boundaries on windows, which makes this a
pretty good heuristic, but defeats the purpose of this test.

I am going to create (in another patch) an basic assembly test, so that
the relevant code gets at least some coverage on windows hosts.

This also reverts commit 1276855f2b4485ec312b379c1b8eaf5510d9b157, which
added the __declspec annotations -- they are not necessary anymore, and
they needlessly complicate the test.

4 years ago[analyzer][StdLibraryFunctionsChecker] Add POSIX file handling functions
Gabor Marton [Mon, 22 Jun 2020 09:00:02 +0000 (11:00 +0200)]
[analyzer][StdLibraryFunctionsChecker] Add POSIX file handling functions

Adding file handling functions from the POSIX standard (2017).
A new checker option is introduced to enable them.
In follow-up patches I am going to upstream networking, pthread, and other
groups of POSIX functions.

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

4 years ago[clangd] Switch FindSymbolsTests to use TestTU
Kadir Cetinkaya [Wed, 1 Jul 2020 10:16:54 +0000 (12:16 +0200)]
[clangd] Switch FindSymbolsTests to use TestTU

Summary:
This gets rid of the dependency on ClangdServer and a bunch of extra
infrastructure coming with it. Also enables us to clear SyncAPI, as it was the
sole user of runWorkspace/DocumentSymbols.

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[NFC][clang] Add missing VALIDATE_DIAG_SIZE()
Whisperity [Thu, 2 Jul 2020 12:14:57 +0000 (14:14 +0200)]
[NFC][clang] Add missing VALIDATE_DIAG_SIZE()

Originally when libCrossTU was introduced in commit
e350b0a19629c4cce87f28913b3137f4c7015de3, the macro which thus had all
diagnostic kinds covered was not added.

4 years ago[Alignment][NFC] Transition and simplify calls to DL::getABITypeAlignment
Guillaume Chatelet [Thu, 2 Jul 2020 11:28:01 +0000 (11:28 +0000)]
[Alignment][NFC] Transition and simplify calls to DL::getABITypeAlignment

This patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

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

4 years ago[Alignment][NFC] VectorLayout now uses Align internally
Guillaume Chatelet [Thu, 2 Jul 2020 11:25:54 +0000 (11:25 +0000)]
[Alignment][NFC] VectorLayout now uses Align internally

By rewritting `ScalarizerVisitor::getVectorLayout` in such a way it returns `VectorLayout` (or `None`) it becomes obvious that `VectorLayout::VecAlign` cannot be `0`.

This patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

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

4 years ago[AArch64][SVE] Add reg+imm addressing mode for unpredicated stores
Kerry McLaughlin [Thu, 2 Jul 2020 09:41:49 +0000 (10:41 +0100)]
[AArch64][SVE] Add reg+imm addressing mode for unpredicated stores

Reviewers: sdesmalen, efriedma, david-arm

Reviewed By: efriedma

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, danielkiss, llvm-commits

Tags: #llvm

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

4 years ago[InstCombine] Add some (vXi1 trunc(lshr(x,c))) -> icmp_eq(and(x,c')) tests for non...
Simon Pilgrim [Thu, 2 Jul 2020 10:56:32 +0000 (11:56 +0100)]
[InstCombine] Add some (vXi1 trunc(lshr(x,c))) -> icmp_eq(and(x,c')) tests for non-uniform vectors

As noticed on PR46531

4 years agoRegenerate apint-shift tests and replace %tmp variable names to silence update_test_c...
Simon Pilgrim [Thu, 2 Jul 2020 10:39:50 +0000 (11:39 +0100)]
Regenerate apint-shift tests and replace %tmp variable names to silence update_test_checks warnings

4 years agoFix some typos (unkown -> unknown); NFC
Aaron Ballman [Thu, 2 Jul 2020 10:40:38 +0000 (06:40 -0400)]
Fix some typos (unkown -> unknown); NFC

4 years ago[LV] Enable the LoopVectorizer to create pointer inductions
Anna Welker [Thu, 2 Jul 2020 10:34:49 +0000 (11:34 +0100)]
[LV] Enable the LoopVectorizer to create pointer inductions

This patch enables the LoopVectorizer to build a phi of pointer
type and provide the vector loads and stores with vector type
getelementptrs built from the pointer induction variable, which
produces much less instructions than the previous approach of
creating scalar getelementpointers and glue them together to a
vector.

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

4 years agoRegenerate llvm/test/CodeGen/X86/optimize-max-0.ll
Roman Lebedev [Thu, 2 Jul 2020 10:35:30 +0000 (13:35 +0300)]
Regenerate llvm/test/CodeGen/X86/optimize-max-0.ll

It surprizingly appears to be affected by the last SCEV patch

4 years ago[ScalarEvolution] createSCEV(): recognize `udiv`/`urem` disguised as an `sdiv`/`srem`
Roman Lebedev [Thu, 2 Jul 2020 09:44:48 +0000 (12:44 +0300)]
[ScalarEvolution] createSCEV(): recognize `udiv`/`urem` disguised as an `sdiv`/`srem`

Summary:
While InstCombine trivially converts that `srem` into a `urem`,
it might happen later than wanted, in particular i'd like
for that to happen on  https://godbolt.org/z/bwuEmJ test case
early in pipeline, before first instcombine run, just before `-mem2reg`.

SCEV should recognize this case natively.

Reviewers: mkazantsev, efriedma, nikic, reames

Reviewed By: efriedma

Subscribers: clementval, hiraditya, javed.absar, llvm-commits

Tags: #llvm

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

4 years ago[BasicAA] New basic-aa-recphi test. NFC
David Green [Thu, 2 Jul 2020 07:03:37 +0000 (08:03 +0100)]
[BasicAA] New basic-aa-recphi test. NFC

4 years ago[gn build] Port 804d9687443
LLVM GN Syncbot [Thu, 2 Jul 2020 09:46:36 +0000 (09:46 +0000)]
[gn build] Port 804d9687443

4 years ago[VE] Rename VE toolchain source files
Kazushi (Jam) Marukawa [Wed, 1 Jul 2020 14:17:27 +0000 (23:17 +0900)]
[VE] Rename VE toolchain source files

Summary:
Rename VE.cpp and VE.h to VEToolchain.cpp and VEToolchain.h respectively
in order to avoid link warning message.  Linker warns that VE.cpp.o and
Arch/VE.cpp.o have the same name.

Reviewers: simoll, k-ishizaka

Reviewed By: simoll

Subscribers: mgorny, cfe-commits

Tags: #llvm, #ve, #clang

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

4 years ago[SVE] Add warnings checks in four more LLVM SVE tests
David Sherwood [Wed, 1 Jul 2020 14:20:01 +0000 (15:20 +0100)]
[SVE] Add warnings checks in four more LLVM SVE tests

I have added CHECK lines to the following tests:

  llvm/test/CodeGen/AArch64/sve-breakdown-scalable-vectortype.ll
  llvm/test/CodeGen/AArch64/sve-calling-convention-tuple-types.ll
  llvm/test/CodeGen/AArch64/sve-intrinsics-create-tuple.ll
  llvm/test/CodeGen/AArch64/sve-intrinsics-loads.ll

since they are now free of warnings related to invalid use of
EVT::getVectorNumElements() and VectorType::getNumElements().

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

4 years ago[Support][Windows] Prevent 2s delay when renaming a file that does not exist
Ben Dunbobbin [Wed, 1 Jul 2020 16:49:30 +0000 (17:49 +0100)]
[Support][Windows] Prevent 2s delay when renaming a file that does not exist

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

4 years agoDSE: fix builtin function recognition to take decl into account
Nuno Lopes [Thu, 2 Jul 2020 09:27:09 +0000 (10:27 +0100)]
DSE: fix builtin function recognition to take decl into account

4 years ago[AMDGPU] Fix formatting in MIR tests
Jay Foad [Thu, 2 Jul 2020 09:17:03 +0000 (10:17 +0100)]
[AMDGPU] Fix formatting in MIR tests

4 years ago[CodeGen][SVE] Don't drop scalable flag in DAGCombiner::visitEXTRACT_SUBVECTOR
Sander de Smalen [Thu, 2 Jul 2020 09:06:41 +0000 (10:06 +0100)]
[CodeGen][SVE] Don't drop scalable flag in DAGCombiner::visitEXTRACT_SUBVECTOR

There was a rogue 'assert' in AArch64ISelLowering for the tuple.get intrinsics,
that shouldn't really have been there (I suspect this was a remnant from when
we expected the wider vector always to have come from a vector CONCAT).

When I tried to create a more minimal reproducer, I found a bug in
DAGCombiner where it drops the scalable flag when trying to fold:

      extract_subv (bitcast X), Index --> bitcast (extract_subv X, Index')

This patch fixes both issues.

Reviewers: david-arm, efriedma, spatel

Reviewed By: efriedma

Tags: #llvm

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

4 years ago[AArch64][SVE] Add unpred load/store patterns for bf16 types
Sander de Smalen [Thu, 2 Jul 2020 08:59:49 +0000 (09:59 +0100)]
[AArch64][SVE] Add unpred load/store patterns for bf16 types

Reviewers: kmclaughlin, c-rhodes, efriedma

Reviewed By: efriedma

Tags: #llvm

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

4 years ago[SVE] ACLE: Fix builtins for svdup_lane_bf16 and svcvtnt_bf16_f32_x
Sander de Smalen [Thu, 2 Jul 2020 08:26:52 +0000 (09:26 +0100)]
[SVE] ACLE: Fix builtins for svdup_lane_bf16 and svcvtnt_bf16_f32_x

bfloat16 variants of svdup_lane were missing, and svcvtnt_bf16_x
was implemented incorrectly (it takes an operand for the inactive
lanes)

Reviewers: fpetrogalli, efriedma

Reviewed By: fpetrogalli

Tags: #clang

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

4 years ago[lldb][NFC] Don't pass around passthrough from ClangDiagnosticManagerAdapter
Raphael Isemann [Thu, 2 Jul 2020 07:41:09 +0000 (09:41 +0200)]
[lldb][NFC] Don't pass around passthrough from ClangDiagnosticManagerAdapter

The passthrough DiagnosticConsumer is an implementation detail of
ClangDiagnosticManagerAdapter and we can just hide it behind the normal
DiagnosticConsumer interface that ClangDiagnosticManagerAdapter is supposed
to implement.

4 years ago[NFC] Fix typo in triples from unkown to unknown
Qiu Chaofan [Thu, 2 Jul 2020 08:06:54 +0000 (16:06 +0800)]
[NFC] Fix typo in triples from unkown to unknown

4 years ago[ARM] Rearrange SizeReduction when using -Oz
Nicholas Guy [Thu, 18 Jun 2020 09:25:24 +0000 (10:25 +0100)]
[ARM] Rearrange SizeReduction when using -Oz

Move the Thumb2SizeReduce pass to before IfConversion when optimising
for minimal code size.

Running the Thumb2SizeReduction pass before IfConversionallows T1
instructions to propagate to the final output, rather than the
ifConverter modifying T2 instructions and preventing them from being
reduced later.

This change does introduce a regression regarding execution time, so
it's only applied when optimising for size.

Running the LLVM Test Suite with this change produces a geomean
difference of -0.1% for the size..text metric.

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

4 years agoFix missing build dependency on omp_gen.
Simon Tatham [Thu, 2 Jul 2020 08:16:13 +0000 (09:16 +0100)]
Fix missing build dependency on omp_gen.

Summary:
`include/llvm/Frontend/OpenMP/CMakeLists.txt` creates a new target
called `omp_gen` which builds the generated include file `OMP.h.inc`.
This target must therefore be a dependency of every compilation step
whose transitive #include dependencies contain `OMP.h.inc`, or else
it's possible for builds to fail if Ninja (or make or whatever)
schedules that compilation step before building `OMP.h.inc` at all.

A few of those dependencies are currently missing, which leads to
intermittent build failures, depending on the order that Ninja (or
whatever) happens to schedule its commands. As far as I can see,
compiles in `clang/lib/CodeGen`, `clang/lib/Frontend`, and
`clang/examples` all depend transitivily on `OMP.h.inc` (usually via
`clang/AST/AST.h`), but don't have the formal dependency in the ninja
graph.

Adding `omp_gen` to the dependencies of `clang-tablegen-targets` seems
to be the way to get the missing dependency into the `clang/examples`
subdirectory. This also fixes the other two clang subdirectories, as
far as I can see.

Reviewers: clementval, thakis, chandlerc, jdoerfert

Reviewed By: clementval

Subscribers: cfe-commits, jdenny, mgorny, sstefan1, llvm-commits

Tags: #llvm, #clang

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

4 years ago[CodeGen] Fix warnings in getCopyToPartsVector
David Sherwood [Mon, 29 Jun 2020 06:48:23 +0000 (07:48 +0100)]
[CodeGen] Fix warnings in getCopyToPartsVector

Whilst trying to assemble the following test:

  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_set2.c

I discovered we were hitting some warnings about possible invalid
calls to getVectorNumElements() in getCopyToPartsVector(). I've
tried to fix these by using ElementCount types where possible and
I've made the assumption that we don't support using a fixed width
vector to copy parts of a scalable vector, and vice versa. Looking
at how the copy is implemented I think that's the right thing for
now.

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

4 years agoRevert "[clang-tidy] For `run-clang-tidy.py` escape the paths that are used for analy...
Nathan James [Thu, 2 Jul 2020 07:54:55 +0000 (08:54 +0100)]
Revert "[clang-tidy] For `run-clang-tidy.py` escape the paths that are used for analysis."

This reverts commit 068fa35746637fde29355a43d17d554a92b32cdf.

Based on a regression reported in https://bugs.llvm.org/show_bug.cgi?id=46536

4 years ago[lldb][NFC] Fix a variable name in ClangDiagnosticManagerAdapter
Raphael Isemann [Thu, 2 Jul 2020 07:10:07 +0000 (09:10 +0200)]
[lldb][NFC] Fix a variable name in ClangDiagnosticManagerAdapter

4 years ago[X86] Enable multibyte NOPs in 64-bit mode for padding/alignment.
Craig Topper [Thu, 2 Jul 2020 06:59:01 +0000 (23:59 -0700)]
[X86] Enable multibyte NOPs in 64-bit mode for padding/alignment.

The default CPU used by llvm-mc doesn't have the NOPL feature, but
if we know we're compiling in 64-bit mode we should be able to
use nopl.

4 years ago[clang] Re-add deleted forward declaration.
Alexander Belyaev [Thu, 2 Jul 2020 06:56:51 +0000 (08:56 +0200)]
[clang] Re-add deleted forward declaration.

4 years agoThis patch adds basic debug info support with basic block sections.
Krzysztof Pszeniczny [Thu, 2 Jul 2020 06:47:30 +0000 (23:47 -0700)]
This patch adds basic debug info support with basic block sections.

This patch uses ranges for debug information when a function contains basic block sections rather than using [lowpc, highpc]. This is also the first in a series of patches for debug info and does not contain the support for linker relaxation. That will be done as a follow up patch.

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

4 years agoAdd parenthesized expression to SyntaxTree
Eduardo Caldas [Wed, 1 Jul 2020 13:58:18 +0000 (13:58 +0000)]
Add parenthesized expression to SyntaxTree

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[mlir][OpFormatGen] Add support for resolving variadic types from non-variadic
River Riddle [Thu, 2 Jul 2020 05:24:36 +0000 (22:24 -0700)]
[mlir][OpFormatGen] Add support for resolving variadic types from non-variadic

This enables better support for traits such as SameOperandsAndResultType, and other situations in which a variadic operand may be resolved from a non-variadic.

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

4 years agold64.lld: Add janky support for tbd files
Nico Weber [Thu, 2 Jul 2020 04:02:09 +0000 (00:02 -0400)]
ld64.lld: Add janky support for tbd files

With this, a simple hello world links against libSystem.tbd and the
old ld64.lld linker kind of works again with newer SDKs.

The motivation here is to have an arm64 cross linker that's good
enough to be able to run simple configure link checks on non-mac
systems for generating config.h files. Once -flavor darwinnew can
link arm64, we'll switch to that.

4 years agolld/MachO: Remove a useless temporary
Nico Weber [Thu, 2 Jul 2020 04:04:51 +0000 (00:04 -0400)]
lld/MachO: Remove a useless temporary

4 years ago[lldb/build.py] Always pass an SDK to the compiler on Darwin
Fred Riss [Thu, 2 Jul 2020 02:54:11 +0000 (19:54 -0700)]
[lldb/build.py] Always pass an SDK to the compiler on Darwin

On macOS 11, system libraries which are part of the shared cache
are not present on the filesystem anymore. This causes issues
with build.py, because it fails to link binaries with libSystem
or libc++.

The real issue is that build.py was not passing an SDK to the
compiler. The script accepts an argument for the SDK, but it
is currently unused. This patch just threads the SDK through
to the compile and link steps and this fixes a bunch of Shell
test failures on very recent macOS builds.

4 years ago[lldb/ObjC] Add support for direct selector references
Fred Riss [Fri, 13 Mar 2020 23:28:23 +0000 (16:28 -0700)]
[lldb/ObjC] Add support for direct selector references

On macOS 11 (and other aligned OSs), the shared cache method
lists get an additional optimization which removes one level
of indirection to get to the selector.
This patch supports this new optimization. Both codepaths are
covered byt the existing Objective-C tests.

4 years ago[lldb/ObjCRuntime] Implement support for small method lists
Fred Riss [Wed, 26 Feb 2020 22:57:50 +0000 (14:57 -0800)]
[lldb/ObjCRuntime] Implement support for small method lists

On macOS 11 (and other aligned Apple OSs), the Objective-C runtime
has a new optimization which saves memory by making the method
lists smaller.
This patch adds support for this new method list encoding (while
also keeping backward compatibility). This is implicitely covered
by some existing Objective-C tests.

4 years ago[AMDGPU] Control num waves per EU for implicit work-group size
Pushpinder Singh [Wed, 17 Jun 2020 04:06:48 +0000 (00:06 -0400)]
[AMDGPU] Control num waves per EU for implicit work-group size

Summary:
If amdgpu-flat-work-group-size is not specified in LLVM IR, the backend
uses default value of 1024. For this, minimum waves per EU should be 4.
However, backend is still setting minimum value to 1 instead of calculated
value. This is not observed normally as frontend always provide
amdgpu-flat-work-group-size attribute.

Reviewers: rampitec, b-sumner, sameerds, msearles

Reviewed By: rampitec

Subscribers: qcolombet, arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[lld-macho] Make sure ZeroFill sections are at the end of their segments
Jez Ng [Mon, 15 Jun 2020 22:00:27 +0000 (15:00 -0700)]
[lld-macho] Make sure ZeroFill sections are at the end of their segments

Summary:
ld64 does this, and references an internal rdar:// number as an explanation. No
idea what that rdar issue is, but in practice, it seems that not putting a BSS
section at the end can cause subsequent sections in the same segment to be
overwritten with zeroes.

Reviewers: #lld-macho

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[PowerPC]Implement Vector Shift Double Bit Immediate Builtins
Biplob Mishra [Thu, 2 Jul 2020 00:48:44 +0000 (19:48 -0500)]
[PowerPC]Implement Vector Shift Double Bit Immediate Builtins

Implement Vector Shift Double Bit Immediate Builtins in LLVM/Clang.
  * vec_sldb ();
  * vec_srdb ();

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

4 years ago[flang][openmp] Use common Directive and Clause enum from llvm/Frontend
Valentin Clement [Thu, 2 Jul 2020 00:57:11 +0000 (20:57 -0400)]
[flang][openmp] Use common Directive and Clause enum from llvm/Frontend

Summary:
This patch is removing the custom enumeration for OpenMP Directives and Clauses and replace them
with the newly tablegen generated one from llvm/Frontend. This is a first patch and some will follow to share the same
infrastructure where possible. The next patch should use the clauses allowance defined in the tablegen file.

Reviewers: jdoerfert, DavidTruby, sscalpone, kiranchandramohan, ichoyjx

Reviewed By: DavidTruby, ichoyjx

Subscribers: jholewinski, cfe-commits, dblaikie, MaskRay, ymandel, ichoyjx, mgorny, yaxunl, guansong, jfb, sstefan1, aaron.ballman, llvm-commits

Tags: #llvm, #flang, #clang

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

4 years ago[X86-64] Support Intel AMX instructions
Xiang1 Zhang [Thu, 2 Jul 2020 00:36:45 +0000 (08:36 +0800)]
[X86-64] Support Intel AMX instructions

Summary:
INTEL ADVANCED MATRIX EXTENSIONS (AMX).
AMX is a new programming paradigm, it has a set of 2-dimensional registers
(TILES) representing sub-arrays from a larger 2-dimensional memory image and
operate on TILES.

Spec can be found in Chapter 3 here https://software.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html

Reviewers: LuoYuanke, annita.zhang, pengfei, RKSimon, xiangzhangllvm

Reviewed By: xiangzhangllvm

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[PowerPC][NFC] Update doc for FeatureISA3_1/FeatureISA3_0 definitions
Lei Huang [Thu, 2 Jul 2020 00:36:19 +0000 (19:36 -0500)]
[PowerPC][NFC] Update doc for FeatureISA3_1/FeatureISA3_0 definitions

4 years ago[flang] Add more support for alternate returns
Tim Keith [Thu, 2 Jul 2020 00:28:00 +0000 (17:28 -0700)]
[flang] Add more support for alternate returns

Add `hasAlternateReturns` to `evaluate::ProcedureRef`.

Add `HasAlternateReturns` to test subprogram symbols.

Fix `label01.F90` test: It was checking that "error: " didn't appear in
the output. But that was erroneously matching a warning that ends
"would be in error:". So change it to check for ": error: " instead.

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

4 years ago[PowerPC] Exploit xxspltiw and xxspltidp instructions
Anil Mahmud [Wed, 1 Jul 2020 19:16:27 +0000 (14:16 -0500)]
[PowerPC] Exploit xxspltiw and xxspltidp instructions

Exploits the VSX Vector Splat Immediate Word and
VSX Vector Splat Immediate Double Precision instructions:

  xxspltiw XT,IMM32
  xxspltidp XT,IMM32

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

4 years ago[mlir][spirv] Add support for lowering scf.for scf/if with return value
Thomas Raoux [Thu, 2 Jul 2020 00:08:08 +0000 (17:08 -0700)]
[mlir][spirv] Add support for lowering scf.for scf/if with return value

This allow lowering to support scf.for and scf.if with results. As right now
spv region operations don't have return value the results are demoted to
Function memory. We create one allocation per result right before the region
and store the yield values in it. Then we can load back the value from
allocation to be able to use the results.

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

4 years ago[mlir][NFC] Move conversion of scf to spir-v ops in their own file
Thomas Raoux [Wed, 1 Jul 2020 23:54:26 +0000 (16:54 -0700)]
[mlir][NFC] Move conversion of scf to spir-v ops in their own file

Move patterns for scf to spir-v ops in their own file/folder.

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

4 years ago[flang][NFC] Get formatting in sync with latest clang-format
Tim Keith [Wed, 1 Jul 2020 23:51:44 +0000 (16:51 -0700)]
[flang][NFC] Get formatting in sync with latest clang-format

flang/module only contains Fortran files and one is a .h so disable
formatting on that directory.

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

4 years ago[gcov] Move llvm_writeout_files from atexit to a static destructor
Fangrui Song [Wed, 1 Jul 2020 23:40:31 +0000 (16:40 -0700)]
[gcov] Move llvm_writeout_files from atexit to a static destructor

atexit registered functions run earlier so `__attribute__((destructor))`
annotated functions cannot be tracked.

Set a priority of 100 (compatible with GCC 7 onwards) to track
destructors and destructors whose priorities are greater than 100.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7970

Reviewed By: calixte, marco-c

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

4 years agoRevert "Update lto.ll test after 3367e9da enabled multibyte NOPs in 64-bit mode."
Douglas Yung [Wed, 1 Jul 2020 23:34:57 +0000 (16:34 -0700)]
Revert "Update lto.ll test after 3367e9da enabled multibyte NOPs in 64-bit mode."

This reverts commit 79f6a814ab9383094a5ffea75bb7aca55292ff15.

Didn't notice that someone had reverted the commit that caused the problem.

4 years agoUpdate lto.ll test after 3367e9da enabled multibyte NOPs in 64-bit mode.
Douglas Yung [Wed, 1 Jul 2020 23:25:25 +0000 (16:25 -0700)]
Update lto.ll test after 3367e9da enabled multibyte NOPs in 64-bit mode.

This should fix the PS4 linux build bot:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/70409

4 years agotypo fixes to cycle bots
Nico Weber [Wed, 1 Jul 2020 23:20:05 +0000 (19:20 -0400)]
typo fixes to cycle bots

4 years agoclang CoverageMapping tests bot cleanup
Xun Li [Wed, 1 Jul 2020 23:06:31 +0000 (16:06 -0700)]
clang CoverageMapping tests bot cleanup

Summary:
D82928 generated unexpected tmp files in the CoverageMapping test directory. This patch cleans it up and remove the file in the test bots.
It will be revered after a week.

Reviewers: thakis

Reviewed By: thakis

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[NFCI] Actually provide correct check lines in sdiv.ll
Roman Lebedev [Wed, 1 Jul 2020 22:59:16 +0000 (01:59 +0300)]
[NFCI] Actually provide correct check lines in sdiv.ll

4 years agoAMDGPU: Set more mov flags on V_ACCVGPR_{READ|WRITE}_B32
Matt Arsenault [Wed, 1 Jul 2020 20:34:51 +0000 (16:34 -0400)]
AMDGPU: Set more mov flags on V_ACCVGPR_{READ|WRITE}_B32

This fixes extra copies when materializing constants in AGPRs. This
made it a lot harder to trigger the spilling in spill-agpr.ll

4 years agoRegAllocGreedy: Use TargetInstrInfo already in the class
Matt Arsenault [Wed, 1 Jul 2020 22:13:51 +0000 (18:13 -0400)]
RegAllocGreedy: Use TargetInstrInfo already in the class

4 years agoAMDGPU: Fix missing tracksRegLiveness in tests
Matt Arsenault [Wed, 1 Jul 2020 18:46:07 +0000 (14:46 -0400)]
AMDGPU: Fix missing tracksRegLiveness in tests

I have no idea why this is considered optional, or why it's not the
default. Also add uses of the copied registers for more useful
liveness testing.

4 years ago[AMDGPU] Limit promote alloca to vector with VGPR budget
Stanislav Mekhanoshin [Wed, 1 Jul 2020 19:08:22 +0000 (12:08 -0700)]
[AMDGPU] Limit promote alloca to vector with VGPR budget

Allow only up to 1/4 of available VGPRs for the vectorization
of any given alloca.

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

4 years agoRevert "[flang][openmp] Use common Directive and Clause enum from llvm/Frontend"
clementval [Wed, 1 Jul 2020 22:49:07 +0000 (18:49 -0400)]
Revert "[flang][openmp] Use common Directive and Clause enum from llvm/Frontend"

This reverts commit 7f1e7767952233d1b6af1feef1371d127de5fa50.

4 years ago[NFC][ScalarEvolution] Add udiv-disguised-as-sdiv test
Roman Lebedev [Mon, 29 Jun 2020 19:15:28 +0000 (22:15 +0300)]
[NFC][ScalarEvolution] Add udiv-disguised-as-sdiv test

Much like 25521150d7b577f6f1b402826f2afbb0ec5fb59b,
but with division instead of remainder.

See https://reviews.llvm.org/D82721

4 years agoRevert "[X86] Enable multibyte NOPs in 64-bit mode for padding/alignment."
Craig Topper [Wed, 1 Jul 2020 22:20:53 +0000 (15:20 -0700)]
Revert "[X86] Enable multibyte NOPs in 64-bit mode for padding/alignment."

Looks like lld tests need updates too

This reverts commit 3367e9dac56024147bbd916c40bfe6a4ee61079b.

4 years ago[RISCV][NFC] Pre-commit tests for D82660
Ben Shi [Wed, 1 Jul 2020 21:35:46 +0000 (22:35 +0100)]
[RISCV][NFC] Pre-commit tests for D82660

4 years ago[lldb/API] Add missing LLDB_RECORD_RESULT
Jonas Devlieghere [Wed, 1 Jul 2020 21:41:04 +0000 (14:41 -0700)]
[lldb/API] Add missing LLDB_RECORD_RESULT

4 years ago[InstSimplify] Move assume icmp test (NFC)
Nikita Popov [Wed, 1 Jul 2020 21:35:06 +0000 (23:35 +0200)]
[InstSimplify] Move assume icmp test (NFC)

Move this test from InstCombine into InstSimplify.

4 years ago[compiler-rt][Android] Use correct builtins library name for tests
Ryan Prichard [Wed, 1 Jul 2020 21:30:25 +0000 (14:30 -0700)]
[compiler-rt][Android] Use correct builtins library name for tests

The builtins library name is special on Android:

 * There is an "-android" suffix.

 * For the compiler-rt i386 architecture, Android targets i686 (in the
   triple and in the builtins library filename)

With this change, check-builtins works with Android.

Reviewed By: compnerd

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

4 years ago[flang] Implement cross-set EQUIVALENCE impossibility checking
peter klausler [Wed, 1 Jul 2020 18:45:38 +0000 (11:45 -0700)]
[flang] Implement cross-set EQUIVALENCE impossibility checking

Implement cross-set EQUIVALENCE impossibility checking; fixes
an infinite loop on an erroneous test.  Also fix substring
reference offset calculations in EQUIVALENCE discovered to
be incorrect during testing.

Reviewed By: tskeith

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

4 years ago[CallGraph] Add support for callback call sites
Sergey Dmitriev [Mon, 29 Jun 2020 23:11:16 +0000 (16:11 -0700)]
[CallGraph] Add support for callback call sites

Summary:
This patch changes call graph analysis to recognize callback call sites
and add an artificial 'reference' call record from the broker function
caller to the callback function in the call graph. A presence of such
reference enforces bottom-up traversal order for callback functions in
CG SCC pass manager because callback function logically becomes a callee
of the broker function caller.

Reviewers: jdoerfert, hfinkel, sstefan1, baziotis

Reviewed By: jdoerfert

Subscribers: hiraditya, kuter, sstefan1, llvm-commits

Tags: #llvm

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

4 years agoTest commit
Anatoly Trosinenko [Wed, 1 Jul 2020 20:42:50 +0000 (23:42 +0300)]
Test commit

Test the commit access to LLVM repository.

4 years ago[libTooling] Fix `maybeExtendRange` to support `CharRange`s.
Gabriel Matute [Wed, 1 Jul 2020 20:40:48 +0000 (20:40 +0000)]
[libTooling] Fix `maybeExtendRange` to support `CharRange`s.

Currently, `maybeExtendRange` takes a `CharSourceRange`, but only works
correctly for the `TokenRange` case. This change adds proper support for the
`CharRange` case.

Reviewed By: gribozavr2

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

4 years ago[ELF] Don't resolve a relocation in .debug_line referencing an ICF folded symbol...
Fangrui Song [Wed, 1 Jul 2020 20:37:20 +0000 (13:37 -0700)]
[ELF] Don't resolve a relocation in .debug_line referencing an ICF folded symbol to the tombstone value

After D81784, we resolve a relocation in .debug_* referencing an ICF folded
section symbol to a tombstone value.

Doing this for .debug_line has a problem (https://reviews.llvm.org/D81784#2116925 ):
.debug_line may describe folded lines as having addresses UINT64_MAX or
some wraparound small addresses.

```
int foo(int x) {
  return x; // line 2
}

int bar(int x) {
  return x; // line 6
}
```

```
Address            Line   Column File   ISA Discriminator Flags
------------------ ------ ------ ------ --- ------------- -------------
0x00000000002016c0      1      0      1   0             0  is_stmt
0x00000000002016c7      2      9      1   0             0  is_stmt
prologue_end
0x00000000002016ca      2      2      1   0             0
0x00000000002016cc      2      2      1   0             0  end_sequence
// UINT64_MAX and wraparound small addresses
0xffffffffffffffff      5      0      1   0             0  is_stmt
0x0000000000000006      6      9      1   0             0  is_stmt
prologue_end
0x0000000000000009      6      2      1   0             0
0x000000000000000b      6      2      1   0             0  end_sequence
0x00000000002016d0      9      0      1   0             0  is_stmt
0x00000000002016df     10      6      1   0             0  is_stmt prologue_end
0x00000000002016e6     11     11      1   0             0  is_stmt
...
```

These entries can confuse debuggers:

gdb before 2020-07-01 (binutils-gdb a8caed5d7faa639a1e6769eba551d15d8ddd9510 "Recognize -1 as a tombstone value in .debug_line")
(can't continue due to a breakpoint in an invalid region of memory):
```
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x6
```
lldb (breakpoint has no effect):
```
(lldb) b 6
Breakpoint 1: no locations (pending).
WARNING:  Unable to resolve breakpoint to any actual locations.
```

This patch special cases .debug_line to not use the tombstone value,
restoring the previous behavior: .debug_line will have entries with the
same addresses (ICF) but different line numbers. A breakpoint on line 2
or 6 will trigger on both functions.

Reviewed By: dblaikie, jhenderson

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