platform/upstream/llvm.git
5 years ago[analyzer] A speculative fix for buildbot failures in the new SymbolReaperTest.
Artem Dergachev [Fri, 18 Jan 2019 01:37:14 +0000 (01:37 +0000)]
[analyzer] A speculative fix for buildbot failures in the new SymbolReaperTest.

I expect an xvalue to be easier to convert.

llvm-svn: 351505

5 years agoUse llvm::VersionTuple instead of manual version marshalling
Brad Smith [Fri, 18 Jan 2019 01:36:58 +0000 (01:36 +0000)]
Use llvm::VersionTuple instead of manual version marshalling

llvm-svn: 351504

5 years ago[safestack] Replace statics with unnamed namespace
Vitaly Buka [Fri, 18 Jan 2019 01:36:09 +0000 (01:36 +0000)]
[safestack] Replace statics with unnamed namespace

Reviewers: eugenis

Subscribers: jfb, llvm-commits

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

llvm-svn: 351503

5 years ago[polly] Change to range-based invocation of llvm::sort
Mandeep Singh Grang [Fri, 18 Jan 2019 01:06:46 +0000 (01:06 +0000)]
[polly] Change to range-based invocation of llvm::sort

llvm-svn: 351502

5 years ago[Reproducers] Refactor reproducer info
Jonas Devlieghere [Fri, 18 Jan 2019 01:04:59 +0000 (01:04 +0000)]
[Reproducers] Refactor reproducer info

In the original reproducer design, I expected providers to be more
dynamic than they turned out. For example, we don't have any instances
where one provider has multiple files. Additionally, I expected there to
be less locality between capture and replay, with the provider being
defined in one place and the replay code to live in another. Both
contributed to the design of the provider info.

This patch refactors the reproducer info to be something static. This
means less magic strings and better type checking. The new design still
allows for the capture and replay code to live in different places as
long as they both have access to the new statically defined info class.

I didn't completely get rid of the index, because it is useful for (1)
sanity checking and (2) knowing what files are used by the reproducer.

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

llvm-svn: 351501

5 years ago[analyzer] MoveChecker: Add one more common resetting method, "append".
Artem Dergachev [Fri, 18 Jan 2019 00:16:25 +0000 (00:16 +0000)]
[analyzer] MoveChecker: Add one more common resetting method, "append".

This is especially crucial for reports related to use-after-move of
standard library objects.

rdar://problem/47338505

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

llvm-svn: 351500

5 years ago[analyzer] Make sure base-region and its sub-regions are either all alive or all...
Artem Dergachev [Fri, 18 Jan 2019 00:08:56 +0000 (00:08 +0000)]
[analyzer] Make sure base-region and its sub-regions are either all alive or all dead.

SymbolReaper now realizes that our liveness analysis isn't sharp enough
to discriminate between liveness of, say, variables and their fields.
Surprisingly, this didn't quite work before: having a variable live only
through Environment (eg., calling a C++ method on a local variable
as the last action ever performed on that variable) would not keep the
region value symbol of a field of that variable alive.

It would have been broken in the opposite direction as well, but both
Environment and RegionStore use the scanReachableSymbols mechanism for finding
live symbols regions within their values, and due to that they accidentally
end up marking the whole chain of super-regions as live when at least one
sub-region is known to be live.

It is now a direct responsibility of SymbolReaper to maintain this invariant,
and a unit test was added in order to make sure it stays that way.

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

rdar://problem/46914108

llvm-svn: 351499

5 years ago[CMake] Only test debugserver if platform can use debugserver
Alex Langford [Fri, 18 Jan 2019 00:05:25 +0000 (00:05 +0000)]
[CMake] Only test debugserver if platform can use debugserver

In commit svn r351496 I changed this condition from
`if(LLDB_CAN_USE_DEBUGSERVER)` to `if(NOT SKIP_TEST_DEBUGSERVER)`.
This causes debugserver tests to run on windows, which shouldn't happen.
SKIP_TEST_DEBUGSERVER is set either by the user (it shouldn't be set on
windows builds) or in the debugserver CMake logic (which doesn't get
included when building on windows). Therefore, I changed the condition
to be `if(LLDB_CAN_USE_DEBUGSERVER AND NOT SKIP_TEST_DEBUGSERVER)`.

llvm-svn: 351498

5 years ago[lit] Fix lldbtest format
Jonas Devlieghere [Thu, 17 Jan 2019 23:30:06 +0000 (23:30 +0000)]
[lit] Fix lldbtest format

The lldbtest format was incorrectly detecting XFAIL as FAIL because it
was looking for the `FAIL:` substring in the dotest output.

llvm-svn: 351497

5 years ago[CMake] Prevent lldbDebugserverCommon from building if you disable debugserver builds
Alex Langford [Thu, 17 Jan 2019 23:14:04 +0000 (23:14 +0000)]
[CMake] Prevent lldbDebugserverCommon from building if you disable debugserver builds

Summary:
The flags `LLDB_USE_SYSTEM_DEBUGSERVER` and `LLDB_NO_DEBUGSERVER` were
introduced to the debugserver build. If one of these two flags are set, then we
do not build and sign debugserver. However I noticed that we were still building
the lldbDebugserverCommon and lldbDebugserverCommon_NonUI libraries regardless
of whether or not these flags were set. I don't believe we should be building
these libraries unless we are building and signing debugserver.

Reviewers: sgraenitz, davide, JDevlieghere, beanz, vsk, aprantl, labath

Subscribers: mgorny, jfb, lldb-commits

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

llvm-svn: 351496

5 years agoMake integral-o-pointer conversions in SFINAE illegal.
Erich Keane [Thu, 17 Jan 2019 23:11:15 +0000 (23:11 +0000)]
Make integral-o-pointer conversions in SFINAE illegal.

