platform/upstream/llvm.git
6 years agoEnsure that DataTypes.h is installed now that it's moved to llvm-c
David Blaikie [Wed, 21 Mar 2018 18:21:57 +0000 (18:21 +0000)]
Ensure that DataTypes.h is installed now that it's moved to llvm-c

llvm-svn: 328130

6 years ago[llvm-mca] Move the logic that computes the register file usage to the BackendStatist...
Andrea Di Biagio [Wed, 21 Mar 2018 18:11:05 +0000 (18:11 +0000)]
[llvm-mca] Move the logic that computes the register file usage to the BackendStatistics view.

With this patch, the "instruction dispatched" event now provides information
related to the number of microarchitectural registers used in each register
file. Similarly, the "instruction retired" event is now able to tell how may
registers are freed in each register file.

Currently, the BackendStatistics view is the only consumer of register
usage/pressure information. BackendStatistics uses that info to print out a few
general statistics (i.e. max number of mappings used; total mapping created).
Before this patch, the BackendStatistics was forced to query the Backend to
obtain the register pressure information.

This helps removes that dependency. Now views are completely independent from
the Backend.  As a consequence, it should be easier to address PR36663 and
further modularize the pipeline.

Added a couple of test cases in the BtVer2 specific directory.

llvm-svn: 328129

6 years ago[SchedModel] Use CodeGenSchedClass::getSchedClassIdx helper directly. NFCI.
Simon Pilgrim [Wed, 21 Mar 2018 18:09:34 +0000 (18:09 +0000)]
[SchedModel] Use CodeGenSchedClass::getSchedClassIdx helper directly. NFCI.

llvm-svn: 328128

6 years ago[clang-tidy] Marking hicpp-no-assembler-msvc unsupported on Windows
Julie Hockett [Wed, 21 Mar 2018 18:03:41 +0000 (18:03 +0000)]
[clang-tidy] Marking hicpp-no-assembler-msvc unsupported on Windows

After changes to lit.site.cfg.in, the test is now running (and failing)
on windows, so temporarily marking it unsupported. See PR36855 for more
details.

llvm-svn: 328127

6 years ago[SchedModel] Use CodeGenSchedClass::isKeyEqual instead of duplicating code. NFCI.
Simon Pilgrim [Wed, 21 Mar 2018 17:57:21 +0000 (17:57 +0000)]
[SchedModel] Use CodeGenSchedClass::isKeyEqual instead of duplicating code. NFCI.

llvm-svn: 328126

6 years ago[libFuzzer] Disable equivalence-signals test on Darwin due to persistent failures
George Karpenkov [Wed, 21 Mar 2018 17:55:36 +0000 (17:55 +0000)]
[libFuzzer] Disable equivalence-signals test on Darwin due to persistent failures

llvm-svn: 328125

6 years ago[Docs] Remove some WIP X86 documentation I accidentally leaked into r328031.
Craig Topper [Wed, 21 Mar 2018 17:32:57 +0000 (17:32 +0000)]
[Docs] Remove some WIP X86 documentation I accidentally leaked into r328031.

I didn't mean to commit it, but I guess I failed to switch branches or stash it in my local tree.

llvm-svn: 328124

6 years agoReapply Support layering fixes.
David Blaikie [Wed, 21 Mar 2018 17:31:49 +0000 (17:31 +0000)]
Reapply Support layering fixes.

Compiler.h is used by Demangle (which Support depends on) - so sink it
into Demangle to avoid a circular dependency

DataTypes.h is used by llvm-c (which Support depends on) - so sink it
into llvm-c.

DataTypes.h could probably be fixed the other way - making llvm-c depend
on Support instead of Support depending on llvm-c - if anyone feels
that's the better option, happy to work with them on that.

I /think/ this'll address the layering issues that previous attempts to
commit this have triggered in the Modules buildbot, but I haven't been
able to reproduce that build so can't say for sure. If anyone's having
trouble with this - it might be worth taking a look to see if there's a
quick fix/something small I missed rather than revert, but no worries.

llvm-svn: 328123

6 years agoAdd missing #includes to Analysis/MustExecute.h
David Blaikie [Wed, 21 Mar 2018 17:31:45 +0000 (17:31 +0000)]
Add missing #includes to Analysis/MustExecute.h

llvm-svn: 328122

6 years ago[Documentation] Fix markup problems in X86Usage.rst
Eugene Zelenko [Wed, 21 Mar 2018 17:24:04 +0000 (17:24 +0000)]
[Documentation] Fix markup problems in X86Usage.rst

llvm-svn: 328121

6 years ago[Hexagon] Generalize DAG mutation for function calls
Krzysztof Parzyszek [Wed, 21 Mar 2018 17:23:32 +0000 (17:23 +0000)]
[Hexagon] Generalize DAG mutation for function calls

Add barrier edges to check for any physical register. The previous code
worked for the function return registers: r0/d0, v0/w0.

Patch by Brendon Cahoon.

llvm-svn: 328120

6 years ago[InstCombine] add folds for xor-of-icmp signbit tests (PR36682)
Sanjay Patel [Wed, 21 Mar 2018 17:17:13 +0000 (17:17 +0000)]
[InstCombine] add folds for xor-of-icmp signbit tests (PR36682)

This is part of solving:
https://bugs.llvm.org/show_bug.cgi?id=36682

There's also a leftover improvement from the long-ago-closed:
https://bugs.llvm.org/show_bug.cgi?id=5438

https://rise4fun.com/Alive/dC1

llvm-svn: 328119

6 years agoTableGen: Remove redundant loop in ListInit::resolveReferences
Nicolai Haehnle [Wed, 21 Mar 2018 17:13:10 +0000 (17:13 +0000)]
TableGen: Remove redundant loop in ListInit::resolveReferences

