platform/upstream/llvm.git
6 years agollvm-symbolizer: Handle function definitions nested within other functions
David Blaikie [Tue, 1 May 2018 18:08:45 +0000 (18:08 +0000)]
llvm-symbolizer: Handle function definitions nested within other functions

LLVM always puts function definition DIEs at the top level, but under
some circumstances GCC does not (at least in this case with member
functions of a function-local type).

To ensure that doesn't appear as though the local type's member function
is unduly inlined within the outer function - ensure the inline
discovery DIE parent walk stops at the first DW_TAG_subprogram.

llvm-svn: 331291

6 years ago[X86] Split WriteFRcp/WriteFRsqrt/WriteFSqrt into XMM and YMM/ZMM scheduler classes
Simon Pilgrim [Tue, 1 May 2018 18:06:07 +0000 (18:06 +0000)]
[X86] Split WriteFRcp/WriteFRsqrt/WriteFSqrt into XMM and YMM/ZMM scheduler classes

llvm-svn: 331290

6 years agoUse no-op opt run to eliminate the difference in bb pred comment, per chandler's...
Wei Mi [Tue, 1 May 2018 17:19:25 +0000 (17:19 +0000)]
Use no-op opt run to eliminate the difference in bb pred comment, per chandler's suggestion. It is better than using sed on portability.

llvm-svn: 331286

6 years agoRevert "[lit] Replace generator expressions in lit.site.cfg"
Jonas Devlieghere [Tue, 1 May 2018 17:08:09 +0000 (17:08 +0000)]
Revert "[lit] Replace generator expressions in lit.site.cfg"

Using GENERATE breaks generators that support multiple configurations,
e.g. MSVC. Reverting for now until we find a better solution.

llvm-svn: 331285

6 years agoAMDGPU: Add missing gfx904 tests
Konstantin Zhuravlyov [Tue, 1 May 2018 17:05:44 +0000 (17:05 +0000)]
AMDGPU: Add missing gfx904 tests

llvm-svn: 331284

6 years ago[X86] Split WriteFCmp into XMM and YMM/ZMM scheduler classes
Simon Pilgrim [Tue, 1 May 2018 16:50:16 +0000 (16:50 +0000)]
[X86] Split WriteFCmp into XMM and YMM/ZMM scheduler classes

Removes more WriteFCmp InstRW overrides

llvm-svn: 331283

6 years agoSupport: assume `std::is_final` with MSVC
Saleem Abdulrasool [Tue, 1 May 2018 16:46:05 +0000 (16:46 +0000)]
Support: assume `std::is_final` with MSVC

According to MSDN, Visual Studio 2015 included support for
std::is_final. Additionally, a bug in the Visual Studio compiler results
in the incorrect definition of __cplusplus. Due to the conditions in the
else case not holding either, we end up with no definition of
LLVM_IS_FINAL when building with MSVC. This has not yet been a problem
with LLVM/clang, however, the uses of LLVM_IS_FINAL is more prevalent in
swift, which uses the ADT library and causes issues when building lldb
with Visual Studio.

Workaround the issue by always assuming that the definition of
std::is_final is available with Visual Studio. Since we currently
require VS 2015+ for building LLVM, this condition should always hold
for the users in LLVM/clang (and for swift).

llvm-svn: 331282

6 years ago[LV] Move test/Transforms/LoopVectorize/pr23997.ll
Daniel Neilson [Tue, 1 May 2018 16:40:45 +0000 (16:40 +0000)]
[LV] Move test/Transforms/LoopVectorize/pr23997.ll

Summary:
This fixes a build break with r331269.

test/Transforms/LoopVectorize/pr23997.ll

should be in:

test/Transforms/LoopVectorize/X86/pr23997.ll

llvm-svn: 331281

6 years agoFix the sed command in test which doesn't work well on BSD.
Wei Mi [Tue, 1 May 2018 16:37:27 +0000 (16:37 +0000)]
Fix the sed command in test which doesn't work well on BSD.

llvm-svn: 331280

6 years ago[WebAssembly] llvm-readobj: display symbols names in relocations
Sam Clegg [Tue, 1 May 2018 16:35:16 +0000 (16:35 +0000)]
[WebAssembly] llvm-readobj: display symbols names in relocations

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

llvm-svn: 331279

6 years agoAMDGPU/NFC: Use enum values for first/last machs instead of numbers
Konstantin Zhuravlyov [Tue, 1 May 2018 16:34:29 +0000 (16:34 +0000)]
AMDGPU/NFC: Use enum values for first/last machs instead of numbers

llvm-svn: 331278

6 years ago[lit] Replace generator expressions in lit.site.cfg
Jonas Devlieghere [Tue, 1 May 2018 16:19:48 +0000 (16:19 +0000)]
[lit] Replace generator expressions in lit.site.cfg

The lit site configuration for the test suite can contain generator
expressions such as $<TARGET_FILE:debugserver> that need to be
substituted.

llvm-svn: 331277

6 years ago[X86] Split WriteFAdd into XMM and YMM/ZMM scheduler classes
Simon Pilgrim [Tue, 1 May 2018 16:13:42 +0000 (16:13 +0000)]
[X86] Split WriteFAdd into XMM and YMM/ZMM scheduler classes

Removes more WriteFAdd InstRW overrides

llvm-svn: 331276

6 years agoRemove @brief commands from doxygen comments, too.
Adrian Prantl [Tue, 1 May 2018 16:10:38 +0000 (16:10 +0000)]
Remove @brief commands from doxygen comments, too.

This is a follow-up to r331272.

We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by
  for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done

https://reviews.llvm.org/D46290

llvm-svn: 331275

6 years ago[SLP] Add additional test for transposable binary operations with reuse
Matthew Simpson [Tue, 1 May 2018 15:59:26 +0000 (15:59 +0000)]
[SLP] Add additional test for transposable binary operations with reuse

llvm-svn: 331274