As reported in PR40362, allowing the conversion from an integral to a
pointer type (despite being illegal in the C++ standard) will cause
surprsing results when testing for certain behaviors in SFINAE.  This
patch converts the error to a SFINAE Error and adds a test to ensure
that it is still a warning in non-SFINAE but an error in it.

Change-Id: I1f475637fa4d83217ae37dc6b5dbf653e118fae4
llvm-svn: 351495

5 years agoAMDGPU: Convert tests away from llvm.SI.load.const
Matt Arsenault [Thu, 17 Jan 2019 22:47:26 +0000 (22:47 +0000)]
AMDGPU: Convert tests away from llvm.SI.load.const

llvm-svn: 351494

5 years agoAddress Ried's post-commit review comment on r351477.
Erik Pilkington [Thu, 17 Jan 2019 22:39:31 +0000 (22:39 +0000)]
Address Ried's post-commit review comment on r351477.

llvm-svn: 351493

5 years ago[HotColdSplit] Allow outlining with live outputs
Vedant Kumar [Thu, 17 Jan 2019 22:36:05 +0000 (22:36 +0000)]
[HotColdSplit] Allow outlining with live outputs

Prior to r348205, extracting code regions with live output values was
disabled because of a miscompilation (PR39433). Lift the restriction as
PR39433 has been addressed.

Tested on LNT+externals, on a run of check-llvm in a stage2 build, and
with a full build of iOS (with hot/cold splitting enabled).

As a drive-by, remove an errant TODO.

llvm-svn: 351492

5 years ago[HotColdSplit] Consider resume instructions to be cold
Vedant Kumar [Thu, 17 Jan 2019 22:35:47 +0000 (22:35 +0000)]
[HotColdSplit] Consider resume instructions to be cold

Resuming exception unwinding is roughly as unlikely as throwing an
exception.

Tested on LNT+externals (in particular, the C++ EH regression tests
provide end-to-end test coverage), as well as with a full build of iOS.

llvm-svn: 351491

5 years agoDon't run TestBreakpointThumbCodesection.py on darwin systems;
Jason Molenda [Thu, 17 Jan 2019 22:26:25 +0000 (22:26 +0000)]
Don't run TestBreakpointThumbCodesection.py on darwin systems;
we don't use a thumb code section.

Don't run Test128BitsInteger.py on armv7k; it's not a supported
type on that target.

llvm-svn: 351490

5 years ago[CMake] Fix lldb-test-depends target
Jonas Devlieghere [Thu, 17 Jan 2019 22:25:20 +0000 (22:25 +0000)]
[CMake] Fix lldb-test-depends target

The lldb-test-depends target was using the old CMake variable name
LLDB_TEST_DEPENDS instead of LLDB_TEST_DEPS. This patch moves the target
definition and makes it use the correct one.

llvm-svn: 351489

5 years ago[WebAssembly] Fix windows compiler warning by using explicit 64bit shift. NFC.
Sam Clegg [Thu, 17 Jan 2019 22:09:09 +0000 (22:09 +0000)]
[WebAssembly] Fix windows compiler warning by using explicit 64bit shift. NFC.

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

llvm-svn: 351488

5 years agoFix cleanup registration for lambda captures.
Richard Smith [Thu, 17 Jan 2019 22:05:50 +0000 (22:05 +0000)]
Fix cleanup registration for lambda captures.

Lambda captures should be destroyed if an exception is thrown only if
the construction of the complete lambda-expression has not completed.
(If the lambda-expression has been fully constructed, any exception will
invoke its destructor, which will destroy the captures.)

This is directly modeled after how we handle the equivalent situation in
InitListExprs.

Note that EmitLambdaLValue was unreachable because in C++11 onwards the
frontend never creates the awkward situation where a prvalue expression
(such as a lambda) is used in an lvalue context (such as the left-hand
side of a class member access).

llvm-svn: 351487

5 years ago[lit] Make sure tests are actually skipped on darwin and windows.
Davide Italiano [Thu, 17 Jan 2019 21:57:33 +0000 (21:57 +0000)]
[lit] Make sure tests are actually skipped on darwin and windows.

llvm-svn: 351486

5 years ago[mips] Emit .reloc R_{MICRO}MIPS_JALR along with j(al)r(c) $25
Vladimir Stefanovic [Thu, 17 Jan 2019 21:50:37 +0000 (21:50 +0000)]
[mips] Emit .reloc R_{MICRO}MIPS_JALR along with j(al)r(c) $25

The callee address is added as an optional operand (MCSymbol) in
AdjustInstrPostInstrSelection() and then used by asm printer to insert:
'.reloc tmplabel, R_MIPS_JALR, symbol
tmplabel:'.
Controlled with '-mips-jalr-reloc', default is true.

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

llvm-svn: 351485

5 years agoAdd -Wctad-maybe-unsupported to diagnose CTAD on types with no user defined deduction...
Eric Fiselier [Thu, 17 Jan 2019 21:44:24 +0000 (21:44 +0000)]
Add -Wctad-maybe-unsupported to diagnose CTAD on types with no user defined deduction guides.

Summary:
Some style guides want to allow using CTAD only on types that "opt-in"; i.e. on types that are designed to support it and not just types that *happen* to work with it.

This patch implements the `-Wctad-maybe-unsupported` warning, which is off by default, which warns when CTAD is used on a type that does not define any deduction guides.

The following pattern can be used to suppress the warning in cases where the type intentionally doesn't define any deduction guides:

```
struct allow_ctad_t;

template <class T>
struct TestSuppression {
  TestSuppression(T) {}
};
TestSuppression(allow_ctad_t)->TestSuppression<void>; // guides with incomplete parameter types are never considered.
```

Reviewers: rsmith, james.dennett, gromer

Reviewed By: rsmith

Subscribers: jdennett, Quuxplusone, lebedev.ri, cfe-commits

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

llvm-svn: 351484

