Commit Graph

289262 Commits

Author SHA1 Message Date
Vitaly Buka d3e55bf7fc [sanitizer] Cleanup sorting functions
llvm-svn: 331915
2018-05-09 20:42:11 +00:00
Stella Stamenova 42ba76c9f6 [cmake, unittests] Fix the CMake file for the LLDB unittests to support multiple configurations
Summary: The current setup for the unit tests only works correctly when the generator does not support multiple configurations. When the generator supports multiple configurations, the inputs are not copied to the correct per-configuration directory. This change sets up the build to copy the inputs in each configuration directory.

Reviewers: labath, asmith, zturner

Reviewed By: labath

Subscribers: mgorny, llvm-commits

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

llvm-svn: 331914
2018-05-09 19:58:51 +00:00
Simon Pilgrim ca7981ac98 [X86] Fix Broadwell's Shuffle256 schedule classes load latency values.
Allows us to remove some unnecessary InstRW overrides.

llvm-svn: 331913
2018-05-09 19:27:48 +00:00
Martin Storsjo 5c84d442f5 [COFF] Fix dangling StringRefs from SVN 331900
llvm-svn: 331912
2018-05-09 19:07:10 +00:00
Simon Pilgrim d5d4cdb49d [X86] Merge instregex patterns to reduce InstrRW compile time.
llvm-svn: 331911
2018-05-09 19:04:15 +00:00
David Bolvansky b89605db01 Allow copy elision in path concatenation
Summary:
Just port of libstdc++'s fix to libc++ fs: e6ac4004fe

Author of fix: Jonathan Wakely

Reviewers: EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: smeenai, christof, cfe-commits, llvm-commits

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

llvm-svn: 331910
2018-05-09 18:57:17 +00:00
Matt Arsenault 762d498808 AMDGPU: Add combine for trunc of bitcast from build_vector
If the truncate is only accessing the first element of the vector,
we can use the original source value.

This helps with some combine ordering issues after operations are
lowered to integer operations between bitcasts of build_vector.
In particular it stops unnecessarily materializing the unused
top half of a vector in some cases.

llvm-svn: 331909
2018-05-09 18:37:39 +00:00
Kostya Serebryany 73634e4037 [dfsan] add one more sanitizer-coverage hook to the whitelist
llvm-svn: 331908
2018-05-09 18:35:09 +00:00
Krzysztof Parzyszek 5093945e5c [Hexagon] Check the end of the correct container (fix typo)
llvm-svn: 331907
2018-05-09 18:33:59 +00:00
Matt Arsenault 378f86998c AMDGPU: Stop special casing constant indexes of extract_vector_elt
The same result folds out of the dynamic expansion logic if the
index is constant.

llvm-svn: 331906
2018-05-09 18:29:26 +00:00
Julie Hockett 4e548fe06f [tools] Updating PPCallbacks::InclusionDirective calls
[revision] added SrcMgr::CharacteristicKind to the InclusionDirective
callback, this revision updates instances of it in clang-tools-extra.

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