Summary:
Recursive lookups are handled by the Resolver, so the loop was purely
a waste of runtime.

Change-Id: I2bd23a68b478aea0bbac1a86ca7635adffa28688

Reviewers: arsenm, craig.topper, tra, MartinO

Subscribers: wdng, llvm-commits

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

llvm-svn: 328118

6 years agoTableGen: Streamline how defs are instantiated
Nicolai Haehnle [Wed, 21 Mar 2018 17:12:53 +0000 (17:12 +0000)]
TableGen: Streamline how defs are instantiated

Summary:
Instantiating def's and defm's needs to perform the following steps:

- for defm's, clone multiclass def prototypes and subsitute template args
- for def's and defm's, add subclass definitions, substituting template
  args
- clone the record based on foreach loops and substitute loop iteration
  variables
- override record variables based on the global 'let' stack
- resolve the record name (this should be simple, but unfortunately it's
  not due to existing .td files relying on rather silly implementation
  details)
- for def(m)s in multiclasses, add the unresolved record as a multiclass
  prototype
- for top-level def(m)s, resolve all internal variable references and add
  them to the record keeper and any active defsets

This change streamlines how we go through these steps, by having both
def's and defm's feed into a single addDef() method that handles foreach,
final resolve, and routing the record to the right place.

This happens to make foreach inside of multiclasses work, as the new
test case demonstrates. Previously, foreach inside multiclasses was not
forbidden by the parser, but it was de facto broken.

Another side effect is that the order of "instantiated from" notes in error
messages is reversed, as the modified test case shows. This is arguably
clearer, since the initial error message ends up pointing directly to
whatever triggered the error, and subsequent notes will point to increasingly
outer layers of multiclasses. This is consistent with how C++ compilers
report nested #includes and nested template instantiations.

Change-Id: Ica146d0db2bc133dd7ed88054371becf24320447

Reviewers: arsenm, craig.topper, tra, MartinO

Subscribers: wdng, llvm-commits

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

llvm-svn: 328117

6 years ago[Documentation] Fix markup problem in AMDGPUUsage.rst.
Eugene Zelenko [Wed, 21 Mar 2018 17:09:35 +0000 (17:09 +0000)]
[Documentation] Fix markup problem in AMDGPUUsage.rst.

llvm-svn: 328116

6 years ago[clang-tidy] Use :doc: for check links in Release Notes.
Eugene Zelenko [Wed, 21 Mar 2018 17:06:13 +0000 (17:06 +0000)]
[clang-tidy] Use :doc: for check links in Release Notes.

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

llvm-svn: 328115

6 years ago[Fuchsia] Don't install libc++, libc++abi or libunwind on Darwin
Petr Hosek [Wed, 21 Mar 2018 16:48:26 +0000 (16:48 +0000)]
[Fuchsia] Don't install libc++, libc++abi or libunwind on Darwin

The Clang driver doesn't currently know how to use the libraries
that are shipped as part of the toolchain so there's no reason to
ship them at all.

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

llvm-svn: 328114

6 years ago[Hexagon] Eliminate subregisters from PHI nodes before pipelining
Krzysztof Parzyszek [Wed, 21 Mar 2018 16:39:11 +0000 (16:39 +0000)]
[Hexagon] Eliminate subregisters from PHI nodes before pipelining

The pipeliner needs to remove instructions from the SlotIndexes
structure when they are deleted. Otherwise, the SlotIndexes map
has stale data, and an assert will occur when adding new
instructions.

This patch also changes the pipeliner to make the back-edge of
a loop carried dependence 1 cycle. The 1 cycle latency is added
to the anti-dependence that represents the back-edge. This
changes eliminates a couple of hacks added to the pipeliner to
handle the latency of the back-edge. It is needed to correctly
pipeline the test case for the sub-register elimination pass.

llvm-svn: 328113

6 years ago[WebAssembly] Suppress unused function warning for register name matcher
Reid Kleckner [Wed, 21 Mar 2018 16:20:58 +0000 (16:20 +0000)]
[WebAssembly] Suppress unused function warning for register name matcher

llvm-svn: 328112

6 years ago[X86][Haswell] Merge multiple InstrRW entries that map to the same SchedWriteRes...
Simon Pilgrim [Wed, 21 Mar 2018 16:19:03 +0000 (16:19 +0000)]
[X86][Haswell] Merge multiple InstrRW entries that map to the same SchedWriteRes group (NFCI) (PR35955)

I've also merged some VEX/non-VEX instregex strings with a (V?) prefix or (Y?) ymm variant - there are still a lot more of these to do.

llvm-svn: 328111

6 years ago[X86][SandyBridge] Merge more VEX/non-VEX instregex patterns (NFCI) (PR35955)
Simon Pilgrim [Wed, 21 Mar 2018 16:05:58 +0000 (16:05 +0000)]
[X86][SandyBridge] Merge more VEX/non-VEX instregex patterns (NFCI) (PR35955)

llvm-svn: 328110

6 years ago[InstCombine] move/add tests for xor-of-icmps (PR36682); NFC
Sanjay Patel [Wed, 21 Mar 2018 15:54:48 +0000 (15:54 +0000)]
[InstCombine] move/add tests for xor-of-icmps (PR36682); NFC

llvm-svn: 328109

6 years ago[Fix] fix type deduction on ARM and MSVC
Jonas Toth [Wed, 21 Mar 2018 15:50:15 +0000 (15:50 +0000)]
[Fix] fix type deduction on ARM and MSVC

llvm-svn: 328108

6 years ago[clang-tidy] Resubmit hicpp-multiway-paths-covered without breaking test
Jonas Toth [Wed, 21 Mar 2018 15:34:15 +0000 (15:34 +0000)]
[clang-tidy] Resubmit hicpp-multiway-paths-covered without breaking test

