platform/upstream/llvm.git
4 years agoMake another attempt at fixing SymbolFilePDBTests.
Adrian Prantl [Tue, 1 Oct 2019 18:15:22 +0000 (18:15 +0000)]
Make another attempt at fixing SymbolFilePDBTests.

llvm-svn: 373373

4 years ago[libc++] Update link to Itanium C++ ABI documentation
Louis Dionne [Tue, 1 Oct 2019 18:14:27 +0000 (18:14 +0000)]
[libc++] Update link to Itanium C++ ABI documentation

llvm-svn: 373372

4 years ago[Diagnostics] Make -Wenum-compare-conditional off by default
David Bolvansky [Tue, 1 Oct 2019 18:12:13 +0000 (18:12 +0000)]
[Diagnostics] Make -Wenum-compare-conditional off by default

Too many false positives, eg. in Chromium.

llvm-svn: 373371

4 years ago[ThinLTO] Enable index-only WPD from clang
Teresa Johnson [Tue, 1 Oct 2019 18:08:29 +0000 (18:08 +0000)]
[ThinLTO] Enable index-only WPD from clang

Summary:
To trigger the index-only Whole Program Devirt support added to LLVM, we
need to be able to specify -fno-split-lto-unit in conjunction with
-fwhole-program-vtables. Keep the default for -fwhole-program-vtables as
-fsplit-lto-unit, but don't error on that option combination.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, steven_wu, dexonsmith, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 373370

4 years ago[PGO] Fix typos from r359612. NFC.
Rong Xu [Tue, 1 Oct 2019 18:06:50 +0000 (18:06 +0000)]
[PGO] Fix typos from r359612. NFC.

llvm-svn: 373369

4 years ago[ARM] Some MVE shuffle plus extend tests. NFC
David Green [Tue, 1 Oct 2019 18:04:02 +0000 (18:04 +0000)]
[ARM] Some MVE shuffle plus extend tests. NFC

llvm-svn: 373368

4 years agoRevert "compiler-rt: use __GLIBC_PREREQ for SANITIZER_INTERCEPT_GETRANDOM"
Vitaly Buka [Tue, 1 Oct 2019 18:03:11 +0000 (18:03 +0000)]
Revert "compiler-rt: use __GLIBC_PREREQ for SANITIZER_INTERCEPT_GETRANDOM"
Revert "compiler-rt: move all __GLIBC_PREREQ into own header file"

"move all __GLIBC_PREREQ" breaks build on some bots

This reverts commit 2d75ee937397c209dbd95aefc88da6301fed07da.
This reverts commit 7a6461fcc2ed8e28c43993c561721af0bbe97f3a.

llvm-svn: 373367

4 years agoAMDGPU/SILoadStoreOptimizer: Add helper functions for working with CombineInfo
Tom Stellard [Tue, 1 Oct 2019 17:56:59 +0000 (17:56 +0000)]
AMDGPU/SILoadStoreOptimizer: Add helper functions for working with CombineInfo

Summary:
This is a refactoring that will make future improvements to this pass easier.
This change should not change the behavior of the pass.

Reviewers: arsenm, pendingchaos, rampitec, nhaehnle, vpykhtin

Reviewed By: nhaehnle, vpykhtin

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 373366

4 years ago[libc++abi] Remove redundant #include of <string.h>
Louis Dionne [Tue, 1 Oct 2019 17:53:17 +0000 (17:53 +0000)]
[libc++abi] Remove redundant #include of <string.h>

<string.h> is always included, so we don't need the additional #include
only in the _WIN32 case.

llvm-svn: 373365

4 years ago[InstCombine] Deal with -(trunc(X >>u 63)) -> trunc(X >>s 63)
Roman Lebedev [Tue, 1 Oct 2019 17:50:20 +0000 (17:50 +0000)]
[InstCombine] Deal with -(trunc(X >>u 63)) -> trunc(X >>s 63)

Identical to it's trunc-less variant, just pretent-to hoist
trunc, and everything else still holds:
https://rise4fun.com/Alive/JRU

llvm-svn: 373364

4 years ago[InstCombine] Preserve 'exact' in -(X >>u 31) -> (X >>s 31) fold
Roman Lebedev [Tue, 1 Oct 2019 17:50:09 +0000 (17:50 +0000)]
[InstCombine] Preserve 'exact' in -(X >>u 31) -> (X >>s 31) fold

https://rise4fun.com/Alive/yR4

llvm-svn: 373363

4 years ago[NFC][InstCombine] (Better) tests for sign-bit-smearing pattern
Roman Lebedev [Tue, 1 Oct 2019 17:49:58 +0000 (17:49 +0000)]
[NFC][InstCombine] (Better) tests for sign-bit-smearing pattern

https://rise4fun.com/Alive/JRU
https://rise4fun.com/Alive/yR4 <- we can preserve 'exact'

llvm-svn: 373362

4 years ago[JSON] Use LLVM's library for argdumper
Jonas Devlieghere [Tue, 1 Oct 2019 17:41:55 +0000 (17:41 +0000)]
[JSON] Use LLVM's library for argdumper

This patch replaces the LLDB's JSON implementation with the one from
LLVM in argdumper.

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

llvm-svn: 373361

4 years ago[JSON] Use LLVM's library for decoding JSON in StructuredData
Jonas Devlieghere [Tue, 1 Oct 2019 17:41:52 +0000 (17:41 +0000)]
[JSON] Use LLVM's library for decoding JSON in StructuredData

This patch replaces the hand-rolled JSON decoding in StructuredData with
LLVM's JSON library.

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

llvm-svn: 373360