llvm-svn: 331905
2018-05-09 18:27:37 +00:00
Julie Hockett 36d94ab8f0 [clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective
Adding a SrcMgr::CharacteristicKind parameter to the InclusionDirective
in PPCallbacks, and updating calls to that function. This will be useful
in https://reviews.llvm.org/D43778 to determine which includes are system
headers.

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

llvm-svn: 331904
2018-05-09 18:27:33 +00:00
Martin Storsjo 518b6c9882 [llvm-rc] Handle C preprocessor output
When preprocessing resource scripts (which can easily be done outside
of llvm-rc), included headers can leave behind C declarations (despite
preprocessing with -DRC_INVOKED), that can't be parsed by a resource
compiler.

This is handled in all of rc.exe, by parsing the preprocessor output
line markers and ignoring content from files named *.h and *.c,
documented at [1].

In addition to this filtering, strip out any other preprocessor directive
that is left behind (like pragmas) which also can't be handled by the
tokenizer.

The added test uses both standard #line markers (supported by rc.exe) and
GNU style extended line markers, thus this test doesn't pass with rc.exe,
but passes with GNU windres. (Windres on the other hand doesn't filter
out files named *.c, only *.h.)

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

[1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa381033(v=vs.85).aspx

llvm-svn: 331903
2018-05-09 18:21:03 +00:00
Martin Storsjo 7bc3c5822e [llvm-rc] Add support for the RCDATA resource type
This is the same as any other user defined resource, but with
a specific allocated resource type number.

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

llvm-svn: 331902
2018-05-09 18:20:56 +00:00
Martin Storsjo c1a67857ba [llvm-rc] Allow -1 for control IDs in old style dialogs with 16 bit fields
-1 is commonly used as ID for controls that one don't want to
refer to later. For DIALOG resources, the IDs are 16 bit numbers,
and -1 gets interpreted as UINT32_MAX earlier, which then later is
too large to write into a uint16_t.

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

llvm-svn: 331901
2018-05-09 18:20:49 +00:00
Martin Storsjo 0ca06f7950 [COFF] Allow specifying export forwarding in a def file
Previously this was only supported when specified on the command line
or in directives.

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

llvm-svn: 331900
2018-05-09 18:19:41 +00:00
Alexey Bataev c15ea70b1f [OPENMP] Generate unique names for offloading regions id.
It is required to emit unique names for offloading regions ids. Required
to support compilation and linking of several compilation units.

llvm-svn: 331899
2018-05-09 18:02:37 +00:00
Roman Tereshin d5fa9fde58 Reapplying r331819 [GlobalISel][Legalizer] More concise and faster widenScalar, NFC
The commit was a suspect for clang-cmake-aarch64-global-isel and
    clang-cmake-aarch64-quick bot failures, proved to be innocent.

llvm-svn: 331898
2018-05-09 17:28:18 +00:00
David Blaikie 1ca61f6e1d llvm-mca: Add missing includes
Move the header include in the primary source file to the top to
validate that it doesn't depend on any other inclusions.

llvm-svn: 331897
2018-05-09 17:28:10 +00:00
Craig Topper 176ec8506f [DAGCombiner] In visitBITCAST when trying to constant fold the bitcast, only call getBitcast if its an fp->int or int->fp conversion even when before legalize ops.
Previously if !LegalOperations we would blindly call getBitcast and hope that getNode would constant fold it. But if the conversion is between a vector and a scalar, getNode has no simplification.

This means we would just get back the original N. We would then return that N which would make the caller of visitBITCAST think that we used CombineTo and did our own worklist management. This prevents target specific optimizations from being called for vector/scalar bitcasts until after legal operations.

llvm-svn: 331896
2018-05-09 17:14:27 +00:00
Yaxun Liu 3cab24aa4f [OpenCL] Fix typos in emitted enqueue kernel function names
Two typos: 
vaarg => vararg
get_kernel_preferred_work_group_multiple => get_kernel_preferred_work_group_size_multiple

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

llvm-svn: 331895
2018-05-09 17:07:06 +00:00
Matt Morehouse 0a4d213176 [libFuzzer] Disable print-func.test on Darwin.
The try-lock guard change seems to be making this test fail on Mac, but
I haven't been able to reproduce the failure.  Disabling the test on Mac
to fix build bot.

llvm-svn: 331894
2018-05-09 17:05:07 +00:00
Craig Topper 455564460a [X86] Only enable the __ud2 and __int2c builtins if intrin.h has been included.
Differential Revision: https://reviews.llvm.org/D46332

llvm-svn: 331893
2018-05-09 16:57:48 +00:00
Greg Clayton f56c30d13b General cleanup to minimize the .debug_types patch
This cleanup is designed to make the https://reviews.llvm.org/D32167 patch smaller and easier to read.

Cleanup in this patch:

Allow DWARFUnit subclasses to hand out the data that should be used when decoding data for a DIE. The information might be in .debug_info or could be in .debug_types. There is a new virtual function on DWARFUnit that each subclass must override:

virtual const lldb_private::DWARFDataExtractor &DWARFUnit::GetData() const;
This allows DWARFCompileUnit and eventually DWARFTypeUnit to hand out different data to be used when decoding the DIE information.

Add a new pure virtual function to get the size of the DWARF unit header:

virtual uint32_t DWARFUnit::GetHeaderByteSize() const = 0;
This allows DWARFCompileUnit and eventually DWARFTypeUnit to hand out different offsets where the first DIE starts when decoding DIE information from the unit.

Added a new function to DWARFDataExtractor to get the size of an offset:

size_t DWARFDataExtractor::GetDWARFSizeOfOffset() const;
Removed dead dumping and parsing code in the DWARFDebugInfo class.
Inlined a bunch of calls in DWARFUnit for accessors that were just returning integer member variables.
Renamed DWARFUnit::Size() to DWARFUnit::GetHeaderByteSize() as it clearly states what it is doing and makes more sense.

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

llvm-svn: 331892
2018-05-09 16:42:53 +00:00
Michael Kruse e330071b43 [ScopInfo] Remove bail out condition in buildMinMaxAccess().
The condition was introduced in r267142 to mitigate a long compile-time
case. In r306087, a max-computation limit was introduced that should
handle the same case while leaving the max disjuncts heuristic it
should have replaced intact.

Today, the max disjuncts bail-out causes problems in that it prematurely
stops SCoPs from being detected, e.g. in SPEC's lbm. This would hit less
like if isl_set_coalesce would be called after isl_set_remove_divs
(which makes more basic_set likely to be coalescable) instead of before.

This patch tries to remove the premature max-disjuncts bail-out
condition by using simple_hull() to reduce the computational overhead,
instead of directly invalidating that SCoP.

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

Contributed-by: Sahil Girish Yerawar <cs15btech11044@iith.ac.in>
llvm-svn: 331891
2018-05-09 16:23:56 +00:00
Kostya Kortchinsky cb7912cc0f [sanitizer] Correct 64-bit atomic_store on 32-bit "other" platforms
Summary:
I think there might be something to optimize in `atomic_store`.
Currently, if everything goes well (and we have a different new value), we
always iterate 3 times.
For example, `with a = 0`, `oldval = a`, `newval = 42`, we get:
```
oldval = 0, newval = 42, curval = 0  
oldval = 0, newval = 42, curval = 42 
oldval = 42, newval = 42, curval = 42
```
and then it breaks.

Unless I am not seeing something, I don't see a point to the third iteration.
If the current value is the one we want, we should just break.
This means that 2 iterations (with a different newval) should be sufficient to
achieve what we want.

Reviewers: dvyukov, alekseyshl

Reviewed By: dvyukov

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 331890
2018-05-09 16:20:52 +00:00
David Bolvansky 9b5e6e8288 [InstCombine] snprintf optimizations
Reviewers: spatel, efriedma, majnemer, rja, bkramer

Reviewed By: rja, bkramer

Subscribers: rja, llvm-commits

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

llvm-svn: 331889
2018-05-09 16:09:31 +00:00
Amara Emerson 4e66142f14 [DAGCombine] Change store merge candidates check cut off to 1024.
The previous value of 8192 resulted in severe compile time hits in
some pathological cases.

rdar://39781410

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

llvm-svn: 331888
2018-05-09 15:53:06 +00:00
Krzysztof Parzyszek 01cf424047 [Hexagon] Fix sanitizer error about using -1u in variable of enum type
llvm-svn: 331887
2018-05-09 15:44:40 +00:00
Stella Stamenova 8a36cb3bb2 [lit, lldbsuite] Add a bug reference to the failing TestLinuxCore and fix an undefined property in dotest.py
Summary:
1) In TestLinuxCore rather than skipping the tests on Windows, mark them as expected failures and add a bug reference
2) In dotest.py replace the undefined property in the exceptions with the actual property causing the exception