The original check did break the green buildbot in the sanitizer build.
It took a while to redroduce and understand the issue.

There occured a stackoverflow while parsing the AST. The testcase with
256 case labels was the problem because each case label added another
stackframe. It seemed that the issue occured only in 'RelWithDebInfo' builds
and not in normal sanitizer builds.

To simplify the matchers the recognition for the different kinds of switch
statements has been moved into a seperate function and will not be done with
ASTMatchers. This is an attempt to reduce recursion and stacksize as well.

The new check removed this big testcase. Covering all possible values is still
implemented for bitfields and works there. The same logic on integer types
will lead to the issue.

Running it over LLVM gives the following results:

Differential: https://reviews.llvm.org/D40737
llvm-svn: 328107

6 years agoLast batch of test-tree cleaning changes
Pavel Labath [Wed, 21 Mar 2018 15:29:32 +0000 (15:29 +0000)]
Last batch of test-tree cleaning changes

- postmortem tests: make sure the core files are created in the build
  folder
- TestSourceManager: copy the .c file into the build dir before
  modifying it
- TestLogging: create log files in the build folder

After these changes I get a clean test run (on linux) even if I set the
source tree to be read only. It's possible some of the skipped/xfailed
tests are still creating files in the source tree, but at the moment, I
don't have plans to go hunting for those.

llvm-svn: 328106

6 years ago[LangRef] add note about format of FP types
Sanjay Patel [Wed, 21 Mar 2018 15:22:09 +0000 (15:22 +0000)]
[LangRef] add note about format of FP types

llvm-svn: 328105

6 years ago[RISCV] Codegen support for RV32F floating point comparison operations
Alex Bradbury [Wed, 21 Mar 2018 15:11:02 +0000 (15:11 +0000)]
[RISCV] Codegen support for RV32F floating point comparison operations

This patch also includes extensive tests targeted at select and br+fcmp IR
inputs. A sequence of br+fcmp required support for FPR32 registers to be added
to RISCVInstrInfo::storeRegToStackSlot and
RISCVInstrInfo::loadRegFromStackSlot.

llvm-svn: 328104

6 years ago[ELF][PPC64] Fix getRelExpr for R_PPC64_REL16_LO and R_PPC64_REL16_HA
Zaara Syeda [Wed, 21 Mar 2018 15:04:04 +0000 (15:04 +0000)]
[ELF][PPC64] Fix getRelExpr for R_PPC64_REL16_LO and R_PPC64_REL16_HA

The relocations R_PPC64_REL16_LO and R_PPC64_REL16_HA should return R_PC
for getRelExpr since they compute #lo(S + A – P) and #ha(S + A – P).

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

llvm-svn: 328103

6 years ago[RISCV] Add tests missed from r327979
Alex Bradbury [Wed, 21 Mar 2018 14:50:27 +0000 (14:50 +0000)]
[RISCV] Add tests missed from r327979

llvm-svn: 328102

6 years ago[clang-tidy][modernize-make-unique] Checks c++14 flag before using std::make_unique
Alexander Kornienko [Wed, 21 Mar 2018 14:39:24 +0000 (14:39 +0000)]
[clang-tidy][modernize-make-unique] Checks c++14 flag before using std::make_unique

Summary: For a c++11 code, the clang-tidy rule "modernize-make-unique" should return immediately, as std::make_unique is not supported.

Reviewers: hokein, aaron.ballman, ilya-biryukov, alexfh

Reviewed By: hokein, aaron.ballman, alexfh

Subscribers: Quuxplusone, xazax.hun, cfe-commits

Tags: #clang-tools-extra

Patch by Frederic Tingaud!

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

llvm-svn: 328101

6 years agoMake positionToOffset return llvm::Expected<size_t>
Simon Marchi [Wed, 21 Mar 2018 14:36:46 +0000 (14:36 +0000)]
Make positionToOffset return llvm::Expected<size_t>

Summary:

To implement incremental document syncing, we want to verify that the
ranges provided by the front-end are valid.  Currently, positionToOffset
deals with invalid Positions by returning 0 or Code.size(), which are
two valid offsets.  Instead, return an llvm:Expected<size_t> with an
error if the position is invalid.

According to the LSP, if the character value exceeds the number of
characters of the given line, it should default back to the end of the
line.  It makes sense in some contexts to have this behavior, and does
not in other contexts.  The AllowColumnsBeyondLineLength parameter
allows to decide what to do in that case, default back to the end of the
line, or return an error.

Reviewers: ilya-biryukov

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

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

llvm-svn: 328100

6 years agoChange DT_* value definitions to macros in a separate file
Alexander Richardson [Wed, 21 Mar 2018 14:17:50 +0000 (14:17 +0000)]
Change DT_* value definitions to macros in a separate file

Summary:
I recently added a new dynamic tag to our fork of LLVM and when adding it
to llvm-readobj I noticed that not all DT_ values were being handled there.

Using macros in a .def file that can be included by both ELFDumper.cpp and
the ELF.h header ensures that the two don't get out of sync when new values
are added.

Reviewers: grimar, pcc, davide, espindola

Reviewed By: grimar, espindola

Subscribers: srhines, llvm-commits

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

llvm-svn: 328099

6 years ago[LangRef] more hyphens: always write "floating-point"
Sanjay Patel [Wed, 21 Mar 2018 14:15:33 +0000 (14:15 +0000)]
[LangRef] more hyphens: always write "floating-point"

We were inconsistent, sometimes even within a single sentence.
The consensus seems clear that the FP we're looking for is
spelled "floating-point". Without the hyphen, it's a
"surprisingly fine" jazz album.

llvm-svn: 328098