4 years ago[JSON] Use LLVM's library for encoding JSON in StructuredData
Jonas Devlieghere [Tue, 1 Oct 2019 17:41:48 +0000 (17:41 +0000)]
[JSON] Use LLVM's library for encoding JSON in StructuredData

This patch replaces the hand-rolled JSON emission in StructuredData with
LLVM's JSON library.

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

llvm-svn: 373359

4 years ago[llvm-mca] Add a -mattr flag
David Green [Tue, 1 Oct 2019 17:41:38 +0000 (17:41 +0000)]
[llvm-mca] Add a -mattr flag

This adds a -mattr flag to llvm-mca, for cases where the -mcpu option does not
contain all optional features.

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

llvm-svn: 373358

4 years agoAdd missing REQUIRES: arm.
Peter Collingbourne [Tue, 1 Oct 2019 17:35:56 +0000 (17:35 +0000)]
Add missing REQUIRES: arm.

llvm-svn: 373357

4 years ago[ReleaseProcess] Document requirement to set MACOSX_DEPLOYMENT_TARGET
Vedant Kumar [Tue, 1 Oct 2019 17:10:45 +0000 (17:10 +0000)]
[ReleaseProcess] Document requirement to set MACOSX_DEPLOYMENT_TARGET

llvm-svn: 373356

4 years agoFix a syntax error.
Adrian Prantl [Tue, 1 Oct 2019 17:10:25 +0000 (17:10 +0000)]
Fix a syntax error.

llvm-svn: 373355

4 years agoFix a condition-flip regression introduced in r373344.
Adrian Prantl [Tue, 1 Oct 2019 17:08:44 +0000 (17:08 +0000)]
Fix a condition-flip regression introduced in r373344.

llvm-svn: 373354

4 years agoTypo (NFC)
Adrian Prantl [Tue, 1 Oct 2019 17:08:41 +0000 (17:08 +0000)]
Typo (NFC)

llvm-svn: 373353

4 years agoSimplify condition (NFC)
Adrian Prantl [Tue, 1 Oct 2019 17:08:38 +0000 (17:08 +0000)]
Simplify condition (NFC)

llvm-svn: 373352

4 years ago[IndVars] An implementation of loop predication without a need for speculation
Philip Reames [Tue, 1 Oct 2019 17:03:44 +0000 (17:03 +0000)]
[IndVars] An implementation of loop predication without a need for speculation

This patch implements a variation of a well known techniques for JIT compilers - we have an implementation in tree as LoopPredication - but with an interesting twist. This version does not assume the ability to execute a path which wasn't taken in the original program (such as a guard or widenable.condition intrinsic). The benefit is that this works for arbitrary IR from any frontend (including C/C++/Fortran). The tradeoff is that it's restricted to read only loops without implicit exits.

This builds on SCEV, and can thus eliminate the loop varying portion of the any early exit where all exits are understandable by SCEV. A key advantage is that fixing deficiency exposed in SCEV - already found one while writing test cases - will also benefit all of full redundancy elimination (and most other loop transforms).

I haven't seen anything in the literature which quite matches this. Given that, I'm not entirely sure that keeping the name "loop predication" is helpful. Anyone have suggestions for a better name? This is analogous to partial redundancy elimination - since we remove the condition flowing around the backedge - and has some parallels to our existing transforms which try to make conditions invariant in loops.

Factoring wise, I chose to put this in IndVarSimplify since it's a generally applicable to all workloads. I could split this off into it's own pass, but we'd then probably want to add that new pass every place we use IndVars.  One solid argument for splitting it off into it's own pass is that this transform is "too good". It breaks a huge number of existing IndVars test cases as they tend to be simple read only loops.  At the moment, I've opted it off by default, but if we add this to IndVars and enable, we'll have to update around 20 test files to add side effects or disable this transform.

Near term plan is to fuzz this extensively while off by default, reflect and discuss on the factoring issue mentioned just above, and then enable by default.  I also need to give some though to supporting widenable conditions in this framing.

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

llvm-svn: 373351

4 years agoAMDGPU/GlobalISel: Increase max legal size to 1024
Matt Arsenault [Tue, 1 Oct 2019 16:35:06 +0000 (16:35 +0000)]
AMDGPU/GlobalISel: Increase max legal size to 1024

There are 1024 bit register classes defined for AGPRs. Additionally
OpenCL defines vectors up to 16 x i64, and this helps those tests
legalize.

llvm-svn: 373350

4 years ago[X86] Add a VBROADCAST_LOAD ISD opcode representing a scalar load broadcasted to...
Craig Topper [Tue, 1 Oct 2019 16:28:20 +0000 (16:28 +0000)]
[X86] Add a VBROADCAST_LOAD ISD opcode representing a scalar load broadcasted to a vector.

Summary:
This adds the ISD opcode and a DAG combine to create it. There are
probably some places where we can directly create it, but I'll
leave that for future work.

This updates all of the isel patterns to look for this new node.
I had to add a few additional isel patterns for aligned extloads
which we should probably fix with a DAG combine or something. This
does mean that the broadcast load folding for avx512 can no
longer match a broadcasted aligned extload.

There's still some work to do here for combining a broadcast of
a broadcast_load. We also need to improve extractelement or
demanded vector elements of a broadcast_load. I'll try to get
those done before I submit this patch.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 373349

4 years ago[OPENMP]Fix PR43516: Compiler crash with collapse(2) on non-rectangular
Alexey Bataev [Tue, 1 Oct 2019 16:19:10 +0000 (16:19 +0000)]
[OPENMP]Fix PR43516: Compiler crash with collapse(2) on non-rectangular
loop.

Missed check if the condition is also dependent when building final
expressions for the collapsed loop directives.

llvm-svn: 373348

