platform/upstream/llvm.git
4 years ago[llvm-rc] Implement the language id option
Martin Storsjö [Sat, 20 Jun 2020 20:34:53 +0000 (23:34 +0300)]
[llvm-rc] Implement the language id option

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

4 years ago[DSE,MSSA] Treat passed by value args as invisible to caller.
Florian Hahn [Tue, 23 Jun 2020 07:58:51 +0000 (08:58 +0100)]
[DSE,MSSA] Treat passed by value args as invisible to caller.

This updates the MemorySSA backed implementation to treat arguments
passed by value similar to allocas: in they are assumed to be invisible
in the caller. This is similar to how they are treated in legacy DSE.

Reviewers: efriedma, asbirlea, george.burgess.iv

Reviewed By: efriedma

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

4 years agoAST dump: recurse into type template arguments when dumping.
Richard Smith [Tue, 23 Jun 2020 07:01:38 +0000 (00:01 -0700)]
AST dump: recurse into type template arguments when dumping.

Also, do not dump the desugared type for a TemplateSpecializationType
twice.

4 years ago[Triple] support macOS 11 os version number
Alex Lorenz [Mon, 22 Jun 2020 23:32:35 +0000 (16:32 -0700)]
[Triple] support macOS 11 os version number

macOS goes to 11! This commit adds support for the new version number by ensuring
that existing version comparison routines, and the 'darwin' OS identifier
understands the new numbering scheme. It also adds a new utility method
'getCanonicalVersionForOS', which lets users translate some uses of
macOS 10.16 into macOS 11. This utility method will be used in upcoming
clang and swift commits.

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

4 years ago[libc] Match x86 long double NaN classification with that of the compiler.
Siva Chandra Reddy [Mon, 22 Jun 2020 20:47:56 +0000 (13:47 -0700)]
[libc] Match x86 long double NaN classification with that of the compiler.

Reviewers: asteinhauser

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

4 years ago[SROA] Teach SROA to perform no-op pointer conversion.
Michael Liao [Tue, 16 Jun 2020 05:17:56 +0000 (01:17 -0400)]
[SROA] Teach SROA to perform no-op pointer conversion.

Summary:
- When promoting a pointer from memory to register, SROA skips pointers
  from different address spaces. However, as `ptrtoint` and `inttoptr`
  are defined as no-op casts if that integer type has the same as the
  pointer value, generate the pair of `ptrtoint`/`inttoptr` (no-op cast)
  sequence to convert pointers from different address spaces if they
  have the same size.

Reviewers: arsenm, chandlerc, lebedev.ri

Subscribers:

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

4 years ago[InstCombine] Replace selects with Phis
Max Kazantsev [Tue, 23 Jun 2020 04:46:59 +0000 (11:46 +0700)]
[InstCombine] Replace selects with Phis

We can sometimes replace a select with a Phi node if all of its values
are available on respective incoming edges.

Differential Revision: https://reviews.llvm.org/D82005
Reviewed By: nikic

4 years ago[SDAG] Add new AssertAlign ISD node.
Michael Liao [Mon, 25 May 2020 03:20:57 +0000 (23:20 -0400)]
[SDAG] Add new AssertAlign ISD node.

Summary:
- AssertAlign node records the guaranteed alignment on its source node,
  where these alignments are retrieved from alignment attributes in LLVM
  IR. These tracked alignments could help DAG combining and lowering
  generating efficient code.
- In this patch, the basic support of AssertAlign node is added. So far,
  we only generate AssertAlign nodes on return values from intrinsic
  calls.
- Addressing selection in AMDGPU is revised accordingly to capture the
  new (base + offset) patterns.

Reviewers: arsenm, bogner

Subscribers: jvesely, wdng, nhaehnle, tpr, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years agoFix rejects-valid when referencing an implicit operator== from within a
Richard Smith [Wed, 17 Jun 2020 21:06:11 +0000 (14:06 -0700)]
Fix rejects-valid when referencing an implicit operator== from within a
templated class.

When a defaulted operator<=> results in the injection of a defaulted
operator==, that operator== can be named by unqualified name within the
same class, even if the class is templated. To make this work, perform
the transform from defaulted operator<=> to defaulted operator== in the
template definition context instead of the template instantiation
context.

This results in our substituting into a declaration from a context where
we don't have a full list of template arguments (or indeed any), for
which we are now more careful to not spuriously instantiate declarations
that are not dependent on the arguments we're substituting.

4 years agoFix a corner case in vector.shape_cast when the trailing dimensions are of size 1.
Wen-Heng (Jack) Chung [Mon, 22 Jun 2020 14:52:12 +0000 (09:52 -0500)]
Fix a corner case in vector.shape_cast when the trailing dimensions are of size 1.

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

4 years ago[mlir][mlir-rocm-runner] Remove compile-time warning. NFC.
Wen-Heng (Jack) Chung [Mon, 22 Jun 2020 22:06:28 +0000 (17:06 -0500)]
[mlir][mlir-rocm-runner] Remove compile-time warning. NFC.

Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, Kayjukh, jurahul, msifontes

Tags: #mlir

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

4 years agoDistinguish between template parameter substitutions that are forming
Richard Smith [Tue, 23 Jun 2020 02:30:36 +0000 (19:30 -0700)]
Distinguish between template parameter substitutions that are forming
specializations and those that are done as part of rewrites.

Do not create Subst* nodes in the latter. We previously had a hybrid of
these two behaviors where we would only create some Subst* nodes but not
others during deduction guide rewrites.

No functional change intended, but the resulting ASTs are more
principled.

4 years ago[PowerPC][Power10] Implement VSX PCV Generate Operations in LLVM/Clang
Amy Kwan [Mon, 22 Jun 2020 22:00:00 +0000 (17:00 -0500)]
[PowerPC][Power10] Implement VSX PCV Generate Operations in LLVM/Clang

This patch implements builtins for the following prototypes for the VSX Permute
Control Vector Generate with Mask Instructions:

vector unsigned char vec_genpcvm (vector unsigned char, const int);
vector unsigned short vec_genpcvm (vector unsigned short, const int);
vector unsigned int vec_genpcvm (vector unsigned int, const int);
vector unsigned long long vec_genpcvm (vector unsigned long long, const int);

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

