platform/upstream/llvm.git
6 years ago[OPENMP] Allow multiple mappings for member expressions for pointers.
Alexey Bataev [Tue, 27 Feb 2018 17:42:00 +0000 (17:42 +0000)]
[OPENMP] Allow multiple mappings for member expressions for pointers.

If several member expressions are mapped and they reference the same
address as a base, but access different members, this must be allowed.

llvm-svn: 326212

6 years ago[clangd] Remove codecomplete override content API. Long live addDocument!
Sam McCall [Tue, 27 Feb 2018 17:15:50 +0000 (17:15 +0000)]
[clangd] Remove codecomplete override content API. Long live addDocument!

llvm-svn: 326211

6 years agoAdd missing REQUIRES.
Rafael Espindola [Tue, 27 Feb 2018 17:13:23 +0000 (17:13 +0000)]
Add missing REQUIRES.

llvm-svn: 326210

6 years agoFix gcc warning.
Rafael Espindola [Tue, 27 Feb 2018 17:11:10 +0000 (17:11 +0000)]
Fix gcc warning.

Should fix the build in some bots.

llvm-svn: 326209

6 years agoRe-enable "[MachineCopyPropagation] Extend pass to do COPY source forwarding"
Geoff Berry [Tue, 27 Feb 2018 16:59:10 +0000 (16:59 +0000)]
Re-enable "[MachineCopyPropagation] Extend pass to do COPY source forwarding"

Re-enable commit r323991 now that r325931 has been committed to make
MachineOperand::isRenamable() check more conservative w.r.t. code
changes and opt-in on a per-target basis.

llvm-svn: 326208

6 years agoAdd support for SHF_ARM_PURECODE.
Rafael Espindola [Tue, 27 Feb 2018 16:55:25 +0000 (16:55 +0000)]
Add support for SHF_ARM_PURECODE.

Now we don't mark a PT_LOAD as readable if all its sections are
SHF_ARM_PURECODE.

llvm-svn: 326207

6 years ago[scudo] Introduce Chunk::getHeaderSize
Kostya Kortchinsky [Tue, 27 Feb 2018 16:14:49 +0000 (16:14 +0000)]
[scudo] Introduce Chunk::getHeaderSize

Summary:
Instead of using `AlignedChunkHeaderSize`, introduce a `constexpr` function
`getHeaderSize` in the `Chunk` namespace. Switch `RoundUpTo` to a `constexpr`
as well (so we can use it in `constexpr` declarations). Mark a few variables
in the areas touched as `const`.

Overall this has no functional change, and is mostly to make things a bit more
consistent.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: delcypher, #sanitizers, llvm-commits

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

llvm-svn: 326206

6 years ago[clang-format] Tidy up new API guessLanguage()
Ben Hamilton [Tue, 27 Feb 2018 15:56:40 +0000 (15:56 +0000)]
[clang-format] Tidy up new API guessLanguage()

Summary:
This fixes a few issues djasper@ brought up in his review of D43522.

Test Plan:
  make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 326205

6 years agoRevert "[Tooling] [0/1] Refactor FrontendActionFactory::create() to return std::uniqu...
Roman Lebedev [Tue, 27 Feb 2018 15:54:55 +0000 (15:54 +0000)]
Revert "[Tooling] [0/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>"

This reverts commit rL326201

This broke gcc4.8 builds, compiler just segfaults:¬
http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/14909¬
http://lab.llvm.org:8011/builders/clang-x86_64-linux-abi-test/builds/22673¬

llvm-svn: 326204

6 years agoRevert "[Tooling] [1/1] Refactor FrontendActionFactory::create() to return std::uniqu...
Roman Lebedev [Tue, 27 Feb 2018 15:54:41 +0000 (15:54 +0000)]
Revert "[Tooling] [1/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>"

This reverts commit rL326202

This broke gcc4.8 builds, compiler just segfaults:
http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/14909
http://lab.llvm.org:8011/builders/clang-x86_64-linux-abi-test/builds/22673

llvm-svn: 326203