5 years ago[HotColdSplit] Relax requirement that the cold sink block be extractable
Vedant Kumar [Thu, 17 Jan 2019 21:42:36 +0000 (21:42 +0000)]
[HotColdSplit] Relax requirement that the cold sink block be extractable

Relaxing this requirement creates opportunities to split code dominated
by an EH pad.

Tested on LNT+externals.

llvm-svn: 351483

5 years ago[demangler] Support for block literals.
Erik Pilkington [Thu, 17 Jan 2019 21:37:51 +0000 (21:37 +0000)]
[demangler] Support for block literals.

llvm-svn: 351482

5 years ago[demangler] Ignore leading underscores if present
Erik Pilkington [Thu, 17 Jan 2019 21:37:36 +0000 (21:37 +0000)]
[demangler] Ignore leading underscores if present

On MacOS, symbols start with a leading underscore, so just parse and
ignore it if present.

llvm-svn: 351481

5 years ago[HotColdSplit] Simplify tests by lowering their splitting thresholds
Vedant Kumar [Thu, 17 Jan 2019 21:29:34 +0000 (21:29 +0000)]
[HotColdSplit] Simplify tests by lowering their splitting thresholds

This gets rid of the brittle/mysterious calls to @sink()/@sideeffect()
peppered throughout the test cases. They are no longer needed to force
splitting to occur.

llvm-svn: 351480

5 years agoxray: Add missing header to list of installed headers.
Peter Collingbourne [Thu, 17 Jan 2019 21:11:49 +0000 (21:11 +0000)]
xray: Add missing header to list of installed headers.

Spotted by gn's llvm/utils/gn/build/sync_source_lists_from_cmake.py script.

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

llvm-svn: 351479

5 years agoFix -Wsign-compare in new tests
Reid Kleckner [Thu, 17 Jan 2019 20:52:46 +0000 (20:52 +0000)]
Fix -Wsign-compare in new tests

llvm-svn: 351478

5 years agoFix an MSVC bot failure from r351474.
Erik Pilkington [Thu, 17 Jan 2019 20:52:10 +0000 (20:52 +0000)]
Fix an MSVC bot failure from r351474.

llvm-svn: 351477

5 years ago[SampleFDO] Skip profile reading when flattened profile used in ThinLTO postlink
Wei Mi [Thu, 17 Jan 2019 20:48:34 +0000 (20:48 +0000)]
[SampleFDO] Skip profile reading when flattened profile used in ThinLTO postlink

If the sample profile has no inlining hierachy information included, we call
the sample profile is flattened. For flattened profile, in ThinLTO postlink
phase, SampleProfileLoader's hot function inlining and profile annotation will
do nothing, so it is better to save the effort to read in the profile and run
the sample profile loader pass. It is helpful for reducing compile time when
the flattened profile is huge.

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

llvm-svn: 351476

5 years ago[InstCombine] Don't sink dynamic allocas
Reid Kleckner [Thu, 17 Jan 2019 20:46:53 +0000 (20:46 +0000)]
[InstCombine] Don't sink dynamic allocas

Summary:
InstCombine's sinking algorithm only thinks about memory. It doesn't
think about non-memory constraints like stack object lifetime. It can
sink dynamic allocas across a stacksave call, which may be used with
stackrestore, which can incorrectly reduce the lifetime of the dynamic
alloca.

Fixes PR40365

Reviewers: hfinkel, efriedma

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 351475

5 years agoNFC: Make the copies of the demangler byte-for-byte identical
Erik Pilkington [Thu, 17 Jan 2019 20:37:51 +0000 (20:37 +0000)]
NFC: Make the copies of the demangler byte-for-byte identical

With this patch, the copies of the files ItaniumDemangle.h,
StringView.h, and Utility.h are kept byte-for-byte in sync between
libcxxabi and llvm. All differences (namespaces, fallthrough, and
unreachable macros) are defined in each copies' DemanglerConfig.h.

This patch also adds a script to copy changes from libcxxabi
(cp-to-llvm.sh), and a README.txt explaining the situation.

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

llvm-svn: 351474

5 years ago[clang-tidy] Add abseil-duration-conversion-cast check
Hyrum Wright [Thu, 17 Jan 2019 20:37:35 +0000 (20:37 +0000)]
[clang-tidy] Add abseil-duration-conversion-cast check

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

llvm-svn: 351473

5 years agoFix the buildbot failure introduced by r351404
Sanjin Sijaric [Thu, 17 Jan 2019 20:24:14 +0000 (20:24 +0000)]
Fix the buildbot failure introduced by r351404

EXPENSIVE_CHECKS buildbots are failing due to r351404.

Add x1 as live in to the funclet basic block for SEH funclets, as well as
-verify-machineinstrs to the test case that triggered the failure.

llvm-svn: 351472

5 years agoRevert r351208 (which was a revert of r350892).
Aaron Ballman [Thu, 17 Jan 2019 20:21:44 +0000 (20:21 +0000)]
Revert r351208 (which was a revert of r350892).

This corresponds to the fix to Clang in r351470.

llvm-svn: 351471

5 years agoRevert r351209 (which was a revert of r350891) with a fix.
Aaron Ballman [Thu, 17 Jan 2019 20:21:34 +0000 (20:21 +0000)]
Revert r351209 (which was a revert of r350891) with a fix.

The test case had a parse error that was causing the condition string to be misreported. We now have better fallback code for error cases.

llvm-svn: 351470

5 years agollvm build: Merge r351448
Nico Weber [Thu, 17 Jan 2019 20:20:56 +0000 (20:20 +0000)]
llvm build: Merge r351448

llvm-svn: 351469

5 years ago[Documentation] Fix another link in docs/clang-tidy/Contributing.rst.
Eugene Zelenko [Thu, 17 Jan 2019 20:00:23 +0000 (20:00 +0000)]
[Documentation] Fix another link in docs/clang-tidy/Contributing.rst.

