platform/upstream/llvm.git
3 years ago[AMDGPU] Optimize waitcnt insertion for flat memory operations
Tony [Fri, 16 Oct 2020 07:09:38 +0000 (07:09 +0000)]
[AMDGPU] Optimize waitcnt insertion for flat memory operations

Change waitcnt insertion to check the memory operand tokens to see if
flat memory operations access VMEM in the same way it does to check if
accessing LDS. This avoids adding waitcnt for counters for address
spaces that are not accessed.

In addition, only generate the pessimistic waitcnt 0 if a flat memory
operation appears to access both VMEM and LDS.

This benefits flat memory operations that explicitly specify the
address space as GLOBAL or LOCAL.

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

3 years ago[X86] Move 'int $3' -> 'int3' handling in the assembler to processInstruction.
Craig Topper [Tue, 20 Oct 2020 21:31:47 +0000 (14:31 -0700)]
[X86] Move 'int $3' -> 'int3' handling in the assembler to processInstruction.

Instead of handling before parsing, just fix it after parsing.

3 years ago[X86] Move 's{hr,ar,hl} , <op>' to 'shift <op>' optimization in the assembler into...
Craig Topper [Tue, 20 Oct 2020 21:17:07 +0000 (14:17 -0700)]
[X86] Move 's{hr,ar,hl} , <op>' to 'shift <op>' optimization in the assembler into processInstruction.

Instead of detecting the mnemonic and hacking the operands before
parsing. Just fix it up after parsing.

3 years ago[libc++] Get rid of <sstream> in the valarray tests
Louis Dionne [Mon, 19 Oct 2020 20:51:33 +0000 (16:51 -0400)]
[libc++] Get rid of <sstream> in the valarray tests

3 years agoclang/Basic: Remove SourceManager::getBufferPointer, NFC
Duncan P. N. Exon Smith [Wed, 14 Oct 2020 22:17:01 +0000 (18:17 -0400)]
clang/Basic: Remove SourceManager::getBufferPointer, NFC

Inline `Source::getBufferPointer` into its only remaining caller,
`getBufferOrNone`. No functionality change.

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

3 years ago[AsmWriter] Construct SlotTracker with the function
Kazu Hirata [Tue, 20 Oct 2020 22:01:39 +0000 (15:01 -0700)]
[AsmWriter] Construct SlotTracker with the function

This patch teaches BasicBlock::print to construct an instance of
SlotTracker with the containing function.

Without this patch, we dump:

*** IR Dump After LoopInstSimplifyPass ***
; Preheader:
  br label %1

; Loop:
<badref>:                                         ; preds = %1, %0
  br label %1

Note "<badref>" above.  This happens because BasicBlock::print calls:

  SlotTracker SlotTable(this->getModule());

Note that this constructor does not add the contents of functions to
the slot table.  That is, basic blocks are left unnumbered.

This patch fixes the problem by switching to:

  SlotTracker SlotTable(this->getParent());

which does add the contents of the Module and the function,
this->getParent(), to the slot table.

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

3 years agoFix pretty printing of linalg GenericOps when there are no inputs.
Federico Lebrón [Tue, 20 Oct 2020 21:37:38 +0000 (14:37 -0700)]
Fix pretty printing of linalg GenericOps when there are no inputs.

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

3 years agoGet the address space within getVectorPtrTy
Christopher Tetreault [Tue, 20 Oct 2020 18:32:28 +0000 (11:32 -0700)]
Get the address space within getVectorPtrTy

getVectorPtrTy is private to VectorBlockGenerator, and all uses query
the address space from the passed-in pointer prior to calling it.

Reviewed By: efriedma

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

3 years ago[clangd][ObjC] Support nullability annotations
David Goldman [Fri, 16 Oct 2020 18:14:37 +0000 (14:14 -0400)]
[clangd][ObjC] Support nullability annotations

Nullability annotations are implmented using attributes; previusly
clangd would skip over AttributedTypeLoc since their location
points to the attribute instead of the modified type.

Also add some test cases for this.

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

3 years ago[LSAN][NFC] Reformat test
Vitaly Buka [Tue, 20 Oct 2020 21:16:27 +0000 (14:16 -0700)]
[LSAN][NFC] Reformat test

3 years ago[hwasan] Increase max allocation size to 1Tb.
Evgenii Stepanov [Mon, 19 Oct 2020 23:38:03 +0000 (16:38 -0700)]
[hwasan] Increase max allocation size to 1Tb.

2Gb is unreasonably low on devices with 12Gb RAM and more.

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

3 years agoclang/Basic: Replace SourceManager::getMemoryBufferForFile, NFC
Duncan P. N. Exon Smith [Wed, 14 Oct 2020 22:06:29 +0000 (18:06 -0400)]
clang/Basic: Replace SourceManager::getMemoryBufferForFile, NFC

Replace `SourceManager::getMemoryBufferForFile`, which returned a
dereferenceable `MemoryBuffer*` and had a `bool*Invalid` out parameter,
with `getMemoryBufferForFileOrNone` (returning
`Optional<MemoryBufferRef>`) and `getMemoryBufferForFileOrFake`
(returning `MemoryBufferRef`).

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

3 years ago[libc++] Remove uses of verbose_assert.h in Filesystem tests
Louis Dionne [Tue, 20 Oct 2020 20:47:47 +0000 (16:47 -0400)]
[libc++] Remove uses of verbose_assert.h in Filesystem tests

For a modest loss of debugability in the tests, this allows more tests
to run on platforms that do not have support for <iostream>.

3 years ago[Apple-stage2] Install FileCheck and yaml2obj in the toolchain
Jonas Devlieghere [Tue, 20 Oct 2020 20:46:34 +0000 (13:46 -0700)]
[Apple-stage2] Install FileCheck and yaml2obj in the toolchain

rdar://70274446

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

3 years agoDriver: Add integer sanitizers to trapping group automatically.
Peter Collingbourne [Tue, 20 Oct 2020 05:18:18 +0000 (22:18 -0700)]
Driver: Add integer sanitizers to trapping group automatically.

In D86000 we added a new sanitizer to the integer group
without adding it to the trapping group. This broke usage of
-fsanitize=integer -fsanitize-trap=integer or -fsanitize=integer
-fsanitize-minimal-runtime.

I think we can reasonably expect any new integer sanitizers to be
compatible with trapping and the minimal runtime, so add them to the
trapping group automatically.

Also add a test to ensure that any future additions of sanitizers
to the integer group will most likely result in test failures which
would lead to updates to the minimal runtime if necessary. For this
particular sanitizer no updates are required because it uses the
existing shift_out_of_bounds callback function.

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

