platform/upstream/llvm.git
6 years agoRefactor test incase results are backwards
Chris Matthews [Thu, 10 May 2018 00:06:17 +0000 (00:06 +0000)]
Refactor test incase results are backwards

Looks like results can come in either way in this file.  Loosen the ordering constraints.

llvm-svn: 331945

6 years ago[Inscombine] fix a signedness warning which broke -Werror builds
Philip Reames [Thu, 10 May 2018 00:05:29 +0000 (00:05 +0000)]
[Inscombine] fix a signedness warning which broke -Werror builds

llvm-svn: 331944

6 years ago[Builtins] Improve the IR emitted for MSVC compatible rotr/rotl builtins to match...
Craig Topper [Thu, 10 May 2018 00:05:13 +0000 (00:05 +0000)]
[Builtins] Improve the IR emitted for MSVC compatible rotr/rotl builtins to match what the middle and backends understand

Previously we emitted something like

rotl(x, n) {
  n &= bitwidth-1;
  return n != 0 ? ((x << n) | (x >> (bitwidth - n)) : x;
}

We use a select to avoid the undefined behavior on the (bitwidth - n) shift.

The middle and backend don't really recognize this as a rotate and end up emitting a cmov or control flow because of the select.

A better pattern is (x << (n & mask)) | (x << (-n & mask)) where mask is bitwidth - 1.

Fixes the main complaint in PR37387. There's still some work to be done if the user writes that sequence directly on a short or char where type promotion rules can prevent it from being recognized. The builtin is emitting direct IR with unpromoted types so that isn't a problem for it.

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

llvm-svn: 331943

6 years ago[LIT] Handle xml characters in test names
Chris Matthews [Wed, 9 May 2018 23:48:32 +0000 (23:48 +0000)]
[LIT] Handle xml characters in test names

Lit creates malformed xml when the test case has an & in the name.

Escape those correctly.

This also adds a test case which I will add other nasty encoding issues to in some followup commits.

llvm-svn: 331942

6 years ago[NVPTX] Added a feature to use short pointers for const/local/shared AS.
Artem Belevich [Wed, 9 May 2018 23:46:19 +0000 (23:46 +0000)]
[NVPTX] Added a feature to use short pointers for const/local/shared AS.

Const/local/shared address spaces are all < 4GB and we can always use
32-bit pointers to access them. This has substantial performance impact
on kernels that uses shared memory for intermediary results.

The feature is disabled by default.

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

llvm-svn: 331941

6 years ago[sanitizer] Use all available rounded up capacity
Vitaly Buka [Wed, 9 May 2018 23:31:05 +0000 (23:31 +0000)]
[sanitizer] Use all available rounded up capacity

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 331940

6 years ago[PhaseOrdering] remove stale comments; NFC
Sanjay Patel [Wed, 9 May 2018 23:10:46 +0000 (23:10 +0000)]
[PhaseOrdering] remove stale comments; NFC

Forgot to update this with rL331937.

llvm-svn: 331939

6 years ago[CUDA] Added -f[no-]cuda-short-ptr option
Artem Belevich [Wed, 9 May 2018 23:10:09 +0000 (23:10 +0000)]
[CUDA] Added -f[no-]cuda-short-ptr option

The option enables use of 32-bit pointers for accessing
const/local/shared memory. The feature is disabled by default.

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

llvm-svn: 331938

6 years ago[AggressiveInstCombine] convert a chain of 'and-shift' bits into masked compare
Sanjay Patel [Wed, 9 May 2018 23:08:15 +0000 (23:08 +0000)]
[AggressiveInstCombine] convert a chain of 'and-shift' bits into masked compare

This is a follow-up to D45986. As suggested there, we should match the "all-bits-set"
pattern in addition to "any-bits-set".

This was a little more complicated than I thought it would be initially because the
"and 1" instruction can be anywhere in the chain. Hopefully, the code comments make
that logic understandable, but if you see a way to simplify or improve that, it's
most appreciated.

This transforms patterns that emerge from bitfield tests as seen in PR37098:
https://bugs.llvm.org/show_bug.cgi?id=37098

I think it would also help reduce the large test from:
D46336
D46595
but we need something to reassociate that case to the forms we're expecting here first.

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

llvm-svn: 331937

6 years ago[lsan] Report unsuspended threads
Vitaly Buka [Wed, 9 May 2018 23:02:14 +0000 (23:02 +0000)]
[lsan] Report unsuspended threads

Summary:
Leak checker needs to suspend all process threads. If we have some running
thread in registry but not suspended we can have false leak report. So we will
report this case here for future debugging.

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 331936

6 years ago[InstCombine] Widen guards with conditions between
Philip Reames [Wed, 9 May 2018 22:56:32 +0000 (22:56 +0000)]
[InstCombine] Widen guards with conditions between

The previous handling for guard widening in InstCombine was extremely restrictive. In particular, it didn't handle the common case where we had two guards separated by a single icmp. Handle this by scanning through a small fixed window of instructions to find the next guard if needed.

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

llvm-svn: 331935

6 years agoRevert "[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module"
Julie Hockett [Wed, 9 May 2018 22:28:18 +0000 (22:28 +0000)]
Revert "[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module"

This reverts commit r331930, which was landed by accident.

llvm-svn: 331934

6 years ago[InstCombine] Teach SimplifyDemandedBits that udiv doesn't demand low dividend bits...
Benjamin Kramer [Wed, 9 May 2018 22:27:34 +0000 (22:27 +0000)]
[InstCombine] Teach SimplifyDemandedBits that udiv doesn't demand low dividend bits that are zero in the divisor

This is safe as long as the udiv is not exact. The pattern is not common in
C++ code, but comes up all the time in code generated by XLA's GPU backend.

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

llvm-svn: 331933

6 years agoRevert "[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective"
Julie Hockett [Wed, 9 May 2018 22:25:47 +0000 (22:25 +0000)]
Revert "[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective"

This reverts commit r331904 because of a memory leak.

llvm-svn: 331932

6 years agoRevert "[tools] Updating PPCallbacks::InclusionDirective calls"
Julie Hockett [Wed, 9 May 2018 22:25:43 +0000 (22:25 +0000)]
Revert "[tools] Updating PPCallbacks::InclusionDirective calls"

This reverts commit r331905, since it's dependent on reverted r331905.

llvm-svn: 331931

6 years ago[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module
Julie Hockett [Wed, 9 May 2018 22:25:42 +0000 (22:25 +0000)]
[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module

Adding a check to restrict system includes to a whitelist. Given a list
of includes that are explicitly allowed, the check issues a fixit to
remove any system include not on that list from the source file.

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

llvm-svn: 331930

6 years ago[ARM] Add support for SETCCCARRY instead of SETCCE
Amaury Sechet [Wed, 9 May 2018 22:15:51 +0000 (22:15 +0000)]
[ARM] Add support for SETCCCARRY instead of SETCCE

Summary: As per title. SETCCE is deprecated and will eventually be removed.

Reviewers: rogfer01, efriedma, rengolin, javed.absar

Subscribers: kristof.beyls, chrib, llvm-commits

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

llvm-svn: 331929

6 years agoUpdate pragma-attribute-supported-attributes-list.test.
Manoj Gupta [Wed, 9 May 2018 22:05:53 +0000 (22:05 +0000)]
Update pragma-attribute-supported-attributes-list.test.

Update the test to include the new attribute NoStackProtector
to fix the build fails.

llvm-svn: 331928

6 years ago[sanitizer] Fix argument type and remove unneeded vector resize
Vitaly Buka [Wed, 9 May 2018 22:03:52 +0000 (22:03 +0000)]
[sanitizer] Fix argument type and remove unneeded vector resize

llvm-svn: 331927

6 years ago[GlobalISel][Legalizer] Widening the second src op of shifts bug fix
Roman Tereshin [Wed, 9 May 2018 21:43:30 +0000 (21:43 +0000)]
[GlobalISel][Legalizer] Widening the second src op of shifts bug fix

The second source operand of G_SHL, G_ASHR, and G_LSHR must preserve its
value as a (small) unsigned integer, therefore its incorrect to widen it
in any way but by zero extending it.

G_SHL was using G_ANYEXT and G_ASHR - G_SEXT (which is correct for their
destination and first source operands, but not the "number of bits to
shift" operand).

Generally, shifts aren't as similar to regular binary operations as it
might seem, for instance, they aren't commutative nor associative and
the second source operand usually requires a special treatment.

Reviewers: bogner, javed.absar, aivchenk, rovka

Reviewed By: bogner

Subscribers: igorb, kristof.beyls, llvm-commits

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

llvm-svn: 331926

6 years ago[Clang] Implement function attribute no_stack_protector.
Manoj Gupta [Wed, 9 May 2018 21:41:18 +0000 (21:41 +0000)]
[Clang] Implement function attribute no_stack_protector.

Summary:
This attribute tells clang to skip this function from stack protector
when -stack-protector option is passed.
GCC option for this is:
__attribute__((__optimize__("no-stack-protector"))) and the
equivalent clang syntax would be: __attribute__((no_stack_protector))

This is used in Linux kernel to selectively disable stack protector
in certain functions.

Reviewers: aaron.ballman, rsmith, rnk, probinson

Reviewed By: aaron.ballman

Subscribers: probinson, srhines, cfe-commits

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

llvm-svn: 331925

6 years ago[llvm-objcopy] Add --strip-symbol (-N) option
Paul Semel [Wed, 9 May 2018 21:36:54 +0000 (21:36 +0000)]
[llvm-objcopy] Add --strip-symbol (-N) option

llvm-svn: 331924

6 years agoAdd SourceManagerForFile helper which sets up SourceManager and dependencies for...
Eric Liu [Wed, 9 May 2018 21:35:52 +0000 (21:35 +0000)]
Add SourceManagerForFile helper which sets up SourceManager and dependencies for a single file with code snippet

Summary: This can be used to create a virtual environment (incl. VFS, source manager) for code snippets.

Reviewers: sammccall, klimek

Reviewed By: sammccall

Subscribers: klimek, mgorny, cfe-commits

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

llvm-svn: 331923

6 years ago[CMake] Build shared version of runtimes for Fuchsia
Petr Hosek [Wed, 9 May 2018 21:24:06 +0000 (21:24 +0000)]
[CMake] Build shared version of runtimes for Fuchsia

Fuchsia is no longer treated as UNIX which means we need to explicitly
enable building of shared versions of runtimes.

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

llvm-svn: 331922

6 years ago[sanitizer] Use tid_t in ThreadLister
Vitaly Buka [Wed, 9 May 2018 21:21:26 +0000 (21:21 +0000)]
[sanitizer] Use tid_t in ThreadLister

llvm-svn: 331921

6 years ago[AMDGPU] Support horizontal vectorization of min/max.
Farhana Aleen [Wed, 9 May 2018 21:18:34 +0000 (21:18 +0000)]
[AMDGPU] Support horizontal vectorization of min/max.

Author: FarhanaAleen

Reviewed By: rampitec

Subscribers: AMDGPU

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

llvm-svn: 331920

6 years agoAMDGPU: Ignore any_extend in mul24 combine
Matt Arsenault [Wed, 9 May 2018 21:11:35 +0000 (21:11 +0000)]
AMDGPU: Ignore any_extend in mul24 combine

If a multiply is truncated, SimplifyDemandedBits
sometimes turns a zero_extend of the inputs into an
any_extend, which makes the known bits computation unhelpful.
Ignore these and compute known bits for the underlying value,
since we insert the correct extend type after.

llvm-svn: 331919

6 years ago[Hexagon] Add patterns for vector shift-and-accumulate
Krzysztof Parzyszek [Wed, 9 May 2018 21:10:41 +0000 (21:10 +0000)]
[Hexagon] Add patterns for vector shift-and-accumulate

llvm-svn: 331918

6 years agoAMDGPU: Handle partial shift reduction for variable shifts
Matt Arsenault [Wed, 9 May 2018 20:52:54 +0000 (20:52 +0000)]
AMDGPU: Handle partial shift reduction for variable shifts

If the variable shift amount has known bits, we can still reduce
the shift.

llvm-svn: 331917

6 years agoAMDGPU: Partially shrink 64-bit shifts if reduced to 16-bit
Matt Arsenault [Wed, 9 May 2018 20:52:43 +0000 (20:52 +0000)]
AMDGPU: Partially shrink 64-bit shifts if reduced to 16-bit

This is an extension of an existing combine to reduce wider
shls if the result fits in the final result type. This
introduces the same combine, but reduces the shift to a middle
sized type to avoid the slow 64-bit shift.

llvm-svn: 331916

6 years ago[sanitizer] Cleanup sorting functions
Vitaly Buka [Wed, 9 May 2018 20:42:11 +0000 (20:42 +0000)]
[sanitizer] Cleanup sorting functions

llvm-svn: 331915

6 years ago[cmake, unittests] Fix the CMake file for the LLDB unittests to support multiple...
Stella Stamenova [Wed, 9 May 2018 19:58:51 +0000 (19:58 +0000)]
[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

6 years ago[X86] Fix Broadwell's Shuffle256 schedule classes load latency values.
Simon Pilgrim [Wed, 9 May 2018 19:27:48 +0000 (19:27 +0000)]
[X86] Fix Broadwell's Shuffle256 schedule classes load latency values.

Allows us to remove some unnecessary InstRW overrides.

llvm-svn: 331913

6 years ago[COFF] Fix dangling StringRefs from SVN 331900
Martin Storsjo [Wed, 9 May 2018 19:07:10 +0000 (19:07 +0000)]
[COFF] Fix dangling StringRefs from SVN 331900

llvm-svn: 331912

6 years ago[X86] Merge instregex patterns to reduce InstrRW compile time.
Simon Pilgrim [Wed, 9 May 2018 19:04:15 +0000 (19:04 +0000)]
[X86] Merge instregex patterns to reduce InstrRW compile time.

llvm-svn: 331911

6 years agoAllow copy elision in path concatenation
David Bolvansky [Wed, 9 May 2018 18:57:17 +0000 (18:57 +0000)]
Allow copy elision in path concatenation

Summary:
Just port of libstdc++'s fix to libc++ fs: https://github.com/gcc-mirror/gcc/commit/e6ac4004fe49d785c63bf87aec4b095b5ce1d19f

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

6 years agoAMDGPU: Add combine for trunc of bitcast from build_vector
Matt Arsenault [Wed, 9 May 2018 18:37:39 +0000 (18:37 +0000)]
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

6 years ago[dfsan] add one more sanitizer-coverage hook to the whitelist
Kostya Serebryany [Wed, 9 May 2018 18:35:09 +0000 (18:35 +0000)]
[dfsan] add one more sanitizer-coverage hook to the whitelist

llvm-svn: 331908

6 years ago[Hexagon] Check the end of the correct container (fix typo)
Krzysztof Parzyszek [Wed, 9 May 2018 18:33:59 +0000 (18:33 +0000)]
[Hexagon] Check the end of the correct container (fix typo)

llvm-svn: 331907

6 years agoAMDGPU: Stop special casing constant indexes of extract_vector_elt
Matt Arsenault [Wed, 9 May 2018 18:29:26 +0000 (18:29 +0000)]
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

6 years ago[tools] Updating PPCallbacks::InclusionDirective calls
Julie Hockett [Wed, 9 May 2018 18:27:37 +0000 (18:27 +0000)]
[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

6 years ago[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective
Julie Hockett [Wed, 9 May 2018 18:27:33 +0000 (18:27 +0000)]
[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

6 years ago[llvm-rc] Handle C preprocessor output
Martin Storsjo [Wed, 9 May 2018 18:21:03 +0000 (18:21 +0000)]
[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

6 years ago[llvm-rc] Add support for the RCDATA resource type
Martin Storsjo [Wed, 9 May 2018 18:20:56 +0000 (18:20 +0000)]
[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

6 years ago[llvm-rc] Allow -1 for control IDs in old style dialogs with 16 bit fields
Martin Storsjo [Wed, 9 May 2018 18:20:49 +0000 (18:20 +0000)]
[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

6 years ago[COFF] Allow specifying export forwarding in a def file
Martin Storsjo [Wed, 9 May 2018 18:19:41 +0000 (18:19 +0000)]
[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

6 years ago[OPENMP] Generate unique names for offloading regions id.
Alexey Bataev [Wed, 9 May 2018 18:02:37 +0000 (18:02 +0000)]
[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

6 years ago Reapplying r331819 [GlobalISel][Legalizer] More concise and faster widenScalar...
Roman Tereshin [Wed, 9 May 2018 17:28:18 +0000 (17:28 +0000)]
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

6 years agollvm-mca: Add missing includes
David Blaikie [Wed, 9 May 2018 17:28:10 +0000 (17:28 +0000)]
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

6 years ago[DAGCombiner] In visitBITCAST when trying to constant fold the bitcast, only call...
Craig Topper [Wed, 9 May 2018 17:14:27 +0000 (17:14 +0000)]
[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

6 years ago[OpenCL] Fix typos in emitted enqueue kernel function names
Yaxun Liu [Wed, 9 May 2018 17:07:06 +0000 (17:07 +0000)]
[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

6 years ago[libFuzzer] Disable print-func.test on Darwin.
Matt Morehouse [Wed, 9 May 2018 17:05:07 +0000 (17:05 +0000)]
[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

6 years ago[X86] Only enable the __ud2 and __int2c builtins if intrin.h has been included.
Craig Topper [Wed, 9 May 2018 16:57:48 +0000 (16:57 +0000)]
[X86] Only enable the __ud2 and __int2c builtins if intrin.h has been included.

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

llvm-svn: 331893

6 years agoGeneral cleanup to minimize the .debug_types patch
Greg Clayton [Wed, 9 May 2018 16:42:53 +0000 (16:42 +0000)]
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

6 years ago[ScopInfo] Remove bail out condition in buildMinMaxAccess().
Michael Kruse [Wed, 9 May 2018 16:23:56 +0000 (16:23 +0000)]
[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

6 years ago[sanitizer] Correct 64-bit atomic_store on 32-bit "other" platforms
Kostya Kortchinsky [Wed, 9 May 2018 16:20:52 +0000 (16:20 +0000)]
[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

6 years ago[InstCombine] snprintf optimizations
David Bolvansky [Wed, 9 May 2018 16:09:31 +0000 (16:09 +0000)]
[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

6 years ago[DAGCombine] Change store merge candidates check cut off to 1024.
Amara Emerson [Wed, 9 May 2018 15:53:06 +0000 (15:53 +0000)]
[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

6 years ago[Hexagon] Fix sanitizer error about using -1u in variable of enum type
Krzysztof Parzyszek [Wed, 9 May 2018 15:44:40 +0000 (15:44 +0000)]
[Hexagon] Fix sanitizer error about using -1u in variable of enum type

llvm-svn: 331887

6 years ago[lit, lldbsuite] Add a bug reference to the failing TestLinuxCore and fix an undefine...
Stella Stamenova [Wed, 9 May 2018 15:35:19 +0000 (15:35 +0000)]
[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

6 years ago[LV] Change MaxVectorSize bound to 256 in assertion, NFC otherwise
Krzysztof Parzyszek [Wed, 9 May 2018 15:18:12 +0000 (15:18 +0000)]
[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

6 years agoAPFloat/x87: Fix string conversion for "unnormal" values (pr35860)
Pavel Labath [Wed, 9 May 2018 15:13:45 +0000 (15:13 +0000)]
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

6 years ago[Hexagon] Simplify MCCodeEmitter, move data to tables
Krzysztof Parzyszek [Wed, 9 May 2018 15:02:04 +0000 (15:02 +0000)]
[Hexagon] Simplify MCCodeEmitter, move data to tables

llvm-svn: 331883

6 years agoFix Windows build for the Predicate.h refactor in r331880
Pavel Labath [Wed, 9 May 2018 14:49:43 +0000 (14:49 +0000)]
Fix Windows build for the Predicate.h refactor in r331880

llvm-svn: 331882

6 years agoAdd basic compiler-rt builtins support for hexagon.
Sid Manning [Wed, 9 May 2018 14:44:54 +0000 (14:44 +0000)]
Add basic compiler-rt builtins support for hexagon.

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

llvm-svn: 331881

6 years agoModernize and clean-up the Predicate class
Pavel Labath [Wed, 9 May 2018 14:29:30 +0000 (14:29 +0000)]
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

6 years ago[OPENMP] Mark global tors/dtors as used.
Alexey Bataev [Wed, 9 May 2018 14:15:18 +0000 (14:15 +0000)]
[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

6 years ago[LV] Add lit testcase for bitcast problem. NFC
Karl-Johan Karlsson [Wed, 9 May 2018 13:34:57 +0000 (13:34 +0000)]
[LV] Add lit testcase for bitcast problem. NFC

llvm-svn: 331878

6 years ago[OpenCL] Add constant address space to __func__ in AST.
Anastasia Stulova [Wed, 9 May 2018 13:23:26 +0000 (13:23 +0000)]
[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

6 years ago[Support/Path] Make handling of paths like "///" consistent
Pavel Labath [Wed, 9 May 2018 13:21:16 +0000 (13:21 +0000)]
[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

6 years agoDo not warn on unused parameters for functions with empty bodies.
Manuel Klimek [Wed, 9 May 2018 13:20:03 +0000 (13:20 +0000)]
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

6 years ago[OpenCL] Restrict various keywords in OpenCL C++ mode
Sven van Haastregt [Wed, 9 May 2018 13:16:17 +0000 (13:16 +0000)]
[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

6 years ago[AArch64] Improve cost of vector division by constant
Adhemerval Zanella [Wed, 9 May 2018 12:48:22 +0000 (12:48 +0000)]
[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

6 years agoRemove 'abi-breaking-checks' lit feature.
Nico Weber [Wed, 9 May 2018 12:39:39 +0000 (12:39 +0000)]
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

6 years agoRemove unused lit setting, see https://reviews.llvm.org/D46619
Nico Weber [Wed, 9 May 2018 12:38:51 +0000 (12:38 +0000)]
Remove unused lit setting, see https://reviews.llvm.org/D46619

llvm-svn: 331871

6 years agoFixes issue introduced by r331556.
Alexander Kornienko [Wed, 9 May 2018 12:27:21 +0000 (12:27 +0000)]
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

6 years agoRevert "DWARFVerifier: Check "completeness" of .debug_names section"
Pavel Labath [Wed, 9 May 2018 12:26:19 +0000 (12:26 +0000)]
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

6 years agoDWARFVerifier: Check "completeness" of .debug_names section
Pavel Labath [Wed, 9 May 2018 12:06:17 +0000 (12:06 +0000)]
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

6 years ago[CostModel][X86] Split off SLM checks
Simon Pilgrim [Wed, 9 May 2018 11:42:34 +0000 (11:42 +0000)]
[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

6 years agoRevert "[InstCombine] snprintf optimizations"
Benjamin Kramer [Wed, 9 May 2018 11:38:57 +0000 (11:38 +0000)]
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

6 years ago[DebugInfo] Mark tests using -debug-only as REQUIRES: asserts
Benjamin Kramer [Wed, 9 May 2018 11:17:30 +0000 (11:17 +0000)]
[DebugInfo] Mark tests using -debug-only as REQUIRES: asserts

llvm-svn: 331865

6 years ago[X86] Cleanup WriteFStore/WriteVecStore schedules
Simon Pilgrim [Wed, 9 May 2018 11:01:16 +0000 (11:01 +0000)]
[X86] Cleanup WriteFStore/WriteVecStore schedules

MOVNTPD/MOVNTPS should be WriteFStore

Standardized BDW/HSW/SKL/SKX WriteFStore/WriteVecStore - fixes some missed instregex patterns. (V)MASKMOVDQU was already using the default, its costs gets increased but is still nowhere near the real cost of that nasty instruction....

llvm-svn: 331864

6 years ago[mips] Move conditional moves out of isCodeGenOnly
Simon Dardis [Wed, 9 May 2018 10:33:21 +0000 (10:33 +0000)]
[mips] Move conditional moves out of isCodeGenOnly

Reviewers: atanasyan, smaksimovic, abeserminji

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

llvm-svn: 331863

6 years ago[wasm] Update test for variables->retainedNodes rename.
Benjamin Kramer [Wed, 9 May 2018 10:09:23 +0000 (10:09 +0000)]
[wasm] Update test for variables->retainedNodes rename.

This fixes the test after LLVM r331841.

llvm-svn: 331862

6 years agoRevert r331843 "[DebugInfo] Generate debug information for labels."
Hans Wennborg [Wed, 9 May 2018 09:29:58 +0000 (09:29 +0000)]
Revert r331843 "[DebugInfo] Generate debug information for labels."

It broke the Chromium build (see reply on the review).

> Generate DILabel metadata and call llvm.dbg.label after label
> statement to associate the metadata with the label.
>
> Differential Revision: https://reviews.llvm.org/D45045
>
> Patch by Hsiangkai Wang.

This doesn't revert the change to backend-unsupported-error.ll
that seems to correspond to an llvm-side change.

llvm-svn: 331861

6 years ago[COFF] Improve correctness of def parsing for GNU features
Martin Storsjo [Wed, 9 May 2018 09:22:03 +0000 (09:22 +0000)]
[COFF] Improve correctness of def parsing for GNU features

The operator == used for exporting a function with a different
name in the DLL compared to the name in the import library
(which is useful for adding linker level aliases for function
in the import library) is a feature distinct and different from
the operator = used for exporting a function with a different
name (both in import library and DLL) than in the implementation
producing the DLL.

When creating an import library using dlltool, from a def file that
contains forwards (Func = OtherDll.Func), this shouldn't affect the
produced import library, which should still behave just as if it
was a normal exported function.

This clears a lot of confusion and subtle misunderstandings, and
avoids a parameter that was used to avoid creating weak aliases
when invoked from lld. (This parameter was added previously due to
the existing conflation of the two features.)

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

llvm-svn: 331860

6 years ago[COFF] Improve correctness of def parsing for GNU features
Martin Storsjo [Wed, 9 May 2018 09:21:53 +0000 (09:21 +0000)]
[COFF] Improve correctness of def parsing for GNU features

The operator == used for exporting a function with a different
name in the DLL compared to the name in the import library
(which is useful for adding linker level aliases for function
in the import library) is a feature distinct and different from
the operator = used for exporting a function with a different
name (both in import library and DLL) than in the implementation
producing the DLL.

When creating an import library using dlltool, from a def file that
contains forwards (Func = OtherDll.Func), this shouldn't affect the
produced import library, which should still behave just as if it
was a normal exported function.

This clears a lot of confusion and subtle misunderstandings, and
avoids a parameter that was used to avoid creating weak aliases
when invoked from lld. (This parameter was added previously due to
the existing conflation of the two features.)

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

llvm-svn: 331859

6 years agoRevert "[Driver] Use -fuse-line-directives by default in MSVC mode"
Martin Storsjo [Wed, 9 May 2018 09:11:01 +0000 (09:11 +0000)]
Revert "[Driver] Use -fuse-line-directives by default in MSVC mode"

This reverts commit SVN r331666.

It was afterwards pointed out in https://reviews.llvm.org/D46520
that #line directives lose information about what parts come from a
system header. That means the result of -E usually won't compile,
since Windows headers are typically full of warnings and
default-error warnings.

llvm-svn: 331858

6 years ago[clang-format] Respect BreakBeforeClosingBrace while calculating length
Krasimir Georgiev [Wed, 9 May 2018 09:02:11 +0000 (09:02 +0000)]
[clang-format] Respect BreakBeforeClosingBrace while calculating length

Summary:
This patch makes `getLengthToMatchingParen` respect the `BreakBeforeClosingBrace`
ParenState for matching scope closers. In order to distinguish between paren states
introduced by real vs. fake parens, I've added the token opening the ParensState
to that struct.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 331857

6 years ago[driver] Add mips_Features_Group to Options to improve documentation sorting
Simon Atanasyan [Wed, 9 May 2018 08:42:30 +0000 (08:42 +0000)]
[driver] Add mips_Features_Group to Options to improve documentation sorting

Move all of the MIPS-only options into a new m_mips_Features_Group.
Nearly all other targets have most target-specific options grouped,
but MIPS does not.

The primary benefits are that the options will be listed together (and
thus identifiable as MIPS-specific even if they have no help string) in
the ClangCommandLineReference, and that Options.td is a bit more organized.

A secondary benefit is that a custom version of clang can more easily
hide/disable groups of options for unsupported targets.

Patch by Vince Del Vecchio

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

llvm-svn: 331856

6 years ago[DWARF] Align non-accelerated function fullname searching with the apple-tables path
Pavel Labath [Wed, 9 May 2018 08:21:25 +0000 (08:21 +0000)]
[DWARF] Align non-accelerated function fullname searching with the apple-tables path

Summary:
Before this patch the two paths were doing very different things
- the apple path searched the .apple_names section, which contained
  mangled names, as well as basenames of all functions. It returned any
  name it found.
- the non-accelerated path looked in the "full name" index we built
  ourselves, which contained mangled as well as demangled names of all
  functions (but no basenames). Then however, if it did not find a match
  it did an extra search in the basename index, with some special
  handling for anonymous namespaces.

This aligns the two paths by changing the non-accelerated path to return
the same results as in the apple-tables one. In pratice, this means we
will search in both the "basename", "method" and "fullname" indexes (in
the manual indexes these are separate indexes. This means the function
will return some slightly inappropriate results (e.g. bar::baz::foo when
one asks for a "full name" foo), but this can be handled by additional
filtering, independently indexing method. I've also stopped inserting
demangled names into the "fullname" index, as that is inconsistent with
the apple path.

Reviewers: clayborg, JDevlieghere

Subscribers: lldb-commits

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

llvm-svn: 331855

6 years agoAdd a test for r331746.
Hans Wennborg [Wed, 9 May 2018 08:20:14 +0000 (08:20 +0000)]
Add a test for r331746.

Thanks to pcc for creating the test file!

llvm-svn: 331854

6 years ago[DebugInfo] Fix test failed due to debug-label-mi.ll and debug-label-opt.ll
Shiva Chen [Wed, 9 May 2018 07:09:28 +0000 (07:09 +0000)]
[DebugInfo] Fix test failed due to debug-label-mi.ll and debug-label-opt.ll

Make these two test cases more generic for other architectures.
Please refer to '[DebugInfo] Convert intrinsic llvm.dbg.label to
MachineInstr.'

Patch by Hsiangkai Wang

llvm-svn: 331853

6 years ago[MergedLoadStoreMotion] Fix a debug invariant bug in mergeStores
Bjorn Pettersson [Wed, 9 May 2018 06:52:12 +0000 (06:52 +0000)]
[MergedLoadStoreMotion] Fix a debug invariant bug in mergeStores

Summary:
MergedLoadStoreMotion::mergeStores is using some heuristics
to limit the amount of stores that it tries to sink (see
MagicCompileTimeControl in MergedLoadStoreMotion.cpp). The
heuristic involves counting the number of instructions in
one of the basic blocks that is part of the transformation.

We now ignore dbg intrinsics when counting instruction for
the MagicCompileTimeControl heuristic. This to make sure that
the amount of stores that are sunk doesn't depend on the amount
of debug information (if -g is used or not).

Reviewers: Gerolf, davide, majnemer

Reviewed By: davide

Subscribers: dberlin, bjope, aprantl, JDevlieghere, llvm-commits

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

llvm-svn: 331852

6 years ago[ELF][MIPS] Add test case to cover LA25 r6 thunks generation. NFC
Simon Atanasyan [Wed, 9 May 2018 06:51:58 +0000 (06:51 +0000)]
[ELF][MIPS] Add test case to cover LA25 r6 thunks generation. NFC

llvm-svn: 331851

6 years ago[LLVM-C] Correct types in Go bindings
Robert Widmann [Wed, 9 May 2018 06:45:28 +0000 (06:45 +0000)]
[LLVM-C] Correct types in Go bindings

Summary: Fixes a test failure introduced in rL331114.

Reviewers: whitequark

Subscribers: llvm-commits

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

llvm-svn: 331850

6 years ago[InstCombine] snprintf optimizations
David Bolvansky [Wed, 9 May 2018 06:34:20 +0000 (06:34 +0000)]
[InstCombine] snprintf optimizations

Reviewers: spatel, efriedma, majnemer, rja

Reviewed By: rja

Subscribers: rja, llvm-commits

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

llvm-svn: 331849

6 years ago[DebugInfo] Fix test failed due to new DISubprogram attributes.
Shiva Chen [Wed, 9 May 2018 06:22:39 +0000 (06:22 +0000)]
[DebugInfo] Fix test failed due to new DISubprogram attributes.

Please refer to '[DebugInfo] Add DILabel metadata and intrinsic
llvm.dbg.label'. I have renamed the 'variables' attributes to
'retainedNodes' to include local variables and local labels for the
function.

Patch by Hsiangkai Wang.

llvm-svn: 331848

6 years ago[X86] Combine (vXi1 (bitcast (-1)))) and (vXi1 (bitcast (0))) to all ones or all...
Craig Topper [Wed, 9 May 2018 06:07:20 +0000 (06:07 +0000)]
[X86] Combine (vXi1 (bitcast (-1)))) and (vXi1 (bitcast (0))) to all ones or all zeros vXi1 vector.

llvm-svn: 331847

6 years agoRevert r331816 and r331820 - [globalisel] Add a combiner helpers for extending loads...
Daniel Sanders [Wed, 9 May 2018 05:00:17 +0000 (05:00 +0000)]
Revert r331816 and r331820 - [globalisel] Add a combiner helpers for extending loads and use them in a pre-legalize combiner for AArch64

Reverting this to see if the clang-cmake-aarch64-global-isel and
clang-cmake-aarch64-quick bots are failing because of this commit.
We know it wasn't r331819.

llvm-svn: 331846