6 years ago[X86] Convert all uses of WriteFAdd to X86SchedWriteWidths.
Simon Pilgrim [Tue, 1 May 2018 15:57:17 +0000 (15:57 +0000)]
[X86] Convert all uses of WriteFAdd to X86SchedWriteWidths.

In preparation of splitting WriteFAdd by vector width.

llvm-svn: 331273

6 years agoRemove \brief commands from doxygen comments.
Adrian Prantl [Tue, 1 May 2018 15:54:18 +0000 (15:54 +0000)]
Remove \brief commands from doxygen comments.

We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

  for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done

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

llvm-svn: 331272

6 years ago[DAG] add test to show FMF mismatch between IR and DAG; NFC
Sanjay Patel [Tue, 1 May 2018 15:43:36 +0000 (15:43 +0000)]
[DAG] add test to show FMF mismatch between IR and DAG; NFC

D45710 proposes to change this, but we have no test coverage
for the first step in this process.

llvm-svn: 331271

6 years agoRemove redundant command.
Adrian Prantl [Tue, 1 May 2018 15:38:01 +0000 (15:38 +0000)]
Remove redundant command.

llvm-svn: 331270

6 years ago[LV] Preserve inbounds on created GEPs
Daniel Neilson [Tue, 1 May 2018 15:35:08 +0000 (15:35 +0000)]
[LV] Preserve inbounds on created GEPs

Summary:
This is a fix for PR23997.

The loop vectorizer is not preserving the inbounds property of GEPs that it creates.
This is inhibiting some optimizations. This patch preserves the inbounds property in
the case where a load/store is being fed by an inbounds GEP.

Reviewers: mkuper, javed.absar, hsaito

Reviewed By: hsaito

Subscribers: dcaballe, hsaito, llvm-commits

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

llvm-svn: 331269

6 years ago[clang-tidy/google-runtime-int] Allow passing non-bitwidth types to printf()-style...
Ben Hamilton [Tue, 1 May 2018 14:48:54 +0000 (14:48 +0000)]
[clang-tidy/google-runtime-int] Allow passing non-bitwidth types to printf()-style APIs

Summary:
The `google-runtime-int` check currently fires on calls like:

  printf("%lu", (unsigned long)foo);

However, the style guide says:

> Where possible, avoid passing arguments of types specified by
> bitwidth typedefs to printf-based APIs.

http://google.github.io/styleguide/cppguide.html#64-bit_Portability

This diff relaxes the check to not fire on parameters to functions
with the `__format__` attribute. (I didn't specifically check
for `__printf__` since there are a few variations.)

Test Plan: New tests added. Ran tests with:
  % make -j16 check-clang-tools

Reviewers: alexfh, bkramer

Reviewed By: alexfh

Subscribers: klimek, cfe-commits

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

llvm-svn: 331268

6 years ago[clang-tidy] Add Apple prefix acronyms to objc-property-declaration
Ben Hamilton [Tue, 1 May 2018 14:48:51 +0000 (14:48 +0000)]
[clang-tidy] Add Apple prefix acronyms to objc-property-declaration

Summary:
This adds a few common Apple first-party API prefixes as acronyms to
`objc-property-declaration`.

Here's a list showing where these come from:

http://nshipster.com/namespacing/

Test Plan: New tests added. Ran tests with:
  % make -j16 check-clang-tools

Reviewers: Wizard, hokein

Subscribers: klimek, xazax.hun, cfe-commits

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

llvm-svn: 331267

6 years agoFix the issue that ComputeValueKnownInPredecessors only handles the case when
Wei Mi [Tue, 1 May 2018 14:47:24 +0000 (14:47 +0000)]
Fix the issue that ComputeValueKnownInPredecessors only handles the case when
phi is on lhs of a comparison op.

For the following testcase,
L1:

  %t0 = add i32 %m, 7
  %t3 = icmp eq i32* %t2, null
  br i1 %t3, label %L3, label %L2

L2:

  %t4 = load i32, i32* %t2, align 4
  br label %L3

L3:

  %t5 = phi i32 [ %t0, %L1 ], [ %t4, %L2 ]
  %t6 = icmp eq i32 %t0, %t5
  br i1 %t6, label %L4, label %L5

We know if we go through the path L1 --> L3, %t6 should always be true. However
currently, if the rhs of the eq comparison is phi, JumpThreading fails to
evaluate %t6 to true. And we know that Instcombine cannot guarantee always
canonicalizing phi to the left hand side of the comparison operation according
to the operand priority comparison mechanism in instcombine. The patch handles
the case when rhs of the comparison op is a phi.

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

llvm-svn: 331266

6 years ago[InstCombine] new testcases for OverflowingBinaryOperators and PossiblyExactOperators...
Omer Paparo Bivas [Tue, 1 May 2018 14:27:10 +0000 (14:27 +0000)]
[InstCombine] new testcases for OverflowingBinaryOperators and PossiblyExactOperators transformations; NFC

instcombine should transform the relevant cases if the OverflowingBinaryOperator/PossiblyExactOperator can be proven to be safe.

Change-Id: I7aec62a31a894e465e00eb06aed80c3ea0c9dd45
llvm-svn: 331265

6 years ago[X86] Split WriteFShuffle into XMM and YMM/ZMM scheduler classes
Simon Pilgrim [Tue, 1 May 2018 14:25:01 +0000 (14:25 +0000)]
[X86] Split WriteFShuffle into XMM and YMM/ZMM scheduler classes

Removes more WriteFShuffle InstRW overrides

llvm-svn: 331264

6 years agoAdd Microsoft Mangling for OpenCL Half Type
Erich Keane [Tue, 1 May 2018 14:16:15 +0000 (14:16 +0000)]
Add Microsoft Mangling for OpenCL Half Type

Half-type mangling is accomplished following the method introduced by Erich
Keane for mangling _Float16. Updated the half.cl LIT test to cover this
particular case.

Patch By: vbridgers

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

llvm-svn: 331263

6 years ago[X86] Convert all uses of WriteFShuffle to X86SchedWriteWidths.
Simon Pilgrim [Tue, 1 May 2018 14:14:42 +0000 (14:14 +0000)]
[X86] Convert all uses of WriteFShuffle to X86SchedWriteWidths.