6 years ago[MemCpyOpt] Update to new API for memory intrinsic alignment
Daniel Neilson [Wed, 21 Mar 2018 14:14:55 +0000 (14:14 +0000)]
[MemCpyOpt] Update to new API for memory intrinsic alignment

Summary:
This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes the
MemCpyOpt pass to cease using:
1) The old getAlignment() API of MemoryIntrinsic in favour of getting source & dest specific
alignments through the new API.
2) The old IRBuilder CreateMemCpy/CreateMemMove single-alignment APIs in favour of the new
API that allows setting source and destination alignments independently.

We also add a few tests to fill gaps in the testing of this pass.

Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead. ( rL323886, rL323891, rL324148, rL324273, rL324278,
rL324384, rL324395, rL324402, rL324626, rL324642, rL324653, rL324654, rL324773, rL324774,
rL324781, rL324784, rL324955, rL324960, rL325816, rL327398, rL327421 )
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.

Reference
   http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
   http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html

llvm-svn: 328097

6 years agoRe-re-land: Teach CorrelatedValuePropagation to reduce the width of udiv/urem instruc...
Justin Lebar [Wed, 21 Mar 2018 14:08:21 +0000 (14:08 +0000)]
Re-re-land: Teach CorrelatedValuePropagation to reduce the width of udiv/urem instructions.

Summary:
If the operands of a udiv/urem can be proved to fit within a smaller
power-of-two-sized type, reduce the width of the udiv/urem.

Backed out for causing performance regressions.  Re-landing
because we've determined that these regressions were noise.

Original Differential Revision: https://reviews.llvm.org/D44102

llvm-svn: 328096

6 years agoRevert "Move DataTypes.h from Support to llvm-c to fix layering."
Jonas Devlieghere [Wed, 21 Mar 2018 13:28:37 +0000 (13:28 +0000)]
Revert "Move DataTypes.h from Support to llvm-c to fix layering."

This reverts r328065.

I missed this one in r328085 and the bots were still failing.

llvm-svn: 328095

6 years ago[llvm-mca] Clean up some code. NFC
Andrea Di Biagio [Wed, 21 Mar 2018 12:49:07 +0000 (12:49 +0000)]
[llvm-mca] Clean up some code. NFC

Removed a couple of methods from DispatchUnit.

llvm-svn: 328094

6 years agoFix build broken by r328090
Pavel Labath [Wed, 21 Mar 2018 12:18:03 +0000 (12:18 +0000)]
Fix build broken by r328090

- constexpr is needed for out-of-class definition of the Type static
  member by some compilers
- MSVC is confused by the initialization of the static constexpr char[]
  member when it happens in a template specialization. Explicitly
  specifying the length of the array seems to be enough to help it
  figure things out.

llvm-svn: 328093

6 years agoclang-interpreter example cmake fix
Luke Cheeseman [Wed, 21 Mar 2018 12:05:19 +0000 (12:05 +0000)]
clang-interpreter example cmake fix

Add in a space when appending the export to the linker options. Without
the space the export is appended onto whatever the last link option
was, which might be a file.

llvm-svn: 328092

6 years ago[PowerPC] Disable failing dynamic tls test cases
Nemanja Ivanovic [Wed, 21 Mar 2018 11:58:37 +0000 (11:58 +0000)]
[PowerPC] Disable failing dynamic tls test cases

Due to recent kernel upgrades, these test case fail on PowerPC buildbots.
This is a known problem on affected kernels.

llvm-svn: 328091

6 years ago[dwarf] Unify unknown dwarf enum formatting code
Pavel Labath [Wed, 21 Mar 2018 11:46:37 +0000 (11:46 +0000)]
[dwarf] Unify unknown dwarf enum formatting code

Summary:
We have had at least three pieces of code (in DWARFAbbreviationDeclaration,
DWARFAcceleratorTable and DWARFDie) that have hand-rolled support for
dumping unknown dwarf enum values. While not terrible, they are a bit
distracting and enable small differences to creep in (Unknown_ffff vs.
Unknown_0xffff). I ended up needing to add a fourth place
(DWARFVerifier), so it seems it would be a good time to centralize.

This patch creates an alternative to the XXXString dumping functions in
the BinaryFormat library, which formats an unknown value as
DW_TYPE_unknown_1234, instead of just an empty string. It is based on
the formatv function, as that allows us to avoid materializing the
string for unknown values (and because this way I don't have to invent a
name for the new functions :P).

In this patch I add formatters for dwarf attributes, forms, tags, and
index attributes as these are the ones in use currently, but adding
other enums is straight-forward.

Reviewers: dblaikie, JDevlieghere, aprantl

Subscribers: llvm-commits

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

llvm-svn: 328090

6 years ago[dotest] Use subprocess.call to forward arguments in wrapper
Jonas Devlieghere [Wed, 21 Mar 2018 11:13:56 +0000 (11:13 +0000)]
[dotest] Use subprocess.call to forward arguments in wrapper

As suggested by Pavel on lldb-commits. Originally I picked os.system
because it was so much more simple than the subprocess module, but that
no longer holds true after yesterday's hack in r328020. This is what it
should've been in the first place.

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

llvm-svn: 328089

6 years agoFix crash exposed by r328025
Pavel Labath [Wed, 21 Mar 2018 11:10:57 +0000 (11:10 +0000)]
Fix crash exposed by r328025

The issue was that the ASTDumper was being passed a null pointer
(because we did not create any declaration for the operator==).  The
crash was in logging code, so it only manifested it self if you ran the
tests with logging enabled (like our bots do).

Given that this is logging code and the rest of the debugger is fine
with the declaration being null, I just make sure the logging code can
handle it as well. Right now I just do the null check in
ClangExpressionDeclMap, but if the ASTDumper class is meant to be a
debugging/logging aid, then it might be a good idea move the check
inside the class itself.