4 years agoELF: Add .interp synthetic sections first in createSyntheticSections().
Peter Collingbourne [Tue, 1 Oct 2019 16:10:13 +0000 (16:10 +0000)]
ELF: Add .interp synthetic sections first in createSyntheticSections().

Our .interp section is not a SyntheticSection. As a result, it terminates the
loop in removeUnusedSyntheticSections(). This has at least two consequences:

- The synthetic .bss and .bss.rel.ro sections are always present in
  dynamically linked executables, even when they are not needed.
- The synthetic .ARM.exidx (and possibly other) sections are always present
  in partitions other than the last one, even when not needed.
  .ARM.exidx in particular is problematic because it assumes that its
  list of code sections is non-empty in getLinkOrderDep(), which can
  lead to a crash if the partition does not have any code sections.

Fix these problems by moving the creation of the .interp sections to the
top of createSyntheticSections(). While here, make the code a little less
error-prone by changing the add() lambdas to take a SyntheticSection instead
of an InputSectionBase.

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

llvm-svn: 373347

4 years ago[AMDGPU] Add VerifyScheduling support.
Jay Foad [Tue, 1 Oct 2019 15:45:47 +0000 (15:45 +0000)]
[AMDGPU] Add VerifyScheduling support.

Summary:
This is cut and pasted from the corresponding GenericScheduler
functions.

Reviewers: arsenm, atrick, tstellar, vpykhtin

Subscribers: MatzeB, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, javed.absar, llvm-commits

Tags: #llvm

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

llvm-svn: 373346

4 years ago[Diagnostics] Move warning into the subgroup (-Wenum-compare-conditional)
David Bolvansky [Tue, 1 Oct 2019 15:44:38 +0000 (15:44 +0000)]
[Diagnostics] Move warning into the subgroup (-Wenum-compare-conditional)

llvm-svn: 373345

4 years agoRemove size_t return parameter from FindTypes
Adrian Prantl [Tue, 1 Oct 2019 15:40:41 +0000 (15:40 +0000)]
Remove size_t return parameter from FindTypes

In r368345 I accidentally introduced a regression that would
over-report the number of matches found by FindTypes if the
DeclContext Filter was hit.

This patch simply removes the size_t return parameter altogether —
it's not that useful.

rdar://problem/55500457

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

llvm-svn: 373344

4 years ago[DAG][X86] Convert isNegatibleForFree/GetNegatedExpression to a target hook (PR42863)
Simon Pilgrim [Tue, 1 Oct 2019 15:32:04 +0000 (15:32 +0000)]
[DAG][X86] Convert isNegatibleForFree/GetNegatedExpression to a target hook (PR42863)

This patch converts the DAGCombine isNegatibleForFree/GetNegatedExpression into overridable TLI hooks.

