platform/upstream/llvm.git
4 years ago[lldb] Improve error message when --func-regex parameter for the breakpoint command...
Raphael Isemann [Mon, 27 Apr 2020 07:11:45 +0000 (09:11 +0200)]
[lldb] Improve error message when --func-regex parameter for the breakpoint command is invalid

Summary:
Currently the breakpoint command is prompting the user to file a bug report if the provided regex is invalid:
```
(lldb) rbreak *foo
error: Function name regular expression could not be compiled: "Inconvertible error value. An error has occurred that could not be converted to a known std::error_code. Please file a bug. repetition-operator operand invalid"
```

The reason is simply that we are using the wrong StringError constructor (the one with the error code as the first parameter
is also printing the string version of the error code, and the inconvertible error code is just an invalid place holder code with
that description). Switching the StringError constructor parameters will only print the error message we get from the regex
engine when we convert the error into a string.

I checked the rest of the code base and I couldn't find the same issue anywhere else.

Fixes rdar://62233561

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

Subscribers: lldb-commits

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

4 years ago[libc++] Mark C++20 Synchronization Library tests as unsupported in C++11
Louis Dionne [Mon, 27 Apr 2020 07:37:51 +0000 (03:37 -0400)]
[libc++] Mark C++20 Synchronization Library tests as unsupported in C++11

The various headers comprising the C++20 Synchronization Library only
contain something in C++ >= 14, not C++ >= 11.

4 years ago[mlir] Don't allocate an operand storage if the operation is known to never have...
River Riddle [Mon, 27 Apr 2020 04:28:32 +0000 (21:28 -0700)]
[mlir] Don't allocate an operand storage if the operation is known to never have operands

Certain classes of operations, such as FuncOp, are known to never have operands. This revision adds a bit to operation to detect this case and avoid allocating the unnecessary operand storage. This saves 1 word for each instance of these operations.

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

4 years ago[mlir] Optimize operand storage such that all operations can have resizable operand...
River Riddle [Mon, 27 Apr 2020 04:28:22 +0000 (21:28 -0700)]
[mlir] Optimize operand storage such that all operations can have resizable operand lists

This revision refactors the structure of the operand storage such that there is no additional memory cost for resizable operand lists until it is required. This is done by using two different internal representations for the operand storage:
* One using trailing operands
* One using a dynamically allocated std::vector<OpOperand>

This allows for removing the resizable operand list bit, and will free up APIs from needing to workaround non-resizable operand lists.

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

4 years ago[mlir] Optimize the allocation of resizable operand lists
River Riddle [Mon, 27 Apr 2020 04:28:11 +0000 (21:28 -0700)]
[mlir] Optimize the allocation of resizable operand lists

This revision optimizes resizable operand lists by allocating them in the same location as the trailing operands. This has numerous benefits:
* If the operation has at least one operand at construction time, there is 0 additional memory overhead to the resizable storage.
* There is less pointer arithmetic necessary as the resizable storage is now only used when the operands are dynamically allocated.

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

4 years ago[X86][CostModel] Fix typos in test. NFC
Craig Topper [Mon, 27 Apr 2020 04:08:17 +0000 (21:08 -0700)]
[X86][CostModel] Fix typos in test. NFC

4 years ago[NFC][DAGCombine] Adding three helper functions and change the getNegatedExpression...
QingShan Zhang [Mon, 27 Apr 2020 03:46:42 +0000 (03:46 +0000)]
[NFC][DAGCombine] Adding three helper functions and change the getNegatedExpression to negateExpression

This is a NFC patch for D77319. The idea is to hide the getNegatibleCost inside the getNegatedExpression()
to have it return null if the cost is expensive, and add some helper function for easy to use. And
rename the old getNegatedExpression to negateExpression to avoid the semantic conflict.

Reviewed By: RKSimon

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

4 years ago[AMDGPU] Expose llvm fence instruction as clang intrinsic
Saiyedul Islam [Mon, 27 Apr 2020 02:56:03 +0000 (08:26 +0530)]
[AMDGPU] Expose llvm fence instruction as clang intrinsic

Expose llvm fence instruction as clang builtin for AMDGPU target

__builtin_amdgcn_fence(unsigned int memoryOrdering, const char *syncScope)

The first argument of this builtin is one of the memory-ordering specifiers
__ATOMIC_ACQUIRE, __ATOMIC_RELEASE, __ATOMIC_ACQ_REL, or __ATOMIC_SEQ_CST
following C++11 memory model semantics. This is mapped to corresponding
LLVM atomic memory ordering for the fence instruction using LLVM atomic C
ABI. The second argument is an AMDGPU-specific synchronization scope
defined as string.

Reviewed By: sameerds

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

4 years ago[llvm-objcopy][MachO] Fix segment's vmsize
Alexander Shaposhnikov [Fri, 24 Apr 2020 07:58:27 +0000 (00:58 -0700)]
[llvm-objcopy][MachO] Fix segment's vmsize

This diff fixes the calculation of the field vmsize
in LC_SEGMENT/LC_SEGMENT_64 load commands.

Test plan: make check-all

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

4 years ago[X86] Add cost model tests for conversions between <2 x float> and integers.
Craig Topper [Sun, 26 Apr 2020 22:04:49 +0000 (15:04 -0700)]
[X86] Add cost model tests for conversions between <2 x float> and integers.

For all but 2 x i32 we were starting from 4 x float.

4 years ago[X86] Add cost table entry for v2i32->v2f64 fp_to_uint with avx512.
Craig Topper [Sun, 26 Apr 2020 21:02:21 +0000 (14:02 -0700)]
[X86] Add cost table entry for v2i32->v2f64 fp_to_uint with avx512.