6 years ago[Tooling] [1/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>
Roman Lebedev [Tue, 27 Feb 2018 15:19:28 +0000 (15:19 +0000)]
[Tooling] [1/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>

Summary:
I'm not sure whether there are any principal reasons why it returns raw owning pointer,
or it is just a old code that was not updated post-C++11.

I'm not too sure what testing i should do, because `check-all` is not error clean here for some reason,
but it does not //appear// asif those failures are related to these changes.

This is Clang-tools-extra part.
Clang part is D43779.

Reviewers: klimek, bkramer, alexfh, pcc

Reviewed By: alexfh

Subscribers: ioeric, jkorous-apple, cfe-commits

Tags: #clang, #clang-tools-extra

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

llvm-svn: 326202

6 years ago[Tooling] [0/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>
Roman Lebedev [Tue, 27 Feb 2018 15:19:20 +0000 (15:19 +0000)]
[Tooling] [0/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>

Summary:
Noticed during review of D41102.

I'm not sure whether there are any principal reasons why it returns raw owning pointer,
or it is just a old code that was not updated post-C++11.

I'm not too sure what testing i should do, because `check-all` is not error clean here for some reason,
but it does not //appear// asif those failures are related to these changes.

This is clang part.
Clang-tools-extra part is D43780.

Reviewers: klimek, bkramer, alexfh, pcc

Reviewed By: alexfh

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 326201

6 years ago[ELF] - Format, fix mistype. NFC.
George Rimar [Tue, 27 Feb 2018 14:06:47 +0000 (14:06 +0000)]
[ELF] - Format, fix mistype. NFC.

llvm-svn: 326198

6 years agoAttrDocs.td: fix some bad code-blocks
Hans Wennborg [Tue, 27 Feb 2018 13:48:50 +0000 (13:48 +0000)]
AttrDocs.td: fix some bad code-blocks

llvm-svn: 326195

6 years agoAttrDocs.td: fix bad bullet list
Hans Wennborg [Tue, 27 Feb 2018 13:48:47 +0000 (13:48 +0000)]
AttrDocs.td: fix bad bullet list

llvm-svn: 326194

6 years agoAttrDocs.td: fix bad indent and code block
Hans Wennborg [Tue, 27 Feb 2018 13:48:41 +0000 (13:48 +0000)]
AttrDocs.td: fix bad indent and code block

llvm-svn: 326193

6 years agoclang-format: use AfterControlStatement to format ObjC control blocks
Francois Ferrand [Tue, 27 Feb 2018 13:48:27 +0000 (13:48 +0000)]
clang-format: use AfterControlStatement to format ObjC control blocks

ObjC defines `@autoreleasepool` and `@synchronized` control blocks. These
used to be formatted according to the `AfterObjCDeclaration` brace-
wrapping flag, which is not very consistent.

This patch changes the behavior to use the `AfterControlStatement` flag
instead. This should not affect the behavior unless a custom brace
wrapping mode is used.

Reviewers: krasimir, djasper, klimek, benhamilton

Subscribers: cfe-commits

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

llvm-svn: 326192

6 years agoclang-format: fix formatting of ObjC @synchronized blocks
Francois Ferrand [Tue, 27 Feb 2018 13:48:21 +0000 (13:48 +0000)]
clang-format: fix formatting of ObjC @synchronized blocks

Summary:
The blocks used to be formatted using the "default" behavior, and would
thus be mistaken for function calls followed by blocks: this could lead
to unexpected inlining of the block and extra line-break before the
opening brace.

They are now formatted similarly to `@autoreleasepool` blocks, as
expected:

  @synchronized(self) {
      f();
  }

Reviewers: krasimir, djasper, klimek

Subscribers: cfe-commits

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

llvm-svn: 326191

6 years ago[X86][AVX] combineLoopMAddPattern - support 256-bit cases on AVX1 via SplitBinaryOpsA...
Simon Pilgrim [Tue, 27 Feb 2018 12:20:37 +0000 (12:20 +0000)]
[X86][AVX] combineLoopMAddPattern - support 256-bit cases on AVX1 via SplitBinaryOpsAndApply

llvm-svn: 326189

6 years agoMake the LLParser accept call instructions of variables in the program AS
Alexander Richardson [Tue, 27 Feb 2018 11:15:11 +0000 (11:15 +0000)]
Make the LLParser accept call instructions of variables in the program AS

Summary:
Since r325479 the DataLayout includes a program address space. However, it
is not possible to use `call %foo` if foo is a `i8(...) addrspace(200)` and
the DataLayout specifies address space 200 as the address space for functions.
With this change the IR parser will still accept variables in the program
address space as well as address space 0 for call and invoke functions.

Reviewers: pcc, arsenm, bjope, dylanmckay, theraven

Reviewed By: dylanmckay

Subscribers: wdng, llvm-commits

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

llvm-svn: 326188

6 years agoDon't output bitcode to stdout in 2002-07-31-SlashInString.ll test
Alexander Richardson [Tue, 27 Feb 2018 11:15:05 +0000 (11:15 +0000)]
Don't output bitcode to stdout in 2002-07-31-SlashInString.ll test

llvm-svn: 326187

6 years ago[dsymutil][test] Add PowerPC test
Jonas Devlieghere [Tue, 27 Feb 2018 10:28:43 +0000 (10:28 +0000)]
[dsymutil][test] Add PowerPC test

Add test that verifies that we don't follow DWARF values with a
reference form class, such as DW_AT_sibling.

Since clang doesn't generate the latter attribute, we added a PowerPC
test generated on an old PowerBook G4. (Thanks Adrian!)

llvm-svn: 326183

6 years ago[ADT] Recognize ppc as valid architecture in target triple.
Jonas Devlieghere [Tue, 27 Feb 2018 10:09:58 +0000 (10:09 +0000)]
[ADT] Recognize ppc as valid architecture in target triple.

Until this patch, only `powerpc` and `ppc32` were recognized as valid
PowerPC 32-bit architectures in a target triple. This was incompatible
with the triple `ppc-apple-darwin` as returned for libObject. I found
out about this when working on a test case using a binary generated on
an old PowerBook G4.

We had the choice of either fix this in the Mach-O object parser or
in the Triple implementation. I chose the latter because it feels like
the most canonical place.

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

llvm-svn: 326182

6 years ago[NewGVN] Update phi-of-ops def block when updating existing ValuePHI.
Florian Hahn [Tue, 27 Feb 2018 09:34:51 +0000 (09:34 +0000)]
[NewGVN] Update phi-of-ops def block when updating existing ValuePHI.

In case we update a ValuePHI node created earlier, we could update it
based on a different OpPHI which could be in a different block.
We need to update the TempToBlock mapping reflecting the new block,
otherwise we would end up placing the new phi node in a wrong block.

This problem is exposed by the test case in
https://bugs.llvm.org/show_bug.cgi?id=36504.

This patch fixes a slightly simpler problem than in the bug report. In
the bug's re-producer, the additional problem is that we are re-using a
ValuePHI node with to few incoming values for the new OpPHI. If this
patch makes sense, I will follow it up with a patch that creates a new
PHI node if the existing PHI node has a different number of incoming
values.

Reviewers: davide, dberlin

Reviewed By: dberlin

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

llvm-svn: 326181

6 years ago[test] Extend the Driver/mingw-msvcrt.c test with a -SAME check. NFC.
Martin Storsjo [Tue, 27 Feb 2018 08:35:35 +0000 (08:35 +0000)]
[test] Extend the Driver/mingw-msvcrt.c test with a -SAME check. NFC.

llvm-svn: 326180

6 years ago[ELF] - Fix case of using both --icf and --symbol-ordering-file together.
George Rimar [Tue, 27 Feb 2018 08:26:38 +0000 (08:26 +0000)]
[ELF] - Fix case of using both --icf and --symbol-ordering-file together.

Imagine that we have sections A, B, C, where A == C and
symbol ordering file containing symbols: symC, symB, symA

Previously because of ICF it was possible that final order would be
B, A or B, C. That violates order specified in ordering file.
Patch changes that.

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

llvm-svn: 326179

6 years ago[SystemZ] Make sure SelectCode() is not called on a target opcode.
Jonas Paulsson [Tue, 27 Feb 2018 07:53:23 +0000 (07:53 +0000)]
[SystemZ]  Make sure SelectCode() is not called on a target opcode.

Since getNode() might not always return the requsted opcode, for instance if
called with (ISD::AND, -1) arguments, there should be a check so that
SelectCode() is only called when appropriate.

Review: Ulrich Weigand
llvm-svn: 326178

6 years ago[MemorySSA] Invalidate def caches on deletion
George Burgess IV [Tue, 27 Feb 2018 07:20:49 +0000 (07:20 +0000)]
[MemorySSA] Invalidate def caches on deletion

The only cases I can come up with where this invalidation needs to
happen is when there's a deletion somewhere. If we find more creative
test-cases, we can probably go with another approach mentioned on
PR36529.

Fixes PR36529.

llvm-svn: 326177

6 years ago[ELF] Create and export symbols provided by a linker script if they referenced by...
Igor Kudrin [Tue, 27 Feb 2018 07:18:07 +0000 (07:18 +0000)]
[ELF] Create and export symbols provided by a linker script if they referenced by DSOs.

It should be possible to resolve undefined symbols in dynamic libraries
using symbols defined in a linker script.

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

llvm-svn: 326176

6 years ago[MemorySSA] Call the correct dtors
George Burgess IV [Tue, 27 Feb 2018 06:43:19 +0000 (06:43 +0000)]
[MemorySSA] Call the correct dtors

It appears that there were many cases where we were directly (through
templates) calling the dtor of MemoryAccess, which is conceptually an
abstract class.

This hasn't been a problem, since the data members of all of the
subclasses of MemoryAccess have been POD. I'm planning on changing that.
:)

llvm-svn: 326175

6 years ago[SCEV] Cleanup SCEVInitRewriter. NFC.
Serguei Katkov [Tue, 27 Feb 2018 06:39:31 +0000 (06:39 +0000)]
[SCEV] Cleanup SCEVInitRewriter. NFC.

Set default value for IgnoreOtherLoops of SCEVInitRewriter::rewrite to true
to be consistent with SCEVPostIncRewriter which does not have this parameter
but behaves as it would be true.

This is follow up for rL326067.

llvm-svn: 326174

6 years ago[RecordLayout] Don't align to non-power-of-2 sizes when using -mms-bitfields
Martin Storsjo [Tue, 27 Feb 2018 06:27:06 +0000 (06:27 +0000)]
[RecordLayout] Don't align to non-power-of-2 sizes when using -mms-bitfields

When targeting GNU/MinGW for i386, the size of the "long double" data
type is 12 bytes (while it is 8 bytes in MSVC). When building
with -mms-bitfields to have struct layouts match MSVC, data types
are laid out in a struct with alignment according to their size.
However, this doesn't make sense for the long double type, since
it doesn't match MSVC at all, and aligning to a non-power-of-2
size triggers other asserts later.

This matches what GCC does, aligning a long double to 4 bytes
in structs on i386 even when -mms-bitfields is specified.

This fixes asserts when using the max_align_t data type when
building for MinGW/i386 with the -mms-bitfields flag.

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

llvm-svn: 326173

6 years ago[MinGW] Ignore the --start-group --end-group parameters
Martin Storsjo [Tue, 27 Feb 2018 06:26:35 +0000 (06:26 +0000)]
[MinGW] Ignore the --start-group --end-group parameters

These are required for handling circular dependencies between
static libraries, which is something that lld-link always does without
any extra parameters.

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

llvm-svn: 326172

6 years ago[Driver] Fix codeview-column-info on macOS
Shoaib Meenai [Tue, 27 Feb 2018 06:04:23 +0000 (06:04 +0000)]
[Driver] Fix codeview-column-info on macOS

macOS home directory paths begin with /Users, and clang-cl interprets
the /U portion as a macro undefine rather than a path, causing test
failures on macOS. Use a -- to explicitly treat the input file as a path
and fix the test.

This effectively reverts r326168 and adds an alternative fix.

llvm-svn: 326171

6 years ago[X86] Simplify if condition. NFC
Craig Topper [Tue, 27 Feb 2018 06:00:38 +0000 (06:00 +0000)]
[X86] Simplify if condition. NFC

SSE2 implies SSE1 and we already covered f32 in the SSE1 check so we don't need to check f32 in the SSE2 check.

llvm-svn: 326170

6 years agoMake test agnostic to cost model
Adam Nemet [Tue, 27 Feb 2018 05:41:16 +0000 (05:41 +0000)]
Make test agnostic to cost model

This was causing bot failures on greendragon

llvm-svn: 326169

6 years agoAttempt to fix greendragon bot after r326141
Adam Nemet [Tue, 27 Feb 2018 04:49:26 +0000 (04:49 +0000)]
Attempt to fix greendragon bot after r326141

llvm-svn: 326168

6 years ago[X86] Replace an impossible if condition with an assert.
Craig Topper [Tue, 27 Feb 2018 03:50:00 +0000 (03:50 +0000)]
[X86] Replace an impossible if condition with an assert.

llvm-svn: 326167

6 years agoMark test_*int*_t_dwarf as failing on FreeBSD
Ed Maste [Tue, 27 Feb 2018 02:54:17 +0000 (02:54 +0000)]
Mark test_*int*_t_dwarf as failing on FreeBSD

Further investigation required; tests will be enabled on the buildbot
worker soon. Marking failing tests for now in order to start with a
green buildbot while investigation takes place.

This is a recommit of r326134, with the required import added.

llvm.org/pr36527

llvm-svn: 326166

6 years ago[analyzer] Fix an uninitialized field.
Artem Dergachev [Tue, 27 Feb 2018 02:53:30 +0000 (02:53 +0000)]
[analyzer] Fix an uninitialized field.

Found by the analyzer!

llvm-svn: 326165

6 years ago[Driver] Allow using a canonical form of '-fuse-ld=' when cross-compiling on Windows.
Igor Kudrin [Tue, 27 Feb 2018 02:51:30 +0000 (02:51 +0000)]
[Driver] Allow using a canonical form of '-fuse-ld=' when cross-compiling on Windows.

clang used to require adding an ".exe" suffix when targeting ELF systems on Windows.

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

llvm-svn: 326164

6 years agoAdd new interceptors: getnetent(3) family
Kamil Rytarowski [Tue, 27 Feb 2018 02:33:30 +0000 (02:33 +0000)]
Add new interceptors: getnetent(3) family

Summary:
getnetent, getnetbyaddr, getnetbyname - get network entry

Reuse them on NetBSD.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka

Reviewed By: vitalybuka

Subscribers: llvm-commits, kubamracek, #sanitizers

Tags: #sanitizers

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

llvm-svn: 326163

6 years agoAdd new interceptors: getprotoent(3) family
Kamil Rytarowski [Tue, 27 Feb 2018 02:32:04 +0000 (02:32 +0000)]
Add new interceptors: getprotoent(3) family

Summary:
getprotoent, getprotobynumber, getprotobyname - get protocol entry

Reuse them on NetBSD.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 326162

6 years agoAdd new interceptors: getttyent(3) family
Kamil Rytarowski [Tue, 27 Feb 2018 02:30:16 +0000 (02:30 +0000)]
Add new interceptors: getttyent(3) family

Summary:
getttyent, getttynam, setttyentpath - get ttys file entry

Reuse them on NetBSD.

Sponsored by <The NetBSD Foundation>

Reviewers: vitalybuka, joerg

Reviewed By: vitalybuka

Subscribers: llvm-commits, kubamracek, #sanitizers

Tags: #sanitizers

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

llvm-svn: 326161

6 years ago[asan] Enable ASAN_INTERCEPT___CXA_THROW for x86 Android
Vitaly Buka [Tue, 27 Feb 2018 02:14:06 +0000 (02:14 +0000)]
[asan] Enable ASAN_INTERCEPT___CXA_THROW for x86 Android

llvm-svn: 326160

6 years agoMove "concurrent events" tests back into one folder
Pavel Labath [Tue, 27 Feb 2018 02:01:30 +0000 (02:01 +0000)]
Move "concurrent events" tests back into one folder

These tests all test very similar things, and use the same inferior.
They were only placed in separate folders to achieve better
paralelization. Now that we paralelize at a file level, this is no
longer relevant, and we can put them together again.

llvm-svn: 326159

6 years agoFix r326154 buildbots test fail
Evgeny Stupachenko [Tue, 27 Feb 2018 01:33:11 +0000 (01:33 +0000)]
Fix r326154 buildbots test fail

Summary:

Add specific mtriples to tests added in r326154.

From: Evgeny Stupachenko <evstupac@gmail.com>
                         <evgeny.v.stupachenko@intel.com>
llvm-svn: 326158

6 years ago[analyzer] Switch the default exploration strategy to priority queue based on coverage
George Karpenkov [Tue, 27 Feb 2018 01:31:56 +0000 (01:31 +0000)]
[analyzer] Switch the default exploration strategy to priority queue based on coverage

After the investigation it seems safe to flip the switch.

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

llvm-svn: 326157

6 years ago[analyzer] Logging test typo quickfix.
George Karpenkov [Tue, 27 Feb 2018 01:31:06 +0000 (01:31 +0000)]
[analyzer] Logging test typo quickfix.

llvm-svn: 326156

6 years ago[analyzer] Logging test quickfix.
George Karpenkov [Tue, 27 Feb 2018 01:13:28 +0000 (01:13 +0000)]
[analyzer] Logging test quickfix.

llvm-svn: 326155

6 years agoFix PR36032, PR35432
Evgeny Stupachenko [Tue, 27 Feb 2018 00:17:31 +0000 (00:17 +0000)]
Fix PR36032, PR35432

Summary:

The change fix an assert fail at ScalarEvolutionExpander.cpp:
  assert(ExitCount != SE.getCouldNotCompute() && "Invalid loop count");

Reviewers: sbaranga

Differential Revision: http://reviews.llvm.org/D42604

From: Evgeny Stupachenko <evstupac@gmail.com>
                         <evgeny.v.stupachenko@intel.com>
llvm-svn: 326154

6 years ago[SelectionDAG] Remove code from PromoteIntRes_CONCAT_VECTORS that was added in r32067...
Craig Topper [Tue, 27 Feb 2018 00:07:24 +0000 (00:07 +0000)]
[SelectionDAG] Remove code from PromoteIntRes_CONCAT_VECTORS that was added in r320674 to help X86.

AVX512 used to promote v32i1 to v32i8 during legalization when BWI was disabled. So this code was added to improve legalization of v32i1 concat_vectors of v16i1 by extending the v16i1 to v16i8 to avoid scalarization.

X86 has since switched to legalizing v32i1 by splitting to v16i1 instead. This has rendered this code unnecessary and its no longer exercised.

llvm-svn: 326153

6 years agoRevert "Revert "[analyzer] Quickfix: do not overflow in calculating offset in RegionM...
George Karpenkov [Tue, 27 Feb 2018 00:05:04 +0000 (00:05 +0000)]
Revert "Revert "[analyzer] Quickfix: do not overflow in calculating offset in RegionManager""

This reverts commit c4cc41166d93178a3ddd4b2b5a685cf74a459247.

Revert and fix uninitialized read.

llvm-svn: 326152

6 years ago[Driver] Add SafeStack to a map of incompatible sanitizers
Petr Hosek [Tue, 27 Feb 2018 00:01:26 +0000 (00:01 +0000)]
[Driver] Add SafeStack to a map of incompatible sanitizers

This allows reporting an error when user tries to use SafeStack with
incompatible sanitizers.

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

llvm-svn: 326151

6 years agoFix build for iOS/ARM ("__Unwind_RaiseException" is not available for armv7).
Kuba Mracek [Mon, 26 Feb 2018 23:39:04 +0000 (23:39 +0000)]
Fix build for iOS/ARM ("__Unwind_RaiseException" is not available for armv7).

llvm-svn: 326150

6 years ago[asan] Fix build for Android
Vitaly Buka [Mon, 26 Feb 2018 23:23:07 +0000 (23:23 +0000)]
[asan] Fix build for Android

llvm-svn: 326149

6 years ago[InstCombine, InstSimplify] add tests with undef elements in constant FP vectors...
Sanjay Patel [Mon, 26 Feb 2018 23:23:02 +0000 (23:23 +0000)]
[InstCombine, InstSimplify] add tests with undef elements in constant FP vectors; NFC

llvm-svn: 326148

6 years ago[AArch64] Harden test cases
Evandro Menezes [Mon, 26 Feb 2018 23:19:25 +0000 (23:19 +0000)]
[AArch64] Harden test cases

NFC

llvm-svn: 326147

6 years ago[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings...
Eugene Zelenko [Mon, 26 Feb 2018 23:15:52 +0000 (23:15 +0000)]
[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 326146

6 years agoFix which Darwin versions have ObjC runtime with full subscripting support.
Volodymyr Sapsai [Mon, 26 Feb 2018 23:10:23 +0000 (23:10 +0000)]
Fix which Darwin versions have ObjC runtime with full subscripting support.

Update min deployment target in some tests so that they don't try
to link against libarclite and don't fail when it's not available.

rdar://problem/29253617

Reviewers: vsk, kubamracek

Reviewed By: vsk

Subscribers: jkorous-apple, cfe-commits

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

llvm-svn: 326145

6 years agoFix codeview-column-info.c test with a triple
Reid Kleckner [Mon, 26 Feb 2018 23:06:40 +0000 (23:06 +0000)]
Fix codeview-column-info.c test with a triple

llvm-svn: 326144

6 years agoFix which Darwin versions have ObjC runtime with full subscripting support.
Volodymyr Sapsai [Mon, 26 Feb 2018 23:04:57 +0000 (23:04 +0000)]
Fix which Darwin versions have ObjC runtime with full subscripting support.

Update min deployment target in some tests so that they don't try
to link against libarclite and don't fail when it's not available.

rdar://problem/29253617

Reviewers: vsk, kubamracek

Reviewed By: vsk

Subscribers: jkorous-apple, cfe-commits

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

llvm-svn: 326143

6 years ago[GISel]: Don't assert when constraining RegisterOperands which are uses.
Aditya Nandakumar [Mon, 26 Feb 2018 22:56:21 +0000 (22:56 +0000)]
[GISel]: Don't assert when constraining RegisterOperands which are uses.

Currently we assert that only non target specific opcodes can have
missing RegisterClass constraints in the MCDesc. The backend can have
instructions with register operands but don't have RegisterClass
constraints (say using unknown_class) in which case the instruction
defining the register will constrain it.
Change the assert to only fire if a def has no regclass.

https://reviews.llvm.org/D43409

llvm-svn: 326142

6 years agoRe-land "Emit proper CodeView when -gcodeview is passed without the cl driver."
Reid Kleckner [Mon, 26 Feb 2018 22:55:33 +0000 (22:55 +0000)]
Re-land "Emit proper CodeView when -gcodeview is passed without the cl driver."

Reverts r326116 and re-lands r326113 with a fix to ASan so that it
enables column info in its test suite.

llvm-svn: 326141

6 years agoAdd a sanity check for inline testcases.
Adrian Prantl [Mon, 26 Feb 2018 22:40:20 +0000 (22:40 +0000)]
Add a sanity check for inline testcases.

When writing an inline test, there is no way to make sure that any of
the inline commands are actually executed, so this patch adds a sanity
check that at least one breakpoint was hit. This avoids a test with no
breakpoints being hit passing.

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

llvm-svn: 326140

6 years agoRevert r326134 due to broken buildbot
Ed Maste [Mon, 26 Feb 2018 22:36:41 +0000 (22:36 +0000)]
Revert r326134 due to broken buildbot

llvm-svn: 326139

6 years ago[ValueTracking] Teach cannotBeOrderedLessThanZeroImpl to handle vector constants.
Craig Topper [Mon, 26 Feb 2018 22:33:17 +0000 (22:33 +0000)]
[ValueTracking] Teach cannotBeOrderedLessThanZeroImpl to handle vector constants.

Summary: This allows vector fabs to be removed in more cases.

Reviewers: spatel, arsenm, RKSimon

Reviewed By: spatel

Subscribers: wdng, llvm-commits

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

llvm-svn: 326138

6 years agoKeep flags from phantom synthetic sections.
Rafael Espindola [Mon, 26 Feb 2018 22:32:15 +0000 (22:32 +0000)]
Keep flags from phantom synthetic sections.

This fixes pr36475.

I think this code can be simplified a bit, but I would like to check
in the more direct fix if we are in agreement on the direction and
then refactor.

This is not something that bfd does. The issue is not noticed in bfd
because it keeps fewer sections from the linkerscript in the output.

The reasons why it seems reasonable to do this:

- As George noticed, we would still keep the flags if the output
  section had both an empty synthetic section and a regular section
- We need an heuristic to find the flags of output sections. Using the
  flags of a synthetic section that would have been there seems a
  reasonable heuristic.

llvm-svn: 326137

6 years ago[analyzer] Exploration strategy prioritizing unexplored nodes first
George Karpenkov [Mon, 26 Feb 2018 22:14:18 +0000 (22:14 +0000)]
[analyzer] Exploration strategy prioritizing unexplored nodes first

See D42775 for discussion.  Turns out, just exploring nodes which
weren't explored first is not quite enough, as e.g. the first quick
traversal resulting in a report can mark everything as "visited", and
then subsequent traversals of the same region will get all the pitfalls
of DFS.
Priority queue-based approach in comparison shows much greater
increase in coverage and even performance, without sacrificing memory.

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

llvm-svn: 326136

6 years ago[analyzer] Do not analyze bison-generated files
George Karpenkov [Mon, 26 Feb 2018 22:14:16 +0000 (22:14 +0000)]
[analyzer] Do not analyze bison-generated files

Bison/YACC generated files result in a very large number of (presumably)
false positives from the analyzer.
These false positives are "true" in a sense of the information analyzer
sees: assuming that the lexer can return any token at any point a number
of uninitialized reads does occur.
(naturally, the analyzer can not capture a complex invariant that
certain tokens can only occur under certain conditions).

Current fix simply stops analysis on those files.
I have examined a very large number of such auto-generated files, and
they do all start with such a comment.
Conversely, user code is very unlikely to contain such a comment.

rdar://33608161

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

llvm-svn: 326135

6 years agoMark test_*int*_t_dwarf as failing on FreeBSD
Ed Maste [Mon, 26 Feb 2018 22:12:24 +0000 (22:12 +0000)]
Mark test_*int*_t_dwarf as failing on FreeBSD

Further investigation required; tests will be enabled on the buildbot
worker soon. Marking failing tests for now in order to start with a
green buildbot while investigation takes place.

llvm.org/pr36527

llvm-svn: 326134

6 years ago[X86][SSE] Reduce FADD/FSUB/FMUL costs on later targets (PR36280)
Simon Pilgrim [Mon, 26 Feb 2018 22:10:17 +0000 (22:10 +0000)]
[X86][SSE] Reduce FADD/FSUB/FMUL costs on later targets (PR36280)

Agner's tables indicate that for SSE42+ targets (Core2 and later) we can reduce the FADD/FSUB/FMUL costs down to 1, which should fix the Himeno benchmark.

Note: the AVX512 FDIV costs look rather dodgy, but this isn't part of this patch.

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

llvm-svn: 326133

6 years ago[asan] Intercept std::rethrow_exception indirectly
Vitaly Buka [Mon, 26 Feb 2018 21:40:19 +0000 (21:40 +0000)]
[asan] Intercept std::rethrow_exception indirectly

Summary:
Fixes Bug 32434
See https://bugs.llvm.org/show_bug.cgi?id=32434

Short summary:
std::rethrow_exception does not use __cxa_throw to rethrow the exception, so if
it is called from uninstrumented code, it will leave the stack poisoned. This
can lead to false positives.

Long description:

For functions which don't return normally (e.g. via exceptions), asan needs to
unpoison the entire stack. It is not known before a call to such a function
where execution will continue, some function which don't contain cleanup code
like destructors might be skipped. After stack unwinding, execution might
continue in uninstrumented code.

If the stack has been poisoned before such a function is called, but the stack
is unwound during the unconventional return, then zombie redzones (entries) for
no longer existing stack variables can remain in the shadow memory. Normally,
this is avoided by asan generating a call to asan_handle_no_return before all
functions marked as [[noreturn]]. This asan_handle_no_return unpoisons the
entire stack. Since these [[noreturn]] functions can be called from
uninstrumented code, asan also introduces interceptor functions which call
asan_handle_no_return before running the original [[noreturn]] function;
for example, cxa_throw is intercepted.

If a [[noreturn]] function is called from uninstrumented code (so the stack is
left poisoned) and additionally, execution continues in uninstrumented code, new
stack variables might be introduced and overlap with the stack variables
which have been removed during stack unwinding. Since the redzones are not
cleared nor overwritten by uninstrumented code, they remain but now contain
invalid data.

Now, if the redzones are checked against the new stack variables, false
positive reports can occur. This can happen for example by the uninstrumented
code calling an intercepted function such as memcpy, or an instrumented
function.

Intercepting std::rethrow_exception directly is not easily possible since it
depends on the C++ standard library implementation (e.g. libcxx vs libstdc++)
and the mangled name it produces for this function. As a rather simple
workaround, we're intercepting _Unwind_RaiseException for libstdc++. For
libcxxabi, we can intercept the ABI function __cxa_rethrow_primary_exception.

Patch by Robert Schneider.

Reviewers: kcc, eugenis, alekseyshl, vitalybuka

Reviewed By: vitalybuka

Subscribers: llvm-commits

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

llvm-svn: 326132

6 years agoRevert "[analyzer] Quickfix: do not overflow in calculating offset in RegionManager"
George Karpenkov [Mon, 26 Feb 2018 21:32:57 +0000 (21:32 +0000)]
Revert "[analyzer] Quickfix: do not overflow in calculating offset in RegionManager"

This reverts commit df306c4c5ab4a6b8d3c47432346d1f9b90c328b4.

Reverting until I can figured out the reasons for failures.

llvm-svn: 326131

6 years agoPartial fix for TestConflictingSymbol.py on Windows
Adrian McCarthy [Mon, 26 Feb 2018 21:22:39 +0000 (21:22 +0000)]
Partial fix for TestConflictingSymbol.py on Windows

Without this fix, the test ERRORs because the link of the inferior fails. This
patch adds the LLDB_TEST_API macro where needed and uses the new -2 magic
value for num_expected_locations to account for lazy-loading of module symbols
on Windows.

With this fix, the test itself still fails:  conflicting_symbol isn't in the
debug info nor the export table, and Windows binaries don't have an equivalent
of the ELF .symtab.  We need to understand why the test works to keep the
symbol out of the debug info.  In the mean time, having the test fail at this
point is a better indication of the remaining problem than a build error.

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

llvm-svn: 326130

6 years ago[DebugInfo] Remove target-specific instructions in test
Scott Linder [Mon, 26 Feb 2018 21:21:19 +0000 (21:21 +0000)]
[DebugInfo] Remove target-specific instructions in test

This AsmParser test is target-agnostic, but contained some target-specific
instructions, which broke on SystemZ.

llvm-svn: 326129

6 years ago[X86] Add constant folding to combineMOVMSK.
Craig Topper [Mon, 26 Feb 2018 21:17:33 +0000 (21:17 +0000)]
[X86] Add constant folding to combineMOVMSK.

There's still some shortcoming in our ability to combine binops of constants with different sizes separated by an extend. I'll try to look at that next.

llvm-svn: 326128

6 years ago[opt-viewer] Kill parser processes before moving onto rendering
Adam Nemet [Mon, 26 Feb 2018 21:15:51 +0000 (21:15 +0000)]
[opt-viewer] Kill parser processes before moving onto rendering

The main benefit is that they release the memory they were holding onto.

llvm-svn: 326127

6 years agoopt-diff: Support splitting to multiple output files
Adam Nemet [Mon, 26 Feb 2018 21:15:51 +0000 (21:15 +0000)]
opt-diff: Support splitting to multiple output files

When reading the resulting files back with opt-viewer, they will be parsed in
parallel.

llvm-svn: 326126

6 years ago[opt-viewer] Set title for the source pages
Adam Nemet [Mon, 26 Feb 2018 21:15:50 +0000 (21:15 +0000)]
[opt-viewer] Set title for the source pages

llvm-svn: 326125

6 years agoopt-viewer: also find thinlto opt.yaml files
Adam Nemet [Mon, 26 Feb 2018 21:15:49 +0000 (21:15 +0000)]
opt-viewer: also find thinlto opt.yaml files

llvm-svn: 326124

6 years agoopt-viewer: output index first
Adam Nemet [Mon, 26 Feb 2018 21:15:47 +0000 (21:15 +0000)]
opt-viewer: output index first

One can start looking at the index while the pages are still generating

llvm-svn: 326123

6 years ago[analyzer] Quickfix: do not overflow in calculating offset in RegionManager
George Karpenkov [Mon, 26 Feb 2018 21:03:06 +0000 (21:03 +0000)]
[analyzer] Quickfix: do not overflow in calculating offset in RegionManager

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

rdar://37159026

A proper fix would be much harder, and would involve changing the
appropriate code in ExprEngine to be aware of the size limitations of
the type used for addressing.

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

llvm-svn: 326122

6 years ago[Darwin] Specify DWARF 2/4 when running apple accelerator tests.
Davide Italiano [Mon, 26 Feb 2018 20:56:45 +0000 (20:56 +0000)]
[Darwin] Specify DWARF 2/4 when running apple accelerator tests.

These sections will be retired. Also, explicitly list llvm-objdump
as a dependency. This should've been done in the previous commit,
but I failed to squash the two changes together.

Thanks to Adrian for pointing the first problem out in a comment.

llvm-svn: 326121

6 years ago[libcxx] [test] Fix MSVC warnings and errors.
Stephan T. Lavavej [Mon, 26 Feb 2018 20:47:46 +0000 (20:47 +0000)]
[libcxx] [test] Fix MSVC warnings and errors.

test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp
test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp
test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp
test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp
test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp
test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp
test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp
test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp
Fix MSVC x64 truncation warnings.
warning C4267: conversion from 'size_t' to 'int', possible loss of data

test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
Fix MSVC uninitialized memory warning.
warning C6001: Using uninitialized memory 'vl'.

test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp
Include <cassert> for the assert() macro.

Fixes D43273.

llvm-svn: 326120

6 years ago[X86] Add a custom legalization for (i16 (bitcast v16i1)) and (i32 (bitcast v32i1...
Craig Topper [Mon, 26 Feb 2018 20:32:27 +0000 (20:32 +0000)]
[X86] Add a custom legalization for (i16 (bitcast v16i1)) and (i32 (bitcast v32i1)) without AVX512 to prevent scalarization

Summary:
We have an early DAG combine to turn these patterns into MOVMSK, but that combine doesn't work if the vXi1 type has more elements than the widest legal vXi8 type. Type legalization will eventually split it down to v16i1 or v32i1 and then the bitcast gets legalized to a truncstore and a scalar load. The truncstore will get lowered to a series of extracts and bit math.

This patch adds a custom legalization to use a sign extend and MOVMSK instead. This prevents the eventual scalarization.

Reviewers: spatel, RKSimon, zvi

Reviewed By: RKSimon

Subscribers: mgorny, llvm-commits

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

llvm-svn: 326119

6 years agoFix for LLVM r326109
David Zarzycki [Mon, 26 Feb 2018 20:21:30 +0000 (20:21 +0000)]
Fix for LLVM r326109

llvm-svn: 326118

6 years ago[SLP] Added new test + fixed some checks, NFC.
Alexey Bataev [Mon, 26 Feb 2018 20:01:24 +0000 (20:01 +0000)]
[SLP] Added new test + fixed some checks, NFC.

llvm-svn: 326117

6 years agoRevert "Emit proper CodeView when -gcodeview is passed without the cl driver."
Zachary Turner [Mon, 26 Feb 2018 19:51:29 +0000 (19:51 +0000)]
Revert "Emit proper CodeView when -gcodeview is passed without the cl driver."

This reverts commit e17911006548518634fad66bb8648bcad49a1d64.

This is failing on ASAN bots because asan expects column info,
and it's also failing on some linux bots for unknown reasons which
i need to investigate.

llvm-svn: 326116

6 years ago[InstCombine] Add test cases with vector constants to fpextend.ll
Craig Topper [Mon, 26 Feb 2018 19:36:37 +0000 (19:36 +0000)]
[InstCombine] Add test cases with vector constants to fpextend.ll

llvm-svn: 326115

6 years ago[InstCombine] Switch to using FileCheck instead of grep. Auto-generate checks. NFC
Craig Topper [Mon, 26 Feb 2018 19:36:36 +0000 (19:36 +0000)]
[InstCombine] Switch to using FileCheck instead of grep. Auto-generate checks. NFC

llvm-svn: 326114

6 years agoEmit proper CodeView when -gcodeview is passed without the cl driver.
Zachary Turner [Mon, 26 Feb 2018 19:25:39 +0000 (19:25 +0000)]
Emit proper CodeView when -gcodeview is passed without the cl driver.

Windows debuggers don't work properly when column info is emitted
with lines.  We handled this by checking if the driver mode was
cl, but it's possible to cause the gcc driver to emit codeview as
well, and in that path we were emitting column info with codeview.

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

llvm-svn: 326113

6 years agoAdd "lldb-test breakpoint" command and convert the case-sensitivity test to use it
Pavel Labath [Mon, 26 Feb 2018 18:50:16 +0000 (18:50 +0000)]
Add "lldb-test breakpoint" command and convert the case-sensitivity test to use it

Summary:
The command takes two input arguments: a module to use as a debug target
and a file containing a list of commands. The command will execute each
of the breakpoint commands in the file and dump the breakpoint state
after each one.

The commands are expected to be breakpoint set/remove/etc. commands, but
I explicitly allow any lldb command here, so you can do things like
change setting which impact breakpoint resolution, etc. There is also a
"-persistent" flag, which causes lldb-test to *not* automatically clear
the breakpoint list after each command. Right now I don't use it, but
the idea behind it was that it could be used to test more complex
combinations of breakpoint commands (set+modify, set+disable, etc.).

Right now the command prints out only the basic breakpoint state, but
more information can be easily added there.  To enable easy matching of
the "at least one breakpoint location found" state, the command
explicitly prints out the string "At least one breakpoint location.".

To enable testing of breakpoints set with an absolute paths, I add the
ability to perform rudimentary substitutions on the commands: right now
the string %p is replaced by the directory which contains the command
file (so, under normal circumstances, this will perform the same
substitution as lit would do for %p).

I use this command to rewrite the TestBreakpointCaseSensitivity test --
the test was checking about a dozen breakpoint commands, but it was
launching a new process for each one, so it took about 90 seconds to
run. The new test takes about 0.3 seconds for me, which is approximately
a 300x speedup.

Reviewers: davide, zturner, jingham

Subscribers: luporl, lldb-commits

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

llvm-svn: 326112

6 years agoFix-up for r326106: FindAvailableMemoryRange needs a nullptr as its 5th argument.
Kuba Mracek [Mon, 26 Feb 2018 18:44:43 +0000 (18:44 +0000)]
Fix-up for r326106: FindAvailableMemoryRange needs a nullptr as its 5th argument.

llvm-svn: 326111

6 years agoFix for LLVM r326109
David Zarzycki [Mon, 26 Feb 2018 18:42:30 +0000 (18:42 +0000)]
Fix for LLVM r326109

llvm-svn: 326110

6 years ago[ADT] Simplify and optimize StringSwitch
David Zarzycki [Mon, 26 Feb 2018 18:41:26 +0000 (18:41 +0000)]
[ADT] Simplify and optimize StringSwitch

This change improves incremental rebuild performance on dual Xeon 8168
machines by 54%. This change also improves run time code gen by not
forcing the case values to be lvalues.

llvm-svn: 326109

6 years ago[Driver] Forward opt-remark hotness threshold to LTO
Adam Nemet [Mon, 26 Feb 2018 18:38:11 +0000 (18:38 +0000)]
[Driver] Forward opt-remark hotness threshold to LTO

llvm-svn: 326108

6 years ago[LTO] Support filtering by hotness threshold
Adam Nemet [Mon, 26 Feb 2018 18:37:45 +0000 (18:37 +0000)]
[LTO] Support filtering by hotness threshold

This wires up -pass-remarks-hotness-threshold to LTO and ThinLTO.

Next is to change the clang driver to pass this
with -fdiagnostics-hotness-threshold.

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

llvm-svn: 326107

6 years ago[asan] Be more careful and verbose when allocating dynamic shadow memory
Kuba Mracek [Mon, 26 Feb 2018 18:33:21 +0000 (18:33 +0000)]
[asan] Be more careful and verbose when allocating dynamic shadow memory

FindAvailableMemoryRange can currently overwrite existing memory (by restricting the VM below addresses that are already used). This patch adds a check to make sure we don't restrict the VM space too much. We are also now more explicit about why the lookup failed and print out verbose values.

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

llvm-svn: 326106

6 years ago[MSan] Print current stack on CHECK violation
Alex Shlyapnikov [Mon, 26 Feb 2018 18:27:24 +0000 (18:27 +0000)]
[MSan] Print current stack on CHECK violation

Summary:
Print current stack on CHECK violation to aid debugging and
match other sanitizers functionality.

Reviewers: eugenis

Subscribers: delcypher, llvm-commits, #sanitizers

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

llvm-svn: 326105