Commit Graph

4788 Commits

Author SHA1 Message Date
Kit Barton
6b7198af28 Revert [LOOPINFO] Extend Loop object to add utilities to get the loop bounds, step, induction variable, and guard branch.
This reverts r361517 (git commit 2049e4dd8f61100f88f14db33bd95d197bcbfbbc)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361553 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-23 20:53:05 +00:00
Kit Barton
b13ba2bf8c [LOOPINFO] Extend Loop object to add utilities to get the loop bounds, step, induction variable, and guard branch.
Summary:
    This PR extends the loop object with more utilities to get loop bounds, step, induction variable, and guard branch. There already exists passes which try to obtain the loop induction variable in their own pass, e.g. loop interchange. It would be useful to have a common area to get these information. Moreover, loop fusion (https://reviews.llvm.org/D55851) is planning to use getGuard() to extend the kind of loops it is able to fuse, e.g. rotated loop with non-constant upper bound, which would have a loop guard.

      /// Example:
      /// for (int i = lb; i < ub; i+=step)
      ///   <loop body>
      /// --- pseudo LLVMIR ---
      /// beforeloop:
      ///   guardcmp = (lb < ub)
      ///   if (guardcmp) goto preheader; else goto afterloop
      /// preheader:
      /// loop:
      ///   i1 = phi[{lb, preheader}, {i2, latch}]
      ///   <loop body>
      ///   i2 = i1 + step
      /// latch:
      ///   cmp = (i2 < ub)
      ///   if (cmp) goto loop
      /// exit:
      /// afterloop:
      ///
      /// getBounds
      ///   getInitialIVValue      --> lb
      ///   getStepInst            --> i2 = i1 + step
      ///   getStepValue           --> step
      ///   getFinalIVValue        --> ub
      ///   getCanonicalPredicate  --> '<'
      ///   getDirection           --> Increasing
      /// getGuard             --> if (guardcmp) goto loop; else goto afterloop
      /// getInductionVariable          --> i1
      /// getAuxiliaryInductionVariable --> {i1}
      /// isCanonical                   --> false

    Committed on behalf of @Whitney (Whitney Tsang).

    Reviewers: kbarton, hfinkel, dmgreen, Meinersbur, jdoerfert, syzaara, fhahn

    Reviewed By: kbarton

    Subscribers: tvvikram, bmahjour, etiotto, fhahn, jsji, hiraditya, llvm-commits

    Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361517 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-23 17:56:35 +00:00
Thomas Preud'homme
1e8636f15a [FileCheck] Introduce substitution subclasses
Summary:
With now a clear distinction between string and numeric substitutions,
this patch introduces separate classes to represent them with a parent
class implementing the common interface. Diagnostics in
printSubstitutions() are also adapted to not require knowing which
substitution is being looked at since it does not hinder clarity and
makes the implementation simpler.

Reviewers: jhenderson, jdenny, probinson, arichardson

Subscribers: llvm-commits, probinson, arichardson, hiraditya

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361446 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-23 00:10:29 +00:00
Thomas Preud'homme
7b079c65a1 FileCheck: Improve FileCheck variable terminology
Summary:
Terminology introduced by [[#]] blocks is confusing and does not
integrate well with existing terminology.

First, variables referred by [[]] blocks are called "pattern variables"
while the text a CHECK directive needs to match is called a "CHECK
pattern". This is inconsistent with variables in [[#]] blocks since
[[#]] blocks are also found in CHECK pattern yet those variables are
called "numeric variable".

Second, the replacing of both [[]] and [[#]] blocks by the value of the
variable or expression they contain is represented by a
FileCheckPatternSubstitution class. The naming refers to being a
substitution in a CHECK pattern but could be wrongly understood as being
a substitution of a pattern variable.

Third and lastly, comments use "numeric expression" to refer both to the
[[#]] blocks as well as to the numeric expressions these blocks contain
which get evaluated at match time.

This patch solves these confusions by
- calling variables in [[]] and [[#]] blocks as string and numeric
  variables respectively;
- referring to [[]] and [[#]] as substitution *blocks*, with the former
  being a string substitution block and the latter a numeric
  substitution block;
- calling [[]] and [[#]] blocks to be replaced by the value of a
  variable or expression they contain a substitution (as opposed to
  definition when these blocks are used to defined a variable), with the
  former being a string substitution and the latter a numeric
  substitution;
- renaming the FileCheckPatternSubstitution as a FileCheckSubstitution
  class with FileCheckStringSubstitution and
  FileCheckNumericSubstitution subclasses;
- restricting the use of "numeric expression" to refer to the expression
  that is evaluated in a numeric substitution.

While numeric substitution blocks only support numeric substitutions of
numeric expressions at the moment there are plans to augment numeric
substitution blocks to support numeric definitions as well as both a
numeric definition and numeric substitution in the same numeric
substitution block.

Reviewers: jhenderson, jdenny, probinson, arichardson

Subscribers: hiraditya, arichardson, probinson, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361445 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-23 00:10:14 +00:00
Lang Hames
766312c7e0 [Support] Renamed member 'Size' to 'AllocatedSize' in MemoryBlock and OwningMemoryBlock.
Rename member 'Size' to 'AllocatedSize' in order to provide a hint that the
allocated size may be different than the requested size. Comments are added to
clarify this point.  Updated the InMemoryBuffer in FileOutputBuffer.cpp to track
the requested buffer size.

Patch by Machiel van Hooren. Thanks Machiel!

https://reviews.llvm.org/D61599

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361195 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-20 20:53:05 +00:00
Nick Desaulniers
8e4472e3d0 [INLINER] allow inlining of blockaddresses if sole uses are callbrs
Summary:
It was supposed that Ref LazyCallGraph::Edge's were being inserted by
inlining, but that doesn't seem to be the case.  Instead, it seems that
there was no test for a blockaddress Constant in an instruction that
referenced the function that contained the instruction. Ex:

```
define void @f() {
  %1 = alloca i8*, align 8
2:
  store i8* blockaddress(@f, %2), i8** %1, align 8
  ret void
}
```

When iterating blockaddresses, do not add the function they refer to
back to the worklist if the blockaddress is referring to the contained
function (as opposed to an external function).

Because blockaddress has sligtly different semantics than GNU C's
address of labels, there are 3 cases that can occur with blockaddress,
where only 1 can happen in GNU C due to C's scoping rules:
* blockaddress is within the function it refers to (possible in GNU C).
* blockaddress is within a different function than the one it refers to
(not possible in GNU C).
* blockaddress is used in to declare a global (not possible in GNU C).

The second case is tested in:

```
$ ./llvm/build/unittests/Analysis/AnalysisTests \
  --gtest_filter=LazyCallGraphTest.HandleBlockAddress
```

This patch adjusts the iteration of blockaddresses in
LazyCallGraph::visitReferences to not revisit the blockaddresses
function in the first case.

The Linux kernel contains code that's not semantically valid at -O0;
specifically code passed to asm goto. It requires that asm goto be
inline-able. This patch conservatively does not attempt to handle the
more general case of inlining blockaddresses that have non-callbr users
(pr/39560).

https://bugs.llvm.org/show_bug.cgi?id=39560
https://bugs.llvm.org/show_bug.cgi?id=40722
https://github.com/ClangBuiltLinux/linux/issues/6
https://reviews.llvm.org/rL212077

Reviewers: jyknight, eli.friedman, chandlerc

Reviewed By: chandlerc

Subscribers: george.burgess.iv, nathanchance, mgorny, craig.topper, mengxu.gatech, void, mehdi_amini, E5ten, chandlerc, efriedma, eraman, hiraditya, haicheng, pirama, llvm-commits, srhines

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361173 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-20 16:48:09 +00:00
Petar Jovanovic
0ddfb52ad6 [DebugInfoMetadata] Refactor DIExpression::prepend constants (NFC)
Refactor DIExpression::With* into a flag enum in order to be less
error-prone to use (as discussed on D60866).

Patch by Djordje Todorovic.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361137 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-20 10:35:57 +00:00
Matt Arsenault
33b1ce984e GlobalISel: Define integer min/max instructions
Doesn't attempt to emit them for anything yet, but some legalizations
I want to port use them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361061 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-17 18:36:31 +00:00
Matt Arsenault
7b82da483d GlobalISel: Add fp<->int casts to MachineIRBuilder
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361019 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-17 11:49:39 +00:00
Matt Arsenault
3371c67806 GlobalISel: Add MIRBuilder wrappers for bitcount instructions
Various expansions use these.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361018 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-17 11:49:35 +00:00
Richard Trieu
d01ffcdc9c Fix broken test case.
EXPECT_EQ takes two arguments, not a single expression that evaluates to bool.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360969 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-17 01:17:32 +00:00
Richard Smith
8a9a01614a Convert PointerUnion to a variadic template.
Summary:
Rather than duplicating code between PointerUnion, PointerUnion3, and
PointerUnion4 (and missing things from the latter cases, such as some of the
DenseMap support and operator==), convert PointerUnion to a variadic template
that can be used as a union of any number of pointers.

(This doesn't support PointerUnion<> right now. Adding a special case for that
would be possible, and perhaps even useful in some situations, but it doesn't
seem worthwhile until we have a concrete use case.)

Reviewers: dblaikie

Subscribers: dexonsmith, kristina, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360962 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-17 00:39:38 +00:00
Don Hinton
ece7bca75d [CommandLine] Don't allow duplicate categories.
Summary:
This is a fix to D61574, r360179, that allowed duplicate
OptionCategory's.  This change adds a check to make sure a category can
only be added once even if the user passes it twice.

Reviewed By: MaskRay

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360913 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-16 16:25:13 +00:00
Pavel Labath
001e6f8745 Minidump: Add support for the MemoryList stream
Summary:
the stream format is exactly the same as for ThreadList and ModuleList
streams, only the entry types are slightly different, so the changes in
this patch are just straight-forward applications of established
patterns.

Reviewers: amccarth, jhenderson, clayborg

Subscribers: markmentovai, lldb-commits, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360908 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-16 15:17:30 +00:00
Matt Arsenault
eb6a004f33 GlobalISel: Add buildFMA to MachineIRBuilder
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360888 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-16 13:04:20 +00:00
Matt Arsenault
e6d677ada8 GlobalISel: Add buildXor/buildNot
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360880 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-16 12:23:04 +00:00
Matt Arsenault
819415bda8 GlobalISel: Add DstOp version of buildIntrinsic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360879 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-16 12:22:56 +00:00
Matt Arsenault
974b6989da GlobalISel: Add buildFConstant for APFloat
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360853 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-16 04:09:06 +00:00
Matt Arsenault
786b357990 GlobalISel: Add some FP instructions to MachineIRBuilder
This makes FP legalization code more convenient.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360852 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-16 04:08:55 +00:00
Tim Northover
d704922315 arm64_32: add some unittests that were in the wrong commit.
Accidentally dropped them when committing the arm64_32 binutils support.
There's no change to real code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360763 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-15 12:01:04 +00:00
Kit Barton
b2f54ba7d5 Save the induction binary operator in IVDescriptors for non FP induction variables.
Summary:
Currently InductionBinOps are only saved for FP induction variables, the PR extends it with non FP induction variable, so user of IVDescriptors can query the InductionBinOps for integer induction variables.

The changes in hasUnsafeAlgebra() and getUnsafeAlgebraInst() are required for the existing LIT test cases to pass. As described in the comment of the two functions, one of the requirement to return true is it is a FP induction variable. The checks was not needed because InductionBinOp was not set on non FP cases before.

https://reviews.llvm.org/D60565 depends on the patch.

Committed on behalf of @Whitney (Whitney Tsang).

Reviewers: jdoerfert, kbarton, fhahn, hfinkel, dmgreen, Meinersbur

Reviewed By: jdoerfert

Subscribers: mgorny, hiraditya, jsji, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360671 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-14 13:26:36 +00:00
Thomas Preud'homme
66fc834999 Reinstate "FileCheck [5/12]: Introduce regular numeric variables"
This reinstates r360578 (git e47362c1ec1ea31b626336cc05822035601c3e57),
reverted in r360653 (git 004393681c25e34e921adccc69ae6378090dee54),
with a fix for the list added in FileCheck.rst to build without error.

Copyright:
    - Linaro (changes up to diff 183612 of revision D55940)
    - GraphCore (changes in later versions of revision D55940 and
                 in new revision created off D55940)

Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar,
arichardson, rnk

Subscribers: hiraditya, llvm-commits, probinson, dblaikie, grimar,
arichardson, tra, rnk, kristina, hfinkel, rogfer01, JonChesterfield

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360665 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-14 11:58:30 +00:00
Thomas Preud'homme
3b00c5331f Revert "FileCheck [5/12]: Introduce regular numeric variables"
This reverts r360578 (git e47362c1ec1ea31b626336cc05822035601c3e57) to
solve the sphinx build failure on
http://lab.llvm.org:8011/builders/llvm-sphinx-docs buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360653 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-14 08:43:11 +00:00
David L. Jones
d6664e77e7 [Support] Ensure redirected outputs don't contain output from previous tests.
stdout may be buffered, and may not flush on every write. Explicitly flushing
before redirecting the output ensures that the captured output does not contain
output from other tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360617 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-13 20:32:53 +00:00
Thomas Preud'homme
9921625c42 FileCheck [5/12]: Introduce regular numeric variables
Summary:
This patch is part of a patch series to add support for FileCheck
numeric expressions. This specific patch introduces regular numeric
variables which can be set on the command-line.

This commit introduces regular numeric variable that can be set on the
command-line with the -D option to a numeric value. They can then be
used in CHECK patterns in numeric expression with the same shape as
@LINE numeric expression, ie. VAR, VAR+offset or VAR-offset where offset
is an integer literal.

The commit also enable strict whitespace in the verbose.txt testcase to
check that the position or the location diagnostics. It fixes one of the
existing CHECK in the process which was not accurately testing a
location diagnostic (ie. the diagnostic was correct, not the CHECK).

Copyright:
    - Linaro (changes up to diff 183612 of revision D55940)
    - GraphCore (changes in later versions of revision D55940 and
                 in new revision created off D55940)

Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson, rnk

Subscribers: hiraditya, llvm-commits, probinson, dblaikie, grimar, arichardson, tra, rnk, kristina, hfinkel, rogfer01, JonChesterfield

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360578 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-13 12:39:08 +00:00
Cullen Rhodes
5324e6dceb [AArch64][SVE2] Add SVE2 target features to backend and TargetParser
Summary:
This patch adds the following features defined by Arm SVE2 architecture
extension:

  sve2, sve2-aes, sve2-sm4, sve2-sha3, bitperm

For existing CPUs these features are declared as unsupported to prevent
scheduler errors.

The specification can be found here:
https://developer.arm.com/docs/ddi0602/latest

Reviewers: SjoerdMeijer, sdesmalen, ostannard, rovka

Reviewed By: SjoerdMeijer, rovka

Subscribers: rovka, javed.absar, tschuett, kristof.beyls, kristina, llvm-commits

Tags: #llvm

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360573 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-13 10:10:24 +00:00
Don Hinton
541e19ce1b [CommandLine] Add long option flag for cl::ParseCommandLineOptions . Part 5 of 5
Summary:
If passed, the long option flag makes the CommandLine parser
mimic the behavior or GNU getopt_long.  Short options are a single
character prefixed by a single dash, and long options are multiple
characters prefixed by a double dash.

This patch was motivated by the discussion in the following thread:
http://lists.llvm.org/pipermail/llvm-dev/2019-April/131786.html

Reviewed By: MaskRay

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360532 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-11 20:27:01 +00:00
Petar Jovanovic
27b4f5d9af [Support] Fix unit test for fs::is_local
Close the temporary file after the test is done using it.
If it is not closed and the file was created on NFS, it will cause the test
to fail. The problem happens in the cleanup process afterwards. It first
tries to delete the file but it is not really deleted. Afterwards, the
program fails to delete the directory containing the file, causing the whole
test to fail.

Patch by Milos Stojanovic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360259 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-08 14:42:13 +00:00
Lang Hames
90dd07f5c5 [Support] Add error handling to sys::Process::getPageSize().
This patch changes the return type of sys::Process::getPageSize to
Expected<unsigned> to account for the fact that the underlying syscalls used to
obtain the page size may fail (see below).

For clients who use the page size as an optimization only this patch adds a new
method, getPageSizeEstimate, which calls through to getPageSize but discards
any error returned and substitues a "reasonable" page size estimate estimate
instead. All existing LLVM clients are updated to call getPageSizeEstimate
rather than getPageSize.

On Unix, sys::Process::getPageSize is implemented in terms of getpagesize or
sysconf, depending on which macros are set. The sysconf call is documented to
return -1 on failure. On Darwin getpagesize is implemented in terms of sysconf
and may also fail (though the manpage documentation does not mention this).
These failures have been observed in practice when highly restrictive sandbox
permissions have been applied. Without this patch, the result is that
getPageSize returns -1, which wreaks havoc on any subsequent code that was
assuming a sane page size value.

<rdar://problem/41654857>

Reviewers: dblaikie, echristo

Subscribers: kristina, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360221 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-08 02:11:07 +00:00
Don Hinton
4b077a176c [CommandLine] Allow Options to specify multiple OptionCategory's.
Summary:
It's not uncommon for separate components to share common
Options, e.g., it's common for related Passes to share Options in
addition to the Pass specific ones.

With this change, components can use OptionCategory's to simply help
output even if some of the options are shared.

Reviewed By: MaskRay

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360179 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-07 18:57:01 +00:00
Nikita Popov
c686868a5e [ConstantRange] Add srem() support
Add support for srem() to ConstantRange so we can use it in LVI. For
srem the sign of the result matches the sign of the LHS. For the RHS
only the absolute value is important. Apart from that the logic is
like urem.

Just like for urem this is only an approximate implementation. The tests
check a few specific cases and run an exhaustive test for conservative
correctness (but not exactness).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360055 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-06 16:59:37 +00:00
Alexandre Ganea
059c038861 Fix compilation warnings when compiling with GCC 7.3
Differential Revision: https://reviews.llvm.org/D61046

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360044 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-06 13:41:54 +00:00
Cameron McInally
ed1ec3ab25 Add FNeg IR constant folding support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359982 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-05 16:07:09 +00:00
Cameron McInally
5cc88b4c52 Update PatternMatcher for FNeg
Match both FNeg(X) and FSub(+-0.0, X) in FNeg_match

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359936 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-03 21:19:12 +00:00
Don Hinton
0eff58c79b [CommandLine] Change help output to prefix long options with -- instead of -. NFC . Part 3 of 5
Summary:
By default, `parseCommandLineOptions()` will accept either a
`-` or `--` prefix for long options -- options with names longer than
a single character.

While this change does not affect behavior, it will be helpful with a
subsequent change that requires long options use the `--` prefix.

Reviewers: rnk, thopre

Reviewed By: thopre

Subscribers: thopre, cfe-commits, hiraditya, llvm-commits

Tags: #llvm, #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359909 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-03 17:47:29 +00:00
Pavel Labath
c69acccf97 Object/Minidump: Add support for the ThreadList stream
Summary:
The stream contains the list of threads belonging to the process
described by the minidump. Its structure is the same as the ModuleList
stream, and in fact, I have generalized the ModuleList reading code to
handle this stream too.

Reviewers: amccarth, jhenderson, clayborg

Subscribers: llvm-commits, lldb-commits, markmentovai, zturner

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359762 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-02 07:45:42 +00:00
Thomas Preud'homme
3abee1bcf3 FileCheck [4/12]: Introduce @LINE numeric expressions
Summary:
This patch is part of a patch series to add support for FileCheck
numeric expressions. This specific patch introduces the @LINE numeric
expressions.

This commit introduces a new syntax to express a relation a numeric
value in the input text must have with the line number of a given CHECK
pattern: [[#<@LINE numeric expression>]]. Further commits build on that
to express relations between several numeric values in the input text.
To help with naming, regular variables are renamed into pattern
variables and old @LINE expression syntax is referred to as legacy
numeric expression.

Compared to existing @LINE expressions, this new syntax allow arbitrary
spacing between the component of the expression. It offers otherwise the
same functionality but the commit serves to introduce some of the data
structure needed to support more general numeric expressions.

Copyright:
    - Linaro (changes up to diff 183612 of revision D55940)
    - GraphCore (changes in later versions of revision D55940 and
                 in new revision created off D55940)

Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson, rnk

Subscribers: hiraditya, llvm-commits, probinson, dblaikie, grimar, arichardson, tra, rnk, kristina, hfinkel, rogfer01, JonChesterfield

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359741 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-02 00:04:38 +00:00
Nico Weber
24da186483 Option spell checking: Penalize delimiter flags if input has no argument
If the user passes a flag like `-version` to a program, it's more likely
they mean `--version` than `-version:`, since there's no parameter
passed. Hence, give delimited arguments a penalty of 1 if the user input
doesn't contain the delimiter or no data after it.

The motivation is that with this, lld-link can suggest "--version"
instead of "-version:" for "-version" and "-nodefaultlib" instead of
"-nodefaultlib:" for "-nodefaultlibs".

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359701 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-01 16:45:15 +00:00
Nico Weber
28a57e37b2 Fix OptTable::findNearest() adding delimiter for free
Prior to this, OptTable::findNearest() thought that the input `--foo`
had an editing distance of 0 from an existing flag `--foo=`, which made
it suggest flags with delimiters more often than flags without one.
After this, it correctly assigns this case an editing distance of 1.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359685 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-01 14:46:17 +00:00
Dan Gohman
15f67f93fc [WebAssembly] Test the "wasm32-wasi" triple
Add triple tests for "wasm32-wasi" and "wasm64-wasi", and also remove the
"-musl" component from the existing wasm triple tests as we're not using that
in practice (WASI libc is derived in part from musl, but it is not fully
musl-compatible).

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

Reviewer: sbc100


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359629 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-30 23:04:49 +00:00
Alina Sbirlea
ddcc2ba101 [AliasAnalysis/NewPassManager] Invalidate AAManager less often.
Summary:
This is a redo of D60914.

The objective is to not invalidate AAManager, which is stateless, unless
there is an explicit invalidate in one of the AAResults.

To achieve this, this patch adds an API to PAC, to check precisely this:
is this analysis not invalidated explicitly == is this analysis not abandoned == is this analysis stateless, so preserved without explicitly being marked as preserved by everyone

Reviewers: chandlerc

Subscribers: mehdi_amini, jlebar, george.burgess.iv, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359622 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-30 22:15:47 +00:00
Nico Weber
ed4e4a5f8d Re-reland "[Option] Fix PR37006 prefix choice in findNearest"
This was first reviewed in https://reviews.llvm.org/D46776 and
landed in r332299, but got reverted because it broke the PS4
bots.

https://reviews.llvm.org/D50410 fixed this, and then this
change was re-reviewed at https://reviews.llvm.org/D50515 and
relanded in r341329. It got reverted due to causing MSan issues.
However, nobody wrote down the error message and the bot link
is dead, so I'm relanding this to capture the MSan error.
I'll then either fix it, or copy it somewhere and revert if
fixing looks difficult.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359580 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-30 17:46:00 +00:00
Lang Hames
f235e145c9 [ORC] Fix an ambiguous call in a unit test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359529 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-30 02:43:01 +00:00
Don Hinton
eb132e02b3 [CommandLine} Wire-up cl::list::setDefault() so it will work correctly with cl::ResetAllOptionOccurrences() in unittests. Part 2 of 5
Summary:
With this change, cl::ResetAllOptionOccurrences() clears
cl::list just like cl::opt, allowing users to call
cl::ParseCommandLineOptions() multiple times without interference from
previous calls.

Reviewers: rnk

Reviewed By: rnk

Subscribers: llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359522 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-30 00:09:49 +00:00
Lang Hames
9a1c76870e [ORC] Allow JITDylib definition generators to return Errors.
Background: A definition generator can be attached to a JITDylib to generate
new definitions in response to queries. For example: a generator that forwards
calls to dlsym can map symbols from a dynamic library into the JIT process on
demand.

If definition generation fails then the generator should be able to return an
error. This allows the JIT API to distinguish between the case where a
generator does not provide a definition, and the case where it was not able to
determine whether it provided a definition due to an error.

The immediate motivation for this is cross-process symbol lookups: If the
remote-lookup generator is attached to a JITDylib early in the search list, and
if a generator failure is misinterpreted as "no definition in this JITDylib" then
lookup may continue and bind to a different definition in a later JITDylib, which
is a bug.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359521 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-30 00:03:26 +00:00
Nico Weber
033bb22f79 [PDB] Fix hash function used to write /src/headerblock
lld-link used to write PDB files that DIA couldn't recover natvis
files from if:

- The global strings table was > 64kiB
- There were at least 3 natvis files

The cause was that the hash function for the /src/headerblock stream
was incorrect: It needs to be truncated to 16 bit.

If the global strings table was <= 64kiB, truncating to 16 bit is a
no-op, so this wasn't needed for small programs.

If there are only 1 or 2 natvis files, then the growth strategy in
HashTable::grow() would mean the hash table would have 2 buckets (for 1
natvis file) or 4 buckets (for 4 natvis files), and since the hash
function is used modulo number of buckets, and since 2 and 4 divide
0x10000, the missing `% 0x10000` is a no-op there too. For 3 natvis
files, the hash table grows to 6 buckets, which has a factor that's not
common with 0x10000 and the difference starts to matter.

Fixes PR41626.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359515 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-29 23:09:35 +00:00
Reid Kleckner
de608b0409 Fix string UAF in new FileCheck test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359493 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-29 19:56:46 +00:00
Thomas Preud'homme
11c60390e3 FileCheck [3/12]: Stricter parsing of @LINE expressions
Summary:
This patch is part of a patch series to add support for FileCheck
numeric expressions. This specific patch gives earlier and better
diagnostics for the @LINE expressions.

Rather than detect parsing errors at matching time, this commit adds
enhance parsing to detect issues with @LINE expressions at parse time
and diagnose them more accurately.

Copyright:
    - Linaro (changes up to diff 183612 of revision D55940)
    - GraphCore (changes in later versions of revision D55940 and
                 in new revision created off D55940)

Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson, rnk

Subscribers: hiraditya, llvm-commits, probinson, dblaikie, grimar, arichardson, tra, rnk, kristina, hfinkel, rogfer01, JonChesterfield

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359475 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-29 17:46:26 +00:00
Thomas Preud'homme
4a42ca4771 FileCheck [2/12]: Stricter parsing of -D option
Summary:
This patch is part of a patch series to add support for FileCheck
numeric expressions. This specific patch gives earlier and better
diagnostics for the -D option.

Prior to this change, parsing of -D option was very loose: it assumed
that there is an equal sign (which to be fair is now checked by the
FileCheck executable) and that the part on the left of the equal sign
was a valid variable name. This commit adds logic to ensure that this
is the case and gives diagnostic when it is not, making it clear that
the issue came from a command-line option error. This is achieved by
sharing the variable parsing code into a new function ParseVariable.

Copyright:
    - Linaro (changes up to diff 183612 of revision D55940)
    - GraphCore (changes in later versions of revision D55940 and
                 in new revision created off D55940)

Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson, rnk

Subscribers: hiraditya, llvm-commits, probinson, dblaikie, grimar, arichardson, tra, rnk, kristina, hfinkel, rogfer01, JonChesterfield

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359447 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-29 13:32:36 +00:00
Nikita Popov
3547a7e64e [ConstantRange] Add makeExactNoWrapRegion()
I got confused on the terminology, and the change in D60598 was not
correct. I was thinking of "exact" in terms of the result being
non-approximate. However, the relevant distinction here is whether
the result is

 * Largest range such that:
   Forall Y in Other: Forall X in Result: X BinOp Y does not wrap.
   (makeGuaranteedNoWrapRegion)
 * Smallest range such that:
   Forall Y in Other: Forall X not in Result: X BinOp Y wraps.
   (A hypothetical makeAllowedNoWrapRegion)
 * Both. (makeExactNoWrapRegion)

I'm adding a separate makeExactNoWrapRegion method accepting a
single APInt (same as makeExactICmpRegion) and using it in the
places where the guarantee is relevant.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359402 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-28 15:40:56 +00:00