llvm-svn: 351468

5 years ago[Documentation] Another attempt to fix link in docs/clang-tidy/Contributing.rst....
Eugene Zelenko [Thu, 17 Jan 2019 19:47:44 +0000 (19:47 +0000)]
[Documentation] Another attempt to fix link in docs/clang-tidy/Contributing.rst. Use HTTPS for links.

llvm-svn: 351467

5 years ago[Documentation] Fix link in docs/clang-tidy/Contributing.rst.
Eugene Zelenko [Thu, 17 Jan 2019 19:35:39 +0000 (19:35 +0000)]
[Documentation] Fix link in docs/clang-tidy/Contributing.rst.

llvm-svn: 351466

5 years ago[WebAssembly] Fixing 2 more symbol offset related tests.
Wouter van Oortmerssen [Thu, 17 Jan 2019 19:18:05 +0000 (19:18 +0000)]
[WebAssembly] Fixing 2 more symbol offset related tests.

llvm-svn: 351465

5 years ago[Test] Fix debug-loc-0.mir with EXPENSIVE_CHECKS
Jonas Devlieghere [Thu, 17 Jan 2019 18:35:14 +0000 (18:35 +0000)]
[Test] Fix debug-loc-0.mir with EXPENSIVE_CHECKS

The `llc` invocation was missing `-start-before=machine-cp`.

llvm-svn: 351464

5 years ago[Documentation] Add a chapter about Clang-tidy integrations.
Eugene Zelenko [Thu, 17 Jan 2019 18:31:34 +0000 (18:31 +0000)]
[Documentation] Add a chapter about Clang-tidy integrations.

Patch by Marina Kalashina.

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

llvm-svn: 351463

5 years ago[WebAssembly] Changed objdump output to offsets instead of indices.
Wouter van Oortmerssen [Thu, 17 Jan 2019 18:30:35 +0000 (18:30 +0000)]
[WebAssembly] Changed objdump output to offsets instead of indices.

Summary: This is to accommodate this change: https://reviews.llvm.org/D56684

Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

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

llvm-svn: 351462

5 years ago[CodeGenObjC] Use a constant value for non-fragile ivar offsets when possible
Erik Pilkington [Thu, 17 Jan 2019 18:18:53 +0000 (18:18 +0000)]
[CodeGenObjC] Use a constant value for non-fragile ivar offsets when possible

If a class inherits from NSObject and has an implementation, then we
can assume that ivar offsets won't need to be updated by the runtime.
This allows us to index into the object using a constant value and
avoid loading from the ivar offset variable.

This patch was adapted from one written by Pete Cooper.

rdar://problem/10132568

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

llvm-svn: 351461

5 years ago[WebAssembly] Fixed objdump not parsing function headers.
Wouter van Oortmerssen [Thu, 17 Jan 2019 18:14:09 +0000 (18:14 +0000)]
[WebAssembly] Fixed objdump not parsing function headers.

Summary:
objdump was interpreting the function header containing the locals
declaration as instructions. To parse these without injecting target
specific code in objdump, MCDisassembler::onSymbolStart was added to
be implemented by the WebAssembly implemention.

WasmObjectFile now returns a code offset for the "address" of a symbol,
rather than the index. This is also more in-line with what other
targets do.

Also ensured that the AsmParser correctly puts each function
in its own segment to enable this test case.

Reviewers: sbc100, dschuff

Subscribers: jgravelle-google, aheejin, sunfish, rupprecht, llvm-commits

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

llvm-svn: 351460

5 years ago[ObjC] Follow-up r350768 and allow the use of unavailable methods that are
Alex Lorenz [Thu, 17 Jan 2019 18:12:45 +0000 (18:12 +0000)]
[ObjC] Follow-up r350768 and allow the use of unavailable methods that are
declared in a parent class from within the @implementation context

This commit extends r350768 and allows the use of methods marked as unavailable
that are declared in a parent class/category from within the @implementation of
the class where the method is marked as unavailable.
This allows users to call init that's marked as unavailable even if they don't
define it.

rdar://47134898

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

llvm-svn: 351459

5 years agoAdd a missing dependency to fix build.
Rui Ueyama [Thu, 17 Jan 2019 17:55:47 +0000 (17:55 +0000)]
Add a missing dependency to fix build.

llvm-svn: 351458

5 years agoTLS: Respect visibility for thread_local variables on Darwin (PR40327)
Vlad Tsyrklevich [Thu, 17 Jan 2019 17:53:45 +0000 (17:53 +0000)]
TLS: Respect visibility for thread_local variables on Darwin (PR40327)

Summary:
Teach clang to mark thread wrappers for thread_local variables with
hidden visibility when the original variable is marked with hidden
visibility. This is necessary on Darwin which exposes the thread wrapper
instead of the thread variable. The thread wrapper would previously
always be created with default visibility unless it had
linkonce*/weak_odr linkage.

Reviewers: rjmccall

Reviewed By: rjmccall

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

llvm-svn: 351457

5 years ago[libFuzzer][MSVC] Make attribute-use compatible with MSVC
Jonathan Metzman [Thu, 17 Jan 2019 16:36:05 +0000 (16:36 +0000)]
[libFuzzer][MSVC] Make attribute-use compatible with MSVC

Summary:
Replace attributes with macros that use equivalent declspecs
for MSVC.

Reviewers: vitalybuka

Reviewed By: vitalybuka

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

llvm-svn: 351456

5 years agoRevert "[ThinLTO] Add summary entries for index-based WPD"
Teresa Johnson [Thu, 17 Jan 2019 16:05:04 +0000 (16:05 +0000)]
Revert "[ThinLTO] Add summary entries for index-based WPD"

Mistaken commit of something still under review!

This reverts commit r351453.

llvm-svn: 351455