In preparation of splitting WriteFShuffle by vector width.

llvm-svn: 331262

6 years ago[OPENMP] Emit template instatiation|specialization functions for
Alexey Bataev [Tue, 1 May 2018 14:09:46 +0000 (14:09 +0000)]
[OPENMP] Emit template instatiation|specialization functions for
devices.

If the function is an instantiation|specialization of the template and
is used in the device code, the definitions of such functions should be
emitted for the device.

llvm-svn: 331261

6 years ago[AArch64][SVE] Asm: Support for contiguous ST1 (scalar+scalar) store instructions.
Sander de Smalen [Tue, 1 May 2018 13:36:03 +0000 (13:36 +0000)]
[AArch64][SVE] Asm: Support for contiguous ST1 (scalar+scalar) store instructions.

Reviewers: fhahn, rengolin, samparker, SjoerdMeijer, javed.absar

Reviewed By: fhahn

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

llvm-svn: 331260

6 years agoReland r331175: "[mips] Fix the predicates of jump and branch and link instructions"
Simon Dardis [Tue, 1 May 2018 13:06:49 +0000 (13:06 +0000)]
Reland r331175: "[mips] Fix the predicates of jump and branch and link instructions"

The previous version of this patch restricted the 'jal' instruction to MIPS and
microMIPSr3. microMIPS32r6 does not have this instruction and instead uses jal
as an alias for balc.

Original commit message:
> Reviewers: smaksimovic, atanasyan, abeserminji
>
> Differential Revision: https://reviews.llvm.org/D46114
>

llvm-svn: 331259

6 years ago[X86] Split WriteVecLogic into XMM and YMM/ZMM scheduler classes
Simon Pilgrim [Tue, 1 May 2018 12:39:17 +0000 (12:39 +0000)]
[X86] Split WriteVecLogic into XMM and YMM/ZMM scheduler classes

This removes all the WriteVecLogic InstRW overrides.

llvm-svn: 331258

6 years ago[InstCombine] Adjusting bswap pattern matching to hold for And/Shift mixed case
Omer Paparo Bivas [Tue, 1 May 2018 12:25:46 +0000 (12:25 +0000)]
[InstCombine] Adjusting bswap pattern matching to hold for And/Shift mixed case

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

Change-Id: I85d4226504e954933c41598327c91b2d08192a9d
llvm-svn: 331257

6 years ago[X86] Convert all uses of WriteFLogic/WriteVecLogic to X86SchedWriteWidths.
Simon Pilgrim [Tue, 1 May 2018 12:15:29 +0000 (12:15 +0000)]
[X86] Convert all uses of WriteFLogic/WriteVecLogic to X86SchedWriteWidths.

In preparation of splitting WriteVecLogic by vector width.

llvm-svn: 331256

6 years ago[MC] Add llvm_unreachable to toString to fix compile time warning.
Florian Hahn [Tue, 1 May 2018 11:18:31 +0000 (11:18 +0000)]
[MC] Add llvm_unreachable to toString to fix compile time warning.

Without this change, GCC 7 raises the warning below:
        control reaches end of non-void function

Reviewers: sbc100, andreadb

Reviewed By: andreadb

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

llvm-svn: 331255

6 years ago[X86] Tag PSLLDQ/PSRLDQ as WriteShuffle scheduler classes instead of shifts.
Simon Pilgrim [Tue, 1 May 2018 11:05:42 +0000 (11:05 +0000)]
[X86] Tag PSLLDQ/PSRLDQ as WriteShuffle scheduler classes instead of shifts.

Although they are encoded similar to bit shifts, the byte shifts behave like shuffles from a scheduling point of view.

llvm-svn: 331253

6 years ago[X86] Correct spill slot size.
Andrea Di Biagio [Tue, 1 May 2018 10:29:38 +0000 (10:29 +0000)]
[X86] Correct spill slot size.

This patch fixes a bug introduced by revision 330778 (originally reviewed at:
https://reviews.llvm.org/D44782), where function isFrameLoadOpcode returned
the wrong number of bytes read for opcodes VMOVSSrm and VMOVSDrm.

This corrects that mistake, and extends the regression test to catch cases where
the dead stores should be removed.

Patch by Jeremy Morse.

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

llvm-svn: 331252

6 years agoNFC, Avoid a warning in WasmObjectWriter
Gabor Buella [Tue, 1 May 2018 10:21:10 +0000 (10:21 +0000)]
NFC, Avoid a warning in WasmObjectWriter

The warning was (introduced in r331220):

lib/MC/WasmObjectWriter.cpp:51:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^

llvm-svn: 331251

6 years agoSplit TestGlobalVariables into two and xfail one of them for arm64 linux
Pavel Labath [Tue, 1 May 2018 10:09:53 +0000 (10:09 +0000)]
Split TestGlobalVariables into two and xfail one of them for arm64 linux

Displaying of global pointer variables is not working on arm64 linux
(pr37301).

I've moved this part into a separate test, so it can be xfailed
separately. I then move the "show-variables-with-process-available"
check before the "show-all-variables" command to presrve the intent of
checking that global variable caching works correctly. (I've verified
that the new arrangement still fails when I revert the fix from
r331230.)

llvm-svn: 331250

6 years ago[X86] directstore and movdir64b intrinsics
Gabor Buella [Tue, 1 May 2018 10:05:42 +0000 (10:05 +0000)]
[X86] directstore and movdir64b intrinsics

Reviewers: spatel, craig.topper, RKSimon

Reviewed By: craig.topper

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

llvm-svn: 331249

6 years ago[X86] movdiri and movdir64b instructions
Gabor Buella [Tue, 1 May 2018 10:01:16 +0000 (10:01 +0000)]
[X86] movdiri and movdir64b instructions

Reviewers: spatel, craig.topper, RKSimon

Reviewed By: craig.topper, RKSimon

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

llvm-svn: 331248

6 years ago[PM/LoopUnswitch] Remove the last manual domtree update code from loop
Chandler Carruth [Tue, 1 May 2018 09:54:39 +0000 (09:54 +0000)]
[PM/LoopUnswitch] Remove the last manual domtree update code from loop
unswitch and replace it with the amazingly simple update API code.

This addresses piles of FIXMEs around the update logic here and makes
everything substantially simpler.

llvm-svn: 331247

6 years ago[PM/LoopUnswitch] Add back a successor set that was removed based on
Chandler Carruth [Tue, 1 May 2018 09:42:09 +0000 (09:42 +0000)]
[PM/LoopUnswitch] Add back a successor set that was removed based on
code review.

It turns out this *is* necessary, and I read the comment on the API
correctly the first time. ;]