4 years ago[InstCombine] reassociate diff of sums into sum of diffs
Sanjay Patel [Tue, 23 Jun 2020 00:45:00 +0000 (20:45 -0400)]
[InstCombine] reassociate diff of sums into sum of diffs

This is the integer sibling to D81491.

(a[0] + a[1] + a[2] + a[3]) - (b[0] + b[1] + b[2] +b[3]) -->
(a[0] - b[0]) + (a[1] - b[1]) + (a[2] - b[2]) + (a[3] - b[3])

Removing the "experimental" from these intrinsics is likely
not too far away.

4 years ago[InstCombine] add tests for integer reductions; NFC
Sanjay Patel [Mon, 22 Jun 2020 21:43:19 +0000 (17:43 -0400)]
[InstCombine] add tests for integer reductions; NFC

4 years ago[VectorCombine] do not use magic number for undef mask element; NFC
Sanjay Patel [Mon, 22 Jun 2020 20:17:06 +0000 (16:17 -0400)]
[VectorCombine] do not use magic number for undef mask element; NFC

4 years ago[AVR] Disassemble double register instructions
Ayke van Laethem [Thu, 18 Jun 2020 13:26:23 +0000 (15:26 +0200)]
[AVR] Disassemble double register instructions

Add disassembly support for the movw, adiw, and sbiw instructions.

I had previously committed test cases for the adiw and sbiw
instructions, but had accidentally made them not runnable so they were
skipped all this time. Oops. This patch fixes that by adding support for
disassembling those instructions.

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

4 years ago[AVR] Disassemble instructions with fixed Z operand
Ayke van Laethem [Thu, 18 Jun 2020 12:41:17 +0000 (14:41 +0200)]
[AVR] Disassemble instructions with fixed Z operand

Some instructions have a fixed Z register and don't have an explicit
register operand. This can be worked around by simply printing the
operand directly if the particular register class is detected.

The LPM and ELPM instructions also needed a custom decoder, which is
also included in this patch.

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

4 years ago[AVR] Disassemble multiplication instructions
Ayke van Laethem [Tue, 16 Jun 2020 21:42:43 +0000 (23:42 +0200)]
[AVR] Disassemble multiplication instructions

These can often only use a limited range of registers, and apparently
need special decoding support.

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

4 years ago[AVR] Decode single register instructions
Ayke van Laethem [Tue, 16 Jun 2020 20:50:29 +0000 (22:50 +0200)]
[AVR] Decode single register instructions

This is a set of instructions that take just a single register as an
operand, with no immediates. Because all instructions share the same
format, I haven't added exhaustive bit testing to all instructions but
just to the inc instruction.

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

4 years ago[AVR] Don't adjust for instruction size
Ayke van Laethem [Sun, 19 Apr 2020 18:58:36 +0000 (20:58 +0200)]
[AVR] Don't adjust for instruction size

I'm not entirely sure why this was ever needed, but when I remove both
adjustments all tests still pass.

This fixes a bug where a long branch (using the `jmp` instead of the
`rjmp` instruction) was incorrectly adjusted by 2 because it jumps to an
absolute address instead of a PC-relative address. I could have added
AVR::fixup_call to the list of exceptions, but it seemed more sensible
to me to just remove this code.

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

4 years ago[llvm-install-name-tool] Implement delete_rpath option
Alexander Shaposhnikov [Mon, 22 Jun 2020 23:49:14 +0000 (16:49 -0700)]
[llvm-install-name-tool] Implement delete_rpath option

This diff adds support for deleting an rpath from a Mach-O binary.

Patch by Sameer Arora!

Test plan: make check-all

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

4 years agoFix multilevel deduction where an outer pack is used in the type of an
Richard Smith [Mon, 22 Jun 2020 23:45:12 +0000 (16:45 -0700)]
Fix multilevel deduction where an outer pack is used in the type of an
inner non-type pack at a different index.

We previously considered the index of the outer pack (which would refer
to an unrelated template parameter) to be deduced by deducing the inner
pack, because we inspected the (largely meaningless) type of an expanded
non-type template parameter pack.

4 years agoAdd -ast-dump-decl-types flag to include types of value and type
Richard Smith [Mon, 22 Jun 2020 22:55:59 +0000 (15:55 -0700)]
Add -ast-dump-decl-types flag to include types of value and type
declarations in AST dumps.

Includes a testcase for deduction guide transformation that makes use of
this new dumping feature.

4 years ago[MLIR][NFC] Adopt hasNItems() for SizedRegion predicate
Rahul Joshi [Mon, 22 Jun 2020 22:11:40 +0000 (15:11 -0700)]
[MLIR][NFC] Adopt hasNItems() for SizedRegion predicate

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

4 years ago[WebAssembly] Add support for externalref to MC and wasm-ld
Sam Clegg [Tue, 16 Jun 2020 22:41:20 +0000 (15:41 -0700)]
[WebAssembly] Add support for externalref to MC and wasm-ld

This allows code for handling externref values to be processed by the
assembler and linker.

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

4 years agoadd copy of MLIR .clang-tidy to squelch noise in phabricator reviews
Eric Schweitz [Mon, 22 Jun 2020 22:26:28 +0000 (15:26 -0700)]
add copy of MLIR .clang-tidy to squelch noise in phabricator reviews

4 years ago[SVE] Remove calls to VectorType::getNumElements from ARM
Christopher Tetreault [Mon, 22 Jun 2020 22:04:48 +0000 (15:04 -0700)]
[SVE] Remove calls to VectorType::getNumElements from ARM

Reviewers: efriedma, greened, c-rhodes, david-arm, dmgreen

Reviewed By: dmgreen

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

Tags: #llvm

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

4 years ago- Add hasNItemsOrLess and container variants of hasNItems, hasNItemsOrMore, and hasNI...
Rahul Joshi [Mon, 22 Jun 2020 19:46:02 +0000 (12:46 -0700)]
- Add hasNItemsOrLess and container variants of hasNItems, hasNItemsOrMore, and hasNItemsOrLess
- Fixed a bug in hasNItems()
- Extend the STLExtras unit test to test hasSingleElement() and hasNItems() and friends.

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

4 years agoFix dynamic alloca detection in CloneBasicBlock
Arthur Eubanks [Mon, 22 Jun 2020 20:22:16 +0000 (13:22 -0700)]
Fix dynamic alloca detection in CloneBasicBlock