5 years agoAdd -dump-input=always to cfi-devirt test to debug flake
Teresa Johnson [Thu, 17 Jan 2019 15:49:04 +0000 (15:49 +0000)]
Add -dump-input=always to cfi-devirt test to debug flake

To help diagnose flaky bot failures in PR40351.

llvm-svn: 351454

5 years ago[ThinLTO] Add summary entries for index-based WPD
Teresa Johnson [Thu, 17 Jan 2019 15:49:03 +0000 (15:49 +0000)]
[ThinLTO] Add summary entries for index-based WPD

Summary:
If LTOUnit splitting is disabled, the module summary analysis computes
the summary information necessary to perform single implementation
devirtualization during the thin link with the index and no IR. The
information collected from the regular LTO IR in the current hybrid WPD
algorithm is summarized, including:
1) For vtable definitions, record the function pointers and their offset
within the vtable initializer (subsumes the information collected from
IR by tryFindVirtualCallTargets).
2) A record for each type metadata summarizing the vtable definitions
decorated with that metadata (subsumes the TypeIdentiferMap collected
from IR).

Also added are the necessary bitcode records, and the corresponding
assembly support.

The index-based WPD will be sent as a follow-on.

Depends on D53890.

Reviewers: pcc

Subscribers: mehdi_amini, Prazek, inglorion, eraman, steven_wu, dexonsmith, arphaman, llvm-commits

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

llvm-svn: 351453

5 years ago[llvm-readobj][ELF]Add demangling support
James Henderson [Thu, 17 Jan 2019 15:34:12 +0000 (15:34 +0000)]
[llvm-readobj][ELF]Add demangling support

This change adds demangling support to the ELF side of llvm-readobj,
under the switch --demangle/-C.

The following places are demangled: symbol table dumps (static and
dynamic), relocation dumps (static and dynamic), addrsig dumps, call
graph profile dumps, and group section signature symbols.

Although GNU readelf doesn't support demangling, it is still a useful
feature to have, and brings it on a par with llvm-objdump's
capabilities.

This fixes https://bugs.llvm.org/show_bug.cgi?id=40054.

Reviewed by: grimar, rupprecht

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

llvm-svn: 351450

5 years agoCodeGen: Cast llvm.flt.rounds result to match __builtin_flt_rounds
Anton Korobeynikov [Thu, 17 Jan 2019 15:21:55 +0000 (15:21 +0000)]
CodeGen: Cast llvm.flt.rounds result to match __builtin_flt_rounds

llvm.flt.rounds returns an i32, but the builtin expects an integer.
On targets where integers are not 32-bits clang tries to bitcast the result, causing an assertion failure.

The patch enables newlib build for msp430.

Patch by Edward Jones!

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

llvm-svn: 351449

5 years agoMove demangling function from llvm-objdump to Demangle library
James Henderson [Thu, 17 Jan 2019 15:18:44 +0000 (15:18 +0000)]
Move demangling function from llvm-objdump to Demangle library

This allows it to be used in an upcoming llvm-readobj change.

A small change in internal behaviour of the function is to always call
the microsoftDemangle function if the string does not have an itanium
encoding prefix, rather than only if it starts with '?'. This is
harmless because the microsoftDemangle function does the same check
already.

Reviewed by: grimar, erik.pilkington

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

llvm-svn: 351448

5 years agoRecommit "Teach the default symbol vendor to respect module.GetSymbolFileFileSpec()"
Pavel Labath [Thu, 17 Jan 2019 15:07:35 +0000 (15:07 +0000)]
Recommit "Teach the default symbol vendor to respect module.GetSymbolFileFileSpec()"

This reapplies commit r351330, which was reverted due to a failing test on
macos. The failure was because the SymbolVendor used on MacOS was stricter than
the default (or ELF) symbol vendor, and rejected the symbol file because it's
UUID did not match the object file.

This version of the patch adds a uuid load command to the test macho file to
make sure the UUIDs match.

llvm-svn: 351447

5 years agobuild_llvm_package.bat: Run more tests
Hans Wennborg [Thu, 17 Jan 2019 13:11:15 +0000 (13:11 +0000)]
build_llvm_package.bat: Run more tests

llvm-svn: 351436

5 years agoRecommit "Add a verbose mode to "image dump line-table" and use it to write a .debug_...
Pavel Labath [Thu, 17 Jan 2019 13:11:04 +0000 (13:11 +0000)]
Recommit "Add a verbose mode to "image dump line-table" and use it to write a .debug_line test"

This reapplies r350802, which was reverted because of issues with
parsing posix-style paths on windows hosts (and vice-versa). These have
since been fixed in r351328, and lldb should now recognise the path
style used in a dwarf compile unit correctly.

llvm-svn: 351435

5 years ago[LoopSimplifyCFG] Form LCSSA when a parent loop becomes a sibling
Max Kazantsev [Thu, 17 Jan 2019 12:51:10 +0000 (12:51 +0000)]
[LoopSimplifyCFG] Form LCSSA when a parent loop becomes a sibling

During the transforms in LoopSimplifyCFG, when we remove a dead exiting edge, the
parent loop may stop being reachable from the child loop, and therefore they become
siblings. If the former child loop had uses of some values from its former parent loop,
now such uses will require LCSSA Phis, even if they weren't needed before. So we must
form LCSSA for all loops that stopped being ancestors of the current loop in this case.

Differential Revision: https://reviews.llvm.org/D56144
Reviewed By: fedor.sergeev

llvm-svn: 351434

5 years ago[LoopSimplifyCFG] Fix order of deletion of complex dead subloops
Max Kazantsev [Thu, 17 Jan 2019 12:25:40 +0000 (12:25 +0000)]
[LoopSimplifyCFG] Fix order of deletion of complex dead subloops