The `applyUpdates` routine requires that updates are "balanced". This is
in order to cleanly handle cycles like inserting, removing, nad then
re-inserting the same edge. This precludes inserting the same edge
multiple times in a row as handling that would cause the insertion logic
to become *ordered* instead of *unordered* (which is what the API
provides).

It happens that in this specific case nothing (other than an assert and
contract violation) goes wrong because we're never inserting and
removing the same edge. The implementation *happens* to do the right
thing to eliminate redundant insertions in that case.

But the requirement is there and there is an assert to catch it.
Somehow, after the code review I never did another asserts-clang build
testing loop-unswich for a long time. As a consequence, I didn't notice
this despite a bunch of testing going on, but it shows up immediately
with an asserts build of clang itself.

llvm-svn: 331246

6 years agoFix up r331244 - the emitted definition is weak_odr linkage. Should get
Chandler Carruth [Tue, 1 May 2018 06:48:30 +0000 (06:48 +0000)]
Fix up r331244 - the emitted definition is weak_odr linkage. Should get
the build bots to healthy again without a full revert. As the
functionality added has nothing to do with linkage this seems unlikely
to represent a deep or interesting bug in the patch.

llvm-svn: 331245

6 years agoImplement P0482R2, support for char8_t type.
Richard Smith [Tue, 1 May 2018 05:02:45 +0000 (05:02 +0000)]
Implement P0482R2, support for char8_t type.

This is not yet part of any C++ working draft, and so is controlled by the flag
-fchar8_t rather than a -std= flag. (The GCC implementation is controlled by a
flag with the same name.)

This implementation is experimental, and will be removed or revised
substantially to match the proposal as it makes its way through the C++
committee.

llvm-svn: 331244

6 years ago[X86] Remove 'opaque ptr' from the intel syntax parser and printer.
Craig Topper [Tue, 1 May 2018 04:42:00 +0000 (04:42 +0000)]
[X86] Remove 'opaque ptr' from the intel syntax parser and printer.

Previously for instructions like fxsave we would print "opaque ptr" as part of the memory operand. Now we print nothing.

We also no longer accept "opaque ptr" in the parser. We still accept any size to be specified for these instructions, but we may want to consider only parsing when no explicit size is specified. This what gas does.

llvm-svn: 331243

6 years agoFix type_lookup test to make buildbots happy
Eugene Zemtsov [Tue, 1 May 2018 03:06:05 +0000 (03:06 +0000)]
Fix type_lookup test to make buildbots happy

llvm-svn: 331242

6 years agoFix return type of isinf(double) and isnan(double) where possible.
Richard Smith [Tue, 1 May 2018 03:05:40 +0000 (03:05 +0000)]
Fix return type of isinf(double) and isnan(double) where possible.

When using an old version of glibc, a ::isinf(double) and ::isnan(double)
function is provided, rather than just the macro required by C and C++.
Displace this function using _LIBCPP_PREFERRED_OVERLOAD where possible.

The only remaining case where we should get the wrong return type is now
glibc + libc++ + a non-clang compiler.

llvm-svn: 331241

6 years agoLog to the process channel, not target twice.
Jason Molenda [Tue, 1 May 2018 00:42:17 +0000 (00:42 +0000)]
Log to the process channel, not target twice.

llvm-svn: 331239

6 years ago[ShadowCallStack] fix the docs
Kostya Serebryany [Tue, 1 May 2018 00:15:56 +0000 (00:15 +0000)]
[ShadowCallStack] fix the docs

llvm-svn: 331238

6 years agoTemporarily revert "[DEBUG] Initial adaptation of NVPTX target for debug info emission."
Eric Christopher [Tue, 1 May 2018 00:10:13 +0000 (00:10 +0000)]
Temporarily revert "[DEBUG] Initial adaptation of NVPTX target for debug info emission."

This appears to have some issues associated with the file directive output
causing multiple global symbols with the name "file" to be emitted into a
startup section. I'm investigating more specific causes and working with the
original author.

This reverts commit r330271.

Also Revert "[DEBUGINFO, NVPTX] Add the test for the debug info of the local"

This reverts commit r330592 and the follow up of 330779 as the testcase is dependent upon r330271.

llvm-svn: 331237

6 years agoAdd logging when ArchSpec::SetArchitecture is given a cputype and
Jason Molenda [Tue, 1 May 2018 00:05:54 +0000 (00:05 +0000)]
Add logging when ArchSpec::SetArchitecture is given a cputype and
cpusubtype that don't map to any known core definition.

<rdar://problem/39779398>

llvm-svn: 331236

6 years agoRefactor GetNextPersistentVariableName into a non-virtual method
Adrian Prantl [Mon, 30 Apr 2018 23:59:17 +0000 (23:59 +0000)]
Refactor GetNextPersistentVariableName into a non-virtual method
that takes a prefix string. This simplifies the implementation and
allows plugins such as the Swift plugin to supply different prefixes
for return and error variables.

rdar://problem/39299889

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

llvm-svn: 331235

6 years agoMove the persistent variable counter into Target
Adrian Prantl [Mon, 30 Apr 2018 23:59:15 +0000 (23:59 +0000)]
Move the persistent variable counter into Target
so it can be shared across multiple language plugins.