llvm-svn: 328088

6 years ago[ASTMatchers] Remove extra qualifier for consistency (LibASTMatchersReference.html)
Clement Courbet [Wed, 21 Mar 2018 10:54:29 +0000 (10:54 +0000)]
[ASTMatchers] Remove extra qualifier for consistency (LibASTMatchersReference.html)

+ Regenerate doc.

llvm-svn: 328087

6 years ago[ASTMatchers] Regenerate doc.
Clement Courbet [Wed, 21 Mar 2018 10:48:00 +0000 (10:48 +0000)]
[ASTMatchers] Regenerate doc.

llvm-svn: 328086

6 years agoRevert layering changes
Jonas Devlieghere [Wed, 21 Mar 2018 10:35:09 +0000 (10:35 +0000)]
Revert layering changes

This reverts:
  r328072 "Move Compiler.h from Support to Demangler to fix layering."
  r328073 "Fix the actual user of DataTypes.h in llvm-c to avoid the circular dependency"

Failing bots:
  http://green.lab.llvm.org/green/job/clang-stage2-coverage-R/
  http://green.lab.llvm.org/green/job/clang-stage2-configure-Rlto/

llvm-svn: 328085

6 years ago[SelectionDAG] Support multiple dangling debug info for one value
Bjorn Pettersson [Wed, 21 Mar 2018 09:44:34 +0000 (09:44 +0000)]
[SelectionDAG] Support multiple dangling debug info for one value

Summary:
When building the selection DAG we sometimes need to postpone
the handling of a dbg.value until the value it should refer to
is created. This is done by using the DanglingDebugInfoMap.
In the past this map has been limited to hold one dangling
dbg.value per value. This patch removes that restriction.

Reviewers: aprantl, rnk, probinson, vsk

Reviewed By: aprantl

Subscribers: Ka-Ka, llvm-commits, JDevlieghere

Tags: #debug-info

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

llvm-svn: 328084

6 years agoFix TestOperatorOverload for 32-bit builds
Pavel Labath [Wed, 21 Mar 2018 09:43:50 +0000 (09:43 +0000)]
Fix TestOperatorOverload for 32-bit builds

- use more goodies from Makefile.rules to correctly build a 32-bit
binary.
- avoid hardcoding typeof(nil) in the test.

This should partially fix the linux bot. There is still one assertion
failure remaining, which I'll have to investigate separately, as I am
not experiencing it locally.

llvm-svn: 328083

6 years agotsan: fix darwin build after 328079
Dmitry Vyukov [Wed, 21 Mar 2018 09:26:29 +0000 (09:26 +0000)]
tsan: fix darwin build after 328079

328079 introduced a weak hook without default implementation.
This broke darwin build:
http://green.lab.llvm.org/green//job/clang-stage1-configure-RA/43731/consoleFull#-119213188149ba4694-19c4-4d7e-bec5-911270d8a58c

Provide default impl for the hook.

llvm-svn: 328082

6 years ago[ELF] - Teach LLD to hint about -fdebug-types-section.
George Rimar [Wed, 21 Mar 2018 09:19:34 +0000 (09:19 +0000)]
[ELF] - Teach LLD to hint about -fdebug-types-section.

Patch teaches LLD to hint user about -fdebug-types-section flag
if relocation overflow happens in debug section.

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

llvm-svn: 328081

6 years agoFix build bot after r328078 "llvm-readobj] - Teach llvm-readobj to dump .note.gnu...
George Rimar [Wed, 21 Mar 2018 08:48:44 +0000 (08:48 +0000)]
Fix build bot after r328078 "llvm-readobj] - Teach llvm-readobj to dump .note.gnu.property sections."

BB was: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/27058/steps/test/logs/stdio

llvm-svn: 328080

6 years agotsan: support inlined frames in external symbolization
Dmitry Vyukov [Wed, 21 Mar 2018 08:44:14 +0000 (08:44 +0000)]
tsan: support inlined frames in external symbolization

New API passes a callback function to the external symbolizer,
allowing it to add multiple frames to the traceback. Note that
the old interface API will be still supported until the clients
migrate to the new one.

Author: asmundak (Alexander Smundak)
Reviewed in: https://reviews.llvm.org/D44714

llvm-svn: 328079

6 years ago[llvm-readobj] - Teach llvm-readobj to dump .note.gnu.property sections.
George Rimar [Wed, 21 Mar 2018 08:34:55 +0000 (08:34 +0000)]
[llvm-readobj] - Teach llvm-readobj to dump .note.gnu.property sections.