We're currently getting this from the default implementation. But
I don't like how the cost model came to this answer and I might
be making some changes there.

4 years ago[clangd] Strip /showIncludes in clangd compile commands
Arthur Eubanks [Fri, 24 Apr 2020 23:08:36 +0000 (16:08 -0700)]
[clangd] Strip /showIncludes in clangd compile commands

In command lines with /showIncludes, clangd would output includes to stdout, breaking clients.

Summary: Fixes https://github.com/clangd/clangd/issues/322.

Reviewers: sammccall, kadircet

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

Tags: #clang

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

4 years ago[TableGen] Simplify with TGParser::consume()
Fangrui Song [Sun, 26 Apr 2020 22:16:07 +0000 (15:16 -0700)]
[TableGen] Simplify with TGParser::consume()

4 years ago[clangd] Fold buildAST into ParsedAST::build. NFCI
Sam McCall [Sun, 26 Apr 2020 22:13:56 +0000 (00:13 +0200)]
[clangd] Fold buildAST into ParsedAST::build. NFCI

4 years ago[mlir][DenseStringAttr] Fix support for splat detection and iteration
River Riddle [Sun, 26 Apr 2020 20:52:50 +0000 (13:52 -0700)]
[mlir][DenseStringAttr] Fix support for splat detection and iteration

This revision also adds proper tests for splat detection.

4 years ago[ViewCFG] Allow printing edge weights in debuggers
Hongtao Yu [Sun, 26 Apr 2020 18:22:16 +0000 (11:22 -0700)]
[ViewCFG] Allow printing edge weights in debuggers

Summary:
Extending the Function::viewCFG prototypes to allow for printing block probability info in form of .dot files during debugging.

Also avoiding an AV when no BFI/BPI available.

Reviewers: wenlei, davidxl, knaumov

Reviewed By: wenlei, davidxl

Subscribers: MaskRay, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoAMDGPU: Add some missing atomics tests
Matt Arsenault [Sun, 26 Apr 2020 15:11:43 +0000 (11:11 -0400)]
AMDGPU: Add some missing atomics tests

We had no FP atomic load/store coverage.

4 years ago[Lexicon] fix typo "may is" -> "is"
Sergei Trofimovich [Sun, 26 Apr 2020 18:35:05 +0000 (19:35 +0100)]
[Lexicon] fix typo "may is" -> "is"

Reviewers: MaskRay

Reviewed By: MaskRay

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[IR] Since AttributeSets are sorted, binary search them.
Benjamin Kramer [Sun, 26 Apr 2020 18:03:29 +0000 (20:03 +0200)]
[IR] Since AttributeSets are sorted, binary search them.

Not likely to make a big difference, but there's a fair bit of pointer
chasing in large sets.

4 years ago[LV] Fix recording of BranchTakenCount for FoldTail
Ayal Zaks [Sat, 25 Apr 2020 00:44:38 +0000 (03:44 +0300)]
[LV] Fix recording of BranchTakenCount for FoldTail

When folding tail, branch taken count is computed during initial VPlan execution
and recorded to be used by the compare computing the loop's mask. This recording
should directly set the State, instead of reusing Value2VPValue mapping which
serves original Values present prior to vectorization.
The branch taken count may be a constant Value, which may be used elsewhere in
the loop; trying to employ Value2VPValue for both leads to the issue reported in
https://reviews.llvm.org/D76992#inline-721028

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

4 years ago[DSE,MSSA] Continue checking more remaining candidates with dbgcnt.
Florian Hahn [Thu, 23 Apr 2020 17:58:33 +0000 (18:58 +0100)]
[DSE,MSSA] Continue checking more remaining candidates with dbgcnt.

After changing the candidate iteration strategy, we should continue with
the next candidate, rather than breaking out of the loop.

4 years ago[clang-tidy] Use StringSwitch in a bunch of places. NFCI.
Benjamin Kramer [Sun, 26 Apr 2020 15:23:30 +0000 (17:23 +0200)]
[clang-tidy] Use StringSwitch in a bunch of places. NFCI.

4 years ago[InstCombine] updated test comments; NFC
Sanjay Patel [Sun, 26 Apr 2020 12:45:08 +0000 (08:45 -0400)]
[InstCombine] updated test comments; NFC

As suggested in review for:
rG4abab5c5ca7b

4 years agoSort EnumAttr so it matches Attribute::operator<
Benjamin Kramer [Sun, 26 Apr 2020 14:52:53 +0000 (16:52 +0200)]
Sort EnumAttr so it matches Attribute::operator<

This means AttrBuilder will always create a sorted set of attributes and
we can skip the sorting step. Sorting attributes is surprisingly
expensive, and I recently made it worse by making it use array_pod_sort.

4 years ago[polly] Don't include PassSupport.h directly - include via Pass.h
Simon Pilgrim [Sun, 26 Apr 2020 14:51:32 +0000 (15:51 +0100)]
[polly] Don't include PassSupport.h directly - include via Pass.h

Missed this in D78815

4 years agoRe-land [MC] Fix quadratic behavior in addPendingLabel
Alexandre Ganea [Sun, 26 Apr 2020 14:39:30 +0000 (10:39 -0400)]
Re-land [MC] Fix quadratic behavior in addPendingLabel

This was discovered when compiling large unity/blob/jumbo files.

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