In a multi-language project it is counterintuitive to have a result
variables reuse numbers just because they are using a different
language plugin in LLDB (but not for example, when they are
Objective-C versus C++, since they are both handled by Clang).

This is NFC on llvm.org except for the Go plugin.

rdar://problem/39299889

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

llvm-svn: 331234

6 years ago[Modules] Fix testcases from r331232
Bruno Cardoso Lopes [Mon, 30 Apr 2018 22:57:02 +0000 (22:57 +0000)]
[Modules] Fix testcases from r331232

llvm-svn: 331233

6 years ago[Modules] Handle ObjC/C ODR-like semantics for EnumConstantDecl
Bruno Cardoso Lopes [Mon, 30 Apr 2018 22:14:29 +0000 (22:14 +0000)]
[Modules] Handle ObjC/C ODR-like semantics for EnumConstantDecl

Support for ObjC/C ODR-like semantics with structural equivalence
checking was added back in r306918. There enums are handled and also
checked for structural equivalence. However, at use time of
EnumConstantDecl, support was missing for preventing ambiguous
name lookup.

Add the missing bits for properly merging EnumConstantDecl.

rdar://problem/38374569

llvm-svn: 331232

6 years ago[CodeGen] Fix typo in comment form->from. NFC
Craig Topper [Mon, 30 Apr 2018 22:02:48 +0000 (22:02 +0000)]
[CodeGen] Fix typo in comment form->from. NFC

llvm-svn: 331231

6 years agoRemove premature caching of the global variables list in CompileUnit.
Adrian Prantl [Mon, 30 Apr 2018 21:54:02 +0000 (21:54 +0000)]
Remove premature caching of the global variables list in CompileUnit.

This fixes a bug where

  (lldb) target var g_ptr

would populate the global variables list with exactly one entry
because SymbolFileDWARF::ParseVariables() was invoked with a list of
DIEs pre-filtered by name, such that a subsequent call to

  (lldb) fr var --show-globals

would only list that one variable, because CompileUnit::m_variables
was already initialized, fooling CompileUnit::GetVariableList().

CompileUnit::GetVariableList() grabs the *complete* list of variables
via (SymbolFileDWARF, ...)::ParseVariablesForContext and that still
calls CompileUnit::SetVariableList(variables) which acts as the
caching mechanism.

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

llvm-svn: 331230

6 years agoProtect DWARFCompileUnit::m_die_array by a new mutex
Jan Kratochvil [Mon, 30 Apr 2018 21:37:30 +0000 (21:37 +0000)]
Protect DWARFCompileUnit::m_die_array by a new mutex

Multiple DW_TAG_compile_unit being indexed in a multithreaded way can request
reading of the same DW_TAG_partial_unit.

Unfortunately one cannot detect DWZ file ahead of time to disable such locking
overhead as DWARFCompileUnit::Extract does not read the first DIE which is the
only place one could find early enough if the DWARF file is using any
DW_TAG_partial_unit.

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

llvm-svn: 331229

6 years ago[InstCombine] fix test to restore intent
Sanjay Patel [Mon, 30 Apr 2018 21:28:18 +0000 (21:28 +0000)]
[InstCombine] fix test to restore intent

This test had values that differed in only in capitalization,
and that causes problems for the auto-generating check line
script. So I changed that in rL331226, but I accidentally
forgot to change a subsequent use of a param.

llvm-svn: 331228

6 years agoFix expression parser to not accept any type whose basename matches for a type that...
Greg Clayton [Mon, 30 Apr 2018 21:06:30 +0000 (21:06 +0000)]
Fix expression parser to not accept any type whose basename matches for a type that must exist at root level

This patch fixes an issue where we weren't looking for exact matches in the expression parser and also fixed the type lookup logic in the Module.cpp. Tests added to make sure we don't regress.

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

llvm-svn: 331227

6 years ago[InstCombine] add tests, update checks; NFC
Sanjay Patel [Mon, 30 Apr 2018 21:03:36 +0000 (21:03 +0000)]
[InstCombine] add tests, update checks; NFC

llvm-svn: 331226

6 years ago[docs] Fix docs/InternalsManual.rst heading.
Fangrui Song [Mon, 30 Apr 2018 20:51:50 +0000 (20:51 +0000)]
[docs] Fix docs/InternalsManual.rst heading.

llvm-svn: 331225

6 years agoStop setting LLVM_ON_WIN32 in config.h and llvm-config.h.
Nico Weber [Mon, 30 Apr 2018 20:19:48 +0000 (20:19 +0000)]
Stop setting LLVM_ON_WIN32 in config.h and llvm-config.h.

See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev.

I replaced all uses of LLVM_ON_WIN32 with _WIN32 in r331127 (llvm),
r331069 (clang), r329697 (lldb), r329696 (lld), r329696 (clang-tools-extra).

If your out-of-tree program used LLVM_ON_WIN32, just use _WIN32 instead, which
is set at exactly the same time to exactly the same value.

https://reviews.llvm.org/D46264

llvm-svn: 331224

6 years ago[ModRefInfo] Rename local variable IsMustAlias to avoid shadowing MustAlias enum...
Alina Sbirlea [Mon, 30 Apr 2018 20:11:13 +0000 (20:11 +0000)]
[ModRefInfo] Rename local variable IsMustAlias to avoid shadowing MustAlias enum entry.

llvm-svn: 331222

6 years ago[SimplifyCFG] Use BB::instructionsWithoutDebug to skip DbgInfo (NFC).
Florian Hahn [Mon, 30 Apr 2018 20:10:53 +0000 (20:10 +0000)]
[SimplifyCFG] Use BB::instructionsWithoutDebug to skip DbgInfo (NFC).

This patch updates some code responsible the skip debug info to use
BasicBlock::instructionsWithoutDebug. I think this makes things slightly
simpler and more direct.

Reviewers: aprantl, vsk, hans, danielcdh

Reviewed By: hans

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

llvm-svn: 331221