NT_GNU_PROPERTY_TYPE_0 is a recently added type of .note.gnu.property
section specified in Linux Extensions to gABI.
(https://github.com/hjl-tools/linux-abi/wiki/Linux-Extensions-to-gABI)

Patch teach tool to print such notes properly.

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

llvm-svn: 328078

6 years agoFix declaration of environ after r327923
Vitaly Buka [Wed, 21 Mar 2018 07:50:02 +0000 (07:50 +0000)]
Fix declaration of environ after r327923

llvm-svn: 328077

6 years ago[X86][Broadwell] Merge multiple InstrRW entries that map to the same SchedWriteRes...
Craig Topper [Wed, 21 Mar 2018 06:28:42 +0000 (06:28 +0000)]
[X86][Broadwell] Merge multiple InstrRW entries that map to the same SchedWriteRes group (NFCI) (PR35955)

llvm-svn: 328076

6 years ago[TableGen] Remove a defaulted function argument that is never called with another...
Craig Topper [Wed, 21 Mar 2018 05:13:04 +0000 (05:13 +0000)]
[TableGen] Remove a defaulted function argument that is never called with another value. NFC

llvm-svn: 328075

6 years ago[TableGen] Move a function from llvm namespace and make it a static function. NFC
Craig Topper [Wed, 21 Mar 2018 05:13:01 +0000 (05:13 +0000)]
[TableGen] Move a function from llvm namespace and make it a static function. NFC

It's only called from one place and is defined just above that use.

llvm-svn: 328074

6 years agoFix the actual user of DataTypes.h in llvm-c to avoid the circular dependency
David Blaikie [Wed, 21 Mar 2018 04:07:07 +0000 (04:07 +0000)]
Fix the actual user of DataTypes.h in llvm-c to avoid the circular dependency

(follow-up to r328065)

llvm-svn: 328073

6 years agoMove Compiler.h from Support to Demangler to fix layering.
David Blaikie [Wed, 21 Mar 2018 04:07:05 +0000 (04:07 +0000)]
Move Compiler.h from Support to Demangler to fix layering.

Support depends on Demangle (Support/Unix/Signals.inc), so Demangle
including Support/Compiler.h created a circular dependency.

Leave a forwarding shim of Compiler.h because it makes more sense for
users (a deeper fix might involve splitting Support into lower and upper
Support - but that also sounds a bit weird/awkward) than thinking about
the dependency on the Demangler.

llvm-svn: 328072

6 years ago[X86] Fix the SchedRW for XOP vpcom register form instructions to not be marked as...
Craig Topper [Wed, 21 Mar 2018 03:41:33 +0000 (03:41 +0000)]
[X86] Fix the SchedRW for XOP vpcom register form instructions to not be marked as loads.

llvm-svn: 328071

6 years ago[TableGen] Use SmallMapVector to simplify some code that was trying to keep a vector...
Craig Topper [Wed, 21 Mar 2018 02:48:34 +0000 (02:48 +0000)]
[TableGen] Use SmallMapVector to simplify some code that was trying to keep a vector unique

Summary:
This code previously had a SmallVector of std::pairs containing an unsigned and another SmallVector. The outer vector was using the unsigned effectively as a key to decide which SmallVector to add into. So each time something new needed to be added the out vector needed to be scanned. If it wasn't found a new entry needed to be added to be added. This sounds very much like a map, but the next loop iterates over the outer vector to get a deterministic order.

We can simplify this code greatly if use SmallMapVector instead. This uses more stack space since we now have a vector and a map, but the searching and creating new entries all happens behind the scenes. It should also make the search more efficient though usually there are only a few entries so that doesn't matter much.

We could probably get determinism by just using std::map which would iterate over the unsigned key, but that would generate different output from what we get with the current implementation.

Reviewers: RKSimon, dblaikie

Reviewed By: dblaikie

Subscribers: llvm-commits

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

llvm-svn: 328070

6 years agoRevert "[lit] Adding config initialization to lit tests in clang-tools-extra"
Petr Hosek [Wed, 21 Mar 2018 02:28:22 +0000 (02:28 +0000)]
Revert "[lit] Adding config initialization to lit tests in clang-tools-extra"

This reverts commit r328060 because a test that was inteded to run on
Windows but never ran before due to the missing config initialization
is now being executed and is failing.

llvm-svn: 328069

6 years agoSet dso_local on runtime variables.
Rafael Espindola [Wed, 21 Mar 2018 01:30:16 +0000 (01:30 +0000)]
Set dso_local on runtime variables.

llvm-svn: 328068

6 years agoRevert r326782 "[analyzer] CStringChecker.cpp: Remove the duplicated check...".
Artem Dergachev [Wed, 21 Mar 2018 00:57:37 +0000 (00:57 +0000)]
Revert r326782 "[analyzer] CStringChecker.cpp: Remove the duplicated check...".

It seems that the refactoring was causing a functional change and some warnings
have disappeared.

llvm-svn: 328067

6 years ago[analyzer] Suppress more MallocChecker positives in smart pointer destructors.
Artem Dergachev [Wed, 21 Mar 2018 00:49:47 +0000 (00:49 +0000)]
[analyzer] Suppress more MallocChecker positives in smart pointer destructors.

r326249 wasn't quite enough because we often run out of inlining stack depth
limit and for that reason fail to see the atomics we're looking for.

Add a more straightforward false positive suppression that is based on the name
of the class. I.e. if we're releasing a pointer in a destructor of a "something
shared/intrusive/reference/counting something ptr/pointer something", then any
use-after-free or double-free that occurs later would likely be a false
positive.

rdar://problem/38013606

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

llvm-svn: 328066

6 years agoMove DataTypes.h from Support to llvm-c to fix layering.
David Blaikie [Wed, 21 Mar 2018 00:48:05 +0000 (00:48 +0000)]
Move DataTypes.h from Support to llvm-c to fix layering.

Support depends on llvm-c (a few typedefs, macros, etc - Types.h,
Disassembler.h, and TargetMachine.h.

This could be done the other way - those macros/typedefs/etc could be
moved into Support and used from llvm-c instead. If someone feels that's
a better direction to go, happy to discuss it/try it out/etc.

llvm-svn: 328065

6 years agoImplement LWG3034: P0767R1 breaks previously-standard-layout types
Marshall Clow [Wed, 21 Mar 2018 00:36:05 +0000 (00:36 +0000)]
Implement LWG3034: P0767R1 breaks previously-standard-layout types

llvm-svn: 328064

6 years ago[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Wed, 21 Mar 2018 00:14:43 +0000 (00:14 +0000)]
[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 328063

6 years ago[Testsuite] Modernize this test to be run out-of-tree.
Davide Italiano [Tue, 20 Mar 2018 23:47:47 +0000 (23:47 +0000)]
[Testsuite] Modernize this test to be run out-of-tree.

New tests should run the make syntax voodoo $@ and $<
instead of hardcoding the names. We should also document
how to write one, it's on my list.

llvm-svn: 328062

6 years ago[X86] Change PMULLD to 10 cycles on Skylake per Agner's tables and llvm-exegesis.
Craig Topper [Tue, 20 Mar 2018 23:39:48 +0000 (23:39 +0000)]
[X86] Change PMULLD to 10 cycles on Skylake per Agner's tables and llvm-exegesis.

Also restrict to port 0 and 1 for SkylakeClient. It looks like the scheduler models don't account for client not having a full vector ALU on port 5 like server.

Fixes PR36808.

llvm-svn: 328061

6 years ago[lit] Adding config initialization to lit tests in clang-tools-extra
Julie Hockett [Tue, 20 Mar 2018 23:22:50 +0000 (23:22 +0000)]
[lit] Adding config initialization to lit tests in clang-tools-extra

Adding the config initialization to clang-tools-extra so that tests that
use REQUIRES, UNSUPPORTED, and XFAIL based on platform or target triple
work properly.

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

llvm-svn: 328060

6 years agoImplement LWG3035: std::allocator's constructors should be constexpr.
Marshall Clow [Tue, 20 Mar 2018 23:02:53 +0000 (23:02 +0000)]
Implement LWG3035: std::allocator's constructors should be constexpr.

llvm-svn: 328059

6 years ago[MustExecute] Shwo the effect of using full loop info variant
Philip Reames [Tue, 20 Mar 2018 23:00:54 +0000 (23:00 +0000)]
[MustExecute] Shwo the effect of using full loop info variant

Most basic possible test for the logic used by LICM.

Also contains a speculative build fix for compiles which complain about a definition of a stuct K; followed by a declaration as class K;

llvm-svn: 328058

6 years ago[WebAssembly] Update torture compile test expectations
Derek Schuff [Tue, 20 Mar 2018 23:00:13 +0000 (23:00 +0000)]
[WebAssembly] Update torture compile test expectations

The tests compile after r328049

llvm-svn: 328057

6 years ago[MustExecute] Add simplest possible test for LoopSafetyOnfo
Philip Reames [Tue, 20 Mar 2018 22:55:20 +0000 (22:55 +0000)]
[MustExecute] Add simplest possible test for LoopSafetyOnfo

(Currently showing without, will enable and check in diff to show impact)

llvm-svn: 328056

6 years ago[MustExecute] Move isGuaranteedToExecute and related rourtines to Analysis
Philip Reames [Tue, 20 Mar 2018 22:45:23 +0000 (22:45 +0000)]
[MustExecute] Move isGuaranteedToExecute and related rourtines to Analysis

Next step is to actually merge the implementations and get both implementations tested through the new printer.

llvm-svn: 328055

6 years agoImplement LWG 3039 and 3041 - 'Treating Unnecessary decay'.
Marshall Clow [Tue, 20 Mar 2018 22:37:37 +0000 (22:37 +0000)]
Implement LWG 3039 and 3041 - 'Treating Unnecessary decay'.

llvm-svn: 328054

6 years ago[Modules] Honor -fmodule-name when handling private framework modules
Bruno Cardoso Lopes [Tue, 20 Mar 2018 22:36:39 +0000 (22:36 +0000)]
[Modules] Honor -fmodule-name when handling private framework modules

When skipping building the module for a private framework module,
LangOpts.CurrentModule isn't enough for implict modules builds; for
instance, in case a private module is built while building a public one,
LangOpts.CurrentModule doesn't reflect the -fmodule-name being passed
down, but instead the module name which triggered the build.

Store the actual -fmodule-name in LangOpts.ModuleName and actually
check a name was provided during compiler invocation in order to
skip building the private module.

rdar://problem/38434694

llvm-svn: 328053

6 years ago[SchedModel] Simplify InstRegexOp::apply. NFCI.
Simon Pilgrim [Tue, 20 Mar 2018 22:20:28 +0000 (22:20 +0000)]
[SchedModel] Simplify InstRegexOp::apply. NFCI.

As discussed on D44687, there was no need for 2 separate for loops for collecting the Regex and then matching against instructions.

llvm-svn: 328052

6 years agoChange ImplicitConverionKind comments to refer to C++ stable names[NFC]
Erich Keane [Tue, 20 Mar 2018 22:05:01 +0000 (22:05 +0000)]
Change ImplicitConverionKind comments to refer to C++ stable names[NFC]

llvm-svn: 328051

6 years agoDelete BuiltinCC. NFC.
Rafael Espindola [Tue, 20 Mar 2018 22:02:57 +0000 (22:02 +0000)]
Delete BuiltinCC. NFC.

It is always identical to RuntimeCC.

llvm-svn: 328050

6 years ago[WebAssembly] Strip threadlocal attribute from globals in single thread mode
Derek Schuff [Tue, 20 Mar 2018 22:01:32 +0000 (22:01 +0000)]
[WebAssembly] Strip threadlocal attribute from globals in single thread mode

The default thread model for wasm is single, and in this mode thread-local
global variables can be lowered identically to non-thread-local variables.

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

llvm-svn: 328049

6 years agoAdd CHECKs for a few declarations. NFC.
Rafael Espindola [Tue, 20 Mar 2018 21:54:14 +0000 (21:54 +0000)]
Add CHECKs for a few declarations. NFC.

We were just missing test coverage for this.

llvm-svn: 328048

6 years ago[format] Eliminate global destructors.
Benjamin Kramer [Tue, 20 Mar 2018 21:52:19 +0000 (21:52 +0000)]
[format] Eliminate global destructors.

llvm-svn: 328047

6 years agoRead OMP_TARGET_OFFLOAD and provide API to access ICV
Jonathan Peyton [Tue, 20 Mar 2018 21:18:17 +0000 (21:18 +0000)]
Read OMP_TARGET_OFFLOAD and provide API to access ICV

Added settings code to read OMP_TARGET_OFFLOAD environment variable. Added
target-offload-var ICV as __kmp_target_offload, set via OMP_TARGET_OFFLOAD,
if available, otherwise defaulting to DEFAULT. Valid values for the ICV are
specified as enum values {0,1,2} for disabled, default, and mandatory. An
internal API access function __kmpc_get_target_offload is provided.

Patch by Terry Wilmarth

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

llvm-svn: 328046

6 years ago[X86] Drop unnecessary InstRW overrides for WriteFMA
Simon Pilgrim [Tue, 20 Mar 2018 21:15:23 +0000 (21:15 +0000)]
[X86] Drop unnecessary InstRW overrides for WriteFMA

As noticed on D44687, these already match the WriteFMA def so can be removed.

llvm-svn: 328045

6 years ago[Driver] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Tue, 20 Mar 2018 21:08:59 +0000 (21:08 +0000)]
[Driver] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 328044

6 years ago[ReachingDefAnalysis] Fix what I assume to be a typo ReachingDedDefaultVal->ReachingD...
Craig Topper [Tue, 20 Mar 2018 20:53:21 +0000 (20:53 +0000)]
[ReachingDefAnalysis] Fix what I assume to be a typo ReachingDedDefaultVal->ReachingDefDefaultVal.

Unless Ded has some many I don't know about.

llvm-svn: 328043

6 years ago[ObjCARC] Add funclet token to ARC marker
Shoaib Meenai [Tue, 20 Mar 2018 20:45:41 +0000 (20:45 +0000)]
[ObjCARC] Add funclet token to ARC marker

The inline assembly generated for the ARC autorelease elision marker
must have a funclet token if it's emitted inside a funclet, otherwise
the inline assembly (and all subsequent code in the funclet) will be
marked unreachable by WinEHPrepare.

Note that this only applies for the non-O0 case, since at O0, clang
emits the autorelease elision marker itself rather than deferring to the
backend. The fix for clang is handled in a separate change.

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

llvm-svn: 328042

6 years ago[format] Initialize regex lazily
Benjamin Kramer [Tue, 20 Mar 2018 20:43:12 +0000 (20:43 +0000)]
[format] Initialize regex lazily

No need to pay for this on program startup, and also no need to destroy
it on process end.

llvm-svn: 328041

6 years agoSet dso_local on string literals.
Rafael Espindola [Tue, 20 Mar 2018 20:42:55 +0000 (20:42 +0000)]
Set dso_local on string literals.

llvm-svn: 328040

6 years ago[X86] Don't use the MSVC stack protector names on mingw
Martin Storsjo [Tue, 20 Mar 2018 20:37:51 +0000 (20:37 +0000)]
[X86] Don't use the MSVC stack protector names on mingw

Mingw uses the same stack protector functions as GCC provides
on other platforms as well.

Patch by Valentin Churavy!

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

llvm-svn: 328039

6 years ago[AArch64] Add vmulxh_lane fp16 vector intrinsic
Abderrazek Zaafrani [Tue, 20 Mar 2018 20:37:31 +0000 (20:37 +0000)]
[AArch64] Add vmulxh_lane fp16 vector intrinsic

https://reviews.llvm.org/D44591

llvm-svn: 328038

6 years agoFor llvm-objdump and Mach-O files, fix the printing of module init and
Kevin Enderby [Tue, 20 Mar 2018 20:29:52 +0000 (20:29 +0000)]
For llvm-objdump and Mach-O files, fix the printing of module init and
term sections from .o files to look to see if the pointers have a relocation
entry and if so print the symbol name from the relocation entry.  If not fall
back to the existing code and use the pointer value to look up that value
in the symbol table.

rdar://38337506

llvm-svn: 328037

6 years agoSet dso_local for runtime function.
Rafael Espindola [Tue, 20 Mar 2018 20:27:30 +0000 (20:27 +0000)]
Set dso_local for runtime function.

This is another case where there is special logic for adding dllimport
and so we cannot use setGVProperties.

llvm-svn: 328036

6 years ago[AArch64] Add vmulxh_lane fp16 vector intrinsic
Abderrazek Zaafrani [Tue, 20 Mar 2018 20:25:40 +0000 (20:25 +0000)]
[AArch64] Add vmulxh_lane fp16 vector intrinsic

https://reviews.llvm.org/D44591

llvm-svn: 328035

6 years ago[TableGen] Use range based for loop. NFC
Craig Topper [Tue, 20 Mar 2018 20:24:16 +0000 (20:24 +0000)]
[TableGen] Use range based for loop. NFC

llvm-svn: 328034

6 years ago[TableGen] Use vector::append instead of looping and calling push_back. NFC
Craig Topper [Tue, 20 Mar 2018 20:24:14 +0000 (20:24 +0000)]
[TableGen] Use vector::append instead of looping and calling push_back. NFC

Both vectors contain unsigned so we can just use append to do the copying. Not only is this shorter, but it should be able to predict the final size and only grow the vector once if needed.

llvm-svn: 328033

6 years ago[TableGen] Use llvm::transform to simplify some loops. NFCI
Craig Topper [Tue, 20 Mar 2018 20:24:12 +0000 (20:24 +0000)]
[TableGen] Use llvm::transform to simplify some loops. NFCI

llvm-svn: 328032

6 years ago[TableGen] Pass result of std::unique to vector::erase instead of calculating a size...
Craig Topper [Tue, 20 Mar 2018 20:24:10 +0000 (20:24 +0000)]
[TableGen] Pass result of std::unique to vector::erase instead of calculating a size and calling resize.

llvm-svn: 328031