platform/upstream/llvm.git
4 years ago[llvm-ranlib] Handle -D and -U command line flag
Alex Richardson [Thu, 2 Jan 2020 12:44:02 +0000 (13:44 +0100)]
[llvm-ranlib] Handle -D and -U command line flag

I have been trying to build CheriBSD (a fork for FreeBSD for the CHERI
CPU) with LLVM binutils instead of the default elftoolchain utilities.
I noticed that building static archives was failing because ranlib is
invoked with the -D flag. This failed with llvm-ranlib since it parses
the -D flag as the archive path and reports an error that more than one
archive has been passed.

This fixes https://llvm.org/PR41707

Reviewed By: rupprecht
Differential Revision: https://reviews.llvm.org/D71554

4 years ago[docs] Update path to clang-tools-extra
Alexander Lanin [Thu, 2 Jan 2020 11:28:53 +0000 (19:28 +0800)]
[docs] Update path to clang-tools-extra

Summary:
> tools/clang/tools/extra
has become
>clang-tools-extra
which was not updated in all docs.

Reviewers: alexfh, aaron.ballman, ilya-biryukov, juliehockett

Reviewed By: aaron.ballman

Subscribers: Jim, cfe-commits

Tags: #clang-tools-extra, #clang

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

4 years ago[lldb][NFC] Remove unused variable in DWARFASTParserClang::ParseSingleMember
Raphael Isemann [Thu, 2 Jan 2020 10:57:00 +0000 (11:57 +0100)]
[lldb][NFC] Remove unused variable in DWARFASTParserClang::ParseSingleMember

4 years ago[lldb][NFC] Create type-safe function for creating a CompilerType from a QualType
Raphael Isemann [Mon, 30 Dec 2019 20:20:01 +0000 (21:20 +0100)]
[lldb][NFC] Create type-safe function for creating a CompilerType from a QualType

LLDB frequently converts QualType to CompilerType. This is currently done like this:
    result = CompilerType(this, qual_type_var.getAsOpaquePtr())
There are a few shortcomings in this current approach:
  1. CompilerType's constructor takes a void* pointer so it isn't type safe.
  2. We can't add any sanity checks to the CompilerType constructor (e.g. that the type
     actually belongs to the passed ClangASTContext) without expanding the TypeSystem API.
  3. The logic for converting QualType->CompilerType is spread out over all of LLDB so
     changing it is difficult (e.g., what if we want to just pass the type ptr and not the
     1type_ptr | qual_flags1 to CompilerType).

This patch adds a `ClangASTContext::GetType` function similar to the other GetTypeForDecl
functions that does this conversion in a type safe way.