6 years ago[WebAssembly] MC: Improve debug output
Sam Clegg [Mon, 30 Apr 2018 19:40:57 +0000 (19:40 +0000)]
[WebAssembly] MC: Improve debug output

llvm-svn: 331220

6 years ago[LivePhysRegs] Remove registers clobbered by regmasks from the live set
Krzysztof Parzyszek [Mon, 30 Apr 2018 19:38:47 +0000 (19:38 +0000)]
[LivePhysRegs] Remove registers clobbered by regmasks from the live set

Dead defs were being removed from the live set (in stepForward), but
registers clobbered by regmasks weren't (more specifically, they were
actually removed by removeRegsInMask, but then they were added back in).

llvm-svn: 331219

6 years ago[MC] Change AsmParser to leverage Assembler during evaluation
Nirav Dave [Mon, 30 Apr 2018 19:22:40 +0000 (19:22 +0000)]
[MC] Change AsmParser to leverage Assembler during evaluation

Teach AsmParser to check with Assembler for when evaluating constant
expressions.  This improves the handing of preprocessor expressions
that must be resolved at parse time. This idiom can be found as
assembling-time assertion checks in source-level assemblers. Note that
this relies on the MCStreamer to keep sufficient tabs on Section /
Fragment information which the MCAsmStreamer does not. As a result the
textual output may fail where the equivalent object generation would
pass. This can most easily be resolved by folding the MCAsmStreamer
and MCObjectStreamer together which is planned for in a separate
patch.

Currently, this feature is only enabled for assembly input, keeping IR
compilation consistent between assembly and object generation.

Reviewers: echristo, rnk, probinson, espindola, peter.smith

Reviewed By: peter.smith

Subscribers: eraman, peter.smith, arichardson, jyknight, hiraditya, llvm-commits

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

llvm-svn: 331218

6 years ago[LoopSimplify] Use BB::instructionsWithoutDebug to skip DbgInfo (NFC).
Florian Hahn [Mon, 30 Apr 2018 19:19:36 +0000 (19:19 +0000)]
[LoopSimplify] Use BB::instructionsWithoutDebug to skip DbgInfo (NFC).

This patch updates some code responsible the skip debug info to use
BasicBlock::instructionsWithoutDebug. I think this makes things slightly
simpler and more direct.

Reviewers: aprantl, vsk, chandlerc

Reviewed By: aprantl

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

llvm-svn: 331217

6 years agoAMDGPU: Add Vega12 and Vega20
Matt Arsenault [Mon, 30 Apr 2018 19:08:27 +0000 (19:08 +0000)]
AMDGPU: Add Vega12 and Vega20

Changes by
  Matt Arsenault
  Konstantin Zhuravlyov

llvm-svn: 331216

6 years agoAMDGPU: Add Vega12 and Vega20
Matt Arsenault [Mon, 30 Apr 2018 19:08:16 +0000 (19:08 +0000)]
AMDGPU: Add Vega12 and Vega20

Changes by
  Matt Arsenault
  Konstantin Zhuravlyov

llvm-svn: 331215

6 years agoclang-cl: Expose -fmerge-all-constants
Hans Wennborg [Mon, 30 Apr 2018 19:04:04 +0000 (19:04 +0000)]
clang-cl: Expose -fmerge-all-constants

Now that constant merging is off by default, we'd like a way to enable
it on Windows.

llvm-svn: 331214

6 years ago[MIR] Reset unique MBB numbering in MachineFunction::reset()
Roman Tereshin [Mon, 30 Apr 2018 18:58:57 +0000 (18:58 +0000)]
[MIR] Reset unique MBB numbering in MachineFunction::reset()

No need to waste space nor number MBBs differently if MF gets recreated.

Reviewers: qcolombet, stoklund, t.p.northover, bogner, javed.absar

Reviewed By: qcolombet

Subscribers: llvm-commits

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

llvm-svn: 331213

6 years ago[OpenMP][OMPT] Fix api_calls_from_other_thread.cpp
Jonathan Peyton [Mon, 30 Apr 2018 18:46:31 +0000 (18:46 +0000)]
[OpenMP][OMPT] Fix api_calls_from_other_thread.cpp

Removed environment setting in RUN: line that was being ignored anyways.
Changed a few specific checks to "any number"

llvm-svn: 331212

6 years ago[OPENMP] Do not emit warning about non-declared target function params.
Alexey Bataev [Mon, 30 Apr 2018 18:28:08 +0000 (18:28 +0000)]
[OPENMP] Do not emit warning about non-declared target function params.

We should not emit warning that the parameters are not marked as declare
target, these declaration are local and cannot be marked as declare
target.

llvm-svn: 331211

6 years ago[DAGCombiner] rename function attribute for disabling ftrunc transform
Sanjay Patel [Mon, 30 Apr 2018 18:20:33 +0000 (18:20 +0000)]
[DAGCombiner] rename function attribute for disabling ftrunc transform

This is the matching name change for the Clang patch at:
D46236
rL331209

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

llvm-svn: 331210

6 years ago[Driver, CodeGen] rename options to disable an FP cast optimization
Sanjay Patel [Mon, 30 Apr 2018 18:19:03 +0000 (18:19 +0000)]
[Driver, CodeGen] rename options to disable an FP cast optimization

As suggested in the post-commit thread for rL331056, we should match these
clang options with the established vocabulary of the corresponding sanitizer
option. Also, the use of 'strict' is well-known for these kinds of knobs,
and we can improve the descriptive text in the docs.

So this intends to match the logic of D46135 but only change the words.
Matching LLVM commit to match this spelling of the attribute to follow shortly.

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

llvm-svn: 331209

6 years ago[X86] Introduce X86SchedWriteWidths schedule wrapper for different vector widths.
Simon Pilgrim [Mon, 30 Apr 2018 18:18:38 +0000 (18:18 +0000)]
[X86] Introduce X86SchedWriteWidths schedule wrapper for different vector widths.

We need to split most of the scheduler classes by vector width to remove more of the InstRW overrides, this patch should make this easier/tidier by allowing us to pass the X86SchedWriteWidths wrapper to multi-width multiclasses and then split as required.