Function `DeleteDeadBlock` requires that all predecessors of a block
being deleted have already been deleted, with the exception of a
single-block loop. When we use it for removal of dead subloops that
contain more than one block, we may not fulfull this requirement and
fail an assertion.

This patch replaces invocation of `DeleteDeadBlock` with a generalized
version `DeleteDeadBlocks` that is able to deal with multiple dead blocks,
even if they contain some cycles.

Differential Revision: https://reviews.llvm.org/D56121
Reviewed By: fedor.sergeev

llvm-svn: 351433

5 years agoRevert r351311 "[OMPT] Make sure that OMPT is enabled when accessing internals of...
Hans Wennborg [Thu, 17 Jan 2019 11:31:03 +0000 (11:31 +0000)]
Revert r351311 "[OMPT] Make sure that OMPT is enabled when accessing internals of the runtime"

and also the follow-up r351315.

The new test is failing on the buildbots.

> Make sure that OMPT is enabled in runtime entry points that access internals
> of the runtime. Else, return an appropiate value indicating an error or that
> the data is not available.
>
> Patch provided by @sconvent
>
> Reviewers: jlpeyton, omalyshe, hbae, Hahnfeld, joachim.protze
>
> Reviewed By: joachim.protze
>
> Tags: #openmp, #ompt
>
> Differential Revision: https://reviews.llvm.org/D47717

llvm-svn: 351431

5 years ago[X86][SSE] Add PR40340 test case
Simon Pilgrim [Thu, 17 Jan 2019 11:20:23 +0000 (11:20 +0000)]
[X86][SSE] Add PR40340 test case

llvm-svn: 351430

5 years ago[X86] Add AVX512 test to insertps
Simon Pilgrim [Thu, 17 Jan 2019 11:11:15 +0000 (11:11 +0000)]
[X86] Add AVX512 test to insertps

Pre-commit for PR40340

llvm-svn: 351429

5 years agoGlobalISel: Add comment to clarify G_BUILD_VECTOR
Matt Arsenault [Thu, 17 Jan 2019 10:50:07 +0000 (10:50 +0000)]
GlobalISel: Add comment to clarify G_BUILD_VECTOR

llvm-svn: 351428

5 years agoAllow FP types for atomicrmw xchg
Matt Arsenault [Thu, 17 Jan 2019 10:49:01 +0000 (10:49 +0000)]
Allow FP types for atomicrmw xchg

llvm-svn: 351427

5 years ago[MC] Remove unused variable
Benjamin Kramer [Thu, 17 Jan 2019 10:25:18 +0000 (10:25 +0000)]
[MC] Remove unused variable

llvm-svn: 351426

5 years agoFix capitalization. NFC
Diana Picus [Thu, 17 Jan 2019 10:11:59 +0000 (10:11 +0000)]
Fix capitalization. NFC

llvm-svn: 351425

5 years ago[ARM GlobalISel] Allow calls to varargs functions
Diana Picus [Thu, 17 Jan 2019 10:11:55 +0000 (10:11 +0000)]
[ARM GlobalISel] Allow calls to varargs functions

Allow varargs functions to be called, both in arm and thumb mode. This
boils down to choosing the correct calling convention, which we can
easily test by making sure arm_aapcscc is used instead of
arm_aapcs_vfpcc when the callee is variadic.

llvm-svn: 351424

5 years ago[NewPM] Add -fsanitize={memory,thread} handling to clang
Philip Pfaffe [Thu, 17 Jan 2019 10:10:47 +0000 (10:10 +0000)]
[NewPM] Add -fsanitize={memory,thread} handling to clang

Summary: This is the missing bit to drive thread and memory sanitizers through clang using the new PassManager.

Reviewers: chandlerc, fedor.sergeev, vitalybuka, leonardchan

Subscribers: bollu, llvm-commits

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

llvm-svn: 351423

5 years ago[RISCV] Add codegen support for RV64A
Alex Bradbury [Thu, 17 Jan 2019 10:04:39 +0000 (10:04 +0000)]
[RISCV] Add codegen support for RV64A

In order to support codegen RV64A, this patch:
* Introduces masked atomics intrinsics for atomicrmw operations and cmpxchg
  that use the i64 type. These are ultimately lowered to masked operations
  using lr.w/sc.w, but we need to use these alternate intrinsics for RV64
  because i32 is not legal
* Modifies RISCVExpandPseudoInsts.cpp to handle PseudoAtomicLoadNand64 and
  PseudoCmpXchg64
* Modifies the AtomicExpandPass hooks in RISCVTargetLowering to sext/trunc as
  needed for RV64 and to select the i64 intrinsic IDs when necessary
* Adds appropriate patterns to RISCVInstrInfoA.td
* Updates test/CodeGen/RISCV/atomic-*.ll to show RV64A support

This ends up being a fairly mechanical change, as the logic for RV32A is
effectively reused.

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

llvm-svn: 351422

5 years ago[ARM64][Windows] Share unwind codes between epilogues
Sanjin Sijaric [Thu, 17 Jan 2019 09:45:17 +0000 (09:45 +0000)]
[ARM64][Windows] Share unwind codes between epilogues

There are cases where we have multiple epilogues that have the exact same unwind
code sequence.  In that case, the epilogues can share the same unwind codes in
the .xdata section.  This should get us past the assert "SEH unwind data
splitting not yet implemented" in many cases.

We still need to add support for generating multiple .pdata/.xdata sections for
those functions that need to be split into fragments.

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

llvm-svn: 351421

5 years ago[llvm-objdump] - Fix comment. NFC.
George Rimar [Thu, 17 Jan 2019 09:14:33 +0000 (09:14 +0000)]
[llvm-objdump] - Fix comment. NFC.

Forgot to address this one.

llvm-svn: 351418

5 years ago[llvm-objdump] - Simplify the getRelocationValueString. NFCI.
George Rimar [Thu, 17 Jan 2019 09:13:17 +0000 (09:13 +0000)]
[llvm-objdump] - Simplify the getRelocationValueString. NFCI.