3 years ago[AMDGPU] [TableGen] Clean up !if(!eq(boolean, 1) and related booleans
Paul C. Anagnostopoulos [Mon, 19 Oct 2020 14:52:15 +0000 (10:52 -0400)]
[AMDGPU] [TableGen] Clean up !if(!eq(boolean, 1) and related booleans

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

3 years ago[libc++] Make it easier to add new restrictions for feature-test macro tests
Louis Dionne [Tue, 20 Oct 2020 19:52:57 +0000 (15:52 -0400)]
[libc++] Make it easier to add new restrictions for feature-test macro tests

3 years ago[libc++] Decouple debug mode tests from iostreams
Louis Dionne [Thu, 15 Oct 2020 21:54:15 +0000 (17:54 -0400)]
[libc++] Decouple debug mode tests from iostreams

3 years ago[ConstantFold] Fold the comparison of bitcasted global values
Shimin Cui [Tue, 20 Oct 2020 19:41:49 +0000 (12:41 -0700)]
[ConstantFold] Fold the comparison of bitcasted global values

This is to simplify icmp instructions in the form like:

%cmp = icmp eq i32 (i8*, i8*)* bitcast (i32 (i32**, i32**)* @f32 to i32
%(i8*, i8*)), bitcast (i32 (i64**, i64**) @f64 to i32 (i8*, i8*)*)

Here @f32 and @f64 are two functions.

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

3 years ago[lldb] Add a page to the docs with (external) links on how to use LLDB
Jonas Devlieghere [Tue, 20 Oct 2020 18:42:09 +0000 (11:42 -0700)]
[lldb] Add a page to the docs with (external) links on how to use LLDB

In a discussion with Jim last week we came to the realization that often
we get asked about things that might not be documented on the website,
but that have been pretty well explained elsewhere. In those situations
it's often easier to quickly answer the question than searching for that
presentation you gave 3 years ago if you remember at all.

This often results in us having to answer the same questions over and
over again. We could add the questions and their answer to the website,
but that means we (1) have to duplicate the work and (2) now have to
maintain it.

A more efficient solution is to add a page with external resources with
the caveat that they might be outdated. That's exactly the purpose of
this patch.

I've added a few links that came to mind, but I don't want to be the
arbiter of what should and should not be included. I'd hope that over
time the community can crowd-source the best resources.

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

3 years ago[NFC][Regalloc] Type 2 statics in terms of Register
Mircea Trofin [Mon, 19 Oct 2020 18:10:47 +0000 (11:10 -0700)]
[NFC][Regalloc] Type 2 statics in terms of Register

Using Register instead of unsigned.

Also added isStack to mirror the other members, and eventually remove
the static testers.

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

3 years agoHandle value uses wrapped in metadata for the use-list order
David Stenberg [Tue, 20 Oct 2020 17:30:39 +0000 (19:30 +0200)]
Handle value uses wrapped in metadata for the use-list order

When generating the use-list order, also consider value uses that are
operands which are wrapped in metadata; e.g. llvm.dbg.value operands.

This fixes PR36778. The test case is based on the reproducer from that
report.

Reviewed By: dexonsmith

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

3 years ago[gn build] Port 848a68a032d
LLVM GN Syncbot [Tue, 20 Oct 2020 17:56:26 +0000 (17:56 +0000)]
[gn build] Port 848a68a032d

3 years agoDomTree: Extract (mostly) read-only logic into type-erased base classes
Nicolai Hähnle [Tue, 20 Oct 2020 17:51:44 +0000 (19:51 +0200)]
DomTree: Extract (mostly) read-only logic into type-erased base classes

Avoid having to instantiate and compile a subset of the dominator tree logic
separately for each node type. More importantly, this allows generic
algorithms to be built on top of dominator trees without writing them as
templates -- such algorithms can now use opaque CfgBlockRef and
CfgInterface instead.

A type-erased implementation of dominator trees could be written in
terms of CfgInterface as well, but doing so would change the current
trade-off: it would slightly reduce code size at the cost of a slight
runtime overhead.

This patch does not change the trade-off, as it only does type-erasure
where basic blocks can be treated in a fully opaque way, i.e. it only
moves methods that don't require iteration over CFG successors and
predecessors.

v5:
- rename generic_{begin,end,children} back without the generic_ prefix
  and refer explictly to base class methods in NewGVN, which wants to
  mutate the order of dominator tree node children directly

v6:
- style change: iDom -> idom; it's arguable whether this is really
  invalid, since it is actually standard camelCase, but clang-tidy
  complains about it so... *shrug*
- rename {to,from}Generic -> {wrap,unwrap}Ref

Change-Id: Ib860dc04cf8bb093d8ed00be7def40d662213672

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

3 years agolldb: Migrate to MemoryBufferRef for createFileID (after 51d1d585e5838ea0f02f1271f754...
Duncan P. N. Exon Smith [Tue, 20 Oct 2020 17:50:52 +0000 (13:50 -0400)]
lldb: Migrate to MemoryBufferRef for createFileID (after 51d1d585e5838ea0f02f1271f7543c4e43639969)

I missed these two lldb users before deleting the `UnownedTag` API for
`createFileID` in 51d1d585e5838ea0f02f1271f7543c4e43639969. This should
fix the build.

3 years ago[NPM] port -unify-loop-exits to NPM
Ta-Wei Tu [Tue, 20 Oct 2020 17:41:38 +0000 (10:41 -0700)]
[NPM] port -unify-loop-exits to NPM

Reviewed By: aeubanks

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

3 years ago[AMDGPU] Remove getAllVGPR32() which cannot handle Accum VGPRs properly
vnalamot [Tue, 20 Oct 2020 16:31:09 +0000 (22:01 +0530)]
[AMDGPU] Remove getAllVGPR32() which cannot handle Accum VGPRs properly

Remove getAllVGPR32() interface and update the SGPR spill code to use
a proper method to get the relevant VGPR registers list.

Reviewed By: arsenm

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

3 years agoFileManager: Test FileManager::getFileRef
Duncan P. N. Exon Smith [Thu, 15 Oct 2020 14:36:00 +0000 (10:36 -0400)]
FileManager: Test FileManager::getFileRef

Add a test demonstrating `getFileRef`'s behaviour, which isn't obvious
from code inspection when it's handling a redirected file.

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

3 years agoclang/Frontend: Use MemoryBufferRef in FrontendInputFile (and remove SourceManager...
Duncan P. N. Exon Smith [Wed, 14 Oct 2020 21:17:34 +0000 (17:17 -0400)]
clang/Frontend: Use MemoryBufferRef in FrontendInputFile (and remove SourceManager::getBuffer)

In order to drop the final callers to `SourceManager::getBuffer`, change
`FrontendInputFile` to use `Optional<MemoryBufferRef>`. Also updated
the "unowned" version of `SourceManager::createFileID` to take a
`MemoryBufferRef` (it now calls `MemoryBuffer::getMemBuffer`, which
creates a `MemoryBuffer` that does not own the buffer data).

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

3 years ago[NPM] Port -mergereturn to NPM
Ta-Wei Tu [Tue, 20 Oct 2020 17:32:28 +0000 (10:32 -0700)]
[NPM] Port -mergereturn to NPM

Reviewed By: aeubanks

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

3 years agoASAN: Support detect_invalid_pointer_pairs=1 with detect_stack_use_after_return=1
Martin Liska [Fri, 16 Oct 2020 13:08:52 +0000 (15:08 +0200)]
ASAN: Support detect_invalid_pointer_pairs=1 with detect_stack_use_after_return=1

Do not crash when AsanThread::GetStackVariableShadowStart does not find
a variable for a pointer on a shadow stack.

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

3 years agoWrap CfgTraitsFor in namespace llvm to please GCC 5
Lei Zhang [Tue, 20 Oct 2020 17:04:02 +0000 (13:04 -0400)]
Wrap CfgTraitsFor in namespace llvm to please GCC 5

3 years agoSet Huge Page mode on shadow regions based on no_huge_pages_for_shadow
Jianzhou Zhao [Sun, 18 Oct 2020 04:39:31 +0000 (04:39 +0000)]
Set Huge Page mode on shadow regions based on no_huge_pages_for_shadow

It turned out that at dynamic shared library mode, the memory access
pattern can increase memory footprint significantly on OS when transparent
hugepages (THP) are enabled. This could cause >70x memory overhead than
running a static linked binary. For example, a static binary with RSS
overhead 300M can use > 23G RSS if it is built dynamically.
/proc/../smaps shows in 6204552 kB RSS 6141952 kB relates to
AnonHugePages.

Also such a high RSS happens in some rate: around 25% runs may use > 23G RSS, the
rest uses in between 6-23G. I guess this may relate to how user memory
is allocated and distributted across huge pages.

THP is a trade-off between time and space. We have a flag
no_huge_pages_for_shadow for sanitizer. It is true by default but DFSan
did not follow this. Depending on if a target is built statically or
dynamically, maybe Clang can set no_huge_pages_for_shadow accordingly
after this change. But it still seems fine to follow the default setting of
no_huge_pages_for_shadow. If time is an issue, and users are fine with
high RSS, this flag can be set to false selectively.

3 years ago[libcxx] [test] Fix path.modifiers/make_preferred for windows
Martin Storsjö [Thu, 15 Oct 2020 10:41:50 +0000 (13:41 +0300)]
[libcxx] [test] Fix path.modifiers/make_preferred for windows

Use p.string() instead of p.native() for comparing with the expected
value.

Explicitly list the expected values for both posix and windos, even if
the operation is an identity operation on posix.

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

3 years ago[libcxx] [test] Avoid conflicting definitions of _CRT_SECURE_NO_WARNINGS
Martin Storsjö [Tue, 4 Feb 2020 20:51:06 +0000 (22:51 +0200)]
[libcxx] [test] Avoid conflicting definitions of _CRT_SECURE_NO_WARNINGS

This is defined both by libcxx/utils/libcxx/test/config.py (for
any windows target) and msvc_stdlib_force_include.h (when testing
specifically the MSVC C++ library).

The command line define (-D_CRT_SECURE_NO_WARNINGS) defines it to the
value 1; change the header define to match that.

Keeping both instances, to keep the fix for cases when not building
in cases that don't use config.py.

Also remove a comment about whether this can be removed; it can't at
least be removed altogether - doing that breaks a number of tests that
otherwise succeed.

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

3 years ago[ELF] --gdb-index: support --icf={safe,all}
Fangrui Song [Mon, 19 Oct 2020 23:45:56 +0000 (16:45 -0700)]
[ELF] --gdb-index: support --icf={safe,all}

The combination has not been tested before. In the case of ICF,
`e.section->getVA(0)` equals the start address of the output section.

This can cause incorrect overlapping with the actual function at the
start of the output section and potentially trigger a GDB internal error
in `dw2_find_pc_sect_compunit_symtab` (presumably because:
if a short address range incorrectly starts at the start address of the
output section, GDB may pick it instead of the correct longer address
range. When mapping an address within the long address range but
out of the scope of the short address range, the routine may find
nothing - while the code asserts that it can find something).

Note that in the case of ICF there may be duplicate address range entries,
but GDB appears to be fine with them.

Reviewed By: grimar

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

3 years agoRelease pages to OS when setting 0 label
Jianzhou Zhao [Sun, 11 Oct 2020 01:26:47 +0000 (01:26 +0000)]
Release pages to OS when setting 0 label

This is a follow up patch of https://reviews.llvm.org/D88755.

When set 0 label for an address range, we can release pages within the
corresponding shadow address range to OS, and set only addresses outside
the pages to be 0.

Reviewed-by: morehouse, eugenis
Differential Revision: https://reviews.llvm.org/D89199

3 years ago[DSE] Do not scan users of memory terminators for further reads.
Florian Hahn [Tue, 20 Oct 2020 15:41:56 +0000 (16:41 +0100)]
[DSE] Do not scan users of memory terminators for further reads.

isMemTerminator checks if the current def is a memory terminator that
terminates the memory pointed to by DefLoc. We do not have to add any of
their users to the worklist, because the follow-on users cannot read the
memory in question.

This leads to more stores eliminated in the presence of lifetime calls.
Previously we added the users of those intrinsics to the worklist,
limiting elimination.

In terms of removed stores, this gives a nice boost on some benchmarks
(MultiSource/SPEC2000/SPEC2006 on X86 with -flto -O3):

Same hash: 205 (filtered out)
Remaining: 32
Metric: dse.NumFastStores

Program                                          base   patch   diff
 test-suite...000/197.parser/197.parser.test     4.00    8.00  100.0%
 test-suite...rolangs-C++/family/family.test     4.00    7.00  75.0%
 test-suite...marks/7zip/7zip-benchmark.test   1722.00 2189.00 27.1%
 test-suite...CFP2000/177.mesa/177.mesa.test    30.00   38.00  26.7%
 test-suite :: External/Nurbs/nurbs.test        44.00   49.00  11.4%
 test-suite...lications/sqlite3/sqlite3.test   115.00  128.00  11.3%
 test-suite...006/447.dealII/447.dealII.test   2715.00 3013.00 11.0%
 test-suite...ProxyApps-C++/CLAMR/CLAMR.test   237.00  261.00  10.1%
 test-suite...tions/lambda-0.1.3/lambda.test    40.00   44.00  10.0%
 test-suite...3.xalancbmk/483.xalancbmk.test   1366.00 1475.00  8.0%
 test-suite...abench/jpeg/jpeg-6a/cjpeg.test    13.00   14.00   7.7%
 test-suite...oxyApps-C++/miniFE/miniFE.test    43.00   46.00   7.0%
 test-suite...lications/ClamAV/clamscan.test   230.00  246.00   7.0%
 test-suite...006/450.soplex/450.soplex.test   284.00  299.00   5.3%
 test-suite...nsumer-jpeg/consumer-jpeg.test    21.00   22.00   4.8%

3 years ago[InstCombine] SimplifyDemandedUseBits - replace dyn_cast<ConstantInt> with m_Constant...
Simon Pilgrim [Tue, 20 Oct 2020 15:44:59 +0000 (16:44 +0100)]
[InstCombine] SimplifyDemandedUseBits - replace dyn_cast<ConstantInt> with m_ConstantInt. NFCI.

3 years ago[AMDGPU] Remove unused declaration. NFC.
Jay Foad [Tue, 20 Oct 2020 15:30:39 +0000 (16:30 +0100)]
[AMDGPU] Remove unused declaration. NFC.

The implementation of this method was removed in D89706.

3 years ago[InstCombine] foldOrOfICmps - use m_Specific instead of explicit comparisons. NFCI.
Simon Pilgrim [Tue, 20 Oct 2020 14:45:54 +0000 (15:45 +0100)]
[InstCombine] foldOrOfICmps - use m_Specific instead of explicit comparisons. NFCI.

3 years ago[clang] Use SourceLocation as key in hash maps, NFCI
Mikhail Maltsev [Tue, 20 Oct 2020 15:21:38 +0000 (16:21 +0100)]
[clang] Use SourceLocation as key in hash maps, NFCI

The patch adjusts the existing `llvm::DenseMap<unsigned, T>` and
`llvm::DenseSet<unsigned>` objects that store source locations, so
that they use `SourceLocation` directly instead of `unsigned`.

This patch relies on the `DenseMapInfo` trait added in D89719.

It also replaces the construction of `SourceLocation` objects from
the constants -1 and -2 with calls to the trait's methods `getEmptyKey`
and `getTombstoneKey` where appropriate.

Reviewed By: dexonsmith

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

3 years agoExplicitly initialize StreamingDiagnostic in derived class copy ctors
Hans Wennborg [Tue, 20 Oct 2020 15:12:07 +0000 (17:12 +0200)]
Explicitly initialize StreamingDiagnostic in derived class copy ctors

To pacify a GCC warning:

[1/1] Building CXX object tools/clang/lib/Analysis/CMakeFiles/obj.clangAnalysis.dir/Dominators.cpp.o
In file included from /work/llvm.monorepo/clang/include/clang/AST/NestedNameSpecifier.h:18:0,
                 from /work/llvm.monorepo/clang/include/clang/AST/Type.h:21,
                 from /work/llvm.monorepo/clang/include/clang/AST/DeclarationName.h:16,
                 from /work/llvm.monorepo/clang/include/clang/AST/DeclBase.h:18,
                 from /work/llvm.monorepo/clang/include/clang/Analysis/AnalysisDeclContext.h:20,
                 from /work/llvm.monorepo/clang/include/clang/Analysis/Analyses/Dominators.h:16,
                 from /work/llvm.monorepo/clang/lib/Analysis/Dominators.cpp:9:
/work/llvm.monorepo/clang/include/clang/Basic/Diagnostic.h:
In copy constructor ‘clang::DiagnosticBuilder::DiagnosticBuilder(const clang::DiagnosticBuilder&)’:
/work/llvm.monorepo/clang/include/clang/Basic/Diagnostic.h:1287:3:
warning: base class ‘class clang::StreamingDiagnostic’ should be explicitly initialized in the copy constructor [-Wextra]
   DiagnosticBuilder(const DiagnosticBuilder &D) {
   ^
In file included from /work/llvm.monorepo/clang/include/clang/AST/Type.h:29:0,
                 from /work/llvm.monorepo/clang/include/clang/AST/DeclarationName.h:16,
                 from /work/llvm.monorepo/clang/include/clang/AST/DeclBase.h:18,
                 from /work/llvm.monorepo/clang/include/clang/Analysis/AnalysisDeclContext.h:20,
                 from /work/llvm.monorepo/clang/include/clang/Analysis/Analyses/Dominators.h:16,
                 from /work/llvm.monorepo/clang/lib/Analysis/Dominators.cpp:9:
/work/llvm.monorepo/clang/include/clang/Basic/PartialDiagnostic.h:
In copy constructor ‘clang::PartialDiagnostic::PartialDiagnostic(const clang::PartialDiagnostic&)’:
/work/llvm.monorepo/clang/include/clang/Basic/PartialDiagnostic.h:52:3:
warning: base class ‘class clang::StreamingDiagnostic’ should be explicitly initialized in the copy constructor [-Wextra]
   PartialDiagnostic(const PartialDiagnostic &Other) : DiagID(Other.DiagID) {
   ^

3 years agoTry to make GCC5 happy about the CfgTraits thing
Hans Wennborg [Tue, 20 Oct 2020 15:06:35 +0000 (17:06 +0200)]
Try to make GCC5 happy about the CfgTraits thing

It was failing with:

In file included from /work/llvm.monorepo/clang/lib/Analysis/Dominators.cpp:9:0:
/work/llvm.monorepo/clang/include/clang/Analysis/Analyses/Dominators.h: At global scope:
/work/llvm.monorepo/clang/include/clang/Analysis/Analyses/Dominators.h:111:26:
error: specialization of ‘template<class CfgRelatedTypeT> struct llvm::CfgTraitsFor’ in different namespace [-fpermissive]
 template <> struct llvm::CfgTraitsFor<clang::CFGBlock> {
                          ^
In file included from /work/llvm.monorepo/clang/include/clang/Analysis/Analyses/Dominators.h:21:0,
                 from /work/llvm.monorepo/clang/lib/Analysis/Dominators.cpp:9:
/work/llvm.monorepo/llvm/include/llvm/Support/CfgTraits.h:294:44:
error:   from definition of ‘template<class CfgRelatedTypeT> struct llvm::CfgTraitsFor’ [-fpermissive]
 template <typename CfgRelatedTypeT> struct CfgTraitsFor;
                                            ^

3 years ago[clang][Basic] Make SourceLocation usable as key in hash maps, NFCI
Mikhail Maltsev [Tue, 20 Oct 2020 14:52:59 +0000 (15:52 +0100)]
[clang][Basic] Make SourceLocation usable as key in hash maps, NFCI

This change creates a `DenseMapInfo` trait specialization for the
SourceLocation class. The empty key, the tombstone key, and the hash
function are identical to `DenseMapInfo<unsigned>`, because we already
have hash maps that use raw the representation of `SourceLocation` as
a key.

The update of existing `DenseMap`s containing raw representation of
`SourceLocation`s will be done in a follow-up patch. As an example
the patch makes use of the new trait in one instance:
clang-tidy/google/UpgradeGoogletestCaseCheck.{h,cpp}

Reviewed By: dexonsmith

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

3 years ago[libc++] Explicitly request new/delete in libc++ for Win to ARM Linux builds
Louis Dionne [Tue, 20 Oct 2020 14:42:11 +0000 (10:42 -0400)]
[libc++] Explicitly request new/delete in libc++ for Win to ARM Linux builds

Since 9b40ee8eb0c1, new/delete must be requested explicitly during the
CMake configuration if one wants these definitions to appear in libc++.

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

3 years agoAdd a C++ test case for https://reviews.llvm.org/D86854
Akira Hatanaka [Tue, 20 Oct 2020 14:34:38 +0000 (07:34 -0700)]
Add a C++ test case for https://reviews.llvm.org/D86854

The test case was part of https://reviews.llvm.org/D82999, which was
abandoned after https://reviews.llvm.org/D86854 fixed the bug.

3 years agoRevert "[clang] Fix warnings on the missing of explicitly copy constructor on the...
Michael Liao [Tue, 20 Oct 2020 14:19:44 +0000 (10:19 -0400)]
Revert "[clang] Fix warnings on the missing of explicitly copy constructor on the base class. NFC."

This reverts commit 1ed506deaddb41870d22f5b48d52ba710e8d6c00.

3 years ago[gn build] assert clang-format does not depend on AST, Frontend, Sema at gn time
Nico Weber [Tue, 20 Oct 2020 14:23:40 +0000 (10:23 -0400)]
[gn build] assert clang-format does not depend on AST, Frontend, Sema at gn time

To catch things like https://reviews.llvm.org/D69854 and
https://reviews.llvm.org/D89708 earlier next time they happen.

3 years ago[gn build] belatedly port 3ddac7e56363
Nico Weber [Tue, 20 Oct 2020 14:17:20 +0000 (10:17 -0400)]
[gn build] belatedly port 3ddac7e56363

3 years ago[gn build] port a2214757e2ca more
Nico Weber [Tue, 20 Oct 2020 14:16:06 +0000 (10:16 -0400)]
[gn build] port a2214757e2ca more

3 years ago[InstCombine] Add (icmp ult (X + CA), C1) | (icmp eq X, C2) -> (icmp ule (X + CA...
Simon Pilgrim [Tue, 20 Oct 2020 14:03:08 +0000 (15:03 +0100)]
[InstCombine] Add (icmp ult (X + CA), C1) | (icmp eq X, C2) -> (icmp ule (X + CA), C1) test coverage

Add both commuted variants and vector uniform/nonuniform examples

3 years ago[clang] Fix warnings on the missing of explicitly copy constructor on the base class...
Michael Liao [Tue, 20 Oct 2020 14:04:53 +0000 (10:04 -0400)]
[clang] Fix warnings on the missing of explicitly copy constructor on the base class. NFC.

3 years ago[amdgpu] Enhance AMDGPU AA.
Michael Liao [Thu, 8 Oct 2020 22:46:00 +0000 (18:46 -0400)]
[amdgpu] Enhance AMDGPU AA.

- In general, a generic point may alias to pointers in all other address
  spaces. However, for certain cases enforced by the programming model,
  we may found a generic point won't alias to pointers to local objects.
  * When a generic pointer is loaded from the constant address space, it
    could only be a pointer to the GLOBAL or CONSTANT address space.
    Thus, it won't alias to pointers to the PRIVATE or LOCAL address
    space.
  * When a generic pointer is passed as a kernel argument, it also could
    only be a pointer to the GLOBAL or CONSTANT address space. Thus, it
    also won't alias to pointers to the PRIVATE or LOCAL address space.

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

3 years ago[DSE] Bail out from getLocForWriteEx if call is not argmemonly/inacc_mem.
Florian Hahn [Tue, 20 Oct 2020 12:27:54 +0000 (13:27 +0100)]
[DSE] Bail out from getLocForWriteEx if call is not argmemonly/inacc_mem.

This change should currently not have any impact, but guard against
further inconsistencies between MemoryLocation and function attributes.

3 years agoReland "[yaml2obj][ELF] - Simplify the code that performs sections validation."
Georgii Rymar [Tue, 20 Oct 2020 13:01:01 +0000 (16:01 +0300)]
Reland "[yaml2obj][ELF] - Simplify the code that performs sections validation."

This reverts commit 1b589f4d4db27e3fcd81fdc5abeb9407753ab790 and relands the D89463
with the fix: update `MappingTraits<FileFilter>::validate()` in ClangTidyOptions.cpp to
match the new signature (change the return type to "std::string" from "StringRef").

Original commit message:

This:

Changes the return type of MappingTraits<T>>::validate to std::string
instead of StringRef. It allows to create more complex error messages.

It introduces std::vector<std::pair<StringRef, bool>> getEntries():
a new virtual method of Section, which is the base class for all sections.
It returns names of special section specific keys (e.g. "Entries") and flags that says if them exist in a YAML.
The code in validate() uses this list of entries descriptions to generalize validation.
This approach was discussed in the D89039 thread.

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

3 years ago[InstSimplify] allow vector splats for icmp-of-neg folds
Sanjay Patel [Tue, 20 Oct 2020 13:04:19 +0000 (09:04 -0400)]
[InstSimplify] allow vector splats for icmp-of-neg folds

3 years ago[InstSimplify] add vector icmp tests; NFC
Sanjay Patel [Mon, 19 Oct 2020 21:50:43 +0000 (17:50 -0400)]
[InstSimplify] add vector icmp tests; NFC

3 years ago[gn build] Port c0cdd22c72f
LLVM GN Syncbot [Tue, 20 Oct 2020 13:20:27 +0000 (13:20 +0000)]
[gn build] Port c0cdd22c72f

3 years ago[gn build] Port a2214757e2c
LLVM GN Syncbot [Tue, 20 Oct 2020 13:20:26 +0000 (13:20 +0000)]
[gn build] Port a2214757e2c

3 years ago[DSE] Add test to make sure memccpy does not kill stores.
Florian Hahn [Tue, 20 Oct 2020 12:56:46 +0000 (13:56 +0100)]
[DSE] Add test to make sure memccpy does not kill stores.

It is not known how many bytes are written by memccpy, so it cannot kill
any stores.

3 years ago[InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp ult/ule (A + C2), C3)) unifor...
Simon Pilgrim [Tue, 20 Oct 2020 12:27:43 +0000 (13:27 +0100)]
[InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp ult/ule (A + C2), C3)) uniform vector support

Reapplied rGa704d8238c86 with a check for integer/integervector types to prevent matching with pointer types

3 years agoRevert "Revert "[gn build] (manually) port d09b08919ca""
Nico Weber [Tue, 20 Oct 2020 13:09:30 +0000 (09:09 -0400)]
Revert "Revert "[gn build] (manually) port d09b08919ca""

This reverts commit 6ca3dd97352013375f907d92a7e1aed7ab80fbc3.
d09b08919ca relanded in 53065c543fe3f1.

3 years ago[libc++] Make __shared_weak_count vtable consistent across all build configurations
Eric Fiselier [Tue, 20 Oct 2020 12:11:20 +0000 (08:11 -0400)]
[libc++] Make __shared_weak_count vtable consistent across all build configurations

This patch ensures that __shared_weak_count provides a consistent vtable
regardless of if RTTI is enabled or if we are targeting a static or shared
libc++ build.

This patch is technically ABI breaking, but only for a very specific
configuration that no vendor should be shipping.

Note that _LIBCPP_BUILD_STATIC is not normally defined when building
libc++.a, but instead it must be manually provided by the user or the
__config_site.

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

3 years agoRevert "[yaml2obj][ELF] - Simplify the code that performs sections validation."
Georgii Rymar [Tue, 20 Oct 2020 12:16:56 +0000 (15:16 +0300)]
Revert "[yaml2obj][ELF] - Simplify the code that performs sections validation."

This reverts commit b9e2b59680ad1bbfd2b9110b3ebf3d2b22cad51b.

3 years ago[flang] Document and use intrinsic subroutine argument intents
Jean Perier [Tue, 20 Oct 2020 10:39:26 +0000 (12:39 +0200)]
[flang] Document and use intrinsic subroutine argument intents

Check INTENT(OUT)/INTENT(INOUT) constraints for actual argument
of intrinsic procedure calls.
- Adding a common::Intent field to the IntrinsicDummyArgument
in the intrinsic table.
- Propagating it to the DummyDataObject intent field so that it can
later be used in CheckExplicitDataArg semantic checks.
- Add related tests.
- Fix regression (C846 false error), C846 INTENT(OUT) rule does
  not apply to intrinsic call. Propagate the information that we
  are in an intrinsic call up to CheckExplicitDataArg (that is
  doing this check). Still enforce C846 on intrinsics other than MOVE_ALLOC (for which
  allocatable coarrays are explicitly allowed) since it's not clear it is allowed in all
  intrinsics and allowing this would lead to runtime penalties in the intrinsic runtime.

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

3 years agoIntroduce CfgTraits abstraction
Nicolai Hähnle [Tue, 20 Oct 2020 11:50:52 +0000 (13:50 +0200)]
Introduce CfgTraits abstraction

The CfgTraits abstraction simplfies writing algorithms that are
generic over the type of CFG, and enables writing such algorithms
as regular non-template code that operates on opaque references
to CFG blocks and values.

Implementations of CfgTraits provide operations on the concrete
CFG types, e.g. `IrCfgTraits::BlockRef` is `BasicBlock *`.

CfgInterface is an abstract base class which provides operations
on opaque types CfgBlockRef and CfgValueRef. Those opaque types
encapsulate a `void *`, but the meaning depends on the concrete
CFG type. For example, MachineCfgTraits -- for use with MachineIR
in SSA form -- encodes a Register inside CfgValueRef. Converting
between concrete references and opaque/generic ones is done by
CfgTraits::{fromGeneric,toGeneric}. Convenience methods
CfgTraits::{un}wrap{Iterator,Range} are available as well.

Writing algorithms in terms of CfgInterface adds some overhead
(virtual method calls, plus in same cases it removes the
opportunity to inline iterators), but can be much more convenient
since generic algorithms can be written as non-templates.

This patch adds implementations of CfgTraits for all CFGs on
which dominator trees are calculated, so that the dominator
tree can be ported to this machinery. Only IrCfgTraits (LLVM IR)
and MachineCfgTraits (Machine IR in SSA form) are complete, the
other implementations are limited to the absolute minimum
required to make the upcoming dominator tree changes work.

v5:
- fix MachineCfgTraits::blockdef_iterator and allow it to iterate over
  the instructions in a bundle
- use MachineBasicBlock::printName

v6:
- implement predecessors/successors for all CfgTraits implementations
- fix error in unwrapRange
- rename toGeneric/fromGeneric into wrapRef/unwrapRef to have naming
  that is consistent with {wrap,unwrap}{Iterator,Range}
- use getVRegDef instead of getUniqueVRegDef

v7:
- std::forward fix in wrapping_iterator
- fix typos

v8:
- cleanup operators on CfgOpaqueType
- address other review comments

Change-Id: Ia75f4f268fded33fca11218a7d578c9aec1f3f4d

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

3 years ago[format] foo.<name>.h should be the main-header for foo.<name>.cc
Haojian Wu [Tue, 20 Oct 2020 09:04:27 +0000 (11:04 +0200)]
[format] foo.<name>.h should be the main-header for foo.<name>.cc

This fixes a regression introduced in https://reviews.llvm.org/D88640.

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

3 years ago[NFC][SCEV] Improve/rework test coverage for ptrtoint handling
Roman Lebedev [Tue, 20 Oct 2020 11:10:57 +0000 (14:10 +0300)]
[NFC][SCEV] Improve/rework test coverage for ptrtoint handling

3 years ago[InstCombine] SimplifyDemandedUseBits - pass APInt by const reference. NFCI.
Simon Pilgrim [Tue, 20 Oct 2020 10:02:23 +0000 (11:02 +0100)]
[InstCombine] SimplifyDemandedUseBits - pass APInt by const reference. NFCI.

3 years ago[compiler-rt][builtins] Add tests for atomic builtins support functions
Luís Marques [Tue, 20 Oct 2020 11:07:40 +0000 (12:07 +0100)]
[compiler-rt][builtins] Add tests for atomic builtins support functions

Adds some simple sanity checks that the support functions for the atomic
builtins do the right thing. This doesn't test concurrency and memory model
issues.

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

3 years ago[doc] Apply buildbot worker terminology change: slave->worker
Konrad Kleine [Tue, 20 Oct 2020 10:42:43 +0000 (06:42 -0400)]
[doc] Apply buildbot worker terminology change: slave->worker

Recently [1], there was an upgrade to the version of buildbot being
deployed. The new setup will still work with old buildslaves but I
thought it might be a good idea to update the documentation to reflect,
that you now can use a newer buildbot version to when setting up your
worker (formely known as slave).

The upgrade from buildbot 0.8.5 to 2.8.5 went a long with a transition
to a new "worker" terminology [2] which is also reflected by this
change.

[1]: http://lists.llvm.org/pipermail/llvm-dev/2020-October/145629.html
[2]: http://docs.buildbot.net/0.9.12/manual/worker-transition.html

Reviewed By: gkistanova

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

3 years ago[libomptarget][AMDGPU][NFC] Split atmi_memcpy for h2d and d2h
Pushpinder Singh [Tue, 20 Oct 2020 09:09:29 +0000 (05:09 -0400)]
[libomptarget][AMDGPU][NFC] Split atmi_memcpy for h2d and d2h

The calls to atmi_memcpy presently determine the direction of copy (host to
device or device to host) by storing pointers in a map during malloc and
looking up the pointers during memcpy. As each call site already knows the
direction, this stash+lookup can be eliminated.

This NFC will be followed by a functional one that deletes those map lookups.

Reviewed By: JonChesterfield

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

Change-Id: I1d9089bc1e56b3a9a30e334735fa07dee1f84990

3 years ago[AMDGPU] Remove fix up operand from SI_ELSE
Carl Ritson [Tue, 20 Oct 2020 09:11:51 +0000 (18:11 +0900)]
[AMDGPU] Remove fix up operand from SI_ELSE

Remove immediate operand from SI_ELSE which indicates if EXEC has
been modified.  Instead always emit code that handles EXEC and
remove unnecessary instructions during pre-RA optimisation.

This facilitates passes (i.e. SIWholeQuadMode) adding exec mask
manipulation post control flow lowering, and pre control flow
lower passes do not need to be aware of SI_ELSE handling.

Reviewed By: nhaehnle

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

3 years ago[clangd][remote] Add Windows paths support
Aleksandr Platonov [Tue, 20 Oct 2020 10:03:28 +0000 (13:03 +0300)]
[clangd][remote] Add Windows paths support

Without this patch 6 marshalling tests fail on Windows.
This patch contains the following changes:
- Allow paths with Windows slashes (convert to the POSIX style instead of assertion)
- Add support for URI with Windows path.
- Change the value of the second parameter of several `llvm::sys::path::convert_to_slash()` calls: we should use `windows` instead of `posix` to ensure UNIX slashes in the path.
- Port `RemoteMarshallingTest::IncludeHeaderURI` test to Windows.

Reviewed By: kbobyrev

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

3 years ago[IR] Make nosync, nofree and willreturn default for intrinsics.
sstefan1 [Thu, 15 Oct 2020 11:04:36 +0000 (13:04 +0200)]
[IR] Make nosync, nofree and willreturn default for intrinsics.

D70365 allows us to make attributes default. This is a follow up to
actually make nosync, nofree and willreturn default. The approach we
chose, for now, is to opt-in to default attributes to avoid introducing
problems to target specific intrinsics. Intrinsics with default
attributes can be created using `DefaultAttrsIntrinsic` class.

3 years ago[mlir] Use affine dim instead of symbol in SCFToGPU lowering.
Tres Popp [Tue, 20 Oct 2020 09:32:48 +0000 (11:32 +0200)]
[mlir] Use affine dim instead of symbol in SCFToGPU lowering.

This still satisfies the constraints required by the affine dialect and
gives more flexibility in what iteration bounds can be used when
loewring to the GPU dialect.

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

3 years ago[yaml2obj][NFCI] - Address post commit comments for "[yaml2obj][ELF] - Simplify the...
Georgii Rymar [Tue, 20 Oct 2020 09:20:15 +0000 (12:20 +0300)]
[yaml2obj][NFCI] - Address post commit comments for "[yaml2obj][ELF] - Simplify the code that performs sections validation."

This addresses post commit comments for D89463.

3 years ago[clangd] NFC: Resolve Clang-Tidy warnings in Protocol.cpp
Kirill Bobyrev [Tue, 20 Oct 2020 09:23:36 +0000 (11:23 +0200)]
[clangd] NFC: Resolve Clang-Tidy warnings in Protocol.cpp

Reviewed By: kadircet

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

3 years ago[Sanitizers] Remove OpenBSD support (new attempt)
David Carlier [Tue, 20 Oct 2020 10:14:26 +0000 (11:14 +0100)]
[Sanitizers] Remove OpenBSD support (new attempt)

- Fixing VS compiler and other cases settings this time.

Reviewers: dmajor, hans

Reviewed By: hans

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

3 years ago[clang-format] Drop clangFrontend dependency for FormatTests
Alex Richardson [Mon, 19 Oct 2020 16:14:01 +0000 (17:14 +0100)]
[clang-format] Drop clangFrontend dependency for FormatTests

This allows building the clang-format unit tests in only 657 ninja steps
rather than 1257 which allows for much faster incremental builds after a
git pull.

Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D89709

3 years agoMove clang/Tooling/Core/Lookup.h to clang/Tooling/Refactoring/Lookup.h
Alex Richardson [Tue, 20 Oct 2020 07:54:07 +0000 (08:54 +0100)]
Move clang/Tooling/Core/Lookup.h to clang/Tooling/Refactoring/Lookup.h

This allows removing the clangAST dependency from libclangToolingCore and
therefore allows clang-format to be built without depending on clangAST.
Before 1166 files had to be compiled for clang-format, now only 796.

Reviewed By: bkramer

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

3 years agoSilence unused variable warning in Release builds. NFCI.
Benjamin Kramer [Tue, 20 Oct 2020 08:48:12 +0000 (10:48 +0200)]
Silence unused variable warning in Release builds. NFCI.

3 years agoAdd a nul byte to packet str before logging, increase default size.
Jason Molenda [Tue, 20 Oct 2020 08:42:02 +0000 (01:42 -0700)]
Add a nul byte to packet str before logging, increase default size.

Add a nul byte to the stream in CommunicationKDP::CheckForPacket
before we send the GetData() to a Log::Printf as a c-str.  Avoids
a crash when logging kdp communications and memory layout isn't
in your favor.

3 years ago[yaml2obj][ELF] - Simplify the code that performs sections validation.
Georgii Rymar [Thu, 15 Oct 2020 09:44:42 +0000 (12:44 +0300)]
[yaml2obj][ELF] - Simplify the code that performs sections validation.

This:
1) Changes the return type of `MappingTraits<T>>::validate` to `std::string`
instead of `StringRef`. It allows to create more complex error messages.

2) It introduces std::vector<std::pair<StringRef, bool>> getEntries():
a new virtual method of Section, which is the base class for all sections.
It returns names of special section specific keys (e.g. "Entries") and flags that
says if them exist in a YAML. The code in validate() uses this list of entries
descriptions to generalize validation.
This approach was discussed in the D89039 thread.

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

3 years ago[AMDGPU][NFC] Tidy SIOptimizeExecMaskingPreRA for extensibility
Carl Ritson [Tue, 20 Oct 2020 07:43:37 +0000 (16:43 +0900)]
[AMDGPU][NFC] Tidy SIOptimizeExecMaskingPreRA for extensibility

Remove duplicate code and move things around to make it easier to
add additional optimisations to the pass.

Reviewed By: rampitec

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

3 years ago[SystemZ] Fix disassembler crashes
Ulrich Weigand [Tue, 20 Oct 2020 08:19:15 +0000 (10:19 +0200)]
[SystemZ] Fix disassembler crashes

The "Size" value returned by SystemZDisassembler::getInstruction is
used by common code even in the case where the routine returns
failure.  If that Size value exceeds the number of bytes remaining
in the section, that could cause disassembler crashes.

Fixed by never returning more than the number of bytes remaining.

3 years ago[ARM][SchedModels] Convert IsCPSRDefinedPred to MCSchedPredicate
Evgeny Leviant [Tue, 20 Oct 2020 08:14:21 +0000 (11:14 +0300)]
[ARM][SchedModels] Convert IsCPSRDefinedPred to MCSchedPredicate

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

3 years agoRevert "[ARM][LowOverheadLoops] Adjust Start insertion."
David Green [Tue, 20 Oct 2020 07:55:21 +0000 (08:55 +0100)]
Revert "[ARM][LowOverheadLoops] Adjust Start insertion."

This reverts commit 38f625d0d1360b035271422bab922d22ed04d79a.

This commit contains some holes in its logic and has been causing
issues since it was commited. The idea sounds OK but some cases were not
handled correctly. Instead of trying to fix that up later it is probably
simpler to revert it and work to reimplement it in a more reliable way.

3 years ago[mlir] Expose Value hierarchy to C API
Alex Zinenko [Mon, 19 Oct 2020 17:17:51 +0000 (19:17 +0200)]
[mlir] Expose Value hierarchy to C API

The Value hierarchy consists of BlockArgument and OpResult, both of which
derive Value. Introduce IsA functions and functions specific to each class,
similarly to other class hierarchies. Also, introduce functions for
pointer-comparison of Block and Operation that are necessary for testing and
are generally useful.

Reviewed By: stellaraccident, mehdi_amini

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

3 years ago[IR] Adds mustprogress as a LLVM IR attribute
Atmn Patel [Tue, 20 Oct 2020 06:48:18 +0000 (02:48 -0400)]
[IR] Adds mustprogress as a LLVM IR attribute

This adds the LLVM IR attribute `mustprogress` as defined in LangRef through D86233. This attribute will be applied to functions with in languages like C++ where forward progress is guaranteed. Functions without this attribute are not required to make progress.

Reviewed By: nikic

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

3 years agoProperly track whether a variable is constant-initialized.
Richard Smith [Tue, 20 Oct 2020 03:03:18 +0000 (20:03 -0700)]
Properly track whether a variable is constant-initialized.

This fixes miscomputation of __builtin_constant_evaluated in the
initializer of a variable that's not usable in constant expressions, but
is readable when constant-folding.

If evaluation of a constant initializer fails, we throw away the
evaluated result instead of keeping it as a non-constant-initializer
value for the variable, because it might not be a correct value.
To avoid regressions for initializers that are foldable but not formally
constant initializers, we now try constant-evaluating some globals in
C++ twice: once to check for a constant initializer (in an mode where
is_constannt_evaluated returns true) and again to determine the runtime
value if the initializer is not a constant initializer.

3 years ago[LTO][Legacy] Eliminate an unused member of llvm::LTOModule. NFC.
Igor Kudrin [Thu, 15 Oct 2020 13:51:02 +0000 (20:51 +0700)]
[LTO][Legacy] Eliminate an unused member of llvm::LTOModule. NFC.

This is a follow-up for D62935 where the corresponding API methods were removed.

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

3 years ago[Driver] Clean up -gz & --compress-debug-sections
Fangrui Song [Tue, 20 Oct 2020 06:05:26 +0000 (23:05 -0700)]
[Driver] Clean up -gz & --compress-debug-sections

* Make cc1 and cc1as --compress-debug-sections an alias for --compress-debug-sections=zlib
* Make -gz an alias for -gz=zlib

The new behavior is consistent with GCC when binutils>=2.26 is detected:
-gz is translated to --compress-debug-sections=zlib instead of --compress-debug-sections.

3 years ago[sanitizer] Fix compilation on older systems
Vitaly Buka [Tue, 20 Oct 2020 05:44:34 +0000 (22:44 -0700)]
[sanitizer] Fix compilation on older systems

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

3 years agoAdding new Azul representative to security group
Artur Pilipenko [Tue, 20 Oct 2020 05:39:32 +0000 (22:39 -0700)]
Adding new Azul representative to security group

Adding myself as a new Azul representative to security group.

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

3 years ago[mlir][Python] Add python binding to create DenseElementsAttribute.
Stella Laurenzo [Tue, 20 Oct 2020 05:29:35 +0000 (22:29 -0700)]
[mlir][Python] Add python binding to create DenseElementsAttribute.

* Interops with Python buffers/numpy arrays to create.
* Also cleans up 'get' factory methods on some types to be consistent.
* Adds mlirAttributeGetType() to C-API to facilitate error handling and other uses.
* Punts on a lot of features of the ElementsAttribute hierarchy for now.
* Does not yet support bool or string attributes.

Reviewed By: ftynse

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

3 years ago[gcov] Unify driver and CC1 option names for -ftest-coverage & -fprofile-arcs
Fangrui Song [Tue, 20 Oct 2020 05:17:32 +0000 (22:17 -0700)]
[gcov] Unify driver and CC1 option names for -ftest-coverage & -fprofile-arcs

No need to use -femit-coverage-notes and -femit-coverage-data.

3 years ago[COFF][ARM] Fix CodeView for Windows on 32bit ARM targets.
Luqman Aden [Tue, 20 Oct 2020 05:10:27 +0000 (22:10 -0700)]
[COFF][ARM] Fix CodeView for Windows on 32bit ARM targets.

Create the LLVM / CodeView register mappings for the 32-bit ARM Window targets.

Reviewed By: compnerd

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

3 years ago[NPM][PFOProfile] Fix some tests under NPM
Arthur Eubanks [Tue, 20 Oct 2020 05:05:01 +0000 (22:05 -0700)]
[NPM][PFOProfile] Fix some tests under NPM