I've included fields for Scl (scalar float/double), MMX (MMX integer), XMM, YMM and ZMM widths. These fields mostly share the same classes but it should give us the flexibility that we may need in the future.

This patch has replaced a set of example SSE/AVX512 instruction cases but isn't exhaustive as it gets very noisy before we really need the functionality.

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

llvm-svn: 331208

6 years agoRegenerated AST Matchers doc.
Alexander Kornienko [Mon, 30 Apr 2018 18:12:15 +0000 (18:12 +0000)]
Regenerated AST Matchers doc.

Backported a minor fix to the comment in the header.

llvm-svn: 331207

6 years ago[OPENMP] Do not crash on codegen for CXX member functions.
Alexey Bataev [Mon, 30 Apr 2018 18:09:40 +0000 (18:09 +0000)]
[OPENMP] Do not crash on codegen for CXX member functions.

Non-static member functions should not be emitted as a standalone
functions, this leads to compiler crash.

llvm-svn: 331206

6 years ago[InstCombine] Unfold masked merge with constant mask
Roman Lebedev [Mon, 30 Apr 2018 17:59:33 +0000 (17:59 +0000)]
[InstCombine] Unfold masked merge with constant mask

Summary:
As discussed in D45733, we want to do this in InstCombine.

https://rise4fun.com/Alive/LGk

Reviewers: spatel, craig.topper

Reviewed By: spatel

Subscribers: chandlerc, xbolva00, llvm-commits

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

llvm-svn: 331205

6 years ago[InstCombine][NFC] Add tests for unfolding masked merge with constant mask
Roman Lebedev [Mon, 30 Apr 2018 17:59:26 +0000 (17:59 +0000)]
[InstCombine][NFC] Add tests for unfolding masked merge with constant mask

Summary: As discussed in D45733, we want to do this in InstCombine.

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

llvm-svn: 331204

6 years ago[SystemZ] Handle SADDO et.al. and ADD/SUBCARRY
Ulrich Weigand [Mon, 30 Apr 2018 17:54:28 +0000 (17:54 +0000)]
[SystemZ] Handle SADDO et.al. and ADD/SUBCARRY

This provides an optimized implementation of SADDO/SSUBO/UADDO/USUBO
as well as ADDCARRY/SUBCARRY on top of the new CC implementation.

In particular, multi-word arithmetic now uses UADDO/ADDCARRY instead
of the old ADDC/ADDE logic, which means we no longer need to use
"glue" links for those instructions.  This also allows making full
use of the memory-based instructions like ALSI, which couldn't be
recognized due to limitations in the DAG matcher previously.

Also, the llvm.sadd.with.overflow et.al. intrinsincs now expand to
directly using the ADD instructions and checking for a CC 3 result.

llvm-svn: 331203

6 years ago[SystemZ] Do not use glue to represent condition code dependencies
Ulrich Weigand [Mon, 30 Apr 2018 17:52:32 +0000 (17:52 +0000)]
[SystemZ] Do not use glue to represent condition code dependencies

Currently, an instruction setting the condition code is linked to
the instruction using the condition code via a "glue" link in the
SelectionDAG.  This has a number of drawbacks; in particular, it
means the same CC cannot be used by multiple users.  It also makes
it more difficult to efficiently implement SADDO et. al.

This patch changes the back-end to represent CC dependencies as
normal values during SelectionDAG matching, along the lines of
how this is handled in the X86 back-end already.

In addition to the core mechanics of updating all relevant patterns,
this requires a number of additional changes:

- We now need to be able to spill/restore a CC value into a GPR
  if necessary.  This means providing a copyPhysReg implementation
  for moves involving CC, and defining getCrossCopyRegClass.

- Since we still prefer to avoid such spills, we provide an override
  for IsProfitableToFold to avoid creating a merged LOAD / ICMP if
  this would result in multiple users of the CC.

- combineCCMask no longer requires a single CC user, and no longer
  need to be careful about preventing invalid glue/chain cycles.

- emitSelect needs to be more careful in marking CC live-in to
  the basic block it generates.  Also, we can now optimize the
  case of multiple subsequent selects with the same condition
  just like X86 does.

llvm-svn: 331202

6 years agoFix infinite loop after r331115
Daniel Sanders [Mon, 30 Apr 2018 17:20:01 +0000 (17:20 +0000)]
Fix infinite loop after r331115

There are two separate fixes here:
* The lowering code for non-extending loads should report UnableToLegalize instead of emitting the same instruction.
* The target should not be requesting lowering of non-extending loads.

llvm-svn: 331201

6 years ago[DebugInfo] Prevent infinite recursion for malformed DWARF
Jonas Devlieghere [Mon, 30 Apr 2018 17:02:41 +0000 (17:02 +0000)]
[DebugInfo] Prevent infinite recursion for malformed DWARF

This prevents infinite recursion in DWARFDie::findRecursively for
malformed DWARF where a DIE references itself.

This fixes PR36257.

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

llvm-svn: 331200

6 years ago[SLPVectorizer] Debug info shouldn't impact spill cost computation.
Davide Italiano [Mon, 30 Apr 2018 16:57:33 +0000 (16:57 +0000)]
[SLPVectorizer] Debug info shouldn't impact spill cost computation.

<rdar://problem/39794738>

(Also, PR32761).

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

llvm-svn: 331199

6 years ago[X86][Atom] Remove unnecessary x87 load/move instrw overrides.
Simon Pilgrim [Mon, 30 Apr 2018 16:51:13 +0000 (16:51 +0000)]
[X86][Atom] Remove unnecessary x87 load/move instrw overrides.

llvm-svn: 331198

6 years agoReflow paragraphs in comments.
Adrian Prantl [Mon, 30 Apr 2018 16:49:04 +0000 (16:49 +0000)]
Reflow paragraphs in comments.

This is intended as a clean up after the big clang-format commit
(r280751), which unfortunately resulted in many of the comment
paragraphs in LLDB being very hard to read.