4 years ago[X86][SSE] getFauxShuffle - support insert(truncate/extend(extract(vec0,c0)),vec1...
Simon Pilgrim [Sun, 26 Apr 2020 14:31:01 +0000 (15:31 +0100)]
[X86][SSE] getFauxShuffle - support insert(truncate/extend(extract(vec0,c0)),vec1,c1) shuffle patterns at the byte level

Followup to the PR45604 fix at rGe71dd7c011a3 where we disabled most of these cases.

By creating the shuffle at the byte level we can handle any extension/truncation as long as we track how small the scalar got and assume that the upper bytes will need to be zero.

4 years agoX86ISelDAGToDAG.cpp - remove unnecessary includes. NFC.
Simon Pilgrim [Sun, 26 Apr 2020 13:50:39 +0000 (14:50 +0100)]
X86ISelDAGToDAG.cpp - remove unnecessary includes. NFC.
The X86 specific headers have to include these so we don't need to duplicate.

4 years agoMachineFunction.h - reduce includes to forward declarations. NFC.
Simon Pilgrim [Sun, 26 Apr 2020 12:49:57 +0000 (13:49 +0100)]
MachineFunction.h - reduce includes to forward declarations. NFC.

4 years agoX86MCTargetDesc.h - remove unused DataType.h include. NFC.
Simon Pilgrim [Sun, 26 Apr 2020 12:47:19 +0000 (13:47 +0100)]
X86MCTargetDesc.h - remove unused DataType.h include. NFC.

4 years agoX86MCTargetDesc.cpp - remove MSVC intrin.h include. NFC.
Simon Pilgrim [Sun, 26 Apr 2020 12:37:51 +0000 (13:37 +0100)]
X86MCTargetDesc.cpp - remove MSVC intrin.h include. NFC.

This was needed when the file called cpuid but that was removed at rL233170.

4 years agoX86MacroFusion.h - reduce MachineScheduler.h include. NFC.
Simon Pilgrim [Sun, 26 Apr 2020 12:17:45 +0000 (13:17 +0100)]
X86MacroFusion.h - reduce MachineScheduler.h include. NFC.
We only need a ScheduleDAGMutation forward declaration.

4 years agoraw_ostream_test: Add a missing buffer flush
Benjamin Kramer [Sun, 26 Apr 2020 13:18:25 +0000 (15:18 +0200)]
raw_ostream_test: Add a missing buffer flush

4 years ago[clangd] Disable delayed template parsing in the main file
Sam McCall [Sat, 25 Apr 2020 01:03:01 +0000 (03:03 +0200)]
[clangd] Disable delayed template parsing in the main file

Summary:
This is on by default in windows and breaks most features in template bodies.
We'd already disabled it in code completion, now disable it for building ASTs.

Potential regressions:
 - we may give spurious errors where files with templates relying on delayed
   parsing are directly opened
 - we may misparse such template bodies that are instantiated (and therefore
   *were* previously parsed)

Still *probably* a win overall. Avoiding the regressions entirely would be
substantial work and we don't have plans for it now.

Fixes https://github.com/clangd/clangd/issues/302 (again)

Reviewers: kadircet

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

Tags: #clang

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

4 years ago[SCCP] Support ranges for loads and stores.
Florian Hahn [Sun, 26 Apr 2020 10:54:35 +0000 (11:54 +0100)]
[SCCP] Support ranges for loads and stores.

Integer ranges can be used for loaded/stored values. Note that widening
can be disabled for loads/stores, as we only rely on instructions that
cause continued increases to ranges to be widened (like binary
operators).

Reviewers: efriedma, mssimpso, davide

Reviewed By: efriedma

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

4 years ago[SCCP] Add load/store test for integer ranges.
Florian Hahn [Sat, 18 Apr 2020 18:49:32 +0000 (19:49 +0100)]
[SCCP] Add load/store test for integer ranges.

4 years agoraw_ostream: Simplify code a bit. NFCI.
Benjamin Kramer [Sun, 26 Apr 2020 12:05:55 +0000 (14:05 +0200)]
raw_ostream: Simplify code a bit. NFCI.

4 years ago[Pass] Ensure we don't include PassSupport.h or PassAnalysisSupport.h directly
Simon Pilgrim [Sun, 26 Apr 2020 11:57:57 +0000 (12:57 +0100)]
[Pass] Ensure we don't include PassSupport.h or PassAnalysisSupport.h directly

Both PassSupport.h and PassAnalysisSupport.h are only supposed to be included via Pass.h.

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

4 years ago[SveEmitter] Add IsAppendSVALL and builtins for svptrue and svcnt[bhwd]
Sander de Smalen [Sun, 26 Apr 2020 11:31:10 +0000 (12:31 +0100)]
[SveEmitter] Add IsAppendSVALL and builtins for svptrue and svcnt[bhwd]

Some ACLE builtins leave out the argument to specify the predicate
pattern, which is expected to be expanded to an SV_ALL pattern.

This patch adds the flag IsAppendSVALL to append SV_ALL as the final
operand.

Reviewers: SjoerdMeijer, efriedma, rovka, rengolin

Reviewed By: efriedma

Tags: #clang

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

4 years ago[CMake] Fix logic error: NOT LIBCLANG_BUILD_STATIC does not imply PIC
David Zarzycki [Sun, 26 Apr 2020 11:02:32 +0000 (07:02 -0400)]
[CMake] Fix logic error: NOT LIBCLANG_BUILD_STATIC does not imply PIC

4 years agoX86Operand.h - remove unnecessary includes. NFC.
Simon Pilgrim [Sun, 26 Apr 2020 11:11:49 +0000 (12:11 +0100)]
X86Operand.h - remove unnecessary includes. NFC.

4 years agoAMDGPU/Utils - cleanup include and forward declarations. NFC.
Simon Pilgrim [Sun, 26 Apr 2020 11:06:28 +0000 (12:06 +0100)]
AMDGPU/Utils - cleanup include and forward declarations. NFC.
Remove unused includes + forward declarations.
Reduce unnecessary StringRef.h includes to StringRef forward declaration.

4 years ago[IR] Simplify code to print string attributes a bit. NFC.
Benjamin Kramer [Sun, 26 Apr 2020 11:06:50 +0000 (13:06 +0200)]
[IR] Simplify code to print string attributes a bit. NFC.

4 years agoDefault raw_string_ostream to be unbuffered
Benjamin Kramer [Sun, 26 Apr 2020 10:45:57 +0000 (12:45 +0200)]
Default raw_string_ostream to be unbuffered

raw_string_ostream can just use the std::string as a buffer. The buffer
requirement came from the days when the minimum buffer size was 128
(fixed in 2015) and std::string was non-SSO. Now we can just use the
inline capacity for small things and on a good growth strategy later.

This assumes that the standard library isn't doing something bad like
only growing to the exact size. I checked some common implementations
and they grow by 2x (libc++) or 1.5x (msvc) which is reasonable. We
should still check if this incurs any performance regressions though.

4 years ago[TableGen] Delete unused Record::resolveReferencesTo() after D44478. NFC
Fangrui Song [Sun, 26 Apr 2020 08:21:36 +0000 (01:21 -0700)]
[TableGen] Delete unused Record::resolveReferencesTo() after D44478. NFC

4 years ago[CaptureTracking] Make MaxUsesToExplore cheaper (NFC)
Nikita Popov [Thu, 23 Apr 2020 16:17:51 +0000 (18:17 +0200)]
[CaptureTracking] Make MaxUsesToExplore cheaper (NFC)

The change in D78624 had a noticeable negative compile-time impact.
It seems that going through a function call for the MaxUsesToExplore
default is fairly expensive, at least if LLVM is not built with LTO.

This patch makes MaxUsesToExpore default to 0 and assigns the actual
default in the implementation instead. This recovers most of the
regression.

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

4 years ago[GVN] Reduce expression size (NFC)
Nikita Popov [Wed, 22 Apr 2020 19:43:07 +0000 (21:43 +0200)]
[GVN] Reduce expression size (NFC)

Reduce size of GVN::Expression by reordering fields to reduce padding.

4 years ago[IR] Use map for string attributes (NFC)
Nikita Popov [Sat, 25 Apr 2020 10:21:21 +0000 (12:21 +0200)]
[IR] Use map for string attributes (NFC)

Attributes are currently stored as a simple list. Enum attributes
additionally use a bitset to allow quickly determining whether an
attribute is set. String attributes on the other hand require a
full scan of the list. As functions tend to have a lot of string
attributes (at least when clang is used), this is a noticeable
performance issue.

This patch adds an additional name => attribute map to the
AttributeSetNode, which allows querying string attributes quickly.
This results in a 3% reduction in instructions retired on CTMark.
Changes to memory usage seem to be in the noise (attribute sets are
uniqued, and we don't tend to have more than a few dozen or hundred
unique attribute sets, so adding an extra map does not have a
noticeable cost.)

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

4 years ago[X86] Fix the cost of v16i1->v16i16 sext/zext on avx targets.
Craig Topper [Sun, 26 Apr 2020 06:00:57 +0000 (23:00 -0700)]
[X86] Fix the cost of v16i1->v16i16 sext/zext on avx targets.

Previously we were hitting the scalarization case in the default
implementation.

4 years ago[X86][CostModel] Improve costs for vXi1 sign_extend/zero_extend with avx512.
Craig Topper [Sun, 26 Apr 2020 04:37:10 +0000 (21:37 -0700)]
[X86][CostModel] Improve costs for vXi1 sign_extend/zero_extend with avx512.

With avx512 vXi1 is legal and uses k-registers with many custom cases
for extending.

4 years ago[X86][CostModel] Add sext/zext from vXi1 tests to min-legal-vector-width.ll. NFC
Craig Topper [Sun, 26 Apr 2020 01:35:59 +0000 (18:35 -0700)]
[X86][CostModel] Add sext/zext from vXi1 tests to min-legal-vector-width.ll. NFC

We aren't properly costing extends from k-registers. I also added
command lines without avx512bw to be able to show all the different
extending strategies we have.

4 years ago[TableGen] Add TGParser::consume()
Fangrui Song [Sun, 26 Apr 2020 04:05:19 +0000 (21:05 -0700)]
[TableGen] Add TGParser::consume()

4 years ago[NFC][PowerPC] Add the killed flag for the case expand-isel-liveness.mir
Kang Zhang [Sun, 26 Apr 2020 04:40:20 +0000 (04:40 +0000)]
[NFC][PowerPC] Add the killed flag for the case expand-isel-liveness.mir

4 years ago[clangd] Enable textual fallback for go-to-definition on dependent names
Nathan Ridge [Thu, 19 Mar 2020 20:28:53 +0000 (16:28 -0400)]
[clangd] Enable textual fallback for go-to-definition on dependent names

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[SourceMgr] Tidy up the SourceMgr header file to include less stuff.
Chris Lattner [Sat, 25 Apr 2020 21:39:31 +0000 (14:39 -0700)]
[SourceMgr] Tidy up the SourceMgr header file to include less stuff.

Summary:
Specifically make some simple refactorings to get PointerUnion.h and
Twine.h out of the public includes.  While here, trim out a lot of
transitive includes as well.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agollvm-tblgen -gen-dag-isel: Hoist SmallVector TmpBuf
Fangrui Song [Sun, 26 Apr 2020 03:16:35 +0000 (20:16 -0700)]
llvm-tblgen -gen-dag-isel: Hoist SmallVector TmpBuf

4 years ago[NFC][PowerPC] Add a new test case in expand-isel-liveness.mir
Kang Zhang [Sun, 26 Apr 2020 03:15:54 +0000 (03:15 +0000)]
[NFC][PowerPC] Add a new test case in expand-isel-liveness.mir

4 years agollvm-tblgen -gen-dag-isel: Reduce lib/Target/*/*GenDAGISel.inc
Fangrui Song [Sun, 26 Apr 2020 02:55:26 +0000 (19:55 -0700)]
llvm-tblgen -gen-dag-isel: Reduce lib/Target/*/*GenDAGISel.inc

X86GenDAGISel.inc: 22597697 bytes -> 20874981 bytes

4 years ago[X86] Shrink lib/Target/X86/X86GenDisassemblerTables.inc
Fangrui Song [Sun, 26 Apr 2020 02:13:16 +0000 (19:13 -0700)]
[X86] Shrink lib/Target/X86/X86GenDisassemblerTables.inc

6330853 bytes -> 5207842 bytes

4 years ago[AVR][NFC] Move preprocessor tests to Preprocessor directory
Ayke van Laethem [Tue, 14 Apr 2020 22:37:44 +0000 (00:37 +0200)]
[AVR][NFC] Move preprocessor tests to Preprocessor directory

These tests were placed in the CodeGen directory while they really
should have been placed in the Preprocessor directory.

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

4 years ago[TableGen] Drop deprecated leading # when parsing a SimpleValue
Fangrui Song [Sat, 25 Apr 2020 22:40:14 +0000 (15:40 -0700)]
[TableGen] Drop deprecated leading # when parsing a SimpleValue

4 years ago[TableGen] Drop deprecated leading # operation (NOP) and replace ## with #
Fangrui Song [Sat, 25 Apr 2020 22:58:40 +0000 (15:58 -0700)]
[TableGen] Drop deprecated leading # operation (NOP) and replace ## with #

4 years ago[builtins] Support architectures with 16-bit int
Ayke van Laethem [Wed, 22 Apr 2020 18:25:22 +0000 (20:25 +0200)]
[builtins] Support architectures with 16-bit int

This is the first patch in a series to add support for the AVR target.
This patch includes changes to make compiler-rt more target independent
by not relying on the width of an int or long.

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

4 years ago[X86] Improve lowering of v16i8->v16i1 truncate under prefer-vector-width=256.
Craig Topper [Sat, 25 Apr 2020 22:00:19 +0000 (15:00 -0700)]
[X86] Improve lowering of v16i8->v16i1 truncate under prefer-vector-width=256.

4 years ago[docs] Fix :option: links
Jon Roelofs [Sat, 25 Apr 2020 22:19:02 +0000 (16:19 -0600)]
[docs] Fix :option: links

4 years ago[SourceMgr/MLIR diagnostics] Introduce a new method to speed things up
Chris Lattner [Sat, 25 Apr 2020 19:02:12 +0000 (12:02 -0700)]
[SourceMgr/MLIR diagnostics] Introduce a new method to speed things up

Summary:
This introduces a new SourceMgr::FindLocForLineAndColumn method that
uses the OffsetCache in SourceMgr::SrcBuffer to do do a constant time
lookup for the line number (once the cache is populated).

Use this method in MLIR's SourceMgrDiagnosticHandler::convertLocToSMLoc,
replacing the O(n) scanning logic.  This resolves a long standing TODO
in MLIR, and makes one of my usecases go dramatically faster (which is
currently producing many diagnostics in a 40MB SourceBuffer).

NFC, this is just a performance speedup and cleanup.

Reviewers: rriddle!, ftynse!

Subscribers: hiraditya, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, grosul1, frgossen, Kayjukh, llvm-commits

Tags: #llvm

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

4 years agoAdjust namespace to make GCC 6 happy
Benjamin Kramer [Sat, 25 Apr 2020 20:42:12 +0000 (22:42 +0200)]
Adjust namespace to make GCC 6 happy

LinalgOps.cpp:232:71: error: specialization of 'template<class GenericOpType> static mlir::LogicalResult {anonymous}::BlockArgsVerifier<GenericOpType>::verify(GenericOpType, mlir::Block&)' in different namespace [-fpermissive]

4 years ago[TableGen] [NFC] Make argv0 const
Alex Brachet [Sat, 25 Apr 2020 20:42:32 +0000 (16:42 -0400)]
[TableGen] [NFC] Make argv0 const

`argv0` was never being modified. No changes made except to the type.

Reviewed By: RKSimon

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

4 years ago[X86] Add avx512vl to the truncate cost model test. NFC
Craig Topper [Sat, 25 Apr 2020 17:49:46 +0000 (10:49 -0700)]
[X86] Add avx512vl to the truncate cost model test. NFC

4 years agoX86ISelLowering.h - remove unnecessary includes. NFC.
Simon Pilgrim [Sat, 25 Apr 2020 19:07:15 +0000 (20:07 +0100)]
X86ISelLowering.h - remove unnecessary includes. NFC.
Fixed implicit MachineFrameInfo.h dependency in X86SelectionDAGInfo.cpp

4 years ago[Support] Fix fragile ThreadPool test
Alexandre Ganea [Sat, 25 Apr 2020 19:05:53 +0000 (15:05 -0400)]
[Support] Fix fragile ThreadPool test

The test ThreadPoolTest.AllThreads_UseAllRessources occasionally fails on the bots: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/32015/steps/test-check-all/logs/FAIL%3A%20LLVM-Unit%3A%3AThreadPoolTest.AllThreads_UseAllRessources

This is because jobs were executed too fast on the first CPU socket, and never manage to reach the second CPU socket.

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

4 years agollvm: IPO: handle IRMover error handling, bug #45636
Sergei Trofimovich [Sat, 25 Apr 2020 18:15:08 +0000 (19:15 +0100)]
llvm: IPO: handle IRMover error handling, bug #45636

Summary:
Missing error mangling is noticed in
https://bugs.llvm.org/show_bug.cgi?id=45636
where inconsistent profiling input caused
llvm/lld to crash as:

```
Program aborted due to an unhandled Error:
linking module flags 'ProfileSummary':
  IDs have conflicting values in 'Mutex_posix.o' and 'nsBrowserApp.o'
```

The change does not change the fact that LLVM crashes
but changes error output to say what was incorrect:

```
LLVM ERROR: Function Import: link error:
  linking module flags 'ProfileSummary':
    IDs have conflicting values in 'Mutex_posix.o' and 'nsBrowserApp.o'
```

Actual crash has yet to be fixed.

Reviewers: lattner

Reviewed By: lattner

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoRework DATA statement semantics to use typed expressions
peter klausler [Fri, 24 Apr 2020 20:54:11 +0000 (13:54 -0700)]
Rework DATA statement semantics to use typed expressions

Summary:
Updates recent work on DATA statement semantic checking in
flang/lib/Semantics/check-data.{h,cpp} to use the compiler's
internal representation for typed expressions rather than working
on the raw parse tree.  Saves the analyzed expressions for DATA
statement values as parse tree decorations because they'll soon be
needed in lowering.  Corrects wording of some error messages.

Fixes a bug in constant expression checking: structure constructors
are not constant expressions if they set an allocatable component
to anything other than NULL.

Includes infrastructure changes to make this work, some renaming
to reflect the fact that the implied DO loop indices tracked by
expression analysis are not (just) from array constructors, remove
some dead code, and improve some comments.

Reviewers: tskeith, sscalpone, jdoerfert, DavidTruby, anchu-rajendran, schweitz

Reviewed By: tskeith, anchu-rajendran, schweitz

Subscribers: llvm-commits, flang-commits

Tags: #flang, #llvm

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

4 years ago[lld][WebAssembly] Fix crash on function signature mismatch with --relocatable
Sam Clegg [Fri, 24 Apr 2020 00:57:00 +0000 (17:57 -0700)]
[lld][WebAssembly] Fix crash on function signature mismatch with --relocatable

These stub new function were not being added to the symbol table
which in turn meant that we were crashing when trying to output
relocations against them.

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

4 years agolibclang: Add static build support for Windows
Cristian Adam [Sat, 25 Apr 2020 17:12:21 +0000 (20:12 +0300)]
libclang: Add static build support for Windows

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

4 years ago[Attributor] Do not set 'returned' attribute for arguments that cannot be bitcasted...
Sergey Dmitriev [Sat, 25 Apr 2020 16:33:50 +0000 (09:33 -0700)]
[Attributor] Do not set 'returned' attribute for arguments that cannot be bitcasted to function result

Reviewers: jdoerfert, sstefan1, uenoku

Reviewed By: jdoerfert

Subscribers: hiraditya, uenoku, llvm-commits

Tags: #llvm

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

4 years ago[MLIR] Replace splitBlock() with createBlock in GenericAtomicRMWOp lowering.
Alexander Belyaev [Sat, 25 Apr 2020 15:35:49 +0000 (17:35 +0200)]
[MLIR] Replace splitBlock() with createBlock in GenericAtomicRMWOp lowering.

`addArgument()` is not undoable and should not be used in
ConversionPattern, therefore replacing `splitBlock()` with
`createBlock()`, that creates a block with specified args.

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

4 years ago[x86] use vector instructions to lower even more FP->int->FP casts
Sanjay Patel [Sat, 25 Apr 2020 15:38:54 +0000 (11:38 -0400)]
[x86] use vector instructions to lower even more FP->int->FP casts

This is another enhancement to D77895/D78362
to avoid a round-trip from XMM->GPR->XMM.
This time we handle the case of starting/ending with different FP types
but always with signed i32 as the intermediate value.
I think this covers all of the faux vector optimization possibilities
for pre-AVX512.

There is at least 1 other transform mentioned in PR36617:
https://bugs.llvm.org/show_bug.cgi?id=36617#c19
...where we fold an 'fpext' into a preceding 'sitofp'. I think we will
want to handle that earlier (DAGCombiner or instcombine) because that's
a target-independent optimization.

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

4 years ago[InstCombine] generalize canonicalization of masked equality comparisons
Sanjay Patel [Sat, 25 Apr 2020 15:25:03 +0000 (11:25 -0400)]
[InstCombine] generalize canonicalization of masked equality comparisons

  (X | MaskC) == C --> (X & ~MaskC) == C ^ MaskC
  (X | MaskC) != C --> (X & ~MaskC) != C ^ MaskC

We have more analyis for 'and' patterns and already lean this way
in the existing code, so this should be neutral or better in IR.

If this does not do as well in codegen, the problem already exists
and we should fix that based on target costs/heuristics.

http://volta.cs.utah.edu:8080/z/oP3ecL

define void @src(i8 %x, i8 %OrC, i8 %C, i1* %p0, i1* %p1) {
  %or = or i8 %x, %OrC
  %eq = icmp eq i8 %or, %C
  store i1 %eq, i1* %p0

  %ne = icmp ne i8 %or, %C
  store i1 %ne, i1* %p1
  ret void
}

define void @tgt(i8 %x, i8 %OrC, i8 %C, i1* %p0, i1* %p1) {
  %NotOrC = xor i8 %OrC, -1
  %a = and i8 %x, %NotOrC
  %NewC = xor i8 %C, %OrC
  %eq = icmp eq i8 %a, %NewC
  store i1 %eq, i1* %p0

  %ne = icmp ne i8 %a, %NewC
  store i1 %ne, i1* %p1
  ret void
}

4 years ago[DSE] Add stat for remaining stores after DSE.
Florian Hahn [Sat, 25 Apr 2020 14:02:02 +0000 (15:02 +0100)]
[DSE] Add stat for remaining stores after DSE.

Using the existing NumFastStores statistic can be misleading when
comparing the impact of DSE patches.

For example, consider the case where a store gets removed from a
function before it is inlined into another function. A less
powerful DSE might only remove the store from functions it has
been inlined into, which will result in more stores being removed, but
no difference in the actual number of stores after DSE.

The new stat provides the absolute number of stores surviving after
DSE.

Reviewers: dmgreen, bryant, asbirlea, jfb

Reviewed By: asbirlea

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

4 years ago[InstCombine] add tests for icmp with bitmask logic op; NFC
Sanjay Patel [Fri, 24 Apr 2020 18:34:02 +0000 (14:34 -0400)]
[InstCombine] add tests for icmp with bitmask logic op; NFC

4 years ago[ValueTracking] Let isGuaranteedNotToBeUndefOrPoison look into more constants/instruc...
Juneyoung Lee [Sun, 15 Mar 2020 03:09:58 +0000 (12:09 +0900)]
[ValueTracking] Let isGuaranteedNotToBeUndefOrPoison look into more constants/instructions

Summary:
This patch helps isGuaranteedNotToBeUndefOrPoison look into more constants and instructions (bitcast/alloca/gep/fcmp).

To deal with bitcast, Depth is added to isGuaranteedNotToBeUndefOrPoison.

This patch is splitted from https://reviews.llvm.org/D75808.

Checked with Alive2

Reviewers: reames, jdoerfert

Reviewed By: jdoerfert

Subscribers: sanwou01, spatel, llvm-commits, hiraditya

Tags: #llvm

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

4 years ago[ValueLattice] Merging unknown with empty CR is unknown.
Florian Hahn [Sat, 25 Apr 2020 12:39:27 +0000 (13:39 +0100)]
[ValueLattice] Merging unknown with empty CR is unknown.

Currently an unknown/undef value is marked as overdefined when merged
with an empty range. An empty range can occur in unreachable/dead code.
When merging the new unknown state (= no value known yet) with an empty
range, there still isn't any information about the value yet and we can
stay in unknown.

This gives a few nice improvements on the number of instructions removed
by IPSCCP:
Same hash: 170 (filtered out)
Remaining: 67
Metric: sccp.IPNumInstRemoved

Program                                        base     patch    diff
 test-suite...rks/FreeBench/mason/mason.test     3.00   6.00 100.0%
 test-suite...nchmarks/McCat/18-imp/imp.test     3.00   5.00 66.7%
 test-suite...C/CFP2000/179.art/179.art.test     2.00   3.00 50.0%
 test-suite...ijndael/security-rijndael.test     2.00   3.00 50.0%
 test-suite...ks/Prolangs-C/agrep/agrep.test    40.00  58.00 45.0%
 test-suite...ce/Applications/Burg/burg.test    26.00  37.00 42.3%
 test-suite...cCat/03-testtrie/testtrie.test     3.00   4.00 33.3%
 test-suite...Source/Benchmarks/sim/sim.test    29.00  36.00 24.1%
 test-suite.../Applications/spiff/spiff.test     9.00  11.00 22.2%
 test-suite...s/FreeBench/neural/neural.test     5.00   6.00 20.0%
 test-suite...pplications/treecc/treecc.test    66.00  79.00 19.7%
 test-suite...langs-C/football/football.test    85.00 101.00 18.8%
 test-suite...ce/Benchmarks/PAQ8p/paq8p.test    90.00 105.00 16.7%
 test-suite...oxyApps-C++/miniFE/miniFE.test    37.00  43.00 16.2%
 test-suite...rks/FreeBench/pifft/pifft.test    26.00  30.00 15.4%
 test-suite...lications/sqlite3/sqlite3.test   481.00  548.00  13.9%
 test-suite...marks/7zip/7zip-benchmark.test   4875.00 5522.00 13.3%
 test-suite.../CINT2000/176.gcc/176.gcc.test   1117.00 1197.00  7.2%
 test-suite...0.perlbench/400.perlbench.test   1618.00 1732.00  7.0%

Reviewers: efriedma, nikic, davide

Reviewed By: efriedma

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

4 years ago[LLD][ELF] Implement --discard-* for cases when -r or --emit-relocs are used.
Igor Kudrin [Sat, 25 Apr 2020 11:58:00 +0000 (18:58 +0700)]
[LLD][ELF] Implement --discard-* for cases when -r or --emit-relocs are used.

When discarding local symbols with --discard-all or --discard-locals,
the ones which are used in relocations should be preserved. LLD used
the simplest approach and just ignored those switches when -r or
--emit-relocs was specified.

The patch implements handling the --discard-* switches for the cases
when relocations are kept by identifying used local symbols and allowing
removing only unused ones. This makes the behavior of LLD compatible
with GNU linkers.

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

4 years ago[DebugInfo][DWARF64] Fix dumping pre-standard .debug_str_offsets.dwo sections.
Igor Kudrin [Sat, 25 Apr 2020 11:26:03 +0000 (18:26 +0700)]
[DebugInfo][DWARF64] Fix dumping pre-standard .debug_str_offsets.dwo sections.

The sizes of offsets in the `.debug_str_offsets.dwo` section depend on
the format of compilation or type units referencing them: 4 bytes for
DWARF32 units and 8 bytes for DWARF64 ones. The fix uses parsed units
to determine the actual size of offsets in the corresponding part of
the `.debug_str_offsets.dwo` section.

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

4 years ago[llvm-dwp] Refuse DWARFv5 input DWP files.
Igor Kudrin [Sat, 25 Apr 2020 10:23:56 +0000 (17:23 +0700)]
[llvm-dwp] Refuse DWARFv5 input DWP files.

The library can parse DWARFv5 unit index sections of DWP files, but
llvm-dwp is not ready to process them. Refuse such input files for now.

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

4 years agoMCJIT.h - reduce unnecessary includes to forward declarations. NFC.
Simon Pilgrim [Sat, 25 Apr 2020 11:57:53 +0000 (12:57 +0100)]
MCJIT.h - reduce unnecessary includes to forward declarations. NFC.

4 years ago[clangd] Disable dependency-output lit test on windows
Kadir Cetinkaya [Sat, 25 Apr 2020 11:55:38 +0000 (13:55 +0200)]
[clangd] Disable dependency-output lit test on windows

4 years ago[clangd] Disable all dependency outputs
Kadir Cetinkaya [Fri, 24 Apr 2020 21:52:19 +0000 (23:52 +0200)]
[clangd] Disable all dependency outputs

Summary: Fixes https://github.com/clangd/clangd/issues/322

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[AssumeBundles] Refactor asssume builder
Tyker [Fri, 24 Apr 2020 20:34:55 +0000 (22:34 +0200)]
[AssumeBundles] Refactor asssume builder

Summary:
refactor assume bulider for the next patch.
the assume builder now generate only one assume per attribute kind and per value they are on. to do this it takes the highest. this is desirable because currently, for all attributes the higest value is the most valuable.

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoGive helpers internal linkage. NFC.
Benjamin Kramer [Sat, 25 Apr 2020 09:50:52 +0000 (11:50 +0200)]
Give helpers internal linkage. NFC.

4 years ago[CodeExtractor] Fix extraction of a value used only by intrinsics outside of region
Ehud Katz [Sat, 25 Apr 2020 08:44:47 +0000 (11:44 +0300)]
[CodeExtractor] Fix extraction of a value used only by intrinsics outside of region

We should only skip `lifetime` and `dbg` intrinsics when searching for users.
Other intrinsics are legit users that can't be ignored.

Without this fix, the testcase would result in an invalid IR. `memcpy`
will have a reference to the, now, external value (local to the
extracted loop function).

Fix PR42194

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

4 years agoMemory corruption issure for DenseStringElementsAttr
Rob Suderman [Sat, 25 Apr 2020 08:23:28 +0000 (01:23 -0700)]
Memory corruption issure for DenseStringElementsAttr

Summary: There was a memory corruption issue where the lifespan of the ArrayRef<StringRef> would fail. Directly passing the data will avoid the issue.

Reviewers: rriddle

Reviewed By: rriddle

Subscribers: mehdi_amini, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, grosul1, frgossen, Kayjukh, llvm-commits

Tags: #llvm

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

4 years ago[mlir] Add support for sparse DenseStringElements.
Rob Suderman [Sat, 25 Apr 2020 08:17:09 +0000 (01:17 -0700)]
[mlir] Add support for sparse DenseStringElements.

Summary: Added support for sparse strings elements. This is a follow up from the original DenseStringElements.

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

4 years ago[MLIR]][DOC] Fix dimension validity constraint in affine dialect doc
Uday Bondhugula [Sat, 25 Apr 2020 04:11:23 +0000 (09:41 +0530)]
[MLIR]][DOC] Fix dimension validity constraint in affine dialect doc