The intention is to let us extend existing FNEG combines to work more generally with negatible float ops, allowing it work with target specific combines and opcodes (e.g. X86's FMA variants).

Unlike the SimplifyDemandedBits, we can't just handle target nodes through a Target callback, we need to do this as an override to allow targets to handle generic opcodes as well. This does mean that the target implementations has to duplicate some checks (recursion depth etc.).

Partial reversion of rL372756 - I've identified the infinite loop issue inside the X86 override but haven't fixed it yet so I've only (re)committed the common TargetLowering refactoring part of the patch.

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

llvm-svn: 373343

4 years agoUpdate SymbolFilePDB for FindTypes API change.
Adrian Prantl [Tue, 1 Oct 2019 15:29:33 +0000 (15:29 +0000)]
Update SymbolFilePDB for FindTypes API change.

This is untested, I don't have access to a Windows machine.

llvm-svn: 373342

4 years ago[Dominators][CodeGen] Add MachinePostDominatorTree verification
Jakub Kuderski [Tue, 1 Oct 2019 15:23:27 +0000 (15:23 +0000)]
[Dominators][CodeGen] Add MachinePostDominatorTree verification

Summary:
This patch implements Machine PostDominator Tree verification and ensures that the verification doesn't fail the in-tree tests.

MPDT verification can be enabled using `verify-machine-dom-info` -- the same flag used by Machine Dominator Tree verification.

Flipping the flag revealed that MachineSink falsely claimed to preserve CFG and MDT/MPDT. This patch fixes that.

Reviewers: arsenm, hliao, rampitec, vpykhtin, grosser

Reviewed By: hliao

Subscribers: wdng, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 373341

4 years ago[clang] Make handling of unnamed template params similar to function params
Kadir Cetinkaya [Tue, 1 Oct 2019 14:08:51 +0000 (14:08 +0000)]
[clang] Make handling of unnamed template params similar to function params

Summary:
Clang uses the location identifier should be inserted for declarator
decls when a decl is unnamed. But for type template and template template
paramaters it uses the location of "typename/class" keyword, which makes it hard
for tooling to insert/change parameter names.

This change tries to unify these two cases by making template parameter
parsing and sourcerange operations similar to function params/declarator decls.

Reviewers: ilya-biryukov

Subscribers: arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 373340

4 years ago[lldb][NFC] Mark ClangASTContext constructor as explicit
Raphael Isemann [Tue, 1 Oct 2019 13:45:06 +0000 (13:45 +0000)]
[lldb][NFC] Mark ClangASTContext constructor as explicit

Given that we can implicitly construct a ClangASTContext from any string, we should
really mark this as explicit.

llvm-svn: 373339

4 years agoRevert rL349624 : Let TableGen write output only if it changed, instead of doing...
Simon Pilgrim [Tue, 1 Oct 2019 13:39:43 +0000 (13:39 +0000)]
Revert rL349624 : Let TableGen write output only if it changed, instead of doing so in cmake, attempt 2

Differential Revision: https://reviews.llvm.org/D55842
-----------------
As discussed on PR43385 this is causing Visual Studio msbuilds to perpetually rebuild all tablegen generated files

llvm-svn: 373338

4 years ago[lldb][NFC] Remove unused ClangASTContext::GetHasExternalStorage
Raphael Isemann [Tue, 1 Oct 2019 13:25:25 +0000 (13:25 +0000)]
[lldb][NFC] Remove unused ClangASTContext::GetHasExternalStorage

This code isn't used nor tested.

llvm-svn: 373337

4 years agoRevert "Reland "[utils] Implement the llvm-locstats tool""
Djordje Todorovic [Tue, 1 Oct 2019 13:21:15 +0000 (13:21 +0000)]
Revert "Reland "[utils] Implement the llvm-locstats tool""

This reverts commit rL373317 due to test failure on the
clang-s390x-linux build bot.

llvm-svn: 373336

4 years agoRevert [InstCombine] sprintf(dest, "%s", str) -> memccpy(dest, str, 0, MAX)
David Bolvansky [Tue, 1 Oct 2019 13:19:04 +0000 (13:19 +0000)]
Revert [InstCombine] sprintf(dest, "%s", str) -> memccpy(dest, str, 0, MAX)

Seems to be slower than memcpy + strlen.

llvm-svn: 373335

4 years ago[lldb][NFC] Remove unused ClangASTContext functions for checking/removing the Externa...
Raphael Isemann [Tue, 1 Oct 2019 13:05:57 +0000 (13:05 +0000)]
[lldb][NFC] Remove unused ClangASTContext functions for checking/removing the ExternalASTSource

llvm-svn: 373334

4 years ago[InstCombine] sprintf(dest, "%s", str) -> memccpy(dest, str, 0, MAX)
David Bolvansky [Tue, 1 Oct 2019 13:03:10 +0000 (13:03 +0000)]
[InstCombine] sprintf(dest, "%s", str) -> memccpy(dest, str, 0, MAX)

llvm-svn: 373333

4 years ago[llvm-exegesis/lib] Fix missing linkage to MCParser
Michal Gorny [Tue, 1 Oct 2019 13:02:48 +0000 (13:02 +0000)]
[llvm-exegesis/lib] Fix missing linkage to MCParser

Otherwise, shared-lib build fails with:

lib64/libLLVMExegesis.a(SnippetFile.cpp.o): In function `llvm::exegesis::readSnippets(llvm::exegesis::LLVMState const&, llvm::StringRef)':
SnippetFile.cpp:(.text._ZN4llvm8exegesis12readSnippetsERKNS0_9LLVMStateENS_9StringRefE+0x31f): undefined reference to `llvm::createMCAsmParser(llvm::SourceMgr&, llvm::MCContext&, llvm::MCStreamer&, llvm::MCAsmInfo const&, unsigned int)'
SnippetFile.cpp:(.text._ZN4llvm8exegesis12readSnippetsERKNS0_9LLVMStateENS_9StringRefE+0x41c): undefined reference to `llvm::MCAsmParser::setTargetParser(llvm::MCTargetAsmParser&)'
collect2: error: ld returned 1 exit status

llvm-svn: 373332

4 years ago[NFC][ARM][MVE] More tests
Sam Parker [Tue, 1 Oct 2019 13:02:14 +0000 (13:02 +0000)]
[NFC][ARM][MVE] More tests

Add some tail predication tests with fast math.

llvm-svn: 373331

4 years ago[lldb][NFC] Disallow changing the ASTContext of an ClangASTContext after construction.
Raphael Isemann [Tue, 1 Oct 2019 12:55:37 +0000 (12:55 +0000)]
[lldb][NFC] Disallow changing the ASTContext of an ClangASTContext after construction.

We have no use case in LLDB where we actually do want to change the ASTContext after
it the ClangASTContext has been constructed. All callers of setASTContext are just setting
the ASTContext directly after construction, so we might as well make this a Constructor
instead of supporting this tricky use case.

llvm-svn: 373330

4 years ago[lldb][NFC] Modernize ClangASTContext constructor
Raphael Isemann [Tue, 1 Oct 2019 12:28:14 +0000 (12:28 +0000)]
[lldb][NFC] Modernize ClangASTContext constructor

Now using default initializers and StringRef.

Also formats the member list that we excluded from clang-format
at some point and still hangs around with the old LLDB code style.

llvm-svn: 373329

4 years ago[libc++] Harden usage of static_assert against C++03
Louis Dionne [Tue, 1 Oct 2019 12:12:21 +0000 (12:12 +0000)]
[libc++] Harden usage of static_assert against C++03

In C++03, we emulate static_assert with a macro, and we must parenthesize
multiple arguments.

llvm-svn: 373328

4 years ago[clang] Ignore builtin namespaces in test/Import/cxx-anon-namespace
Raphael Isemann [Tue, 1 Oct 2019 11:53:20 +0000 (11:53 +0000)]
[clang] Ignore builtin namespaces in test/Import/cxx-anon-namespace

Some platforms (e.g. AArch64) put __va_list in the 'std' namespace which might
end up being the first namespace we match in this test. Instead let
the first namespace match via file name/line so that we skip the
builtin namespaces.

llvm-svn: 373327

4 years agoDIExpression::createFragmentExpression - silence static analyzer DIExpression* null...
Simon Pilgrim [Tue, 1 Oct 2019 11:25:38 +0000 (11:25 +0000)]
DIExpression::createFragmentExpression - silence static analyzer DIExpression* null dereference warning with an assertion. NFCI.

llvm-svn: 373326

4 years agoVirtualFileSystem - replace dyn_cast<>+assert with cast<> calls. NFCI.
Simon Pilgrim [Tue, 1 Oct 2019 11:25:29 +0000 (11:25 +0000)]
VirtualFileSystem - replace dyn_cast<>+assert with cast<> calls. NFCI.

Silences a number of clang static analyzer null dereference warnings.

llvm-svn: 373325

4 years agoObjectFile makeTriple - silence static analyzer dyn_cast<COFFObjectFile> null derefer...
Simon Pilgrim [Tue, 1 Oct 2019 11:25:17 +0000 (11:25 +0000)]
ObjectFile makeTriple - silence static analyzer dyn_cast<COFFObjectFile> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<COFFObjectFile> directly and if not assert will fire for us.

llvm-svn: 373324

4 years ago[clangd] Implement getBeginning for overloaded operators.
Haojian Wu [Tue, 1 Oct 2019 11:03:56 +0000 (11:03 +0000)]
[clangd] Implement getBeginning for overloaded operators.

Summary:
This will fix some bugs where navigation doesn't work on cases like
`std::cout <^< "hello"`.

Reviewers: ilya-biryukov

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

Tags: #clang

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

llvm-svn: 373323

4 years agoInstrProf - avoid static analyzer dyn_cast<ConstantInt> null dereference warning.
Simon Pilgrim [Tue, 1 Oct 2019 10:38:30 +0000 (10:38 +0000)]
InstrProf - avoid static analyzer dyn_cast<ConstantInt> null dereference warning.

The static analyzer is warning about a potential null dereference, as we're already earlying-out for a null Constant pointer I've just folded this into a dyn_cast_or_null<ConstantInt>.

No test case, this is by inspection only.

llvm-svn: 373322

4 years agoConstantFold - ConstantFoldSelectInstruction - assume constant vector elements are...
Simon Pilgrim [Tue, 1 Oct 2019 10:22:01 +0000 (10:22 +0000)]
ConstantFold - ConstantFoldSelectInstruction - assume constant vector elements are constant. NFCI.

Goes a bit further than rL372743 which added the early out - elements should be Constant so use cast<Constant> instead (and rely on the assert if anything fails).

llvm-svn: 373321

4 years ago[clangd] Use the index-based API to do the header-source switch.
Haojian Wu [Tue, 1 Oct 2019 10:21:15 +0000 (10:21 +0000)]
[clangd] Use the index-based API to do the header-source switch.

Summary:
If the file heuristic fails, we try to use the index&AST to do the
header/source inference.

Reviewers: kadircet

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

Tags: #clang

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

llvm-svn: 373320

4 years ago[obj2yaml] - Fix BB after r373315.
George Rimar [Tue, 1 Oct 2019 10:02:47 +0000 (10:02 +0000)]
[obj2yaml] - Fix BB after r373315.

The success return value for data extractor's cursor
should also be checked.

llvm-svn: 373319

4 years ago[clangd] Handle template arguments in findExplicitReferences
Ilya Biryukov [Tue, 1 Oct 2019 10:02:23 +0000 (10:02 +0000)]
[clangd] Handle template arguments in findExplicitReferences

Reviewers: kadircet

Reviewed By: kadircet

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

Tags: #clang

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

llvm-svn: 373318

4 years agoReland "[utils] Implement the llvm-locstats tool"
Djordje Todorovic [Tue, 1 Oct 2019 09:59:15 +0000 (09:59 +0000)]
Reland "[utils] Implement the llvm-locstats tool"

The tool reports verbose output for the DWARF debug location coverage.
The llvm-locstats for each variable or formal parameter DIE computes what
percentage from the code section bytes, where it is in scope, it has
location description. The line 0 shows the number (and the percentage) of
DIEs with no location information, but the line 100 shows the number (and
the percentage) of DIEs where there is location information in all code
section bytes (where the variable or parameter is in the scope). The line
50..59 shows the number (and the percentage) of DIEs where the location
information is in between 50 and 59 percentage of its scope covered.

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

llvm-svn: 373317

4 years ago[yaml2obj] - Allow specifying custom Link values for SHT_HASH section.
George Rimar [Tue, 1 Oct 2019 09:54:40 +0000 (09:54 +0000)]
[yaml2obj] - Allow specifying custom Link values for SHT_HASH section.

This allows setting any sh_link values for SHT_HASH sections.

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

llvm-svn: 373316

4 years ago[yaml2obj/obj2yaml] - Add support for SHT_HASH sections.
George Rimar [Tue, 1 Oct 2019 09:45:59 +0000 (09:45 +0000)]
[yaml2obj/obj2yaml] - Add support for SHT_HASH sections.

SHT_HASH specification is:
http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#hash

In short the format is the following: it has 2 uint32 fields
in its header: nbucket and nchain followed by (nbucket + nchain)
uint32 values.

This patch allows dumping and parsing such sections.

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

llvm-svn: 373315

4 years agoFixup r373278: Move test to X86 directory
Diana Picus [Tue, 1 Oct 2019 09:27:20 +0000 (09:27 +0000)]
Fixup r373278: Move test to X86 directory

...since it's using an x86 triple.

llvm-svn: 373314

4 years ago[llvm-exegesis][NFC] Refactor X86 tests fixtures into a base class.
Clement Courbet [Tue, 1 Oct 2019 09:20:36 +0000 (09:20 +0000)]
[llvm-exegesis][NFC] Refactor X86 tests fixtures into a base class.

Reviewers: gchatelet, a.sidorin

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

llvm-svn: 373313

4 years ago[clang][lldb][NFC] Encapsulate ExternalASTMerger::ImporterSource
Raphael Isemann [Tue, 1 Oct 2019 09:02:05 +0000 (09:02 +0000)]
[clang][lldb][NFC] Encapsulate ExternalASTMerger::ImporterSource

NFC preparation work for upcoming ExternalASTMerger patches.

llvm-svn: 373312

4 years agoRevert "[OCaml] Handle nullptr in Llvm.global_initializer"
Dmitri Gribenko [Tue, 1 Oct 2019 08:29:07 +0000 (08:29 +0000)]
Revert "[OCaml] Handle nullptr in Llvm.global_initializer"

This reverts commit r373299. It broke tests:
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/18485

llvm-svn: 373311

4 years agoRevert "GlobalISel: Handle llvm.read_register"
Dmitri Gribenko [Tue, 1 Oct 2019 08:24:01 +0000 (08:24 +0000)]
Revert "GlobalISel: Handle llvm.read_register"

This reverts commit r373294. It broke Clang's
CodeGen/arm64-microsoft-status-reg.cpp:
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/18483

llvm-svn: 373310

4 years ago[NFC][HardwareLoops] Update some iterators
Sam Parker [Tue, 1 Oct 2019 07:53:28 +0000 (07:53 +0000)]
[NFC][HardwareLoops] Update some iterators

llvm-svn: 373309

4 years agoDecrease the verbosity of the -ftime-trace option
Sylvestre Ledru [Tue, 1 Oct 2019 07:52:42 +0000 (07:52 +0000)]
Decrease the verbosity of the -ftime-trace option
And move the relevant information in the doc.

Summary:
Currently, building a large software like Firefox shows
'Use chrome://tracing or Speedscope App (https://www.speedscope.app) for flamegraph visualization'
for each file.

Reviewers: anton-afanasyev

Reviewed By: anton-afanasyev

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 373308

4 years ago[clangd] Handle OverloadExpr in targetDecl
Ilya Biryukov [Tue, 1 Oct 2019 07:27:55 +0000 (07:27 +0000)]
[clangd] Handle OverloadExpr in targetDecl

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: nridge, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

llvm-svn: 373305

4 years ago[clang-tidy] Fix module registry name and description for Darwin clang-tidy module.
Dmitri Gribenko [Tue, 1 Oct 2019 07:17:26 +0000 (07:17 +0000)]
[clang-tidy] Fix module registry name and description for Darwin clang-tidy module.

Summary: When creating the module, must have copy-pasted from the misc module, and forgotten to update the name/description of the module in the registry.

Reviewers: stephanemoore, benhamilton, gribozavr

Reviewed By: gribozavr

Subscribers: xazax.hun, cfe-commits

Tags: #clang, #clang-tools-extra, #llvm

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

llvm-svn: 373304

4 years ago[X86] Consider isCodeGenOnly in the EVEX2VEX pass to make VMAXPD/PS map to the non...
Craig Topper [Tue, 1 Oct 2019 07:10:09 +0000 (07:10 +0000)]
[X86] Consider isCodeGenOnly in the EVEX2VEX pass to make VMAXPD/PS map to the non-commutable VEX instruction. Use EVEX2VEX override to fix the scalar instructions.

Previously the match was ambiguous and VMAXPS/PD and VMAXCPS/PD
were mapped to the same VEX instruction. But we should keep
the commutableness when change the opcode.

llvm-svn: 373303

4 years ago[WebAssembly] Make sure EH pads are preferred in sorting
Heejin Ahn [Tue, 1 Oct 2019 06:53:28 +0000 (06:53 +0000)]
[WebAssembly] Make sure EH pads are preferred in sorting

Summary:
In CFGSort, we try to make EH pads have higher priorities as soon as
they are ready to be sorted, to prevent creation of unwind destination
mismatches in CFGStackify. We did that by making priority queues'
comparison function  prefer EH pads, but it was possible for an EH pad
to be popped from `Preferred` queue and then not sorted immediately and
enter `Ready` queue instead in a certain condition. This patch makes
sure that special condition does not consider EH pads as its candidates.

Reviewers: dschuff

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

Tags: #llvm

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

llvm-svn: 373302

4 years ago[WebAssembly] Unstackify regs after fixing unwinding mismatches
Heejin Ahn [Tue, 1 Oct 2019 06:21:53 +0000 (06:21 +0000)]
[WebAssembly] Unstackify regs after fixing unwinding mismatches

Summary:
Fixing unwind mismatches for exception handling can result in splicing
existing BBs and moving some of instructions to new BBs. In this case
some of stackified def registers in the original BB can be used in the
split BB. For example, we have this BB and suppose %r0 is a stackified
register.
```
bb.1:
  %r0 = call @foo
  ... use %r0 ...
```

After fixing unwind mismatches in CFGStackify, `bb.1` can be split and
some instructions can be moved to a newly created BB:
```
bb.1:
  %r0 = call @foo

bb.split (new):
  ... use %r0 ...
```

In this case we should make %r0 un-stackified, because its use is now in
another BB.

When spliting a BB, this CL unstackifies all def registers that have
uses in the new split BB.

Reviewers: dschuff

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

Tags: #llvm

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

llvm-svn: 373301

4 years ago[Windows] Added support of watchpoints to `NativeProcessWindows`
Aleksandr Urakov [Tue, 1 Oct 2019 05:52:16 +0000 (05:52 +0000)]
[Windows] Added support of watchpoints to `NativeProcessWindows`

Summary: This patch adds support of watchpoints to the new `NativeProcessWindows` plugin. The same tests as in D67168 pass with these changes when the old plugin is turned off, so they will cover this functionality when the old plugin is gone.

Reviewers: asmith, amccarth, stella.stamenova, labath

Reviewed By: labath

Subscribers: labath, jfb, JDevlieghere, lldb-commits, leonid.mashinskiy

Tags: #lldb

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

llvm-svn: 373300

4 years ago[OCaml] Handle nullptr in Llvm.global_initializer
Aditya Kumar [Tue, 1 Oct 2019 03:45:09 +0000 (03:45 +0000)]
[OCaml] Handle nullptr in Llvm.global_initializer

LLVMGetInitializer returns nullptr in case there is no
initializer. There is not much that can be done with nullptr in OCaml,
not even test if it is null. Also, there does not seem to be a C or
OCaml API to test if there is an initializer. So this diff changes
Llvm.global_initializer to return an option.

Differential Revision: https://reviews.llvm.org/D65195
Reviewed by: whitequark
Authored by: kren1

llvm-svn: 373299

4 years agoAMDGPU/GlobalISel: Select s1 src G_SITOFP/G_UITOFP
Matt Arsenault [Tue, 1 Oct 2019 02:23:20 +0000 (02:23 +0000)]
AMDGPU/GlobalISel: Select s1 src G_SITOFP/G_UITOFP

llvm-svn: 373298

4 years agoRemove a undefined constructor introduced by r373244.
Yuanfang Chen [Tue, 1 Oct 2019 02:08:14 +0000 (02:08 +0000)]
Remove a undefined constructor introduced by r373244.

llvm-svn: 373297

4 years agoAMDGPU/GlobalISel: Add support for init.exec intrinsics
Matt Arsenault [Tue, 1 Oct 2019 02:07:25 +0000 (02:07 +0000)]
AMDGPU/GlobalISel: Add support for init.exec intrinsics

TThe existing wave32 behavior seems broken and incomplete, but this
reproduces it.

llvm-svn: 373296

4 years agoAMDGPU/GlobalISel: Allow scc/vcc alternative mappings for s1 constants
Matt Arsenault [Tue, 1 Oct 2019 02:07:19 +0000 (02:07 +0000)]
AMDGPU/GlobalISel: Allow scc/vcc alternative mappings for s1 constants

llvm-svn: 373295

4 years agoGlobalISel: Handle llvm.read_register
Matt Arsenault [Tue, 1 Oct 2019 02:07:16 +0000 (02:07 +0000)]
GlobalISel: Handle llvm.read_register

SelectionDAG has a bunch of machinery to defer this to selection time
for some reason. Just directly emit a copy during IRTranslator. The
x86 usage does somewhat questionably check hasFP, which could depend
on the whole function being at minimum translated.

This does lose the convergent bit if the callsite had it, which may be
a problem. We also lose that in general for intrinsics, which may also
be a problem.

llvm-svn: 373294

4 years agoAMDGPU/GlobalISel: Avoid creating shift of 0 in arg lowering
Matt Arsenault [Tue, 1 Oct 2019 01:44:46 +0000 (01:44 +0000)]
AMDGPU/GlobalISel: Avoid creating shift of 0 in arg lowering

This is sort of papering over the fact that we don't run a combiner
anywhere, but avoiding creating 2 instructions in the first place is
easy.

llvm-svn: 373293

4 years agoTLI: Remove DAG argument from getRegisterByName
Matt Arsenault [Tue, 1 Oct 2019 01:44:39 +0000 (01:44 +0000)]
TLI: Remove DAG argument from getRegisterByName

Replace with the MachineFunction. X86 is the only user, and only uses
it for the function. This removes one obstacle from using this in
GlobalISel. The other is the more tolerable EVT argument.

The X86 use of the function seems questionable to me. It checks hasFP,
before frame lowering.

llvm-svn: 373292

4 years ago[llvm-readobj/llvm-readelf] Delete --arm-attributes (alias for --arch-specific)
Fangrui Song [Tue, 1 Oct 2019 01:31:15 +0000 (01:31 +0000)]
[llvm-readobj/llvm-readelf] Delete --arm-attributes (alias for --arch-specific)

D68110 added --arch-specific (supported by GNU readelf) and made
--arm-attributes an alias for it. The tests were later migrated to use
--arch-specific.

Note, llvm-readelf --arch-specific currently just uses llvm-readobj
style output for ARM attributes. The readelf-style output is not
implemented.

Reviewed By: compnerd, kongyi, rupprecht

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

llvm-svn: 373291

4 years ago[X86] Add test case to show missed opportunity to shrink a constant index to a gather...
Craig Topper [Tue, 1 Oct 2019 01:27:52 +0000 (01:27 +0000)]
[X86] Add test case to show missed opportunity to shrink a constant index to a gather in order to avoid splitting.

Also add a test case for an index that could be shrunk, but
would create a narrow type. We can go ahead and do it we just
need to be before type legalization.

Similar test cases for scatter as well.

llvm-svn: 373290

4 years agoDon't elide the use of the thread wrapper for a thread_local constinit
Richard Smith [Tue, 1 Oct 2019 01:23:23 +0000 (01:23 +0000)]
Don't elide the use of the thread wrapper for a thread_local constinit
variable with non-trivial destruction.

We still need to invoke the thread wrapper to trigger registration of
the destructor call on thread shutdown.

llvm-svn: 373289

4 years agoAMDGPU/GlobalISel: Select G_UADDO/G_USUBO
Matt Arsenault [Tue, 1 Oct 2019 01:23:13 +0000 (01:23 +0000)]
AMDGPU/GlobalISel: Select G_UADDO/G_USUBO

llvm-svn: 373288

4 years agoGlobalISel: Implement widenScalar for G_SITOFP/G_UITOFP sources
Matt Arsenault [Tue, 1 Oct 2019 01:06:48 +0000 (01:06 +0000)]
GlobalISel: Implement widenScalar for G_SITOFP/G_UITOFP sources

Legalize 16-bit G_SITOFP/G_UITOFP for AMDGPU.

llvm-svn: 373287

4 years agoAMDGPU/GlobalISel: Legalize G_GLOBAL_VALUE
Matt Arsenault [Tue, 1 Oct 2019 01:06:43 +0000 (01:06 +0000)]
AMDGPU/GlobalISel: Legalize G_GLOBAL_VALUE

Handle other cases besides LDS. Mostly a straight port of the existing
handling, without the intermediate custom nodes.

llvm-svn: 373286

4 years agoFile::Clear() -> File::TakeStreamAndClear()
Lawrence D'Anna [Tue, 1 Oct 2019 01:05:02 +0000 (01:05 +0000)]
File::Clear() -> File::TakeStreamAndClear()

Summary:
File::Clear() is an ugly function.  It's only used in one place,
which is the swig typemaps for FILE*.   This patch refactors and
renames that function to make it clear what it's really for and
why nobody else should use it.

Both File::TakeStreamAndClear() and the FILE* typemaps will be
removed in later patches after a suitable replacement is in place.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 373285

4 years agocompiler-rt: use __GLIBC_PREREQ for SANITIZER_INTERCEPT_GETRANDOM
Vitaly Buka [Tue, 1 Oct 2019 00:58:29 +0000 (00:58 +0000)]
compiler-rt: use __GLIBC_PREREQ for SANITIZER_INTERCEPT_GETRANDOM

Summary: Fixes https://github.com/google/oss-fuzz/issues/2836

Reviewers: eugenis

Subscribers: dberris, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 373284

4 years agocompiler-rt: move all __GLIBC_PREREQ into own header file
Vitaly Buka [Tue, 1 Oct 2019 00:58:28 +0000 (00:58 +0000)]
compiler-rt: move all __GLIBC_PREREQ into own header file

Reviewers: eugenis

Subscribers: dberris, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 373283

4 years agoRename tsan_interceptors.cpp into tsan_interceptors_posix.cpp
Vitaly Buka [Tue, 1 Oct 2019 00:58:26 +0000 (00:58 +0000)]
Rename tsan_interceptors.cpp into tsan_interceptors_posix.cpp

Summary:
It's needed to use __GLIBC_PREREQ from <features.h>

tsan didn't let us to include <features.h> by using --sysroot=. to disable system includes on
anything that is not named as "tsan*posix*", "tsan*mac*", "tsan*linux*".
See compiler-rt/lib/tsan/CMakeLists.txt

Reviewers: eugenis, dvyukov, kcc

Reviewed By: kcc

Subscribers: mgorny, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 373282

4 years ago[c++20] Add a C++20 version of the existing turing machine test.
Richard Smith [Tue, 1 Oct 2019 00:47:41 +0000 (00:47 +0000)]
[c++20] Add a C++20 version of the existing turing machine test.

Unlike the C++11 version, this one uese mutable state and dynamic
allocation instead of a carefully balanced and ever-accumulating pile of
temporaries.

llvm-svn: 373281

4 years agoAllow the internal-state-thread free access to the TargetAPI mutex.
Jim Ingham [Tue, 1 Oct 2019 00:47:25 +0000 (00:47 +0000)]
Allow the internal-state-thread free access to the TargetAPI mutex.

It is always doing work on behalf of another thread that presumably
has the mutex, so if it is calling SB API's it should have free access
to the mutex.  This is the same decision as we made earlier with the
process RunLock.

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

llvm-svn: 373280

4 years agoDuring constant evaluation, handle CXXBindTemporaryExprs for
Richard Smith [Tue, 1 Oct 2019 00:41:16 +0000 (00:41 +0000)]
During constant evaluation, handle CXXBindTemporaryExprs for
array-of-class types, not just for class types.

llvm-svn: 373279

4 years agoDebugInfo: Add parsing support for debug_loc base address specifiers
David Blaikie [Tue, 1 Oct 2019 00:29:13 +0000 (00:29 +0000)]
DebugInfo: Add parsing support for debug_loc base address specifiers

llvm-svn: 373278

4 years ago[Docs] Document lldb-instr
Jonas Devlieghere [Tue, 1 Oct 2019 00:12:47 +0000 (00:12 +0000)]
[Docs] Document lldb-instr

This adds some information on how to instrument the API classes.

llvm-svn: 373277

4 years ago[c++20] Fix crash when constant-evaluating an assignment with a
Richard Smith [Tue, 1 Oct 2019 00:07:14 +0000 (00:07 +0000)]
[c++20] Fix crash when constant-evaluating an assignment with a
reference member access on its left-hand side.

llvm-svn: 373276

4 years agoFix Driver/modules.cpp test to work when build directory name contains '.s'
Tom Stellard [Mon, 30 Sep 2019 23:42:17 +0000 (23:42 +0000)]
Fix Driver/modules.cpp test to work when build directory name contains '.s'

Reviewers: dyung, rsmith, hansw

Subscribers: mati865, mgorny, cfe-commits

Tags: #clang

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

llvm-svn: 373275

4 years ago[SimplifyLibCalls] Define the value of the Euler number
Evandro Menezes [Mon, 30 Sep 2019 23:21:02 +0000 (23:21 +0000)]
[SimplifyLibCalls] Define the value of the Euler number

This patch fixes the build break on Windows hosts.

There must be a better way of accessing the equivalent POSIX math constant
`M_E`.

llvm-svn: 373274

4 years agoDebugInfo: Simplify section label caching/usage
David Blaikie [Mon, 30 Sep 2019 23:19:10 +0000 (23:19 +0000)]
DebugInfo: Simplify section label caching/usage

llvm-svn: 373273

4 years agoFix crash on value-dependent delete-expressions.
Richard Smith [Mon, 30 Sep 2019 22:55:27 +0000 (22:55 +0000)]
Fix crash on value-dependent delete-expressions.

We used to miscompute the 'value-dependent' bit, and would crash if we
tried to evaluate a delete expression that should be value-dependent.

llvm-svn: 373272