Reviewers: asmith, labath, zturner

Reviewed By: labath, zturner

Subscribers: llvm-commits

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

llvm-svn: 331886
2018-05-09 15:35:19 +00:00
Krzysztof Parzyszek ea4c1bb772 [LV] Change MaxVectorSize bound to 256 in assertion, NFC otherwise
It's possible to have a vector of 256 bytes in HVX code on Hexagon
(vector pair in 128-byte mode).

llvm-svn: 331885
2018-05-09 15:18:12 +00:00
Pavel Labath b1bcafd706 APFloat/x87: Fix string conversion for "unnormal" values (pr35860)
Summary:
Unnormal values are a feature of some very old x87 processors. We handle
them correctly for the most part -- the only exception was an unnormal
value whose significand happened to be zero. In this case the APFloat
was still initialized as normal number (category = fcNormal), but a
subsequent toString operation would assert because the math would
produce nonsensical values for the zero significand.

During review, it was decided that the correct way to fix this is to
treat all unnormal values as NaNs (as that is what any >=386 processor
will do).

The issue was discovered because LLDB would crash when trying to print
some "long double" values.

Reviewers: skatkov, scanon, gottesmm

Subscribers: llvm-commits

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

llvm-svn: 331884
2018-05-09 15:13:45 +00:00
Krzysztof Parzyszek 8e7625eed7 [Hexagon] Simplify MCCodeEmitter, move data to tables
llvm-svn: 331883
2018-05-09 15:02:04 +00:00
Pavel Labath 4b13033149 Fix Windows build for the Predicate.h refactor in r331880
llvm-svn: 331882
2018-05-09 14:49:43 +00:00
Sid Manning ed3065f7a1 Add basic compiler-rt builtins support for hexagon.
Differential Revision: https://reviews.llvm.org/D46364