Fix affine dialect documentation on valid dimensional values: they also
include affine.parallel IVs.

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

4 years ago[X86] Add cost model tests for truncating from v2i8/v4i8/v8i8/v16i8 to vXi1. NFC
Craig Topper [Sat, 25 Apr 2020 06:11:17 +0000 (23:11 -0700)]
[X86] Add cost model tests for truncating from v2i8/v4i8/v8i8/v16i8 to vXi1. NFC

4 years ago[CallSite removal] Rename CallSite.h to AbstractCallSite.h. NFC
Craig Topper [Sat, 25 Apr 2020 05:12:21 +0000 (22:12 -0700)]
[CallSite removal] Rename CallSite.h to AbstractCallSite.h. NFC

The CallSite and ImmutableCallSite were removed in a previous
commit. So rename the file to match the remaining class and
the name of the cpp that implements it.

4 years ago[SanitizerCoverage] Add `__sanitizer_cov_bool_flag_init` as the weak interface functions.
Pratyai Mazumder [Fri, 24 Apr 2020 20:27:54 +0000 (13:27 -0700)]
[SanitizerCoverage] Add `__sanitizer_cov_bool_flag_init` as the weak interface functions.

Summary:
Following up the discussion on D77638 (and following rGd6cfed6060c283dc4a6bf9ca294dcd732e8b9f72
as example), defining `__sanitizer_cov_bool_flag_init` as the weak interface
functions in various compiler-rt/ files.

Reviewers: vitalybuka

Reviewed By: vitalybuka

Subscribers: dberris, #sanitizers

Tags: #sanitizers

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

4 years agoRevert "ADT: SmallVector size/capacity use word-size integers when elements are small"
Andrew Browne [Sat, 25 Apr 2020 02:23:31 +0000 (19:23 -0700)]
Revert "ADT: SmallVector size/capacity use word-size integers when elements are small"

This reverts commit b5f0eae1dc3c09c020cdf9d07238dec9acdacf5f.

clang-cmake-armv7-quick/llvm/llvm/lib/Support/SmallVector.cpp:81:22:
error: duplicate explicit instantiation of 'SmallVectorBase<unsigned int>'

4 years ago[X86] Improve accuracy of cost for v16i64->v16i8 truncate with avx512.
Craig Topper [Sat, 25 Apr 2020 01:56:33 +0000 (18:56 -0700)]
[X86] Improve accuracy of cost for v16i64->v16i8 truncate with avx512.

The 2 vpmovqds are only 1 uop each.