FYI, the script I used was:

import textwrap
import commands
import os
import sys
import re
tmp = "%s.tmp"%sys.argv[1]
out = open(tmp, "w+")
with open(sys.argv[1], "r") as f:
  header = ""
  text = ""
  comment = re.compile(r'^( *//) ([^ ].*)$')
  special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$')
  for line in f:
      match = comment.match(line)
      if match and not special.match(match.group(2)):
          # skip intentionally short comments.
          if not text and len(match.group(2)) < 40:
              out.write(line)
              continue

          if text:
              text += " " + match.group(2)
          else:
              header = match.group(1)
              text = match.group(2)

          continue

      if text:
          filled = textwrap.wrap(text, width=(78-len(header)),
                                 break_long_words=False)
          for l in filled:
              out.write(header+" "+l+'\n')
              text = ""

      out.write(line)

os.rename(tmp, sys.argv[1])

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

llvm-svn: 331197

6 years agoAMDGPU: Remove some dead code
Tom Stellard [Mon, 30 Apr 2018 16:28:02 +0000 (16:28 +0000)]
AMDGPU: Remove some dead code

llvm-svn: 331196

6 years ago[OPENMP] Do not crash on incorrect input data.
Alexey Bataev [Mon, 30 Apr 2018 16:26:57 +0000 (16:26 +0000)]
[OPENMP] Do not crash on incorrect input data.

Emit error messages instead of compiler crashing when the target region
does not exist in the device code + fix crash when the location comes
from macros.

llvm-svn: 331195

6 years agoMatch also DW_TAG_partial_unit when DW_TAG_compile_unit is matched
Jan Kratochvil [Mon, 30 Apr 2018 16:04:32 +0000 (16:04 +0000)]
Match also DW_TAG_partial_unit when DW_TAG_compile_unit is matched

Code commonly checks if the parent DIE is DW_TAG_compile_unit.
But DW_TAG_partial_unit also acts as DW_TAG_compile_unit for DWZ
as DWZ is using DW_TAG_imported_unit only at the top unit level.

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

llvm-svn: 331194

6 years ago[llvm-mca] Correctly handle zero-latency stores that consume pipeline resources.
Andrea Di Biagio [Mon, 30 Apr 2018 15:55:04 +0000 (15:55 +0000)]
[llvm-mca] Correctly handle zero-latency stores that consume pipeline resources.

This fixes PR37293.

We can have scheduling classes with no write latency entries, that still consume
processor resources. We don't want to treat those instructions as zero-latency
instructions; they still have to be issued to the underlying pipelines, so they
still consume resource cycles.

This is likely to be a regression which I have accidentally introduced at
revision 330807. Now, if an instruction has a non-empty set of write processor
resources, we conservatively treat it as a normal (i.e. non zero-latency)
instruction.

llvm-svn: 331193

6 years ago[SystemZ] Refactor some VT casts in DAG match patterns
Ulrich Weigand [Mon, 30 Apr 2018 15:52:28 +0000 (15:52 +0000)]
[SystemZ] Refactor some VT casts in DAG match patterns

In patterns where we need to specify a result VT, prefer

  [(set (tr.vt tr.op:$V1), (operator ...))]

over

  [(set tr.op:$V1, (tr.vt (operator ...)))]

This is NFC now, but simplifies some future changes.

llvm-svn: 331192

6 years ago[SystemZ] Improve handling of Select pseudo-instructions
Ulrich Weigand [Mon, 30 Apr 2018 15:49:27 +0000 (15:49 +0000)]
[SystemZ] Improve handling of Select pseudo-instructions

If we have LOCR instructions, select them directly from SelectionDAG
instead of first going through a pseudo instruction and then using
the custom inserter to emit the LOCR.

Provide Select pseudo-instructions for VR32/VR64 if we have vector
instructions, to avoid having to go through the first 16 FPRs
unnecessarily.

If we do not have LOCFHR, prefer using LOCR followed by a move
over a conditional branch.

llvm-svn: 331191

6 years agoIWYU for llvm-config.h, removals. Also see r331184.
Nico Weber [Mon, 30 Apr 2018 15:26:01 +0000 (15:26 +0000)]
IWYU for llvm-config.h, removals. Also see r331184.

llvm-svn: 331190

6 years ago[clangd] Using index for GoToDefinition.
Haojian Wu [Mon, 30 Apr 2018 15:24:17 +0000 (15:24 +0000)]
[clangd] Using index for GoToDefinition.

Summary:
This patch adds index support for GoToDefinition -- when we don't get the
definition from local AST, we query our index (Static&Dynamic) index to
get it.

Since we currently collect top-level symbol in the index, it doesn't support all
cases (e.g. class members), we will extend the index to include more symbols in
the future.

Reviewers: sammccall

Subscribers: klimek, ilya-biryukov, jkorous-apple, ioeric, MaskRay, cfe-commits

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

llvm-svn: 331189

6 years ago[X86] Drop unnecessary VPORrm InstrRW override in SkylakeServer.
Simon Pilgrim [Mon, 30 Apr 2018 15:18:33 +0000 (15:18 +0000)]
[X86] Drop unnecessary VPORrm InstrRW override in SkylakeServer.

llvm-svn: 331188

6 years ago[X86] Fix SkylakeServer typo in WritePSADBW class - it only uses 1 resource.
Simon Pilgrim [Mon, 30 Apr 2018 15:17:16 +0000 (15:17 +0000)]
[X86] Fix SkylakeServer typo in WritePSADBW class - it only uses 1 resource.

llvm-svn: 331187

6 years agoAMDGPU/GlobalISel: Don't try to lower geometry shaders
Tom Stellard [Mon, 30 Apr 2018 15:15:23 +0000 (15:15 +0000)]
AMDGPU/GlobalISel: Don't try to lower geometry shaders

Summary: The AMDGPU_GS calling convention is not supported yet.

Reviewers: arsenm, nhaehnle

Reviewed By: nhaehnle

Subscribers: kzhuravl, wdng, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 331186