llvm-svn: 331881
2018-05-09 14:44:54 +00:00
Pavel Labath 3879fe0099 Modernize and clean-up the Predicate class
Summary:
The comments on this class were out of date with the implementation, and
the implementation itself was inconsistent with our usage of the Timeout
class (I started converting everything to use this class back in D27136,
but I missed this one). I avoid duplicating the waiting logic by
introducing a templated WaitFor function, and make other functions
delegate to that. This function can be also used as a replacement for
the unused WaitForBitToBeSet functions I removed, if it turns out to be
necessary.

As this changes the meaning of a "zero" timeout, I tracked down all the
callers of these functions and updated them accordingly. Propagating the
changes to all the callers of RunShellCommand was a bit too much for
this patch, so I stopped there and will continue that in a follow-up
patch.

I also add some basic unittests for the functions I modified.

Reviewers: jingham, clayborg

Subscribers: mgorny, lldb-commits

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

llvm-svn: 331880
2018-05-09 14:29:30 +00:00
Alexey Bataev e253f2f886 [OPENMP] Mark global tors/dtors as used.
If the global variables are marked as declare target and they need
ctors/dtors, these ctors/dtors are emitted and then invoked by the
offloading runtime library. They are not explicitly used in the emitted
code and thus can be optimized out. Patch marks these functions as used,
so the optimizer cannot remove these function during the optimization
phase.

llvm-svn: 331879
2018-05-09 14:15:18 +00:00
Karl-Johan Karlsson b27dd33c58 [LV] Add lit testcase for bitcast problem. NFC
llvm-svn: 331878
2018-05-09 13:34:57 +00:00
Anastasia Stulova 59055b94af [OpenCL] Add constant address space to __func__ in AST.
Added string literal helper function to obtain the type
attributed by a constant address space.

Also fixed predefind __func__ expr to use the helper
to constract the string literal correctly.

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

llvm-svn: 331877
2018-05-09 13:23:26 +00:00
Pavel Labath d20289b31a [Support/Path] Make handling of paths like "///" consistent
Summary:
Various path functions were not treating paths consisting of slashes
alone consistently. For example, the iterator-based accessors decomposed the
path "///" into two elements: "/" and ".". This is not too bad, but it
is different from the behavior specified by posix:
```
A pathname that contains ***at least one non-slash character*** and that
ends with one or more trailing slashes shall be resolved as if a single
dot character ( '.' ) were appended to the pathname.
```
More importantly, this was different from how we treated the same path
in the filename+parent_path functions, which decomposed this path into
"." and "". This was completely wrong as it lost the information that
this was an absolute path which referred to the root directory.

This patch fixes this behavior by making sure all functions treat paths
consisting of (back)slashes alone the same way as "/". I.e., the
iterator-based functions will just report one component ("/"), and the
filename+parent_path will decompose them into "/" and "".

A slightly controversial topic here may be the treatment of "//". Posix
says that paths beginning with "//" may have special meaning and indeed
we have code which parses paths like "//net/foo/bar" specially. However,
as we were already not being consistent in parsing the "//" string
alone, and any special parsing for it would complicate the code further,
I chose to treat it the same way as longer sequences of slashes (which
are guaranteed to be the same as "/").

Another slight change of behavior is in the parsing of paths like
"//net//". Previously the last component of this path was ".". However,
as in our parsing the "//net" part in this path was the same as the
"drive" part in "c:\" and the next slash was the "root directory", it
made sense to treat "//net//" the same way as "//net/" (i.e., not to add
the extra "." component at the end).

Reviewers: zturner, rnk, dblaikie, Bigcheese

Subscribers: llvm-commits

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

llvm-svn: 331876
2018-05-09 13:21:16 +00:00
Manuel Klimek d88caa21e6 Do not warn on unused parameters for functions with empty bodies.
If a function has an empty body, all parameters are trivially unused.

llvm-svn: 331875
2018-05-09 13:20:03 +00:00
Sven van Haastregt 2ca6ba1045 [OpenCL] Restrict various keywords in OpenCL C++ mode
Restrict the following keywords in the OpenCL C++ language mode,
according to Sections 2.2 & 2.9 of the OpenCL C++ 1.0 Specification.

 - dynamic_cast
 - typeid
 - register (already restricted in OpenCL C, update the diagnostic)
 - thread_local
 - exceptions (try/catch/throw)
 - access qualifiers read_only, write_only, read_write