This refactors the getRelocationValueString method.
It is a bit overcomplicated and it is possible to reduce it without
losing the functionality it seems.

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

llvm-svn: 351417

5 years ago[NFC] Factor out some local vars
Max Kazantsev [Thu, 17 Jan 2019 06:20:42 +0000 (06:20 +0000)]
[NFC] Factor out some local vars

llvm-svn: 351416

5 years ago[CMake][Fuchsia] Disable modules for the second stage build
Petr Hosek [Thu, 17 Jan 2019 04:12:30 +0000 (04:12 +0000)]
[CMake][Fuchsia] Disable modules for the second stage build

This made the toolchain build 50% slower.

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

llvm-svn: 351415

5 years ago[hurd] Fix unconditional use of PATH_MAX
Eric Fiselier [Thu, 17 Jan 2019 02:59:28 +0000 (02:59 +0000)]
[hurd] Fix unconditional use of PATH_MAX

Patch by Samuel Thibault

The GNU/Hurd system does not define an arbitrary PATH_MAX limitation, the POSIX 2001 realpath
extension can be used instead, and the size of symlinks can be determined.

Reviewed as https://reviews.llvm.org/D54677

llvm-svn: 351414

5 years ago[WebAssembly] Parse llvm.ident into producers section
Thomas Lively [Thu, 17 Jan 2019 02:29:55 +0000 (02:29 +0000)]
[WebAssembly] Parse llvm.ident into producers section

llvm-svn: 351413

5 years ago[WebAssembly] Merge producers section
Thomas Lively [Thu, 17 Jan 2019 02:29:41 +0000 (02:29 +0000)]
[WebAssembly] Merge producers section

llvm-svn: 351412

5 years ago[MergeFunc] Prevent silent miscompile of vararg functions
Vedant Kumar [Thu, 17 Jan 2019 02:15:05 +0000 (02:15 +0000)]
[MergeFunc] Prevent silent miscompile of vararg functions

The function merging pass miscompiles identical vararg functions. The
forwarding thunk it emits doesn't forward the full variable-length list
of arguments. Disable merging for vararg functions for now.

I've filed llvm.org/PR40345 to track the issue.

rdar://47326238

llvm-svn: 351411

5 years agoRevert "[WebAssembly] Parse llvm.ident into producers section"
Thomas Lively [Thu, 17 Jan 2019 00:39:49 +0000 (00:39 +0000)]
Revert "[WebAssembly] Parse llvm.ident into producers section"

This reverts commit eccdbba3a02a33e13b5262e92200a33e2ead873d.

llvm-svn: 351410

5 years agoRevert "[WebAssembly] Merge producers section"
Thomas Lively [Thu, 17 Jan 2019 00:34:44 +0000 (00:34 +0000)]
Revert "[WebAssembly] Merge producers section"

This reverts commit 71eaf61c6c121c8c3bcaf3490557e92cf81599cb. One of
the lld tests was breaking, so revert this change until it is fixed.

llvm-svn: 351409

5 years ago[X86] Add custom emission for the avx512 scatter builtins to convert from scalar...
Craig Topper [Thu, 17 Jan 2019 00:34:19 +0000 (00:34 +0000)]
[X86] Add custom emission for the avx512 scatter builtins to convert from scalar integer to vXi1 for the mask arguments to the intrinsics.

llvm-svn: 351408

5 years ago[X86] Remove GCCBuiltin from deprecated avx512 scatter intrinsics that use scalar...
Craig Topper [Thu, 17 Jan 2019 00:34:04 +0000 (00:34 +0000)]
[X86] Remove GCCBuiltin from deprecated avx512 scatter intrinsics that use scalar integers for mask.

We will custom emit these builtins in clang using the new intrinsics that take a vXi1 mask.

llvm-svn: 351407

5 years ago[docs] Fix formatting.
Eli Friedman [Thu, 17 Jan 2019 00:31:35 +0000 (00:31 +0000)]
[docs] Fix formatting.

llvm-svn: 351406

5 years ago[FunctionComparator] Consider tail call kinds
Vedant Kumar [Thu, 17 Jan 2019 00:29:14 +0000 (00:29 +0000)]
[FunctionComparator] Consider tail call kinds

Essentially, do not treat `call` and `musttail call` as the same thing.

As a drive-by, fold CallInst and InvokeInst handling together using the
CallSite helper.

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

llvm-svn: 351405

5 years ago[SEH] [ARM64] Retrieve the frame pointer from SEH funclets
Sanjin Sijaric [Thu, 17 Jan 2019 00:24:38 +0000 (00:24 +0000)]
[SEH] [ARM64] Retrieve the frame pointer from SEH funclets

The Windows ARM64 runtime passes the establisher frame to funclets as the first
argument.

llvm-svn: 351404

5 years ago[docs] Add more ARM/AArch64 links to CompilerWriterInfo.rst .
Eli Friedman [Thu, 17 Jan 2019 00:21:08 +0000 (00:21 +0000)]
[docs] Add more ARM/AArch64 links to CompilerWriterInfo.rst .

Also, fix a few existing links so they don't require registration.

llvm-svn: 351403

5 years ago[Frontend] Make WrapperFrontendAction call WrappedAction.PrepareToExecuteAction.
Volodymyr Sapsai [Thu, 17 Jan 2019 00:20:43 +0000 (00:20 +0000)]
[Frontend] Make WrapperFrontendAction call WrappedAction.PrepareToExecuteAction.

Fixes `-emit-header-module` when GenerateHeaderModuleAction is wrapped
by another frontend action.

rdar://problem/47302588

Reviewers: rsmith, arphaman

Reviewed By: arphaman

Subscribers: jkorous, dexonsmith, cfe-commits

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

llvm-svn: 351402