Summary:
Simply check AI->isStaticAlloca instead of reimplementing checks for
static/dynamic allocas.

Reviewers: efriedma

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Coroutines] Ensure co_await promise.final_suspend() does not throw
Xun Li [Mon, 15 Jun 2020 23:27:41 +0000 (16:27 -0700)]
[Coroutines] Ensure co_await promise.final_suspend() does not throw

Summary:
This patch addresses https://bugs.llvm.org/show_bug.cgi?id=46256
The spec of coroutine requires that the expression co_­await promise.final_­suspend() shall not be potentially-throwing.
To check this, we recursively look at every call (including Call, MemberCall, OperatorCall and Constructor) in all code
generated by the final suspend, and ensure that the callees are declared with noexcept. We also look at any returned data
type that requires explicit destruction, and check their destructors for noexcept.

This patch does not check declarations with dependent types yet, which will be done in future patches.

Updated all tests to add noexcept to the required functions, and added a dedicated test for this patch.

This patch might start to cause existing codebase fail to compile because most people may not have been strict in tagging
all the related functions noexcept.

Reviewers: lewissbaker, modocache, junparser

Reviewed By: modocache

Subscribers: arphaman, junparser, cfe-commits

Tags: #clang

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

4 years ago[mlir][ods] Allow filtering of ops
Jacques Pienaar [Mon, 22 Jun 2020 21:56:54 +0000 (14:56 -0700)]
[mlir][ods] Allow filtering of ops

Add option to filter which op the OpDefinitionsGen run on. This enables having multiple ops together in the same TD file but generating different CC files for them (useful if one wants to use multiclasses or split out 1 dialect into multiple different libraries). There is probably more general query here (e.g., split out all ops that don't have a verify method, or that are commutative) but filtering based on op name (e.g., test.a_op) seemed a reasonable start and didn't require inventing a query specification mechanism here.

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

4 years agoRecommit "[X86] Calculate the needed size of the feature arrays in _cpu_indicator_ini...
Craig Topper [Mon, 22 Jun 2020 20:29:43 +0000 (13:29 -0700)]
Recommit "[X86] Calculate the needed size of the feature arrays in _cpu_indicator_init and getHostCPUName using the size of the feature enum."

Hopefully this version will fix the previously buildbot failure

4 years agoFix the verification of DIEs with DW_AT_ranges.
Greg Clayton [Wed, 13 May 2020 23:51:44 +0000 (16:51 -0700)]
Fix the verification of DIEs with DW_AT_ranges.

Summary: Previous code would try to verify DW_AT_ranges and if any ranges would overlap, it would stop attributing any ranges after this to the DIE which caused incorrect errors to be reported that a DIE's address ranges were not contained in the parent DIE's ranges. Added a fix and a test.

Reviewers: aprantl, labath, probinson, JDevlieghere, jhenderson

Subscribers: hiraditya, MaskRay, cmtice, llvm-commits

Tags: #llvm

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

4 years agollvm-nm: Implement --special-syms.
Peter Collingbourne [Sat, 20 Jun 2020 02:06:14 +0000 (19:06 -0700)]
llvm-nm: Implement --special-syms.

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

4 years agoAdd Statically Linked Libraries
Aaron En Ye Shi [Wed, 27 May 2020 18:49:25 +0000 (18:49 +0000)]
Add Statically Linked Libraries

Add GNU Static Lib Tool, which supports the --emit-static-lib
flag. For HIP, a static library archive will be created and
consist of HIP Fat Binary host object with the device images embedded.
Using llvm-ar to create the static archive. Also, delete existing
output file to ensure a new archive is created each time.

Reviewers: yaxunl, tra, rjmccall, echristo

Subscribers: echristo, JonChesterfield, scchan, msearles

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

4 years ago[HIP] Move HIP Linking Logic into HIP ToolChain
Aaron En Ye Shi [Thu, 11 Jun 2020 18:36:10 +0000 (18:36 +0000)]
[HIP] Move HIP Linking Logic into HIP ToolChain

This patch is a follow up on https://reviews.llvm.org/D78759.

Extract the HIP Linker script from generic GNU linker,
and move it into HIP ToolChain. Update OffloadActionBuilder
Link actions feature to apply device linking and host linking
actions separately. Using MC Directives, embed the device images
and define symbols.

Reviewers: JonChesterfield, yaxunl

Subscribers: tra, echristo, jdoerfert, msearles, scchan

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

4 years agoUse std::make_tuple instead initializer list
Lei Zhang [Mon, 22 Jun 2020 19:32:21 +0000 (15:32 -0400)]
Use std::make_tuple instead initializer list

Hopefully this pleases GCC-5 and fixes the build error:

LowerExpectIntrinsic.cpp:62:53: error: converting to
'std::tuple<unsigned int, unsigned int>' from initializer list would use
explicit constructor 'constexpr std::tuple<_T1, _T2>::tuple(_U1&&,
_U2&&) [with _U1 = llvm::cl::opt<unsigned int>&; _U2 =
llvm::cl::opt<unsigned int>&; <template-parameter-2-3> = void; _T1 =
unsigned int; _T2 = unsigned int]'
     return {LikelyBranchWeight, UnlikelyBranchWeight};

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

4 years agoRevert "[X86][SSE] MatchVectorAllZeroTest - handle OR vector reductions"
Hans Wennborg [Mon, 22 Jun 2020 18:58:11 +0000 (20:58 +0200)]
Revert "[X86][SSE] MatchVectorAllZeroTest - handle OR vector reductions"

This caused a Chromium test to miscompile. See discussion on the Phabricator
review.

> This patch extends MatchVectorAllZeroTest to handle OR vector reduction patterns where the result is compared against zero.
>
> Fixes PR45378
>
> Differential Revision: https://reviews.llvm.org/D81547

This reverts 057c9c7ee00b7f7696065a3fc26a3df5ce3ebe96

4 years ago[SVE] Remove calls to VectorType::getNumElements from WebASM
Christopher Tetreault [Mon, 22 Jun 2020 17:46:53 +0000 (10:46 -0700)]
[SVE] Remove calls to VectorType::getNumElements from WebASM

Summary:
The getNumElements in base VectorType is being deprecated.

See: http://lists.llvm.org/pipermail/llvm-dev/2020-March/139811.html

