platform/upstream/llvm.git
5 years ago[TargetLowering] getValueType - use dyn_cast directly to find VectorType. NFCI.
Simon Pilgrim [Sun, 5 May 2019 20:23:45 +0000 (20:23 +0000)]
[TargetLowering] getValueType - use dyn_cast directly to find VectorType. NFCI.

Matches what we do in other getValueType functions and fixes a null dereference warning in scan-build.

Also cleans up the rest of the function - use auto and standardize the variable names.

llvm-svn: 360000

5 years ago[TTI][X86] Make getAddressComputationCost cost value const. NFCI.
Simon Pilgrim [Sun, 5 May 2019 20:03:51 +0000 (20:03 +0000)]
[TTI][X86] Make getAddressComputationCost cost value const. NFCI.

llvm-svn: 359999

5 years ago[analyzer][UninitializedObjectChecker] PR41741: Regard all scalar types as primitive.
Kristof Umann [Sun, 5 May 2019 19:42:33 +0000 (19:42 +0000)]
[analyzer][UninitializedObjectChecker] PR41741: Regard all scalar types as primitive.

https://bugs.llvm.org/show_bug.cgi?id=41741

Pretty much the same as D61246 and D61106, this time for __complex__ types. Upon
further investigation, I realized that we should regard all types
Type::isScalarType returns true for as primitive, so I merged
isMemberPointerType(), isBlockPointerType() and isAnyComplexType()` into that
instead.

I also stumbled across yet another bug,
https://bugs.llvm.org/show_bug.cgi?id=41753, but it seems to be unrelated to
this checker.

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

llvm-svn: 359998

5 years ago[NFC] BasicBlock: generalize replaceSuccessorsPhiUsesWith(), take Old bb
Roman Lebedev [Sun, 5 May 2019 18:59:45 +0000 (18:59 +0000)]
[NFC] BasicBlock: generalize replaceSuccessorsPhiUsesWith(), take Old bb

Thus it does not assume that the old basic block is the basic block
for which we are looking at successors.

Not reviewed, but seems rather trivial, in line with the rest of
previous few patches.

llvm-svn: 359997

5 years ago[NFC] BasicBlock: refactor changePhiUses() out of replacePhiUsesWith(), use it
Roman Lebedev [Sun, 5 May 2019 18:59:39 +0000 (18:59 +0000)]
[NFC] BasicBlock: refactor changePhiUses() out of replacePhiUsesWith(), use it

Summary:
It is a common thing to loop over every `PHINode` in some `BasicBlock`
and change old `BasicBlock` incoming block to a new `BasicBlock` incoming block.
`replaceSuccessorsPhiUsesWith()` already had code to do that,
it just wasn't a function.
So outline it into a new function, and use it.

Reviewers: chandlerc, craig.topper, spatel, danielcdh

Reviewed By: craig.topper

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 359996

5 years ago[NFC] PHINode: introduce replaceIncomingBlockWith() function, use it
Roman Lebedev [Sun, 5 May 2019 18:59:30 +0000 (18:59 +0000)]
[NFC] PHINode: introduce replaceIncomingBlockWith() function, use it

Summary:
There is `PHINode::getBasicBlockIndex()`, `PHINode::setIncomingBlock()`
and `PHINode::getNumOperands()`, but no function to replace every
specified `BasicBlock*` predecessor with some other specified `BasicBlock*`.
Clearly, there are a lot of places that could use that functionality.

Reviewers: chandlerc, craig.topper, spatel, danielcdh

Reviewed By: craig.topper

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 359995

5 years ago[NFC] Instruction: introduce replaceSuccessorWith() function, use it
Roman Lebedev [Sun, 5 May 2019 18:59:22 +0000 (18:59 +0000)]
[NFC] Instruction: introduce replaceSuccessorWith() function, use it

Summary:
There is `Instruction::getNumSuccessors()`, `Instruction::getSuccessor()`
and `Instruction::setSuccessor()`, but no function to replace every
specified `BasicBlock*` successor with some other specified `BasicBlock*`.
I've found one place where it should clearly be used.

Reviewers: chandlerc, craig.topper, spatel, danielcdh

Reviewed By: craig.topper

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 359994

5 years ago[NFC][Utils] deleteDeadLoop(): add an assert that exit block has some non-PHI instruction
Roman Lebedev [Sun, 5 May 2019 18:59:12 +0000 (18:59 +0000)]
[NFC][Utils] deleteDeadLoop(): add an assert that exit block has some non-PHI instruction

Summary:
If `deleteDeadLoop()` is called on such a loop, that has "bad" exit block,
one that e.g. has no terminator instruction, the `DIBuilder::insertDbgValueIntrinsic()`
will be told to insert the Dbg Value Intrinsic after `nullptr`
(since there is no first non-PHI instruction), which will cause it to not insert
those instructions into any basic block. The instructions will be parent-less,
and IR verifier will complain. It is rather obvious to track down the root cause
when that happens, so let's just assert it never happens.

Reviewers: sanjoy, davide, vsk

Reviewed By: vsk

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 359993

5 years ago[test] Remove randomness
Jonas Devlieghere [Sun, 5 May 2019 18:54:16 +0000 (18:54 +0000)]
[test] Remove randomness

This particular test fails once every so many runs on GreenDragon. Given
that the randomness in the inferior isn't critical to the test, I
removed it in the hopes that it is the cause of the flakiness.

llvm-svn: 359992

5 years agoMove getOpcode() call into if statement. NFCI.
Simon Pilgrim [Sun, 5 May 2019 18:34:38 +0000 (18:34 +0000)]
Move getOpcode() call into if statement. NFCI.

Avoids a cppcheck "Local variable name shadows outer variable" warning.

llvm-svn: 359991

5 years agoPrecommit an FNeg InstructionSimplify test.
Cameron McInally [Sun, 5 May 2019 18:22:09 +0000 (18:22 +0000)]
Precommit an FNeg InstructionSimplify test.

llvm-svn: 359990

5 years ago[SLPVectorizer] Prefer pre-increments. NFCI.
Simon Pilgrim [Sun, 5 May 2019 17:53:09 +0000 (17:53 +0000)]
[SLPVectorizer] Prefer pre-increments. NFCI.

llvm-svn: 359989

5 years ago[LLParser] Remove unused variable after r359987. NFC
Craig Topper [Sun, 5 May 2019 17:46:17 +0000 (17:46 +0000)]
[LLParser] Remove unused variable after r359987. NFC

llvm-svn: 359988

5 years ago[LLParser] Remove unnecessary error check making sure NUW/NSW flags aren't set on...
Craig Topper [Sun, 5 May 2019 17:19:23 +0000 (17:19 +0000)]
[LLParser] Remove unnecessary error check making sure NUW/NSW flags aren't set on a non-integer operation.

Summary: This check appears to be a leftover from when add/sub/mul could be either integer or fp. The NSW/NUW flags are only set for add/sub/mul/shl earlier. And we check that those operations only have integer types just below this. So it seems unnecessary to explicitly error for NUW/NSW being used on a add/sub/mul that have the wrong type that would later error for that.

Reviewers: spatel, dblaikie, jyknight, arsenm

Reviewed By: spatel

Subscribers: wdng, llvm-commits, hiraditya

Tags: #llvm

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

llvm-svn: 359987

5 years ago[LLParser] Simplify type checking in ParseArithmetic and ParseUnaryOp.
Craig Topper [Sun, 5 May 2019 17:19:19 +0000 (17:19 +0000)]
[LLParser] Simplify type checking in ParseArithmetic and ParseUnaryOp.

Summary:
These methods previously took a 0, 1, or 2 to indicate what types were allowed, but the 0 encoding which meant both fp and integer types has been unused for years. Its leftover from when add/sub/mul used to be shared between int and fp

Simplify it by changing it to just a bool to distinquish int and fp.

Reviewers: spatel, dblaikie, jyknight, arsenm

Reviewed By: spatel

Subscribers: wdng, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 359986

5 years ago[Constants] Simplify type checking switch in ConstantExpr::get.
Craig Topper [Sun, 5 May 2019 17:19:16 +0000 (17:19 +0000)]
[Constants] Simplify type checking switch in ConstantExpr::get.

Summary:
Remove duplicate checks that both operands have the same type. This is checked
before the switch.

Use 'integer' or 'floating-point' instead of 'arithmetic' type. I think this
might be a leftover to the days when floating point and integer operations
shared the same opcodes.

Reviewers: spatel, RKSimon, dblaikie

Reviewed By: RKSimon

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 359985

5 years agoRevert rL359962 : Use DiagRuntimeBehavior for -Wunsequenced to weed out false positives
Simon Pilgrim [Sun, 5 May 2019 17:10:05 +0000 (17:10 +0000)]
Revert rL359962 : Use DiagRuntimeBehavior for -Wunsequenced to weed out false positives
where either the modification or the other access is unreachable.
........
Try to fix buildbots

llvm-svn: 359984

5 years ago[MCA] Notify event listeners when instructions transition to the Pending state. NFCI
Andrea Di Biagio [Sun, 5 May 2019 16:07:27 +0000 (16:07 +0000)]
[MCA] Notify event listeners when instructions transition to the Pending state. NFCI

llvm-svn: 359983

5 years agoAdd FNeg IR constant folding support
Cameron McInally [Sun, 5 May 2019 16:07:09 +0000 (16:07 +0000)]
Add FNeg IR constant folding support

llvm-svn: 359982

5 years ago[X86] Make X86RegisterInfo(const Triple &TT) constructor explicit.
Simon Pilgrim [Sun, 5 May 2019 12:51:47 +0000 (12:51 +0000)]
[X86] Make X86RegisterInfo(const Triple &TT) constructor explicit.

Fixes cppcheck warning.

llvm-svn: 359981

5 years ago[clang] fixing -ast-print for variadic parameter pack in lambda capture
Nicolas Lesser [Sun, 5 May 2019 12:35:12 +0000 (12:35 +0000)]
[clang] fixing -ast-print for variadic parameter pack in lambda capture

Summary:
currently for:
```
 template<typename ... T>