5 years ago[WebAssembly] Merge producers section
Thomas Lively [Wed, 16 Jan 2019 23:46:15 +0000 (23:46 +0000)]
[WebAssembly] Merge producers section

Reviewers: sbc100, aheejin, dschuff

Subscribers: jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 351400

5 years ago[WebAssembly] Parse llvm.ident into producers section
Thomas Lively [Wed, 16 Jan 2019 23:46:14 +0000 (23:46 +0000)]
[WebAssembly] Parse llvm.ident into producers section

Summary:
Everything before the word "version" is the tool, and everything after
the word "version" is the version.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 351399

5 years agoFix sanitizer tool list used to generate sanitizer_common tests to be up-to-date.
Dan Liew [Wed, 16 Jan 2019 23:37:31 +0000 (23:37 +0000)]
Fix sanitizer tool list used to generate sanitizer_common tests to be up-to-date.

Summary:
This replaces the sanitizer tool list (used for generating
sanitizer_common configurations) with a tool list derived from
existing build system information.

Previously sanitizer_common had its own list of supported sanitizer
tools. This was bad because it was out of sync with the rest of the
build system. Notably it meant that the sanitizer_common runtime was
only being tested on Darwin the ASan dylib and not the other sanitizer
dylibs that are built for Darwin (LSan, TSan, and UBSan).

Unfortunately enabling the tests against other sanitizer dylibs has lead
to some test failures on Darwin. For now they've been marked as
XFAIL until the failures can investigated properly.

For Windows and Android we use the old sanitizer tool list to try avoid
bot breakages.

rdar://problem/47143078

Reviewers: kubamracek, george.karpenkov, yln, samsonov, vitalybuka, krytarowski

Subscribers: srhines, mgorny, fedor.sergeev, #sanitizers, llvm-commits

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

llvm-svn: 351398

5 years agoFix a mistake in rL351392.
Wei Mi [Wed, 16 Jan 2019 23:31:40 +0000 (23:31 +0000)]
Fix a mistake in rL351392.

PGOInstrGen should be initialized to "" instead of false.

llvm-svn: 351397

5 years ago[ELF][X86_64] Fix corrupted LD -> LE optimization for TLS without PLT
Peter Wu [Wed, 16 Jan 2019 23:28:51 +0000 (23:28 +0000)]
[ELF][X86_64] Fix corrupted LD -> LE optimization for TLS without PLT

The LD -> LE optimization for Thread-Local Storage without PLT requires
an additional "66" prefix, otherwise the next instruction will be
corrupted, causing runtime misbehavior (crashes) of the linked object.

The other (GD -> IE/LD) optimizations are the same with or without PLT,
but add tests for completeness. The instructions are copied from
https://raw.githubusercontent.com/wiki/hjl-tools/x86-psABI/x86-64-psABI-1.0.pdf#subsection.11.1.2

This does not try to address ILP32 (x32) support.

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

Reviewed By: ruiu

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

llvm-svn: 351396

5 years ago[AsmPrinter] Collapse .loc 0 0 directives
Jonas Devlieghere [Wed, 16 Jan 2019 23:26:29 +0000 (23:26 +0000)]
[AsmPrinter] Collapse .loc 0 0 directives

Currently we do not always collapse subsequent .loc 0 0 directives. The
reason is that we were checking for a PrevInstLoc which is not set when
we emit a line-0 record. We should only check the LastAsmLine, which
seems to be created exactly for this purpose.

  // When we emit a line-0 record, we don't update PrevInstLoc; so look at
  // the last line number actually emitted, to see if it was line 0.
  unsigned LastAsmLine =
    Asm->OutStreamer->getContext().getCurrentDwarfLoc().getLine();

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

llvm-svn: 351395

5 years ago[analyzer] Another RetainCountChecker cleanup
George Karpenkov [Wed, 16 Jan 2019 23:21:38 +0000 (23:21 +0000)]
[analyzer] Another RetainCountChecker cleanup

This is not NFC strictly speaking, since it unifies CleanupAttr handling,
so that out parameters now also understand it.

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

llvm-svn: 351394

5 years ago[analyzer] [NFC] Yet another minor cleanup of RetainCountChecker
George Karpenkov [Wed, 16 Jan 2019 23:21:15 +0000 (23:21 +0000)]
[analyzer] [NFC] Yet another minor cleanup of RetainCountChecker

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

llvm-svn: 351393

5 years ago[PGO] Make pgo related options in opt more consistent.
Wei Mi [Wed, 16 Jan 2019 23:19:02 +0000 (23:19 +0000)]
[PGO] Make pgo related options in opt more consistent.

Currently we have pgo options defined in PassManagerBuilder.cpp only for
instrument pgo, but not for sample pgo. We also have pgo options defined
in NewPMDriver.cpp in opt only for new pass manager and for all kinds of
pgo. They have some inconsistency.

To make the options more consistent and make tests writing easier, the
patch let old pass manager to share the same pgo options with new pass
manager in opt, and removes the options in PassManagerBuilder.cpp.

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

llvm-svn: 351392

5 years agoRecommit r351160 "[X86] Make _xgetbv/_xsetbv on non-windows platforms"
Craig Topper [Wed, 16 Jan 2019 22:56:25 +0000 (22:56 +0000)]
Recommit r351160 "[X86] Make _xgetbv/_xsetbv on non-windows platforms"

V8 has been fixed now.

llvm-svn: 351391

5 years ago[X86] Add versions of the avx512 gather intrinsics that take the mask as a vXi1 vecto...
Craig Topper [Wed, 16 Jan 2019 22:34:33 +0000 (22:34 +0000)]
[X86] Add versions of the avx512 gather intrinsics that take the mask as a vXi1 vector instead of a scalar

We need to custom handle these so we can turn the scalar mask into a vXi1 vector.

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

llvm-svn: 351390