Reviewers: efriedma, tlively, fpetrogalli, c-rhodes, dschuff

Reviewed By: tlively, dschuff

Subscribers: dschuff, sbc100, tschuett, jgravelle-google, hiraditya, aheejin, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years agoRevert "[X86] Calculate the needed size of the feature arrays in _cpu_indicator_init...
Craig Topper [Mon, 22 Jun 2020 19:20:40 +0000 (12:20 -0700)]
Revert "[X86] Calculate the needed size of the feature arrays in _cpu_indicator_init and getHostCPUName using the size of the feature enum."

Seems to breaking build.

This reverts commit 5ac144fe64c6911b5b6011cac1d61e0f82562e7f.

4 years ago[X86] Remove encoding value from the X86_FEATURE and X86_FEATURE_COMPAT macro. NFCI
Craig Topper [Mon, 22 Jun 2020 03:20:04 +0000 (20:20 -0700)]
[X86] Remove encoding value from the X86_FEATURE and X86_FEATURE_COMPAT macro. NFCI

This was orignally done so we could separate the compatibility
values and the llvm internal only features into a separate entries
in the feature array. This was needed when we explicitly had to
convert the feature into the proper 32-bit chunk at every reference
and we didn't want things moving around.

Now everything is in an array and we have helper funtions or macros
to convert encoding to index. So we renumbering is no longer an
issue.

4 years ago[X86] Calculate the needed size of the feature arrays in _cpu_indicator_init and...
Craig Topper [Mon, 22 Jun 2020 00:30:10 +0000 (17:30 -0700)]
[X86] Calculate the needed size of the feature arrays in _cpu_indicator_init and getHostCPUName using the size of the feature enum.

Move 0 initialization up to the caller so we don't need to know
the size.

4 years ago[flang] Fix bug checking SAVE attribute
Tim Keith [Mon, 22 Jun 2020 18:32:54 +0000 (11:32 -0700)]
[flang] Fix bug checking SAVE attribute

Treat function result like dummy argument: a SAVE statement without an
entity-list does not make it saved.

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

4 years ago[mlir] Fix a doc link in LinalgBase.td
Hanhan Wang [Mon, 22 Jun 2020 18:15:44 +0000 (11:15 -0700)]
[mlir] Fix a doc link in LinalgBase.td

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

4 years ago[llvm] Fix typo in test case comment (NFC)
Tobias Gysi [Mon, 22 Jun 2020 17:53:01 +0000 (19:53 +0200)]
[llvm] Fix typo in test case comment (NFC)

4 years ago[ARM][BFloat] Implement bf16 get/set_lane without casts to i16 vectors
Mikhail Maltsev [Mon, 22 Jun 2020 17:15:11 +0000 (17:15 +0000)]
[ARM][BFloat] Implement bf16 get/set_lane without casts to i16 vectors

Currently, in order to extract an element from a bf16 vector, we cast
the vector to an i16 vector, perform the extraction, and cast the result to
bfloat. This behavior was copied from the old fp16 implementation.

The goal of this patch is to achieve optimal code generation for lane
copying intrinsics in a subsequent patch (LLVM fails to fold certain
combinations of bitcast, insertelement, extractelement and
shufflevector instructions leading to the generation of suboptimal code).

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

4 years ago[clang-tidy] RenamerClangTidy wont emit fixes in scratch space
Nathan James [Mon, 22 Jun 2020 17:26:17 +0000 (18:26 +0100)]
[clang-tidy] RenamerClangTidy wont emit fixes in scratch space