Support the `__global`, `__local`, `__constant`, `__private`, and
`__generic` keywords in OpenCL C++.  Leave the unprefixed address
space qualifiers such as global available, i.e., do not mark them as
reserved keywords in OpenCL C++.  libclcxx provides explicit address
space pointer classes such as `global_ptr` and `global<T>` that are
implemented using the `__`-prefixed qualifiers.

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

llvm-svn: 331874
2018-05-09 13:16:17 +00:00
Adhemerval Zanella f384bc7166 [AArch64] Improve cost of vector division by constant
With custom lowering for vector MULLH{S,U}, it is now profitable to
vectorize a divide by constant loop for the custom types (v16i8, v8i16,
and v4i32).  The cost if based on TargetLowering::Build{S,U}DIV which
uses a multiply by constant plus adjustment to express a divide by
constant.

Both {u,s}mull{2} are expressed as Instruction::Mul and shifts by
Instruction::AShr.

llvm-svn: 331873
2018-05-09 12:48:22 +00:00
Nico Weber 3934dba059 Remove 'abi-breaking-checks' lit feature.
Its only two uses were removed in r311730.
Effectively reverts r304851 (but that code has removed around a bit since then).
https://reviews.llvm.org/D46619

clang side done in r331871.

llvm-svn: 331872
2018-05-09 12:39:39 +00:00
Nico Weber 82574aaac9 Remove unused lit setting, see https://reviews.llvm.org/D46619
llvm-svn: 331871
2018-05-09 12:38:51 +00:00
Alexander Kornienko 48fcfc3274 Fixes issue introduced by r331556.
Closes bug: https://bugs.llvm.org/show_bug.cgi?id=37357

Patch by Rafael Stahl!

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

llvm-svn: 331870
2018-05-09 12:27:21 +00:00
Pavel Labath e0207a60dd Revert "DWARFVerifier: Check "completeness" of .debug_names section"
The new verifier check has found an error in the
debug-names-name-collisions.ll test on the PS4 bot:

error: Name Index @ 0x0: Entry @ 0xdc: mismatched Name of DIE @ 0x23: index - _ZN3foo3fooE; debug_info - foo.

Reverting while I investigate whether this is a bug in the verifier or
the generator.

This reverts commit r331868.

llvm-svn: 331869
2018-05-09 12:26:19 +00:00
Pavel Labath 3280e0467f DWARFVerifier: Check "completeness" of .debug_names section
Summary:
This patch implements a check which makes sure all entries required by
the DWARF v5 specification are present in the Name Index. The algorithm
tries to follow the wording of Section 6.1.1.1 of the spec as closely as
possible.

The main deviation from it is that instead of a whitelist-based approach
in the spec "The name index must contain an entry for each debugging
information entry that defines a named subprogram, label, variable,
type, or namespace" I chose a blacklist-based one, where I consider
everything to be "in" and then remove the entries that don't make sense.
I did this because it has more potential for catching interesting cases
and the above is a bit vague (it uses plain words like "variable" and
"subprogram", but the rest of the section speaks about specific TAGs).

This approach has raised some interesting questions, the main one being
whether enumerator values should be indexed. The consensus seems to be
that they should, although it does not follow from section 6.1.1.1.
For the time being I made the verifier ignore these, as LLVM does not do
this yet, and I wanted to get a clean run when verifying generated debug
info.

Another interesting case was the DW_TAG_imported_declaration. It was not
immediately clear to me whether this should go in or not, but currently
it is not indexed, and (unlike the enumerators) in does not seem to cause
problems for LLDB, so I've also ignored it.

Reviewers: JDevlieghere, aprantl, dblaikie

Subscribers: llvm-commits

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

llvm-svn: 331868
2018-05-09 12:06:17 +00:00
Simon Pilgrim fe5c5277ed [CostModel][X86] Split off SLM checks
A future patch will require this and the diff is much better if we perform the split separately.

llvm-svn: 331867
2018-05-09 11:42:34 +00:00
Benjamin Kramer ccb0fbe9a0 Revert "[InstCombine] snprintf optimizations"
This reverts commit r331849. It miscompiles
snprintf(buf, sizeof(buf), "%s", "any constant string); into
memcpy(buf, "%s", sizeof("any constant string"));

llvm-svn: 331866
2018-05-09 11:38:57 +00:00