void f(T... t) {
  auto l = [t...]{};
}
```
`clang -ast-print file.cpp`
outputs:

```
template <typename ...T> void f(T ...t) {
    auto l = [t]         {
        }
;
}
```
notice that there is not `...` in the capture list of the lambda. this patch fixes this issue. and add test for it.

Patch by Tyker

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 359980

5 years ago[C++] Interpret unknown identifier in parameter clause as unknown type
Nicolas Lesser [Sun, 5 May 2019 12:15:17 +0000 (12:15 +0000)]
[C++] Interpret unknown identifier in parameter clause as unknown type

instead of as parameter name without a type.

llvm-svn: 359979

5 years ago[lldb] [lit] Simplify general-purpose register tests
Michal Gorny [Sun, 5 May 2019 12:06:32 +0000 (12:06 +0000)]
[lldb] [lit] Simplify general-purpose register tests

Use output constraints for specific general-purpose registers in order
to simplify the tests.  They save us from having to manually put
the values in correct registers, and reduce the number of registers
needed as a result.

llvm-svn: 359978

5 years ago[lldb] [lit] Fix more filename mismatches in Register tests
Michal Gorny [Sun, 5 May 2019 12:06:22 +0000 (12:06 +0000)]
[lldb] [lit] Fix more filename mismatches in Register tests

llvm-svn: 359977

5 years ago[X86] Fix some cppcheck "Local variable name shadows outer variable" warnings. NFCI.
Simon Pilgrim [Sun, 5 May 2019 12:00:14 +0000 (12:00 +0000)]
[X86] Fix some cppcheck "Local variable name shadows outer variable" warnings. NFCI.

llvm-svn: 359976

5 years ago[SLPVectorizer] Make getSpillCost() const. NFCI.
Simon Pilgrim [Sun, 5 May 2019 10:37:38 +0000 (10:37 +0000)]
[SLPVectorizer] Make getSpillCost() const. NFCI.

Ideally getTreeCost() should be const as well but non-const Type creation would need to be addressed first.

llvm-svn: 359975

5 years ago[SelectionDAG] Use any_of/all_of where possible. NFCI.
Simon Pilgrim [Sun, 5 May 2019 10:30:04 +0000 (10:30 +0000)]
[SelectionDAG] Use any_of/all_of where possible. NFCI.

llvm-svn: 359974

5 years agoMove Value *RHSCIOp def into the scope where its actually used. NFCI.
Simon Pilgrim [Sun, 5 May 2019 10:27:45 +0000 (10:27 +0000)]
Move Value *RHSCIOp def into the scope where its actually used. NFCI.

llvm-svn: 359973

5 years agoAdd InstCombine tests for FNeg instruction.
Cameron McInally [Sat, 4 May 2019 14:56:08 +0000 (14:56 +0000)]
Add InstCombine tests for FNeg instruction.

llvm-svn: 359970

5 years ago[CodeGenPrepare] limit overflow intrinsic matching to a single basic block (2nd try)
Sanjay Patel [Sat, 4 May 2019 12:46:32 +0000 (12:46 +0000)]
[CodeGenPrepare] limit overflow intrinsic matching to a single basic block (2nd try)

This is a subset of the original commit from rL359879
which was reverted because it could crash when using the 'RemovedInstructions'
structure that enables delayed deletion of dead instructions. The motivating
compile-time win does not require that change though. We should get most of
that win from this change alone.

Using/updating a dominator tree to match math overflow patterns may be very
expensive in compile-time (because of the way CGP uses a DT), so just handle
the single-block case.

See post-commit thread for rL354298 for more details:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190422/646276.html

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

llvm-svn: 359969

5 years ago[NFC] Add parentheses to avoid -Wparentheses.
Nicolas Lesser [Sat, 4 May 2019 11:28:11 +0000 (11:28 +0000)]
[NFC] Add parentheses to avoid -Wparentheses.

llvm-svn: 359968

5 years ago[c++20] Implement P0428R2 - Familiar template syntax for generic lambdas
Hamza Sood [Sat, 4 May 2019 10:49:46 +0000 (10:49 +0000)]
[c++20] Implement P0428R2 - Familiar template syntax for generic lambdas

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

llvm-svn: 359967

5 years ago[lldb] Fix buildbot failure due to clang AST change.
Nicolas Lesser [Sat, 4 May 2019 10:21:50 +0000 (10:21 +0000)]
[lldb] Fix buildbot failure due to clang AST change.

In r359949 several AST node constructors were modified without the
corresponding change in lldb, which caused build failures.

llvm-svn: 359966

5 years ago[llvm-nm] Convert weak.test to use yaml2obj and fix unntested 'v'
Fangrui Song [Sat, 4 May 2019 09:12:18 +0000 (09:12 +0000)]
[llvm-nm] Convert weak.test to use yaml2obj and fix unntested 'v'

This restores part of the good change reverted by r359830.

llvm-svn: 359965

5 years ago[c++20] Implement tweaked __VA_OPT__ rules from P1042R1:
Richard Smith [Sat, 4 May 2019 06:46:18 +0000 (06:46 +0000)]
[c++20] Implement tweaked __VA_OPT__ rules from P1042R1:

 * __VA_OPT__ is expanded if the *expanded* __VA_ARGS__ is non-empty,
   not if the original argument contained no tokens.
 * Placemarkers at the start and end of __VA_OPT__ are retained just
   long enough to paste them with adjacent ## operators. We never paste
   "across" a discarded placemarker.

llvm-svn: 359964

5 years ago[AMDGPU] Fixed asan error after D61536
Stanislav Mekhanoshin [Sat, 4 May 2019 06:40:20 +0000 (06:40 +0000)]
[AMDGPU] Fixed asan error after D61536

llvm-svn: 359963

5 years agoUse DiagRuntimeBehavior for -Wunsequenced to weed out false positives
Richard Smith [Sat, 4 May 2019 05:20:14 +0000 (05:20 +0000)]
Use DiagRuntimeBehavior for -Wunsequenced to weed out false positives
where either the modification or the other access is unreachable.

llvm-svn: 359962

5 years agoAMDGPU] gfx1010 hazard recognizer
Stanislav Mekhanoshin [Sat, 4 May 2019 04:30:57 +0000 (04:30 +0000)]
AMDGPU] gfx1010 hazard recognizer

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

llvm-svn: 359961

5 years agoReduce amount of work ODR hashing does.
Richard Trieu [Sat, 4 May 2019 04:22:33 +0000 (04:22 +0000)]
Reduce amount of work ODR hashing does.

When a FunctionProtoType is in the original type in a DecayedType, the decayed
type is a PointerType which points back the original FunctionProtoType.  The
visitor for ODRHashing will attempt to process both Type's, doing double work.
By chaining together multiple DecayedType's and FunctionProtoType's, this would
result in 2^N Type's visited only N DecayedType's and N FunctionProtoType's
exsit.  Another bug where VisitDecayedType and VisitAdjustedType did
redundant work doubled the work at each level, giving 4^N Type's visited.  This
patch removed the double work and detects when a FunctionProtoType decays to
itself to only check the Type once.  This lowers the exponential runtime to
linear runtime.  Fixes https://bugs.llvm.org/show_bug.cgi?id=41625

llvm-svn: 359960

5 years ago[AMDGPU] gfx1010: use fmac instructions
Stanislav Mekhanoshin [Sat, 4 May 2019 04:20:37 +0000 (04:20 +0000)]
[AMDGPU] gfx1010: use fmac instructions

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

llvm-svn: 359959

5 years agoDisallow the operand of __builtin_constant_p from modifying enclosing
Richard Smith [Sat, 4 May 2019 04:00:45 +0000 (04:00 +0000)]
Disallow the operand of __builtin_constant_p from modifying enclosing
state when it's encountered while evaluating a constexpr function.

We attempt to follow GCC trunk's behavior here, but it is somewhat
inscrutible, so our behavior is only approximately the same for now.
Specifically, we only permit modification of objects whose lifetime
began within the operand of the __builtin_constant_p. GCC appears to
have effectively the same restriction, but also some unknown restriction
based on where and how the local state of the constexpr function is
mentioned within the operand (see added testcases).

llvm-svn: 359958

5 years ago[Driver] Create non-existent directory for -fcrash-diagnostics-dir
Petr Hosek [Sat, 4 May 2019 00:55:14 +0000 (00:55 +0000)]
[Driver] Create non-existent directory for -fcrash-diagnostics-dir

When user specifies non-existent directory to -fcrash-diagnostics-dir,
create it rather than failing with an error as would be the case before.

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

llvm-svn: 359954

5 years ago[cxx_status] Don't list -fmodules / -fmodules-ts against C++ modules
Richard Smith [Sat, 4 May 2019 00:27:21 +0000 (00:27 +0000)]
[cxx_status] Don't list -fmodules / -fmodules-ts against C++ modules
support; those turn on different modules modes. The real C++ modules
support is behind -std=c++2a like the rest of C++20.

llvm-svn: 359953

5 years ago[cxx_status] Replace "SVN" entries with Clang 8 as appropriate.
Richard Smith [Sat, 4 May 2019 00:23:18 +0000 (00:23 +0000)]
[cxx_status] Replace "SVN" entries with Clang 8 as appropriate.

Also: use the "svn" color for "explicit(bool)" rather than the "full" color.
llvm-svn: 359951

5 years ago[JITLink] Add two useful Section operations: find by name, get address range.
Lang Hames [Sat, 4 May 2019 00:23:09 +0000 (00:23 +0000)]
[JITLink] Add two useful Section operations: find by name, get address range.

These operations were already used in eh-frame registration, and are likely to
be used in other runtime registrations, so this commit moves them into a header
where they can be re-used.

llvm-svn: 359950

5 years ago[clang] adding explicit(bool) from c++2a
Nicolas Lesser [Sat, 4 May 2019 00:09:00 +0000 (00:09 +0000)]
[clang] adding explicit(bool) from c++2a

this patch adds support for the explicit bool specifier.

Changes:
- The parsing for the explicit(bool) specifier was added in ParseDecl.cpp.
- The storage of the explicit specifier was changed. the explicit specifier was stored as a boolean value in the FunctionDeclBitfields and in the DeclSpec class. now it is stored as a PointerIntPair<Expr*, 2> with a flag and a potential expression in CXXConstructorDecl, CXXDeductionGuideDecl, CXXConversionDecl and in the DeclSpec class.
- Following the AST change, Serialization, ASTMatchers, ASTComparator and ASTPrinter were adapted.
- Template instantiation was adapted to instantiate the potential expressions of the explicit(bool) specifier When instantiating their associated declaration.
- The Add*Candidate functions were adapted, they now take a Boolean indicating if the context allowing explicit constructor or conversion function and this boolean is used to remove invalid overloads that required template instantiation to be detected.
- Test for Semantic and Serialization were added.

This patch is not yet complete. I still need to check that interaction with CTAD and deduction guides is correct. and add more tests for AST operations. But I wanted first feedback.
Perhaps this patch should be spited in smaller patches, but making each patch testable as a standalone may be tricky.

Patch by Tyker

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

llvm-svn: 359949

5 years agoCWG issue 727: Fix numerous bugs in support for class-scope explicit
Richard Smith [Fri, 3 May 2019 23:51:38 +0000 (23:51 +0000)]
CWG issue 727: Fix numerous bugs in support for class-scope explicit
specializations for variable templates.

llvm-svn: 359947

5 years agoExpressionParser: only force link MCJIT when needed
Saleem Abdulrasool [Fri, 3 May 2019 23:19:27 +0000 (23:19 +0000)]
ExpressionParser: only force link MCJIT when needed

This was added to support FreeBSD.  The inclusion of this header increases the
size of `lldb-server` due to MCJIT being forcefully preserved.  Conditionalise
the inclusion to shared builds of LLVM which will allow for MCJIT to be stripped
if unnecessary when performing static linking of tools.  This shaves off ~28% of
the binary size for lldb-server when linked with gold using
`-ffunction-sections` and `-fdata-sections`.

llvm-svn: 359944

5 years ago[clang-format] Fix bug in block comment reflow that joins * and /
Owen Pan [Fri, 3 May 2019 23:15:40 +0000 (23:15 +0000)]
[clang-format] Fix bug in block comment reflow that joins * and /

Fixes PR41213

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

llvm-svn: 359943

5 years ago[lld] Specify output file explicitly
Alexander Kornienko [Fri, 3 May 2019 23:11:32 +0000 (23:11 +0000)]
[lld] Specify output file explicitly

The test shouldn't try to create `a.out` in the current directory, which can be
read-only (and it is in our test setup).

llvm-svn: 359942

5 years ago[x86] add tests for fneg IR with undef; NFC
Sanjay Patel [Fri, 3 May 2019 22:47:29 +0000 (22:47 +0000)]
[x86] add tests for fneg IR with undef; NFC

llvm-svn: 359941

5 years ago[AArch64][GlobalISel] Use fcsel instead of csel for G_SELECT on FPRs
Jessica Paquette [Fri, 3 May 2019 22:37:46 +0000 (22:37 +0000)]
[AArch64][GlobalISel] Use fcsel instead of csel for G_SELECT on FPRs

This saves us some unnecessary copies.

If the inputs to a G_SELECT are floating point, we should use fcsel rather than
csel.

Changes here are...

- Teach selectCopy about s1-to-s1 copies across register banks.
- AArch64RegisterBankInfo about G_SELECT in general.
- Teach the instruction selector about the FCSEL instructions.

Also add two tests:

- select-select.mir to show that we get the expected FCSEL
- regbank-select.mir (unfortunately named) to show the register banks on
G_SELECT are properly preserved

And update fast-isel-select.ll to show that we do the same thing as other
instruction selectors in these cases.

llvm-svn: 359940

5 years agoMake the git-llvm script work on older git versions that don't support git rev-parse...
Craig Topper [Fri, 3 May 2019 22:03:29 +0000 (22:03 +0000)]
Make the git-llvm script work on older git versions that don't support git rev-parse --git-common-dir.

Not all versions of git support git rev-parse --git-common-dir. Rather than erorr or print any kind of
useful error, they just print back '--git-common-dir' instead of a directory. The git-llvm script
ends up taking this '--git-common-dir' as a diretory name to use.

Not sure exactly what happens after that, but the end result is that the 'git llvm push' ends up
looking like it pushed your commits, but really did nothing.

This patch makes the script detect the bogus directory name for --git-common-dir and falls back to using --git-dir instead.

llvm-svn: 359939

5 years ago[AMDGPU] gfx1010 wait count insertion
Stanislav Mekhanoshin [Fri, 3 May 2019 21:53:53 +0000 (21:53 +0000)]
[AMDGPU] gfx1010 wait count insertion

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

llvm-svn: 359938

5 years ago[AMDGPU] gfx1010 s_code_end generation
Stanislav Mekhanoshin [Fri, 3 May 2019 21:26:39 +0000 (21:26 +0000)]
[AMDGPU] gfx1010 s_code_end generation

Also add some missing metadata in the streamer.

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

llvm-svn: 359937

5 years agoUpdate PatternMatcher for FNeg
Cameron McInally [Fri, 3 May 2019 21:19:12 +0000 (21:19 +0000)]
Update PatternMatcher for FNeg

Match both FNeg(X) and FSub(+-0.0, X) in FNeg_match

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

llvm-svn: 359936

5 years ago[AMDGPU] gfx1010 loop alignment
Stanislav Mekhanoshin [Fri, 3 May 2019 21:17:29 +0000 (21:17 +0000)]
[AMDGPU] gfx1010 loop alignment

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

llvm-svn: 359935

5 years ago[COFF, ARM64] Fix ABI implementation of struct returns
Mandeep Singh Grang [Fri, 3 May 2019 21:12:36 +0000 (21:12 +0000)]
[COFF, ARM64] Fix ABI implementation of struct returns

Summary:
Refer the ABI doc at: https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=vs-2019#return-values

Related clang patch: D60349

Reviewers: rnk, efriedma, TomTan, ssijaric

Reviewed By: rnk, efriedma

Subscribers: mstorsjo, javed.absar, kristof.beyls, llvm-commits

Tags: #llvm

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

llvm-svn: 359934

5 years ago[COFF, ARM64] Fix ABI implementation of struct returns
Mandeep Singh Grang [Fri, 3 May 2019 21:12:24 +0000 (21:12 +0000)]
[COFF, ARM64] Fix ABI implementation of struct returns

Summary:
Related llvm patch: D60348.
Patch co-authored by Sanjin Sijaric.

Reviewers: rnk, efriedma, TomTan, ssijaric, ostannard

Reviewed By: efriedma

Subscribers: dmajor, richard.townsend.arm, ostannard, javed.absar, kristof.beyls, cfe-commits

Tags: #clang

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

llvm-svn: 359932

5 years agoFixed some minor style issues in rLLDB359921 [NFC]
Raphael Isemann [Fri, 3 May 2019 21:01:45 +0000 (21:01 +0000)]
Fixed some minor style issues in rLLDB359921 [NFC]

Ran clang-format on the added test file and use the new StringRef
comparison over the temporary ConstStrings. Also aligned the
end of one of the code string literals.

llvm-svn: 359931

5 years ago[test] Make check more strict
Jonas Devlieghere [Fri, 3 May 2019 20:58:56 +0000 (20:58 +0000)]
[test] Make check more strict

Before this change the test would always pass if the path to the test
contained the number 11 in it. Thanks to Ted for pointing this out.

llvm-svn: 359930

5 years ago[lldb] Remove the 'www' folder.
Jonas Devlieghere [Fri, 3 May 2019 20:42:45 +0000 (20:42 +0000)]
[lldb] Remove the 'www' folder.

Now that the new website is live and everything is generated from the
repository, we don't need the www folder anymore.

llvm-svn: 359929

5 years ago[Alias] Add 're' alias for register
Jonas Devlieghere [Fri, 3 May 2019 20:37:09 +0000 (20:37 +0000)]
[Alias] Add 're' alias for register

This patch makes `re` an alias for `register`. Currently `re<TAB>` gives
you the choice between `register` and `reproducer`. Given that you use
`register` a lot more often, it should win for the common substring.

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

llvm-svn: 359927

5 years agoMake lldb-mi optional and change how we deal with missing tools in lit
Jonas Devlieghere [Fri, 3 May 2019 20:33:58 +0000 (20:33 +0000)]
Make lldb-mi optional and change how we deal with missing tools in lit

We don't need the variables in lit, we can use the capabilities to check
if the utility exists.

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

llvm-svn: 359926

5 years agoSupply a default implementation of IsRuntimeSupportValue.
Adrian Prantl [Fri, 3 May 2019 20:28:19 +0000 (20:28 +0000)]
Supply a default implementation of IsRuntimeSupportValue.

Thanks to Pavel for pointing this out.

llvm-svn: 359925

5 years agoShrink SectionChunk by combining Relocs and SectionName sizes
Reid Kleckner [Fri, 3 May 2019 20:17:14 +0000 (20:17 +0000)]
Shrink SectionChunk by combining Relocs and SectionName sizes

SectionChunk is one of the most frequently allocated data structures in
LLD, since there are about four per function when optimizations and
debug info are enabled (.text, .pdata, .xdata, .debug$S).

A PE COFF file cannot be larger than 2GB, so there is an inherent limit
on the length of the section name and the number of relocations.
Decompose the ArrayRef and StringRef into pointer and size, and put them
back together in the accessors for section name and relocation list.

I plan to gather complete performance numbers later by padding
SectionChunk with dead data and measuring performance after all the size
optimizations are done.

llvm-svn: 359923

5 years ago[OPENMP][NVPTX]Improve thread limit counter, NFC.
Alexey Bataev [Fri, 3 May 2019 20:00:38 +0000 (20:00 +0000)]
[OPENMP][NVPTX]Improve thread limit counter, NFC.

Summary:
Patch improves performance of the full runtime mode by moving
thread-limit counter to the shared memory. It also allows to save
global memory.

Reviewers: grokos, gtbercea, kkwli0

Subscribers: guansong, jdoerfert, caomhin, openmp-commits

Tags: #openmp

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

llvm-svn: 359922

5 years agoFix for ambiguous lookup in expressions between local variable and namespace
Shafik Yaghmour [Fri, 3 May 2019 19:59:22 +0000 (19:59 +0000)]
Fix for ambiguous lookup in expressions between local variable and namespace

Summary:
In an Objective-C context a local variable and namespace can cause an ambiguous name lookup when used in an expression. The solution involves mimicking the existing C++ solution which is to add local using declarations for local variables. This causes a different type of lookup to be used which eliminates the namespace during acceptable results filtering.

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

llvm-svn: 359921

5 years ago[Lsan] Disabling explicitally FreeBSD
David Carlier [Fri, 3 May 2019 19:46:55 +0000 (19:46 +0000)]
[Lsan] Disabling explicitally FreeBSD

As it is not implemented upon usage, it just provokes numerous linkage issues so better switch off clearly.

Reviewers: vitalybuka, morehouse

Reviewed By: morehouse

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

llvm-svn: 359920

5 years agoReapply r359906, "RegAllocFast: Add heuristic to detect values not live-out of a...
Matt Arsenault [Fri, 3 May 2019 19:06:57 +0000 (19:06 +0000)]
Reapply r359906, "RegAllocFast: Add heuristic to detect values not live-out of a block"

This reverts commit r359912.

This should pass now, since the clang test was made less fragile in
r359918.

llvm-svn: 359919

5 years agoEnsure there is stack usage in stack size warning test
Matt Arsenault [Fri, 3 May 2019 19:04:14 +0000 (19:04 +0000)]
Ensure there is stack usage in stack size warning test

r359906 broke this because the only stack usage was from a spill which
can be avoided since the only block is a return.

llvm-svn: 359918

5 years ago[CommandLine] Enable Grouping for short options by default. Part 4 of 5
Don Hinton [Fri, 3 May 2019 18:56:25 +0000 (18:56 +0000)]
[CommandLine] Enable Grouping for short options by default.  Part 4 of 5

Summary:
This change enables `cl::Grouping` for short options --
options with names of a single character.  This is consistent with GNU
getopt behavior.

Reviewers: rnk, MaskRay

Reviewed By: MaskRay

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

Tags: #llvm, #clang

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

llvm-svn: 359917

5 years agoAttempt to fix the clang-sphinx-docs bot after r358797
Nico Weber [Fri, 3 May 2019 18:54:18 +0000 (18:54 +0000)]
Attempt to fix the clang-sphinx-docs bot after r358797

llvm-svn: 359916

5 years ago[DAGCombine] Remove repeated variables. NFCI.
Simon Pilgrim [Fri, 3 May 2019 18:20:28 +0000 (18:20 +0000)]
[DAGCombine] Remove repeated variables. NFCI.

llvm-svn: 359915

5 years ago[hwasan] Fix HWASAN_WITH_INTERCEPTORS=OFF build on not-android.
Evgeniy Stepanov [Fri, 3 May 2019 18:20:16 +0000 (18:20 +0000)]
[hwasan] Fix HWASAN_WITH_INTERCEPTORS=OFF build on not-android.

Summary:
I'm not aware of any platforms where this will work, but the code should at least compile.
HWASAN_WITH_INTERCEPTORS=OFF means there is magic in libc that would call __hwasan_thread_enter /
__hwasan_thread_exit as appropriate.

Reviewers: pcc, winksaville

Subscribers: srhines, kubamracek, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 359914

5 years agoRemove else-after-return
David Blaikie [Fri, 3 May 2019 18:11:31 +0000 (18:11 +0000)]
Remove else-after-return

llvm-svn: 359913

5 years agoRevert r359906, "RegAllocFast: Add heuristic to detect values not live-out of a block"
Nico Weber [Fri, 3 May 2019 18:08:03 +0000 (18:08 +0000)]
Revert r359906, "RegAllocFast: Add heuristic to detect values not live-out of a block"

Makes clang/test/Misc/backend-stack-frame-diagnostics-fallback.cpp fail.

llvm-svn: 359912

5 years ago[TargetLowering] SimplifySetCC - remove repeated variable. NFCI.
Simon Pilgrim [Fri, 3 May 2019 18:02:33 +0000 (18:02 +0000)]
[TargetLowering] SimplifySetCC - remove repeated variable. NFCI.

Also reduce scope of Temp variable.

llvm-svn: 359911

5 years ago[CUDA][Clang][Bugfix] Add missing CUDA 9.2 case
Gheorghe-Teodor Bercea [Fri, 3 May 2019 17:59:18 +0000 (17:59 +0000)]
[CUDA][Clang][Bugfix] Add missing CUDA 9.2 case

Summary:
The bug was reported on the OpenMP-dev list:

.../obj-release/lib/clang/9.0.0/include/__clang_cuda_intrinsics.h:173:35: error: '__nvvm_shfl_sync_idx_i32' needs target feature ptx60|ptx61|ptx63|ptx64
__MAKE_SYNC_SHUFFLES(__shfl_sync, __nvvm_shfl_sync_idx_i32,

This problem occurs when trying to compile a .cu file that requires a newer ptx version (>ptx60 in this case) than ptx42.

Reviewers: tra, ABataev, caomhin

Reviewed By: tra

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 359910

5 years ago[CommandLine] Change help output to prefix long options with `--` instead of `-`...
Don Hinton [Fri, 3 May 2019 17:47:29 +0000 (17:47 +0000)]
[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

llvm-svn: 359909

5 years agoRevert "[CodeGenPrepare] limit overflow intrinsic matching to a single basic block"
Evgeniy Stepanov [Fri, 3 May 2019 17:31:49 +0000 (17:31 +0000)]
Revert "[CodeGenPrepare] limit overflow intrinsic matching to a single basic block"

This reverts commit r359879, which introduced a compiler crash.

llvm-svn: 359908

5 years agoMark is_trivially_destructible as unsupported with apple-clang-9
Nico Weber [Fri, 3 May 2019 17:26:17 +0000 (17:26 +0000)]
Mark is_trivially_destructible as unsupported with apple-clang-9

See discussion on https://reviews.llvm.org/D48292

llvm-svn: 359907

5 years agoRegAllocFast: Add heuristic to detect values not live-out of a block
Matt Arsenault [Fri, 3 May 2019 17:03:24 +0000 (17:03 +0000)]
RegAllocFast: Add heuristic to detect values not live-out of a block

Add an improved/new heuristic to catch more cases when values are not
live out of a basic block.

Patch by Matthias Braun

llvm-svn: 359906

5 years ago[hexagon] change AsmParser assertion to error
Brian Cain [Fri, 3 May 2019 16:50:38 +0000 (16:50 +0000)]
[hexagon] change AsmParser assertion to error

For immediates that can't be evaluated in assembler-mapped instructions, we
should return 'invalid operand' instead of assert.

llvm-svn: 359905

5 years ago[Docs][CodeGenerator][eBPF] Correct the values for BPF_X and BPF_K
Yonghong Song [Fri, 3 May 2019 16:40:16 +0000 (16:40 +0000)]
[Docs][CodeGenerator][eBPF] Correct the values for BPF_X and BPF_K

Fix the values of BPF_X and BPF_K according to BPFInstrFormats.td:
"
def BPF_K : BPFSrcType<0x0>;
def BPF_X : BPFSrcType<0x1>;
"

The right value for BPF_X is 0x1, and the right value for BPF_K is 0x0.

Signed-off-by: Wang YanQing <udknight@gmail.com>
Differential Revision: https://reviews.llvm.org/D61512

llvm-svn: 359904

5 years ago[X86] Allow assembly parser to accept x/y/z suffixes on non-memory vfpclassps/pd...
Craig Topper [Fri, 3 May 2019 16:15:15 +0000 (16:15 +0000)]
[X86] Allow assembly parser to accept x/y/z suffixes on non-memory vfpclassps/pd and on memory forms in intel syntax

The x/y/z suffix is needed to disambiguate the memory form in at&t syntax since no xmm/ymm/zmm register is mentioned.

But we should also allow it for the register and broadcast forms where its not needed for consistency. This matches gas.

The printing code will still only use the suffix for the memory form where it is needed.

llvm-svn: 359903

5 years ago[llvm] Revert r231274: "Devirtualize ~parser<T> by making it protected in base classe...
Don Hinton [Fri, 3 May 2019 16:15:13 +0000 (16:15 +0000)]
[llvm] Revert r231274: "Devirtualize ~parser<T> by making it protected in base classes and making derived classes final"

Summary: This patch was previously applied in r231221, and reverted in
r231254 because it broke self-hosting.  It was subsequently fixed and
reapplied in r231274.  Unfortunately, making the `parser<T>` classes
final prevents inheritance which makes it impossible to implement
custom parsers.

Reverting r231221 restores the ability to customize parsers.

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: craig.topper, llvm-commits

Tags: #llvm

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

llvm-svn: 359902

5 years ago[X86] LowerToHorizontalOp - Tidyup calls to getHopForBuildVector. NFCI.
Simon Pilgrim [Fri, 3 May 2019 15:56:06 +0000 (15:56 +0000)]
[X86] LowerToHorizontalOp - Tidyup calls to getHopForBuildVector. NFCI.

Merge the if() tests for the various HADD/SUB + Subtarget tests

llvm-svn: 359901

5 years ago[SelectionDAG] CreateTopologicalOrder - don't use iterator
Simon Pilgrim [Fri, 3 May 2019 15:50:37 +0000 (15:50 +0000)]
[SelectionDAG] CreateTopologicalOrder - don't use iterator

We shouldn't use an iterator to loop across a std::vector when the same loop is adding elements to that std::vector

Found by cppcheck

llvm-svn: 359900

5 years agoAMDGPU: Select VOP3 form of sub
Matt Arsenault [Fri, 3 May 2019 15:37:07 +0000 (15:37 +0000)]
AMDGPU: Select VOP3 form of sub

The VOP3 form should always be the preferred selection form to be
shrunk later.

The r600 sub test needs to be split out because it asserts on the
arguments in the new test during the calling convention lowering.

llvm-svn: 359899

5 years agoAMDGPU: Support shrinking add with FI in SIFoldOperands
Matt Arsenault [Fri, 3 May 2019 15:21:53 +0000 (15:21 +0000)]
AMDGPU: Support shrinking add with FI in SIFoldOperands

Avoids test regression in a future patch

llvm-svn: 359898

5 years agoRevert r359549 - incorrect update of test checks. NFC
Robert Lougher [Fri, 3 May 2019 15:14:19 +0000 (15:14 +0000)]
Revert r359549 - incorrect update of test checks. NFC

llvm-svn: 359897

5 years ago[x86] add tests for fneg with undefs; NFC
Sanjay Patel [Fri, 3 May 2019 15:09:53 +0000 (15:09 +0000)]
[x86] add tests for fneg with undefs; NFC

This was originally part of D61419.

llvm-svn: 359896

5 years agoAMDGPU: Remove redundant patterns for shifts
Matt Arsenault [Fri, 3 May 2019 15:08:36 +0000 (15:08 +0000)]
AMDGPU: Remove redundant patterns for shifts

llvm-svn: 359895

5 years agoAMDGPU: Remove redundant patterns for sub
Matt Arsenault [Fri, 3 May 2019 15:08:35 +0000 (15:08 +0000)]
AMDGPU: Remove redundant patterns for sub

There were 2 patterns for sub, one selecting to sub and one to
subrev. Only one of these will succeed, so remove the reversed one.

llvm-svn: 359894

5 years agoAMDGPU: Add baseline test for future patch
Matt Arsenault [Fri, 3 May 2019 14:54:38 +0000 (14:54 +0000)]
AMDGPU: Add baseline test for future patch

llvm-svn: 359893

5 years ago[OPENMP][NVPTX]Improved several standard OpenMP functions, NFC.
Alexey Bataev [Fri, 3 May 2019 14:47:20 +0000 (14:47 +0000)]
[OPENMP][NVPTX]Improved several standard OpenMP functions, NFC.

Summary:
Used parallelLevel[] counter to simplify and improve implementation of
the existing standard OpenMP functions. Functions are tested already in
several tests, the patch is NFC.

Reviewers: grokos, gtbercea, kkwli0

Subscribers: guansong, jdoerfert, caomhin, openmp-commits

Tags: #openmp

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

llvm-svn: 359892

5 years agoAMDGPU: Replace shrunk instruction with dummy implicit_def
Matt Arsenault [Fri, 3 May 2019 14:40:10 +0000 (14:40 +0000)]
AMDGPU: Replace shrunk instruction with dummy implicit_def

This was broken if the original operand was killed. The kill flag
would appear on both instructions, and fail the verifier. Keep the
kill flag, but remove the operands from the old instruction. This has
an added benefit of really reducing the use count for future folds.

Ideally the pass would be structured more like what PeepholeOptimizer
does to avoid this hack to avoid breaking instruction iterators.

llvm-svn: 359891

5 years ago[TargetLowering] ShrinkDemandedConstant - reduce scope of TLO.DAG variable. NFCI.
Simon Pilgrim [Fri, 3 May 2019 14:38:24 +0000 (14:38 +0000)]
[TargetLowering] ShrinkDemandedConstant - reduce scope of TLO.DAG variable. NFCI.

Only ever used in one block

llvm-svn: 359890

5 years ago[X86] Remove repeated variables. NFCI.
Simon Pilgrim [Fri, 3 May 2019 14:37:00 +0000 (14:37 +0000)]
[X86] Remove repeated variables. NFCI.

llvm-svn: 359889