Prevent fixes being displayed if usages are found in the scratch buffer.
See [[ https://bugs.llvm.org/show_bug.cgi?id=46219 | Fix-It hints are being generated in the ScratchBuffer ]].
It may be wise down the line to put in a general fix in clang-tidy to prevent ScratchBuffer replacements being applied, but for now this will help.

Reviewed By: aaron.ballman

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

4 years ago[clang-tidy] llvm-twine-local ignores parameters
Nathan James [Mon, 22 Jun 2020 17:25:44 +0000 (18:25 +0100)]
[clang-tidy] llvm-twine-local ignores parameters

Ignore paramater declarations of type `::llvm::Twine`, These don't suffer the same use after free risks as local twines.

Reviewed By: aaron.ballman

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

4 years agoAdd support of __builtin_expect_with_probability
Zhi Zhuang [Mon, 22 Jun 2020 17:20:42 +0000 (10:20 -0700)]
Add support of __builtin_expect_with_probability

Add a new builtin-function __builtin_expect_with_probability and
intrinsic llvm.expect.with.probability.
The interface is __builtin_expect_with_probability(long expr, long
expected, double probability).
It is mainly the same as __builtin_expect besides one more argument
indicating the probability of expression equal to expected value. The
probability should be a constant floating-point expression and be in
range [0.0, 1.0] inclusive.
It is similar to builtin-expect-with-probability function in GCC
built-in functions.

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

4 years ago[PGO][PGSO] Enable non-cold size opts under partial profile sample PGO.
Hiroshi Yamauchi [Wed, 17 Jun 2020 20:11:45 +0000 (13:11 -0700)]
[PGO][PGSO] Enable non-cold size opts under partial profile sample PGO.

Summary: Similar to D81020. Follow up D78949.

Reviewers: davidxl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[sve][acle] Add SVE BFloat16 extensions.
Francesco Petrogalli [Tue, 16 Jun 2020 22:56:00 +0000 (22:56 +0000)]
[sve][acle] Add SVE BFloat16 extensions.

Summary:
List of intrinsics:

svfloat32_t svbfdot[_f32](svfloat32_t op1, svbfloat16_t op2, svbfloat16_t op3)
svfloat32_t svbfdot[_n_f32](svfloat32_t op1, svbfloat16_t op2, bfloat16_t op3)
svfloat32_t svbfdot_lane[_f32](svfloat32_t op1, svbfloat16_t op2, svbfloat16_t op3, uint64_t imm_index)

svfloat32_t svbfmmla[_f32](svfloat32_t op1, svbfloat16_t op2, svbfloat16_t op3)

svfloat32_t svbfmlalb[_f32](svfloat32_t op1, svbfloat16_t op2, svbfloat16_t op3)
svfloat32_t svbfmlalb[_n_f32](svfloat32_t op1, svbfloat16_t op2, bfloat16_t op3)
svfloat32_t svbfmlalb_lane[_f32](svfloat32_t op1, svbfloat16_t op2, svbfloat16_t op3, uint64_t imm_index)

svfloat32_t svbfmlalt[_f32](svfloat32_t op1, svbfloat16_t op2, svbfloat16_t op3)
svfloat32_t svbfmlalt[_n_f32](svfloat32_t op1, svbfloat16_t op2, bfloat16_t op3)
svfloat32_t svbfmlalt_lane[_f32](svfloat32_t op1, svbfloat16_t op2, svbfloat16_t op3, uint64_t imm_index)

svbfloat16_t svcvt_bf16[_f32]_m(svbfloat16_t inactive, svbool_t pg, svfloat32_t op)
svbfloat16_t svcvt_bf16[_f32]_x(svbool_t pg, svfloat32_t op)
svbfloat16_t svcvt_bf16[_f32]_z(svbool_t pg, svfloat32_t op)

svbfloat16_t svcvtnt_bf16[_f32]_m(svbfloat16_t even, svbool_t pg, svfloat32_t op)
svbfloat16_t svcvtnt_bf16[_f32]_x(svbfloat16_t even, svbool_t pg, svfloat32_t op)

For reference, see section 7.2 of "Arm C Language Extensions for SVE - Version 00bet4"

Reviewers: sdesmalen, ctetreau, efriedma, david-arm, rengolin

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

Tags: #clang, #llvm

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

4 years ago[flang] Shape analysis for result of MATMUL
peter klausler [Sat, 20 Jun 2020 01:11:46 +0000 (18:11 -0700)]
[flang] Shape analysis for result of MATMUL

Implement shape analysis for the result of the MATMUL
generic transformational intrinsic function, based on
the shapes of its arguments.  Correct the names of the
arguments to match the standard, too.

Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D82250

4 years ago[lldb/Lua] Recognize "quit" as a way to exit the script interpreter.
Jonas Devlieghere [Sun, 21 Jun 2020 07:31:46 +0000 (00:31 -0700)]
[lldb/Lua] Recognize "quit" as a way to exit the script interpreter.

Add a way to quit the interactive script interpreter from a shell tests.
Currently, the only way (that I know) to exit the interactive Lua
interpreter is to send a EOF with CTRL-D. I noticed that the embedded
Python script interpreter accepts quit (while the regular python
interpreter doesn't). I've added a special case to the Lua interpreter
to do the same.

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

4 years ago[VectorCombine] make helper function for shift-shuffle; NFC
Sanjay Patel [Mon, 22 Jun 2020 16:22:45 +0000 (12:22 -0400)]
[VectorCombine] make helper function for shift-shuffle; NFC

This will probably be useful for other extract patterns.

4 years ago[DSE,MSSA] Reorder DSE blocking checks.
Florian Hahn [Mon, 22 Jun 2020 15:24:27 +0000 (16:24 +0100)]
[DSE,MSSA] Reorder DSE blocking checks.

Currently we stop exploring candidates too early in some cases.

In particular, we can continue checking the defining accesses of
non-removable MemoryDefs and defs without analyzable write location
(read clobbers are already ruled out using MemorySSA at this point).

4 years ago[MCParser] Support quoted section name for COFF
Fangrui Song [Mon, 22 Jun 2020 16:11:44 +0000 (09:11 -0700)]
[MCParser] Support quoted section name for COFF

This features matches ELFAsmParser and makes it possible to use `.section ".llvm.call-graph-profile","n"`

Reviewed By: zequanwu

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

4 years ago[NPM] Bail out when -foo and --passes=foo are both specified
Arthur Eubanks [Sun, 21 Jun 2020 06:51:26 +0000 (23:51 -0700)]
[NPM] Bail out when -foo and --passes=foo are both specified

Summary:
Currently when --passes is used, any passes specified via -foo are
ignored. Explicitly bail out when that happens.

This requires changing some tests. Most were straightforward, but
codegenprepare-produced-address-math.ll is tricky. One of its RUNs runs
CodeGenPrepare. I tried porting CodeGenPrepare to the NPM, but ended up
getting stuck when I needed a TargetMachine. NPM doesn't have support
for MachineFunctions yet. So I just deleted that RUN line, since it was
mass-added in https://reviews.llvm.org/D54848 and is likely not that
useful.

Reviewers: echristo, hans

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[DSE,MSSA] Add additional tests with non-removable stores (NFC).
Florian Hahn [Mon, 22 Jun 2020 15:09:03 +0000 (16:09 +0100)]
[DSE,MSSA] Add additional tests with non-removable stores (NFC).

Add a few additional tests with volatile stores, which cannot be
removedt stas.

4 years ago[flang] Finish adding AbstractConverter.h
Eric Schweitz [Sat, 20 Jun 2020 21:17:17 +0000 (14:17 -0700)]
[flang] Finish adding AbstractConverter.h

This adds the abstract converter interface. The abstract converter is an
interface that supports the conversion of front-end data structures to
MLIR. This interface will be instantiated by the bridge in a future
commit.

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

4 years ago[MLIR] Remove TableGen redundant calls to native calls when creating new operations...
AlexEichenberger [Mon, 22 Jun 2020 15:10:23 +0000 (08:10 -0700)]
[MLIR] Remove TableGen redundant calls to native calls when creating new operations in DRR TableGen files

Summary:
Currently, the TableGen rewrite generates redundant native calls in MLIR DRR files. This is a problem as some native calls may involve significant computations (e.g. when performing constant propagation where every values in a large tensor is touched).

The pattern was as follow:

```c++
if (native-call(args)) tblgen_attrs.emplace_back(rewriter, attribute, native-call(args))
```

The replacement pattern compute `native-call(args)` once and then use it both in the `if` condition and the `emplace_back` call.

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

4 years agoPre-commited test update. NFC.
Stanislav Mekhanoshin [Mon, 22 Jun 2020 15:06:34 +0000 (08:06 -0700)]
Pre-commited test update. NFC.

4 years ago[AMDGPU] Generate test checks
Jay Foad [Mon, 22 Jun 2020 15:07:18 +0000 (16:07 +0100)]
[AMDGPU] Generate test checks

4 years ago[DebugInfo] Update MachineInstr to help support variadic DBG_VALUE instructions
stozer [Mon, 22 Jun 2020 15:01:12 +0000 (16:01 +0100)]
[DebugInfo] Update MachineInstr to help support variadic DBG_VALUE instructions

Following on from this RFC[0] from a while back, this is the first patch towards
implementing variadic debug values.

This patch specifically adds a set of functions to MachineInstr for performing
operations specific to debug values, and replacing uses of the more general
functions where appropriate. The most prevalent of these is replacing
getOperand(0) with getDebugOperand(0) for debug-value-specific code, as the
operands corresponding to values will no longer be at index 0, but index 2 and
upwards: getDebugOperand(x) == getOperand(x+2). Similar replacements have been
added for the other operands, along with some helper functions to replace
oft-repeated code and operate on a variable number of value operands.

[0] http://lists.llvm.org/pipermail/llvm-dev/2020-February/139376.html<Paste>

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

4 years ago[ARC] Add missing return statement
Guillaume Chatelet [Mon, 22 Jun 2020 14:56:27 +0000 (14:56 +0000)]
[ARC] Add missing return statement

4 years agoPre-commit SLP test. NFC.
Stanislav Mekhanoshin [Mon, 22 Jun 2020 14:26:39 +0000 (07:26 -0700)]
Pre-commit SLP test. NFC.

4 years ago[analyzer] Remove forbidden characters from a filename for a graph dump on Windows
Denys Petrov [Mon, 22 Jun 2020 12:35:57 +0000 (15:35 +0300)]
[analyzer] Remove forbidden characters from a filename for a graph dump on Windows

Summary:
Windows forbidden file path characters are used in a field `file`, while creating a dump `dot` file using an argument -analyzer-dump-egraph. It specifically relates to angle brackets when using `<scratch space>`, `<built-in>`, `<command line>` values in filenames. It causes that script exploded-graph-rewriter.py incorrectly parses the dump.

Fix:
Remove forbidden characters from filename for Windows platform, when creating graph dump file.

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

4 years ago[mlir][spirv] Enhance AccessChainOp index type handling
HazemAbdelhafez [Mon, 22 Jun 2020 14:04:53 +0000 (10:04 -0400)]
[mlir][spirv] Enhance AccessChainOp index type handling

This patch extends the AccessChainOp index type handling to be able to deal with
all Integer type indices (i.e., all bit-widths and signedness symantics).

There were two ways of achieving this:
1- Backward compatible: The new way of handling the indices will assume that
   an index type is i32 by default if not specified in the assembly format,
   this way all the old tests would pass correctly.
2- Enforce the format: This unifies the spv.AccessChain Op format and all the old
   tests had to be updated to reflect this change or else they fail.

I picked option-2 to unify the Op format and avoid having optional index-type fields
that can lead to somewhat confusing tests format and multiple representations for
the same Op with undocumented assumption that an index is i32 unless stated.
Nonetheless, reverting to option-1 should be straightforward if preferred or needed.

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

4 years agoImplement constexpr BinaryOperator for vector types
Erich Keane [Fri, 8 May 2020 20:14:50 +0000 (13:14 -0700)]
Implement constexpr BinaryOperator for vector types

These operations do member-wise versions of the all of the listed
operations.  This patch implements all of the binaryoperators for these
types. Note that the test is required to use codegen as I could not come
up with a good way to validate the values without the array-subscript
operator implemented (which is likely a much more involved change).

Differential Reivision: https://reviews.llvm.org/D79755

4 years ago[VectorCombine] add helper to replace uses and rename
Sanjay Patel [Mon, 22 Jun 2020 13:26:46 +0000 (09:26 -0400)]
[VectorCombine] add helper to replace uses and rename

The tests are regenerated to show a path that missed renaming,
but there should be no functional difference from this patch.

4 years agoRevert commit 9e52530 because of dependencies issue
Valentin Clement [Mon, 22 Jun 2020 13:56:14 +0000 (09:56 -0400)]
Revert commit 9e52530 because of dependencies issue

This reverts commit 9e525309fb3cbea4ab341b54d127d97831962285.

4 years ago[openmp] Base of tablegen generated OpenMP common declaration
Valentin Clement [Mon, 22 Jun 2020 13:32:47 +0000 (09:32 -0400)]
[openmp] Base of tablegen generated OpenMP common declaration

Summary:
As discussed previously when landing patch for OpenMP in Flang, the idea is
to share common part of the OpenMP declaration between the different Frontend.
While doing this it was thought that moving to tablegen instead of Macros will also
give a cleaner and more powerful way of generating these declaration.
This first part of a future series of patches is setting up the base .td file for
DirectiveLanguage as well as the OpenMP version of it. The base file is meant to
be used by other directive language such as OpenACC.
In this first patch, the Directive and Clause enums are generated with tablegen
instead of the macros on OMPConstants.h. The next pacth will extend this
to other enum and move the Flang frontend to use it.

Reviewers: jdoerfert, DavidTruby, fghanim, ABataev, jdenny, hfinkel, jhuber6, kiranchandramohan, kiranktp

Reviewed By: jdoerfert, jdenny

Subscribers: cfe-commits, mgorny, yaxunl, hiraditya, guansong, jfb, sstefan1, aaron.ballman, llvm-commits

Tags: #llvm, #openmp, #clang

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

4 years ago[DWARFYAML][debug_info] Add support for error handling.
Xing GUO [Mon, 22 Jun 2020 13:35:51 +0000 (21:35 +0800)]
[DWARFYAML][debug_info] Add support for error handling.

This patch helps add support for error handling in `DWARFYAML::emitDebugInfo()`.

Reviewed By: jhenderson

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

4 years ago[DWARFYAML][debug_info] Use 'AbbrCode' to index the abbreviation.
Xing GUO [Mon, 22 Jun 2020 13:33:00 +0000 (21:33 +0800)]
[DWARFYAML][debug_info] Use 'AbbrCode' to index the abbreviation.

Before this patch, we use `(uint32_t)AbbrCode - (uint32_t)FirstAbbrCode` to index the abbreviation. It's impossible for we to use the preceeding abbreviation of the previous one (e.g., if the previous DIE's `AbbrCode` is 2, we are unable to use the abbreviation with index 1). In this patch, we use `AbbrCode` to index the abbreviation directly.

Reviewed By: jhenderson

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

4 years ago[DAG] Add SimplifyMultipleUseDemandedVectorElts helper for SimplifyMultipleUseDemande...
Simon Pilgrim [Mon, 22 Jun 2020 13:17:02 +0000 (14:17 +0100)]
[DAG] Add SimplifyMultipleUseDemandedVectorElts helper for SimplifyMultipleUseDemandedBits. NFCI.

We have many cases where we call SimplifyMultipleUseDemandedBits and demand specific vector elements, but all the bits from them - this adds a helper wrapper to handle this.

4 years agoRevert "[clang][Driver] Correct tool search path priority"
David Spickett [Mon, 22 Jun 2020 13:18:54 +0000 (14:18 +0100)]
Revert "[clang][Driver] Correct tool search path priority"

Revert 028571d60843cb87e2637ef69ee09090d4526c62 to investigate
MacOS failure.
(also the review link was incorrect, should be
https://reviews.llvm.org/D79842)

4 years ago[lldb][NFC] Add more test for builtin formats
Raphael Isemann [Sat, 20 Jun 2020 17:30:20 +0000 (19:30 +0200)]
[lldb][NFC] Add more test for builtin formats

Reland 90c1af106a20785ffd01c0d6a41db8bc0160fd11 . This changes the char format
tests which were printing the pointer value of the C-string instead of its
contents, so this test failed on other machines. Now they just print the
bytes in a uint128_t.

Original commit description:

The previous tests apparently missed a few code branches in DumpDataExtractor
code. Also renames the 'test_instruction' which had the same name as another
test (and Python therefore ignored the test entirely).

4 years ago[VectorCombine] add/use pass-level IRBuilder
Sanjay Patel [Mon, 22 Jun 2020 12:57:37 +0000 (08:57 -0400)]
[VectorCombine] add/use pass-level IRBuilder

This saves creating/destroying a builder every time we
perform some transform.

The tests show instruction ordering diffs resulting from
always inserting at the root instruction now, but those
should be benign.

4 years ago[AMDGPU] Update more live intervals in SIWholeQuadMode
Jay Foad [Fri, 19 Jun 2020 13:27:15 +0000 (14:27 +0100)]
[AMDGPU] Update more live intervals in SIWholeQuadMode

This fixes various assertion failures that would otherwise be triggered
by a later patch to move SIWholeQuadMode later in the pass pipeline.

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

4 years ago[llvm-readelf] - Do not crash when dumping the dynamic symbol table when its sh_entzi...
Georgii Rymar [Fri, 19 Jun 2020 13:21:57 +0000 (16:21 +0300)]
[llvm-readelf] - Do not crash when dumping the dynamic symbol table when its sh_entzize == 0.

We have a division by zero crash currently when
the sh_entzize of the dynamic symbol table is 0.

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

4 years agoLet HIP default include respect -nogpuinc and -nogpulib
Yaxun (Sam) Liu [Mon, 22 Jun 2020 12:00:57 +0000 (08:00 -0400)]
Let HIP default include respect -nogpuinc and -nogpulib

4 years ago[VectorCombine] improve IR debugging by providing/salvaging value names
Sanjay Patel [Mon, 22 Jun 2020 12:32:55 +0000 (08:32 -0400)]
[VectorCombine] improve IR debugging by providing/salvaging value names

The tests are regenerated to show the diffs, but there should be no
functional change from this patch.

4 years ago[AMDGPU] clang-format of SIModeRegister.cpp
Tim Corringham [Mon, 22 Jun 2020 11:28:24 +0000 (12:28 +0100)]
[AMDGPU] clang-format of SIModeRegister.cpp

Ran clang-format just to ease future reviews. No functional changes.

4 years ago[llvm-readobj] - Validate the DT_STRSZ value to avoid crash.
Georgii Rymar [Fri, 19 Jun 2020 15:37:15 +0000 (18:37 +0300)]
[llvm-readobj] - Validate the DT_STRSZ value to avoid crash.

It is possible to trigger a crash when a dynamic symbol has a
broken (too large) st_name and the DT_STRSZ is also broken.

We have the following code in the `Elf_Sym_Impl<ELFT>::getName`:

```
template <class ELFT>
Expected<StringRef> Elf_Sym_Impl<ELFT>::getName(StringRef StrTab) const {
  uint32_t Offset = this->st_name;
  if (Offset >= StrTab.size())
    return createStringError(object_error::parse_failed,
                             "st_name (0x%" PRIx32
                             ") is past the end of the string table"
                             " of size 0x%zx",
                             Offset, StrTab.size());
...
```

The problem is that `StrTab` here is a `ELFDumper::DynamicStringTab` member
which is not validated properly on initialization. So it is possible to bypass the
`if` even when the `st_name` is huge.

This patch fixes the issue.

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

4 years agoAttempt to unbreak the test introduced in 359fae6eb094 on Windows
Anton Korobeynikov [Mon, 22 Jun 2020 11:29:32 +0000 (14:29 +0300)]
Attempt to unbreak the test introduced in 359fae6eb094 on Windows

4 years ago[DAG] SimplifyMultipleUseDemandedBits - drop unnecessary *_EXTEND_VECTOR_INREG cases
Simon Pilgrim [Mon, 22 Jun 2020 11:11:11 +0000 (12:11 +0100)]
[DAG] SimplifyMultipleUseDemandedBits - drop unnecessary *_EXTEND_VECTOR_INREG cases

For little endian targets, if we only need the lowest element and none of the extended bits then we can just use the (bitcasted) source vector directly.

We already do this in SimplifyDemandedBits, this adds the SimplifyMultipleUseDemandedBits equivalent.

4 years agoOptimizationRemarkEmitter.h - reduce unnecessary Function.h include to forward declar...
Simon Pilgrim [Sat, 20 Jun 2020 14:59:46 +0000 (15:59 +0100)]
OptimizationRemarkEmitter.h - reduce unnecessary Function.h include to forward declaration. NFC.

4 years ago[mlir] Fix linalg.generic matmul example in the doc
Jakub Lichman [Mon, 22 Jun 2020 11:23:39 +0000 (13:23 +0200)]
[mlir] Fix linalg.generic matmul example in the doc

Example of Matmul implementation in linalg.generic operation contained few mistakes that can puzzle new startes when trying to run the example.

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

4 years ago[analyzer] Handle `\l` symbol in string literals in exploded-graph-rewriter
Denys Petrov [Mon, 22 Jun 2020 11:17:43 +0000 (14:17 +0300)]
[analyzer] Handle `\l` symbol in string literals in exploded-graph-rewriter

Fix for test due to build-bot complains.

4 years agoRevert "[CGP] Enable CodeGenPrepares phi type convertion."
Tres Popp [Mon, 22 Jun 2020 11:06:18 +0000 (13:06 +0200)]
Revert "[CGP] Enable CodeGenPrepares phi type convertion."

This reverts commit 67121d7b82ed78a47ea32f0c87b7317e2b469ab2.

This is causing compile times to be 2x slower on some large binaries.

4 years ago[ASTMatcher] Correct memoization bug ignoring direction (descendants or ancestors)
Loïc Joly [Mon, 22 Jun 2020 10:41:39 +0000 (12:41 +0200)]
[ASTMatcher] Correct memoization bug ignoring direction (descendants or ancestors)

Summary:
In ASTMatcher, when we have `has(...)` and `hasParent(...)` called with the same internal matcher on the same node, the memoization process will mix-up the two calls because the direction of the traversal is not part of the memoization key.

This patch adds this information.

Reviewers: klimek

Reviewed By: klimek

Subscribers: Godin, njames93, cfe-commits

Tags: #clang

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

4 years agoRevert "[Peeling] Extend the scope of peeling a bit"
Serguei Katkov [Mon, 22 Jun 2020 10:33:00 +0000 (17:33 +0700)]
Revert "[Peeling] Extend the scope of peeling a bit"

This reverts commit 29b2c1ca72096ca06415b5e626e6728c42ef1e74.

The patch causes the DT verifier failure like:
DominatorTree is different than a freshly computed one!

Not sure the patch itself it wrong but revert to investigate the failure.

4 years ago[StackSafety] Check variable lifetime
Vitaly Buka [Mon, 22 Jun 2020 08:28:25 +0000 (01:28 -0700)]
[StackSafety] Check variable lifetime

We can't consider variable safe if out-of-lifetime access is possible.
So if StackLifetime can't prove that the instruction always uses
the variable when it's still alive, we consider it unsafe.

4 years ago[StackSafety] Ignore unreachable instructions
Vitaly Buka [Mon, 22 Jun 2020 07:45:08 +0000 (00:45 -0700)]
[StackSafety] Ignore unreachable instructions

Usually DominatorTree provides this info, but here we use
StackLifetime. The reason is that in the next patch StackLifetime
will be used for actual lifetime checks and we can avoid
forwarding the DominatorTree into this code.

4 years ago[analyzer] Handle `\l` symbol in string literals in exploded-graph-rewriter
Denys Petrov [Mon, 22 Jun 2020 10:11:54 +0000 (13:11 +0300)]
[analyzer] Handle `\l` symbol in string literals in exploded-graph-rewriter

Summary:
Handle `\l` separately because a string literal can be in code like "string\\literal" with the `\l` inside. Also on Windows macros __FILE__ produces specific delimiters `\` and a directory or file may starts with the letter `l`.

Fix:
Use regex for replacing all `\l` (like `,\l`, `}\l`, `[\l`) except `\\l`, because a literal as a rule contains multiple `\` before `\l`.

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

4 years agoRevert "[MSP430] Update register names"
Anton Korobeynikov [Mon, 22 Jun 2020 10:36:52 +0000 (13:36 +0300)]
Revert "[MSP430] Update register names"

This reverts commit 8f6620f663031da2bb35b788239f4b607271af84.

4 years agoMake ninja smart console builds more pretty
David Zarzycki [Mon, 22 Jun 2020 10:34:49 +0000 (06:34 -0400)]
Make ninja smart console builds more pretty

Summary: CMake's `find_package` outputs to the console on success, which confuses the smart console mode of the `ninja` build system. Let's quiet the success message and manually warn instead.

Reviewers: tstellar, phosek, mehdi_amini

Reviewed By: mehdi_amini

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

4 years ago[MSP430] Update register names
Anatoly Trosinenko [Mon, 22 Jun 2020 10:22:59 +0000 (13:22 +0300)]
[MSP430] Update register names

When writing a unit test on replacing standard epilogue sequences with `BR __mspabi_func_epilog_<N>`, by manually asm-clobbering `rN` - `r10` for N = 4..10, everything worked well except for seeming inability to clobber r4.

The problem was that MSP430 code generator of LLVM used an obsolete name FP for that register. Things were worse because when `llc` read an unknown register name, it silently ignored it.

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

4 years ago[LTO] Use StringRef instead of C-style strings in setCodeGenDebugOptions
Momchil Velikov [Mon, 22 Jun 2020 10:14:53 +0000 (11:14 +0100)]
[LTO] Use StringRef instead of C-style strings in setCodeGenDebugOptions

Fixes an issue with missing nul-terminators and saves us some string
copying, compared to a version which would insert nul-terminators.

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

4 years ago[MSP430] Enable some basic support for debug information
Anatoly Trosinenko [Mon, 22 Jun 2020 10:14:02 +0000 (13:14 +0300)]
[MSP430] Enable some basic support for debug information

This commit technically permits LLVM to emit the debug information for ELF files for MSP430 architecture. Aside from this, it only defines the register numbers as defined by part 10.1 of MSP430 EABI specification (assuming the 1-byte subregisters share the register numbers with corresponding full-size registers).

This commit was basically tested by me with TI-provided GCC 8.3.1 toolchain by compiling an example program with `clang` (please note manual linking may be required due to upstream `clang` not yet handling the `-msim` option necessary to run binaries on the GDB-provided simulator) and then running it and single-stepping with `msp430-elf-gdb` like this:

```
$sysroot/bin/msp430-elf-gdb ./test -ex "target sim" -ex "load ./test"
(gdb) ... traditional GDB commands follow ...
```

While this implementation is most probably far from completeness and is considered experimental, it can already help with debugging MSP430 programs as well as finding issues in LLVM debug info support for MSP430 itself.

One of the use cases includes trying to find a point where UBSan check in a trap-on-error mode was triggered.

The expected debug information format is described in the [MSP430 Embedded Application Binary Interface](http://www.ti.com/lit/an/slaa534/slaa534.pdf) specification, part 10.

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