It also adds a sanity check for Tag-based types that the type actually belongs to the
current ClangASTContext (Types don't seem to know their ASTContext, so we have to
workaround by looking at the decl for the underlying TagDecl. This doesn't cover all types
we construct but it's better than no sanity check).

4 years ago[NFC] Make the type of X86AlignBranchBoundary compatible
Shengchen Kan [Thu, 2 Jan 2020 06:24:13 +0000 (14:24 +0800)]
[NFC] Make the type of X86AlignBranchBoundary compatible

Change the type of X86AlignBranchBoundary from cl::opt<uint64_t> to
cl::opt<unsigned> since the template class cl::opt is only instantiated with
type unsigned, int, std::string, char and bool.

4 years ago[XRay][test] Fix xray-empty-firstmbb.mir and delete incorrect xray-empty-function.mir
Fangrui Song [Thu, 2 Jan 2020 06:14:33 +0000 (22:14 -0800)]
[XRay][test] Fix xray-empty-firstmbb.mir and delete incorrect xray-empty-function.mir

xray-empty-firstmbb.mir does not test the intended code path. Change
xray-instruction-threshold to 0 to exercise the code path.

Delete xray-empty-function.mir . Empty MachineFunction does not work.
Various passes (e.g. MachineDominatorTree) assume the presence of an
entry block.

4 years ago[mlir][spirv] NFC: Move shader ABI attributes to a new file
Lei Zhang [Thu, 2 Jan 2020 03:42:39 +0000 (22:42 -0500)]
[mlir][spirv] NFC: Move shader ABI attributes to a new file

This allows us to include the definitions of these attributes in
other files without pulling in all dependencies for lowering.

Reviewed By: mravishankar

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

4 years ago[mlir][spirv] Fix links in docs and update dialect docs
Lei Zhang [Thu, 2 Jan 2020 03:39:28 +0000 (22:39 -0500)]
[mlir][spirv] Fix links in docs and update dialect docs

Summary:
This commit fixes links to code directories and uses doc links on
mlir.llvm.org where possible. The docs in TableGen dialect definition
is also updated to reflect recent developments.

Reviewed By: mravishankar

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

4 years ago[X86] Add x86_regcallcc calling convention to function declaration recently added...
Craig Topper [Thu, 2 Jan 2020 03:06:05 +0000 (19:06 -0800)]
[X86] Add x86_regcallcc calling convention to function declaration recently added in a test.

The callsite had the calling convention, but not the function itself.

4 years ago[gn build] (manually) merge 68a235d07f9e70
Nico Weber [Thu, 2 Jan 2020 03:06:31 +0000 (22:06 -0500)]
[gn build] (manually) merge 68a235d07f9e70

4 years ago[Coroutines] const-ify internal helpers (NFC)
Brian Gesiak [Thu, 2 Jan 2020 01:24:14 +0000 (20:24 -0500)]
[Coroutines] const-ify internal helpers (NFC)

Several helpers internal to llvm/Transforms/Coroutines do not use
'const' for parameters that are not modified. Add const where possible.

4 years ago[X86] Add test cases for regcall function that takes a long double as a parameter...
Craig Topper [Thu, 2 Jan 2020 02:14:13 +0000 (18:14 -0800)]
[X86] Add test cases for regcall function that takes a long double as a parameter, but does not return a long double.

I believe we are incorrectly doing some FP stack manipulations
after the call.

4 years ago[RegisterClassInfo] Use SmallVector::assign instead of resize to make sure we erase...
Craig Topper [Thu, 2 Jan 2020 01:30:05 +0000 (17:30 -0800)]
[RegisterClassInfo] Use SmallVector::assign instead of resize to make sure we erase previous contents from all entries of the vector.

resize only writes to elements that get added. Any elements that
already existed maintain their previous value. In this case we're
trying to erase cached information so we should use assign which
will write to every element.

Found while trying to add new tests to an existing X86 test and
 noticed register allocation changing in other functions.

4 years ago[Coroutines] Rename "legacy" passes (NFC)
Brian Gesiak [Thu, 2 Jan 2020 01:07:34 +0000 (20:07 -0500)]
[Coroutines] Rename "legacy" passes (NFC)

A series of patches beginning with https://reviews.llvm.org/D71898
propose to add an implementation of the coroutine passes to the new pass
manager. As part of these changes, the coroutine passes that implement
the legacy pass manager interface are renamed, to `<PassName>Legacy`.
This mirrors similar changes that have been made to many other passes in
LLVM as they've been transitioned to support both old and new pass
managers.

This commit splits out the renaming portion of that patch and commits it
in advance as an NFC (no functional change intended) commit. It renames:

* `CoroEarly` => `CoroEarlyLegacy`
* `CoroSplit` => `CoroSplitLegacy`
* `CoroElide` => `CoroElideLegacy`
* `CoroCleanup` => `CoroCleanupLegacy`

4 years agobuild: make `LLVM_ENABLE_ZLIB` a tri-bool for users
Saleem Abdulrasool [Thu, 2 Jan 2020 00:57:00 +0000 (16:57 -0800)]
build: make `LLVM_ENABLE_ZLIB` a tri-bool for users

Treat the flag `LLVM_ENABLE_ZLIB` as a tri-bool, `FORCE_ON` being `ON`,
and `ON` being an auto-detect.  This is needed as many of the builders
enable the flag without having zlib available.

4 years agobuild: reduce CMake handling for zlib
Saleem Abdulrasool [Wed, 1 Jan 2020 23:01:04 +0000 (15:01 -0800)]
build: reduce CMake handling for zlib

Rather than handling zlib handling manually, use `find_package` from CMake
to find zlib properly. Use this to normalize the `LLVM_ENABLE_ZLIB`,
`HAVE_ZLIB`, `HAVE_ZLIB_H`. Furthermore, require zlib if `LLVM_ENABLE_ZLIB` is
set to `YES`, which requires the distributor to explicitly select whether
zlib is enabled or not. This simplifies the CMake handling and usage in
the rest of the tooling.

4 years ago[mlir] Fix -Wrange-loo-analysis warnings
Fangrui Song [Wed, 1 Jan 2020 23:55:14 +0000 (15:55 -0800)]
[mlir] Fix -Wrange-loo-analysis warnings

for (const auto &x : llvm::zip(..., ...))

->

for (auto x : llvm::zip(..., ...))

The return type of zip() is a wrapper that wraps a tuple of references.

> warning: loop variable 'p' is always a copy because the range of type 'detail::zippy<detail::zip_shortest, ArrayRef<long> &, ArrayRef<long> &>' does not return a reference [-Wrange-loop-analysis]

4 years ago[lld] Fix -Wrange-loop-analysis warnings
Fangrui Song [Wed, 1 Jan 2020 23:28:48 +0000 (15:28 -0800)]
[lld] Fix -Wrange-loop-analysis warnings

One instance looks like a false positive:

lld/ELF/Relocations.cpp:1622:14: note: use reference type 'const std::pair<ThunkSection *, uint32_t> &' (aka 'cons
t pair<lld::elf::ThunkSection *, unsigned int> &') to prevent copying
        for (const std::pair<ThunkSection *, uint32_t> ts : isd->thunkSections)

It is not changed in this commit.

4 years ago[polly][Support] Un-break polly tests
Alexandre Ganea [Wed, 1 Jan 2020 22:23:06 +0000 (17:23 -0500)]
[polly][Support] Un-break polly tests
Previously, the polly unit tests were stuck in a infinite loop.
There was an edge case in StringRef::count() introduced by 9f6b13e5cce96066d7262d224c971d93c2724795, where an empty 'Str' would cause the function to never exit.
Also fixed usage in polly.

4 years ago[mlir] Fix compilation warnings
Alexandre Ganea [Wed, 1 Jan 2020 22:05:16 +0000 (17:05 -0500)]
[mlir] Fix compilation warnings

Fixes:
- (MSVC) F:\llvm-project\mlir\lib\Dialect\Linalg\Analysis\DependenceAnalysis.cpp(103): warning C4551: function call missing argument list
- (Clang) tools\mlir\lib\Dialect\SPIRV\SPIRVCanonicalization.inc(232,1): warning: unused function 'populateWithGenerated' [-Wunused-function]

4 years ago[mlir] Fix linking with LLD
Alexandre Ganea [Tue, 31 Dec 2019 19:04:29 +0000 (14:04 -0500)]
[mlir] Fix linking with LLD

The issue is that /WHOLEARCHIVE is interpreted differently in LLD, which needs the same exact path as the .lib; whereas link.exe can take the library name, withoutout a path or extension, if that was already supplied on the cmd-line. I'll write a follow-up patch to fix the issue in LLD.

4 years ago[mlir] Fix warnings when compiling with Clang 9.0
Alexandre Ganea [Tue, 31 Dec 2019 19:00:31 +0000 (14:00 -0500)]
[mlir] Fix warnings when compiling with Clang 9.0

Fixes: warning: comparison of integers of different signs: 'const unsigned int' and '(anonymous namespace)::OperationPrinter::(anonymous enum at F:\llvm-project\mlir\lib\IR\AsmPrinter.cpp:1444:3)' [-Wsign-compare]

4 years agotests: XFAIL/UNSUPPORTED tests on Windows
Saleem Abdulrasool [Wed, 1 Jan 2020 22:19:41 +0000 (14:19 -0800)]
tests: XFAIL/UNSUPPORTED tests on Windows

Now that we are building the python bindings on Windows once more, the
extended testsuite is running.  Mark a few failing tests and skip a few
tests which hang.  This should at least bring the bot back to green
without reverting the Python changes which are an improvement for the
build system and enable another ~35% of the test suite which was
previously disabled.

4 years ago[InstCombine] Preserve inbounds when merging with zero-index GEP (PR44423)
Nikita Popov [Wed, 1 Jan 2020 19:09:40 +0000 (20:09 +0100)]
[InstCombine] Preserve inbounds when merging with zero-index GEP (PR44423)

This addresses https://bugs.llvm.org/show_bug.cgi?id=44423.
If one of the GEPs is inbounds and the other is zero-index,
we can also preserve inbounds.

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

4 years ago[lldb][NFC] Simplify CompilerType constructors/destructors and fix unused variable...
Raphael Isemann [Wed, 1 Jan 2020 21:42:25 +0000 (22:42 +0100)]
[lldb][NFC] Simplify CompilerType constructors/destructors and fix unused variable warning

CompilerType has no virtual functions and no statements in its constructors,
so we can simplify this code. This also allows Clang to emit unused variable warnings
for CompilerType, so I also removed one unused variable that otherwise causes -Werror
builds to fail.

4 years agoRevert "Adds -Wrange-loop-analysis to -Wall"
Mark de Wever [Wed, 1 Jan 2020 21:19:18 +0000 (22:19 +0100)]
Revert "Adds -Wrange-loop-analysis to -Wall"

The sanitizer-x86_64-linux buildbot failed to build lld with -Werror.

This reverts commit d8117542ac57f6051674ca70ea14c0e0d7d9b046.

4 years ago[InstCombine] Fix incorrect inbounds on GEP of GEP (PR44425)
Nikita Popov [Wed, 1 Jan 2020 19:09:40 +0000 (20:09 +0100)]
[InstCombine] Fix incorrect inbounds on GEP of GEP (PR44425)

This fixes https://bugs.llvm.org/show_bug.cgi?id=44425. We need to
drop inbounds if one of the GEPs is not inbounds. This was already
done when creating a new GEP, but not when modifying in place.

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

4 years ago[MachineScheduler] improve reuse of 'releaseNode'method
Lorenzo Casalino [Wed, 1 Jan 2020 19:53:16 +0000 (19:53 +0000)]
[MachineScheduler] improve reuse of 'releaseNode'method

The 'SchedBoundary::releaseNode' is merely invoked for releasing the Top/Bottom root nodes.
However,  'SchedBoundary::releasePending' uses its same logic to check if the Pending queue
has any releasable SUnit.
It is possible to slightly modify the body of the two, allowing re-use of the former ('releaseNode')
in the latter.

Patch by Lorenzo Casalino <lorenzo.casalino93@gmail.com>

Reviewers: MatzeB, fhahn, atrick

Reviewed By: fhahn

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

4 years ago[InstCombine] Add tests for PR44423 and PR44425; NFC
Nikita Popov [Wed, 1 Jan 2020 19:27:20 +0000 (20:27 +0100)]
[InstCombine] Add tests for PR44423 and PR44425; NFC

4 years ago[InstCombine] Regenerate test checks; NFC
Nikita Popov [Wed, 1 Jan 2020 19:25:13 +0000 (20:25 +0100)]
[InstCombine] Regenerate test checks; NFC

4 years ago[InstCombine] Add tests for sub nuw of geps; NFC
Nikita Popov [Wed, 1 Jan 2020 10:15:13 +0000 (11:15 +0100)]
[InstCombine] Add tests for sub nuw of geps; NFC

Tests for PR44419.

4 years ago[X86] Call SimplifyMultipleUseDemandedBits from combineVSelectToBLENDV if the conditi...
Craig Topper [Wed, 1 Jan 2020 18:29:09 +0000 (10:29 -0800)]
[X86] Call SimplifyMultipleUseDemandedBits from combineVSelectToBLENDV if the condition is used by something other than select conditions.

We might be able to bypass some nodes on the condition path.

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

4 years agoAdds -Wrange-loop-analysis to -Wall
Mark de Wever [Wed, 1 Jan 2020 16:23:18 +0000 (17:23 +0100)]
Adds -Wrange-loop-analysis to -Wall

This makes the range loop warnings part of -Wall.

Fixes PR32823: Warn about accidental coping of data in range based for

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

4 years agoImprove Wrange-loop-analyses for rvalue reference
Mark de Wever [Wed, 1 Jan 2020 16:23:20 +0000 (17:23 +0100)]
Improve Wrange-loop-analyses for rvalue reference

The Wrange-loop-analyses warns if a copy is made. Suppress this warning when
a temporary is bound to a rvalue reference.

While fixing this issue also found a copy-paste error in test6, which is also
fixed.

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

4 years agoAdds fixit hints to the -Wrange-loop-analysis
Mark de Wever [Wed, 1 Jan 2020 16:23:19 +0000 (17:23 +0100)]
Adds fixit hints to the -Wrange-loop-analysis

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

4 years ago[NFC] Fixes -Wrange-loop-analysis warnings
Mark de Wever [Wed, 1 Jan 2020 16:23:21 +0000 (17:23 +0100)]
[NFC] Fixes -Wrange-loop-analysis warnings

This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.

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

4 years ago[lldb][NFC] Make some checks more readable in Variable::PrivateAutoComplete
Raphael Isemann [Wed, 1 Jan 2020 17:47:44 +0000 (18:47 +0100)]
[lldb][NFC] Make some checks more readable in Variable::PrivateAutoComplete

4 years ago[ARM] Add +mve feature to mve tests. NFC
David Green [Mon, 30 Dec 2019 13:01:09 +0000 (13:01 +0000)]
[ARM] Add +mve feature to mve tests. NFC

4 years agoclang-tidy doc: Remove severities as they don't make consensus
Sylvestre Ledru [Wed, 1 Jan 2020 11:55:59 +0000 (12:55 +0100)]
clang-tidy doc: Remove severities as they don't make consensus

Reviewers: jdoerfert, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: whisperity, cfe-commits

Tags: #clang

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

4 years agoadd strict float for round operation
Liu, Chen3 [Tue, 31 Dec 2019 03:38:17 +0000 (11:38 +0800)]
add strict float for round operation

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

4 years ago[MC][TargetMachine] Delete MCTargetOptions::MCPIECopyRelocations
Fangrui Song [Wed, 1 Jan 2020 08:15:28 +0000 (00:15 -0800)]
[MC][TargetMachine] Delete MCTargetOptions::MCPIECopyRelocations

clang/lib/CodeGen/CodeGenModule performs the -mpie-copy-relocations
check and sets dso_local on applicable global variables. We don't need
to duplicate the work in TargetMachine shouldAssumeDSOLocal.

Verified that -mpie-copy-relocations can still emit PC relative
relocations for external variable accesses.

clang -target x86_64 -fpie -mpie-copy-relocations -c => R_X86_64_PC32
clang -target aarch64 -fpie -mpie-copy-relocations -c => R_AARCH64_ADR_PREL_PG_HI21+R_AARCH64_LDST64_ABS_LO12_NC

4 years ago[ELF][RISCV][test] Test absolute/PC-relative/branch relocations to undefined weak...
Fangrui Song [Tue, 31 Dec 2019 23:00:59 +0000 (15:00 -0800)]
[ELF][RISCV][test] Test absolute/PC-relative/branch relocations to undefined weak symbols

4 years ago[Attributor] AAValueConstantRange: Value range analysis using constant range
Hideto Ueno [Wed, 1 Jan 2020 06:25:19 +0000 (15:25 +0900)]
[Attributor] AAValueConstantRange: Value range analysis using constant range

This patch introduces `AAValueConstantRange`, which answers a possible range for integer value in a specific program point.
One of the motivations is propagating existing `range` metadata. (I think we need to change the situation that `range` metadata cannot be put to Argument).

The state is a tuple of `ConstantRange` and it is initialized to (known, assumed) = ([-∞, +∞], empty).

Currently, AAValueConstantRange is created when AAValueSimplify cannot
simplify the value.

Supported
 - BinaryOperator(add, sub, ...)
 - CmpInst(icmp eq, ...)
 - !range metadata

`AAValueConstantRange` is not intended to extend to polyhedral range value analysis.

Reviewed By: jdoerfert

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

4 years ago[X86] Fix typo in getCMovOpcode.
Craig Topper [Wed, 1 Jan 2020 05:40:58 +0000 (21:40 -0800)]
[X86] Fix typo in getCMovOpcode.

The 64-bit HasMemoryOperand line was using CMOV32rm instead of
CMOV64rm. Not sure how to test this. We have no test coverage
that passes true for HasMemoryOperand.

4 years ago[X86] Add X87 FCMOV support to X86FlagsCopyLowering.
Craig Topper [Wed, 1 Jan 2020 04:29:41 +0000 (20:29 -0800)]
[X86] Add X87 FCMOV support to X86FlagsCopyLowering.

Fixes PR44396

4 years agoDAG: Stop trying to fold FP -(x-y) -> y-x in getNode with nsz
Matt Arsenault [Mon, 30 Dec 2019 19:46:24 +0000 (14:46 -0500)]
DAG: Stop trying to fold FP -(x-y) -> y-x in getNode with nsz

This was increasing the number of instructions when fsub was legalized
on AMDGPU with no signed zeros enabled. This fold should be guarded by
hasOneUse, and I don't think getNode should be doing that. The same
fold is already done as a regular combine through isNegatibleForFree.

This does require duplicating, even though isNegatibleForFree does
this combine already (and properly checks hasOneUse) to avoid one PPC
regression. In the regression, the outer fneg has nsz but the fsub
operand does not. isNegatibleForFree only sees the operand, and
doesn't see it's used from a nsz context. A nsz parameter needs to be
added and threaded through isNegatibleForFree to avoid this.

4 years ago[ELF][RISCV] Improve error message for unknown relocations
Fangrui Song [Tue, 31 Dec 2019 23:06:31 +0000 (15:06 -0800)]
[ELF][RISCV] Improve error message for unknown relocations

Like rLLD354040.

4 years ago[X86] Constant fold KSHIFT of an all zeros vector to just an all zeros vector.
Craig Topper [Tue, 31 Dec 2019 23:57:17 +0000 (15:57 -0800)]
[X86] Constant fold KSHIFT of an all zeros vector to just an all zeros vector.

4 years ago[X86][InstCombine] Add constant folding and simplification support for pdep and pext
Craig Topper [Tue, 31 Dec 2019 23:06:47 +0000 (15:06 -0800)]
[X86][InstCombine] Add constant folding and simplification support for pdep and pext

The instructions use a mask to either pack disjoint bits together(pext) or spread bits to disjoint locations(pdep). If the mask is all 0s then no bits are extracted or deposited. If the mask is all ones, then the source value is written to the result since no compression or expansion happens. Otherwise if both the source and mask are constant we can walk the bits in the source/mask and calculate the result.

There other crazier things we could do like computeKnownBits or turning pext into shift/and if only a single contiguous range of bits is extracted.

Fixes PR44389

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

4 years ago[X86] Use carry flag from add for (seteq (add X, -1), -1).
Craig Topper [Tue, 31 Dec 2019 23:05:21 +0000 (15:05 -0800)]
[X86] Use carry flag from add for (seteq (add X, -1), -1).

If we just subtracted 1 and are checking if the result is -1. We can use the carry flag from the ADD instead of an explicit CMP. I'm using the same checks for the add users as EmitTest.

Fixes one case from PR44412

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

4 years ago[LegalizeVectorOps][AArch64] Stop asking for v4f16 fp_round and fp_extend to be promoted.
Craig Topper [Tue, 31 Dec 2019 22:04:09 +0000 (14:04 -0800)]
[LegalizeVectorOps][AArch64] Stop asking for v4f16 fp_round and fp_extend to be promoted.

These operations are needed as building blocks for promoting so they
can't be promoted themselves.

This appeared to work because the fp_extend query type for operation
actions is the result type, not the input type so it never triggered
in the legalizer.

For fp_round, the vector op legalizer just ended up creating a
nop fp_extend that was elided by getNode, followed by a nop
fp_round that was also elided by getNode. This was followed by
a final fp_round from v4f32 back to vf416 which was CSEd to the
original node. Then legalize vector ops just believed that node
legalized to itself. LegalizeDAG took another crack at promoting
it, but didn't have a handler so just skipped it with a debug
message saying it wasn't promoted.

This patch just removes the operation actions to avoid this
non-sense. Found while trying to refactor LegalizeVectorOps to
handle multiple result nodes better.

4 years agoAMDGPU: Precommit test showing extra instructions are introduced
Matt Arsenault [Tue, 31 Dec 2019 18:51:52 +0000 (13:51 -0500)]
AMDGPU: Precommit test showing extra instructions are introduced

4 years agoRevert "[Diagnostic] Add ftabstop to -Wmisleading-indentation"
Martin Storsjö [Tue, 31 Dec 2019 19:38:43 +0000 (21:38 +0200)]
Revert "[Diagnostic] Add ftabstop to -Wmisleading-indentation"

This reverts commit b47b35ff51b355a446483777155290541ab64fae.

This caused failed asserts (Assertion `FIDAndOffset.second >
ColNo && "Column number smaller than file offset?"' failed.)
on a source file with a single line containing
"int main (void) { for( int i = 0; i < 9; i++ ); return 0; }".

4 years ago[amdgpu] Fix scoreboard updating on `s_waitcnt_vscnt`.
Michael Liao [Wed, 25 Dec 2019 05:47:18 +0000 (00:47 -0500)]
[amdgpu] Fix scoreboard updating on `s_waitcnt_vscnt`.

Summary: - Other counters are accidentally cleared.

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

Tags: #llvm

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

4 years ago[OPENMP]Emit artificial threprivate vars as threadlocal, if possible.
Alexey Bataev [Tue, 31 Dec 2019 17:41:57 +0000 (12:41 -0500)]
[OPENMP]Emit artificial threprivate vars as threadlocal, if possible.

It may improve performance for declare reduction constructs.

4 years ago[mlir][docs] Remove redundant path prefix
Jacques Pienaar [Tue, 31 Dec 2019 18:56:24 +0000 (10:56 -0800)]
[mlir][docs] Remove redundant path prefix

./ is not needed.

4 years ago[X86] Add test case for opposite branch condition for PR44412. NFC
Craig Topper [Tue, 31 Dec 2019 18:57:58 +0000 (10:57 -0800)]
[X86] Add test case for opposite branch condition for PR44412. NFC

4 years ago[CodeGen] Emit conj/conjf/confjl libcalls as fneg instructions if possible.
Craig Topper [Tue, 31 Dec 2019 18:33:30 +0000 (10:33 -0800)]
[CodeGen] Emit conj/conjf/confjl libcalls as fneg instructions if possible.

We already recognize the __builtin versions of these, might as well
recognize the libcall version.

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

4 years ago[mlir] Make code blocks more consistent
Jacques Pienaar [Tue, 31 Dec 2019 17:52:19 +0000 (09:52 -0800)]
[mlir] Make code blocks more consistent

Use the same form specification for the same type of code.

4 years ago[InstCombine] fold zext of masked bit set/clear
Sanjay Patel [Tue, 31 Dec 2019 17:29:53 +0000 (12:29 -0500)]
[InstCombine] fold zext of masked bit set/clear

This does not solve PR17101, but it is one of the
underlying diffs noted here:
https://bugs.llvm.org/show_bug.cgi?id=17101#c8

We could ease the one-use checks for the 'clear'
(no 'not' op) half of the transform, but I do not
know if that asymmetry would make things better
or worse.

Proofs:
https://rise4fun.com/Alive/uVB

  Name: masked bit set
  %sh1 = shl i32 1, %y
  %and = and i32 %sh1, %x
  %cmp = icmp ne i32 %and, 0
  %r = zext i1 %cmp to i32
  =>
  %s = lshr i32 %x, %y
  %r = and i32 %s, 1

  Name: masked bit clear
  %sh1 = shl i32 1, %y
  %and = and i32 %sh1, %x
  %cmp = icmp eq i32 %and, 0
  %r = zext i1 %cmp to i32
  =>
  %xn = xor i32 %x, -1
  %s = lshr i32 %xn, %y
  %r = and i32 %s, 1

4 years ago[InstCombine] add/adjust tests for masked bit; NFC
Sanjay Patel [Tue, 31 Dec 2019 17:00:07 +0000 (12:00 -0500)]
[InstCombine] add/adjust tests for masked bit; NFC

4 years agoImplement additional traverse() overloads
Stephen Kelly [Sun, 29 Dec 2019 19:21:57 +0000 (19:21 +0000)]
Implement additional traverse() overloads

Summary:
These overloads make it possible to wrap unless(), anyOf(), has() etc
with the traverse matcher.

Reviewers: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years agoUnnest struct in Matcher implementation
Stephen Kelly [Sun, 29 Dec 2019 19:19:55 +0000 (19:19 +0000)]
Unnest struct in Matcher implementation

This allows implementation of the traverse() matcher to surround
matchers like unless().

4 years agoMatch code following lambdas when ignoring invisible nodes
Stephen Kelly [Sun, 29 Dec 2019 19:19:35 +0000 (19:19 +0000)]
Match code following lambdas when ignoring invisible nodes

Reviewers: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[Attributor][Fix] Avoid leaking memory after D68765
Johannes Doerfert [Tue, 31 Dec 2019 16:55:07 +0000 (10:55 -0600)]
[Attributor][Fix] Avoid leaking memory after D68765

4 years agoRevert "[InstCombine] Fix infinite loop due to bitcast <-> phi transforms"
Nikita Popov [Tue, 31 Dec 2019 16:42:38 +0000 (17:42 +0100)]
Revert "[InstCombine] Fix infinite loop due to bitcast <-> phi transforms"

This reverts commit 27a0795943fee0f30b995fe5165428afc2dfd402.

Seems to break test-suite.

4 years ago[PowerPC][NFC] Fix clang-tidy warning
Jinsong Ji [Tue, 31 Dec 2019 16:24:35 +0000 (16:24 +0000)]
[PowerPC][NFC] Fix clang-tidy warning

Reported by
https://results.llvm-merge-guard.org/amd64_debian_testing_clang8-726/clang-tidy.txt

/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/llvm/lib/Target/PowerPC/PPCISelLowering.cpp:11672:10:
warning: invalid case style for variable 'isEQ'
[readability-identifier-naming]
    bool isEQ = (MI.getOpcode() == PPC::ANDI_rec_1_EQ_BIT ||
         ^~~~
         IsEq
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/llvm/lib/Target/PowerPC/PPCISelLowering.cpp:11679:14:
warning: invalid case style for variable 'dl'
[readability-identifier-naming]
    DebugLoc dl = MI.getDebugLoc();
             ^~
             Dl

4 years ago[OpenCL] Remove redundant foreach in OpenCLBuiltins.td; NFC
Sven van Haastregt [Tue, 31 Dec 2019 15:30:02 +0000 (15:30 +0000)]
[OpenCL] Remove redundant foreach in OpenCLBuiltins.td; NFC

Remove various `foreach` declarations where the iterator is used only
once.  This makes the .td file more compact.

4 years ago[AArch64] add test for fsub+fneg; NFC
Sanjay Patel [Tue, 31 Dec 2019 15:25:41 +0000 (10:25 -0500)]
[AArch64] add test for fsub+fneg; NFC

D72015 proposes to restrict the current behavior.

4 years ago[InstCombine] add tests for masked bit set/clear; NFC
Sanjay Patel [Mon, 30 Dec 2019 19:56:57 +0000 (14:56 -0500)]
[InstCombine] add tests for masked bit set/clear; NFC

4 years ago[InstCombine] Fix infinite loop due to bitcast <-> phi transforms
Nikita Popov [Sat, 7 Dec 2019 11:21:22 +0000 (12:21 +0100)]
[InstCombine] Fix infinite loop due to bitcast <-> phi transforms

Fix for https://bugs.llvm.org/show_bug.cgi?id=44245.

The optimizeBitCastFromPhi() and FoldPHIArgOpIntoPHI() end up
fighting against each other, because optimizeBitCastFromPhi()
assumes that bitcasts of loads will get folded. This doesn't happen
here, because a dangling phi node prevents the one-use fold in
https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp#L620-L628 from triggering.

This patch fixes the issue by adding manually removing the old phis.

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

4 years ago[mlir][Linalg] Delete unused LinalgLibraryOps.td
Nicolas Vasilache [Mon, 30 Dec 2019 20:41:12 +0000 (15:41 -0500)]
[mlir][Linalg] Delete unused LinalgLibraryOps.td

Summary: This has been previously renamed to LinalgStructuredOps.td

Reviewers: ftynse

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, llvm-commits, ftynse

Tags: #llvm

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

4 years ago[llvm-exegesis] Check counters before running
Miloš Stojanović [Tue, 31 Dec 2019 13:14:41 +0000 (14:14 +0100)]
[llvm-exegesis] Check counters before running

Check if the appropriate counters for the specified mode are defined on
the target. This is checked before any other work is done.

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

4 years ago[ARM][TypePromotion] Re-enable by default
Sam Parker [Tue, 31 Dec 2019 11:31:06 +0000 (11:31 +0000)]
[ARM][TypePromotion] Re-enable by default

Re-enable the pass after it was reverted and the bug fixed.

4 years agoFix external-names.c test when separator is \\
Michael Platings [Mon, 30 Dec 2019 08:21:42 +0000 (08:21 +0000)]
Fix external-names.c test when separator is \\

This fixes the following failure:

C:\[...]\llvm\tools\clang\test\VFS\external-names.c:34:26: error: CHECK-DEBUG-EXTERNAL: expected string not found in input
// CHECK-DEBUG-EXTERNAL: ![[Num]] = !DIFile(filename: "{{[^"]*}}Inputs{{.}}external-names.h"
                         ^
[...]
<stdin>:42:54: note: possible intended match here
!10 = !DIFile(filename: "C:/[...]\\llvm\\tools\\clang\\test\\VFS\\Inputs\\external-names.h", directory: "")

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

4 years ago[InstCombine] Don't rewrite phi-of-bitcast when the phi has other users
Connor Abbott [Tue, 31 Dec 2019 11:11:35 +0000 (12:11 +0100)]
[InstCombine] Don't rewrite phi-of-bitcast when the phi has other users

Judging by the existing comments, this was the intention, but the
transform never actually checked if the existing phi's would be removed.
See https://bugs.llvm.org/show_bug.cgi?id=44242 for an example where
this causes much worse code generation on AMDGPU.

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

4 years ago[InstCombine] Add tests for PR44242
Connor Abbott [Tue, 31 Dec 2019 11:10:06 +0000 (12:10 +0100)]
[InstCombine] Add tests for PR44242

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

4 years agoclang-tidy doc: modernize-make-unique has an autofix
Sylvestre Ledru [Tue, 31 Dec 2019 10:56:17 +0000 (11:56 +0100)]
clang-tidy doc: modernize-make-unique has an autofix

4 years ago[Attributor] Suppress unused warnings when assertions are disabled. NFC
Ilya Biryukov [Tue, 31 Dec 2019 09:21:52 +0000 (10:21 +0100)]
[Attributor] Suppress unused warnings when assertions are disabled. NFC

4 years ago[Utils] Deal with occasionally deleted functions
Johannes Doerfert [Fri, 11 Oct 2019 01:23:17 +0000 (20:23 -0500)]
[Utils] Deal with occasionally deleted functions

When functions exist for some but not all run lines we need to be
careful when selecting the prefix. So far, a common prefix was
potentially chosen as there was never a "conflict" that would have
caused otherwise. With this patch we avoid common prefixes if they
are used by run lines that do not emit the function.

Reviewed By: lebedev.ri

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

4 years ago[Attributor] Function signature rewrite infrastructure
Johannes Doerfert [Thu, 10 Oct 2019 06:39:16 +0000 (01:39 -0500)]
[Attributor] Function signature rewrite infrastructure

As part of the Attributor manifest we want to change the signature of
functions. This patch introduces a fairly generic interface to do so.
As a first, very simple, use case, we remove unused arguments. A second
use case, pointer privatization, will be committed with this patch as
well.

A lot of the code and ideas are taken from argument promotion and we
run all argument promotion tests through this framework as well.

Reviewed By: uenoku

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

4 years ago[X86] Slightly improve our attempted error recovery for 64-bit -mno-sse2 in LowerCall...
Craig Topper [Tue, 31 Dec 2019 07:41:35 +0000 (23:41 -0800)]
[X86] Slightly improve our attempted error recovery for 64-bit -mno-sse2 in LowerCallResult to use FP1 if there are two return values.

If the return value is a struct of 2 doubles we need two return
registers.

If SSE2 is disabled we can't return in XMM registers like the ABI says.
After logging an error we attempt to recover by using FP0 instead
of an XMM register. But if the return needs two registers, we may have
already used FP0. So if the register we were supposed to copy to is
XMM1, copy to FP1 in the recovery instead.

This seems to fix the assertion/crash in PR44413.

4 years ago[Utils][Fix] Minor test result change
Johannes Doerfert [Tue, 31 Dec 2019 08:11:30 +0000 (02:11 -0600)]
[Utils][Fix] Minor test result change

4 years ago [NFC] Style cleanup
Shengchen Kan [Tue, 31 Dec 2019 08:08:05 +0000 (16:08 +0800)]
 [NFC] Style cleanup

1. make function Is16BitMemOperand static
2. Use Doxygen features in comment
3. Rename functions to make them start with a lower case letter

4 years ago[Utils] Reuse argument variable names in the body
Johannes Doerfert [Fri, 1 Nov 2019 17:51:26 +0000 (12:51 -0500)]
[Utils] Reuse argument variable names in the body

If we have `int foo(int a) { return a; }` and we run with --function-signature
enabled, we want a single variable declaration for `a` which is reused
later.

Reviewed By: lebedev.ri

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

4 years ago[Utils] Allow update_test_checks to scrub attribute annotations
Johannes Doerfert [Fri, 11 Oct 2019 01:32:04 +0000 (20:32 -0500)]
[Utils] Allow update_test_checks to scrub attribute annotations

Attribute annotations on calls, e.g., #0, are not useful on their own.
This patch adds a flag to update_test_checks.py to scrub them.

Reviewed By: lebedev.ri

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

4 years ago[Attributor] Propagate known align from arguments to call sites arguments
Johannes Doerfert [Tue, 31 Dec 2019 07:27:50 +0000 (01:27 -0600)]
[Attributor] Propagate known align from arguments to call sites arguments

Since the information is known we can simply use it at the call site.
This is especially useful for callbacks but also helps regular calls.

The test changes are mechanical.

4 years ago[Attributor] Use abstract call sites to determine associated arguments
Johannes Doerfert [Thu, 10 Oct 2019 06:19:57 +0000 (01:19 -0500)]
[Attributor] Use abstract call sites to determine associated arguments

This is the second step after D67871 to make use of abstract call sites.
In this patch the argument we associate with a abstract call site
argument can be the one in the callback callee instead of the one in the
callback broker.

Caveat: We cannot allow no-alias arguments for problematic callbacks:
As described in [1], adding no-alias (or restrict) to arguments could
break synchronization as the synchronization effect, e.g., a barrier,
does not "alias" with the pointer anymore. This disables no-alias
annotation for potentially problematic arguments until we implement the
fix described in [1].

Reviewed By: uenoku

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

[1] Compiler Optimizations for OpenMP, J. Doerfert and H. Finkel,
    International Workshop on OpenMP 2018,
    http://compilers.cs.uni-saarland.de/people/doerfert/par_opt18.pdf

4 years ago[Attributor] Annotate the memory behavior of call site arguments
Johannes Doerfert [Tue, 31 Dec 2019 06:57:00 +0000 (00:57 -0600)]
[Attributor] Annotate the memory behavior of call site arguments

Especially for callbacks, annotating the call site arguments is
important. Doing so exposed a too strong dependence of AAMemoryBehavior
on AANoCapture since we handle the case of potentially captured pointers
explicitly.

The changes to the tests are all mechanical.

4 years ago[NFC] Make X86MCCodeEmitter::isPCRel32Branch static
Shengchen Kan [Tue, 31 Dec 2019 07:10:08 +0000 (15:10 +0800)]
[NFC] Make X86MCCodeEmitter::isPCRel32Branch static

4 years agoRevert "DebugInfo: Fix rangesBaseAddress DICompileUnit bitcode serialization/deserial...
David Blaikie [Tue, 31 Dec 2019 06:32:08 +0000 (22:32 -0800)]
Revert "DebugInfo: Fix rangesBaseAddress DICompileUnit bitcode serialization/deserialization"

Seeing some curious CFI failures internally - which makes little sense
to me, as I don't think anyone is using this flag (even us,
internally)... so sounds like a bug in my code somewhere (possibly a
latent one that propagating this flag exposed, not sure). Reverting
while I investigate.

This reverts commit c51b45e32ef7f35c11891f60871aa9c2c04cd991.

4 years ago[NFC] Style cleanup
Shengchen Kan [Tue, 31 Dec 2019 06:23:07 +0000 (14:23 +0800)]
[NFC] Style cleanup

1. Remove function is64BitMode() and use STI.hasFeature(X86::Mode16Bit) directly
2. Use Doxygen features in comment
3. Rename functions to make them start with a lower case letter
4. Format the code with clang-format

4 years ago[mlir] Refactor operation results to use a single use list for all results of the...
River Riddle [Tue, 31 Dec 2019 04:49:47 +0000 (20:49 -0800)]
[mlir] Refactor operation results to use a single use list for all results of the operation.

Summary: A new class is added, IRMultiObjectWithUseList, that allows for representing an IR use list that holds multiple sub values(used in this case for OpResults). This class provides all of the same functionality as the base IRObjectWithUseList, but for specific sub-values. This saves a word per operation result and is a necessary step in optimizing the layout of operation results. For now the use list is placed on the operation itself, so zero-result operations grow by a word. When the work for optimizing layout is finished, this can be moved back to being a trailing object based on memory/runtime benchmarking.

Reviewed By: jpienaar

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

4 years ago[TargetLowering][AMDGPU] Make scalarizeVectorLoad return a pair of SDValues instead...
Craig Topper [Tue, 31 Dec 2019 03:07:36 +0000 (19:07 -0800)]
[TargetLowering][AMDGPU] Make scalarizeVectorLoad return a pair of SDValues instead of creating a MERGE_VALUES node. NFCI

This allows us to clean up some places that were peeking through
the MERGE_VALUES node after the call. By returning the SDValues
directly, we can clean that up.

Unfortunately, there are several call sites in AMDGPU that wanted
the MERGE_VALUES and now need to create their own.

4 years ago[SelectionDAG] Fix copy/paste mistake in comment. NFC
Craig Topper [Tue, 31 Dec 2019 02:01:59 +0000 (18:01 -0800)]
[SelectionDAG] Fix copy/paste mistake in comment. NFC

I think this was copied from scalarizeVectorLoad where that is
what happens.

4 years ago[NFC] Add comments in unit test aix-xcoff-toc.ll to clarify the intent
jasonliu [Tue, 31 Dec 2019 03:29:50 +0000 (03:29 +0000)]
[NFC] Add comments in unit test aix-xcoff-toc.ll to clarify the intent

Address David's post review comment in https://reviews.llvm.org/D71667.
Add comments to clarify what we are testing in that file.

4 years ago[X86] Add test case for PR44412. NFC
Craig Topper [Mon, 30 Dec 2019 22:40:56 +0000 (14:40 -0800)]
[X86] Add test case for PR44412. NFC

4 years ago[CodeGen] Use IRBuilder::CreateFNeg for __builtin_conj
Craig Topper [Mon, 30 Dec 2019 21:25:23 +0000 (13:25 -0800)]
[CodeGen] Use IRBuilder::CreateFNeg for __builtin_conj

This replaces the fsub -0.0 idiom with an fneg instruction. We didn't see to have a test that showed the current codegen. Just some tests for constant folding and a test that was only checking the declare lines for libcalls. The latter just checked that we did not have a declare for @conj when using __builtin_conj.

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

4 years ago[CodeGen] Use CreateFNeg in buildFMulAdd
Craig Topper [Mon, 30 Dec 2019 21:24:08 +0000 (13:24 -0800)]
[CodeGen] Use CreateFNeg in buildFMulAdd

We have an fneg instruction now and should use it instead of the fsub -0.0 idiom. Looks like we had no test that showed that we handled the negation cases here so I've added new tests.

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

4 years agoRemove a redundant `default:` on an exhaustive switch(enum).
Eric Astor [Mon, 30 Dec 2019 21:11:28 +0000 (16:11 -0500)]
Remove a redundant `default:` on an exhaustive switch(enum).