platform/upstream/llvm.git
6 years ago[AVR] Update to current LLVM API
Dylan McKay [Wed, 18 Oct 2017 12:35:15 +0000 (12:35 +0000)]
[AVR] Update to current LLVM API

r315410 broke a number of things in the AVR backend, which are now
fixed.

llvm-svn: 316076

6 years agoSilence -Wimplicit-fallthrough warnings with the generated code; NFC.
Aaron Ballman [Wed, 18 Oct 2017 12:11:58 +0000 (12:11 +0000)]
Silence -Wimplicit-fallthrough warnings with the generated code; NFC.

llvm-svn: 316075

6 years ago[clang-rename] Rename alias.
Haojian Wu [Wed, 18 Oct 2017 12:10:11 +0000 (12:10 +0000)]
[clang-rename] Rename alias.

Summary:
* Support rename alias.
* Add unittests for renaming alias.
* Don't generate fixes for the SourceLocations that are invalid or in temporary
  buffer, otherwise crash would be happened when generating AtomicChanges.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, mgorny, cfe-commits

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

llvm-svn: 316074

6 years ago[ELF] - Make LinkerScript::assignOffsets private. NFC.
George Rimar [Wed, 18 Oct 2017 12:09:41 +0000 (12:09 +0000)]
[ELF] - Make LinkerScript::assignOffsets private. NFC.

llvm-svn: 316073

6 years ago[AVX512][AVX2]Cost calculation for interleave load/store patterns {v8i8,v16i8,v32i8...
Michael Zuckerman [Wed, 18 Oct 2017 11:41:55 +0000 (11:41 +0000)]
[AVX512][AVX2]Cost calculation for interleave load/store patterns {v8i8,v16i8,v32i8,v64i8}

This patch adds accurate instructions cost.
The formula presents two cases(stride 3 and stride 4) and calculates the cost according to the VF and stride.

Reviewers:
1. delena
2. Farhana
3. zvi
4. dorit
5. Ayal

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

Change-Id: If4cfbd4ac0e63694e8144cb78c7fa34850647ff7
llvm-svn: 316072

6 years ago[PowerPC] Use helper functions to check sign-/zero-extended value
Hiroshi Inoue [Wed, 18 Oct 2017 10:31:19 +0000 (10:31 +0000)]
[PowerPC] Use helper functions to check sign-/zero-extended value

Helper functions to identify sign- and zero-extending machine instruction is introduced in rL315888.
This patch makes PPCInstrInfo::optimizeCompareInstr use the helper functions. It simplifies the code and also makes possible more optimizations since the helper can do more analysis than the original check code; I observed about 5000 more compare instructions are eliminated while building LLVM.

Also, this patch fixes a bug in helpers on ANDIo instruction handling due to the order of checks. This bug causes a failure in an existing test case for optimizeCompareInstr.

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

llvm-svn: 316071

6 years agoImprove lookThroughCast function.
Nikolai Bozhenov [Wed, 18 Oct 2017 09:28:09 +0000 (09:28 +0000)]
Improve lookThroughCast function.

Summary:
When we have the following case:

  %cond = cmp iN %x, CmpConst
  %tr = trunc iN %x to iK
  %narrowsel = select i1 %cond, iK %t, iK C

We could possibly match only min/max pattern after looking through cast.
So it is more profitable if widened C constant will be equal CmpConst.
That is why just set widened C constant equal to CmpConst, because there
is a further check in this function that trunc CmpConst == C.

Also description for lookTroughCast function was added.

Reviewers: spatel

Subscribers: llvm-commits

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

Patch by: Artur Gainullin <artur.gainullin@intel.com>

llvm-svn: 316070

6 years ago[ASTImporter] Import SubStmt of CaseStmt
Gabor Horvath [Wed, 18 Oct 2017 09:25:18 +0000 (09:25 +0000)]
[ASTImporter] Import SubStmt of CaseStmt

Patch by: Rafael Stahl!

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

llvm-svn: 316069

6 years ago[ELF] - Remove excessive helper. NFC.
George Rimar [Wed, 18 Oct 2017 08:36:47 +0000 (08:36 +0000)]
[ELF] - Remove excessive helper. NFC.

Removes addRegular() helper that looks excessive from Writer.cpp.

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

llvm-svn: 316068

6 years agoFixing bug issue https://bugs.llvm.org/show_bug.cgi?id=34978
Michael Zuckerman [Wed, 18 Oct 2017 08:04:31 +0000 (08:04 +0000)]
Fixing bug issue https://bugs.llvm.org/show_bug.cgi?id=34978

Change-Id: I7f13d5bcb181be2860377df7b40e1579a8ad4add
llvm-svn: 316067

6 years agoNew -assume-filename=param to check_clang_tidy.py (like clang-format)
Haojian Wu [Wed, 18 Oct 2017 07:48:40 +0000 (07:48 +0000)]
New -assume-filename=param to check_clang_tidy.py (like clang-format)

Summary:
Currently, check_clang_tidy.py includes logic to select default
clang flags based on the extension of the source filename passed
as the first argument.

Since the source filename might be a temporary or test file with an
arbitrary extension unrelated to the file type, this adds the ability
to override the logic the same way `clang-format`'s -assume-filename=
parameter does.

I included a test with a nonstandard file extension. I confirmed
when I modified the warning message that the new test failed,
and that it passed again when I restored the warning message.

Ran tests with:

% cmake -G Ninja /path/to/llvm
% ninja check-clang-tools

Patch by Ben Hamilton!

Reviewers: hokein, alexfh

Reviewed By: hokein

Subscribers: alexfh

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

llvm-svn: 316066

6 years agoHandle shared symbols in the gnu hash construction.
Rafael Espindola [Wed, 18 Oct 2017 06:49:59 +0000 (06:49 +0000)]
Handle shared symbols in the gnu hash construction.

They are special in that they they need to be in the hash table iff we
are linking an executable that preempts them.

llvm-svn: 316065

6 years agoFix the incorrect detection of ICONV_LIBRARY_PATH
Serguei Katkov [Wed, 18 Oct 2017 06:26:39 +0000 (06:26 +0000)]
Fix the incorrect detection of ICONV_LIBRARY_PATH

This is introduced in rL308711.
Check for c library is incorrect here just because libc will be found always
and it does not mean that iconv is presented.

Thank to Andrew Krasny for narrowing down the root cause.

Reviewers: ecbeckmann
Reviewed By: ecbeckmann
Subscribers: mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D38875

llvm-svn: 316064

6 years agoupdate_mir_test_checks: Support '-' in function names
Justin Bogner [Wed, 18 Oct 2017 05:52:56 +0000 (05:52 +0000)]
update_mir_test_checks: Support '-' in function names

Some AArch64 and AMDGPU tests have functions with hyphens in the names

llvm-svn: 316063

6 years agoupdate_mir_test_checks: Fix a typo I made while preparing for commit
Justin Bogner [Wed, 18 Oct 2017 05:39:22 +0000 (05:39 +0000)]
update_mir_test_checks: Fix a typo I made while preparing for commit

I accidentally added an extra arg here, so this didn't work at all.

llvm-svn: 316062

6 years ago[CMake] Use #cmakedefine01 for CLANG_ENABLE_(ARCMT|OBJC_REWRITER|STATIC_ANALYZER)
NAKAMURA Takumi [Wed, 18 Oct 2017 05:21:17 +0000 (05:21 +0000)]
[CMake] Use #cmakedefine01 for CLANG_ENABLE_(ARCMT|OBJC_REWRITER|STATIC_ANALYZER)

It'd be better that they are #cmakedefine01 rather than #cmakedefine.
(#if FOO rather than #if defined(FOO))
Then we can find missing #include "clang/Config/config.h" in the future.

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

llvm-svn: 316061

6 years agoPrune trailing linefeed.
NAKAMURA Takumi [Wed, 18 Oct 2017 04:45:09 +0000 (04:45 +0000)]
Prune trailing linefeed.

llvm-svn: 316060

6 years agoStatically link llvm-cfi-verify's libraries.
Vlad Tsyrklevich [Wed, 18 Oct 2017 04:27:53 +0000 (04:27 +0000)]
Statically link llvm-cfi-verify's libraries.

Summary:
llvm-cfi-verify (D38379) introduced a potential build failure when compiling with `-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON`. Specific versions of cmake seem to treat the `add_subdirectory()` rule differently. It seems as if old versions of cmake BFS these rules, adding them to the fringe for expansion later. Newer versions of cmake seem to immediately execute CMakeFiles that are present in this subdirectory.

If the subdirectory is expanded through the fringe, the globbing resultant from `llvm_add_implicit_projects()` from `cmake/modules/AddLLVM.cmake:1012` means that `tools/llvm-shlib/CMakeFile.txt` gets executed before `tools/llvm-cfi-verify/lib/CMakeFile.txt`. As the latter CMakeFile adds a new library, this expansion order means that the library files required the unit tests in `unittests/tools/llvm-cfi-verify/` are not present in the dynamic library. This causes unit tests to fail as the required functions can't be found.

This change now ensures that the libraries created by `llvm-cfi-verify` are statically linked into the unit tests. As `tools/llvm-cfi-verify/lib` no longer adds anything to `llvm-shlib`, there should be no concern about the order-of-compilation.

Reviewers: skatkov, pcc

Reviewed By: skatkov, pcc

Subscribers: llvm-commits, kcc, pcc, aheejin, vlad.tsyrklevich, mgorny

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

llvm-svn: 316059

6 years agoRevert "Bring back the rest of r315721."
Rafael Espindola [Wed, 18 Oct 2017 03:06:45 +0000 (03:06 +0000)]
Revert "Bring back the rest of r315721."

This reverts commit r316051.

It fails on a bot.

llvm-svn: 316058

6 years agoAdd a utility to update MIR checks, similar to update_llc_test_checks
Justin Bogner [Wed, 18 Oct 2017 02:20:31 +0000 (02:20 +0000)]
Add a utility to update MIR checks, similar to update_llc_test_checks

This adds update_mir_test_checks, which updates the check lines in mir
tests. This can only update tests that start and end with .mir
currently (ie, -run-pass) but it should be sufficient for updating at
least some of the GlobalISel tests.

llvm-svn: 316057

6 years agoProvide a flag group to turn on/off all "binary literals" extension warnings.
Richard Smith [Wed, 18 Oct 2017 02:19:24 +0000 (02:19 +0000)]
Provide a flag group to turn on/off all "binary literals" extension warnings.

llvm-svn: 316056

6 years ago[modules] When finding the owning module of an instantiated context in template
Richard Smith [Wed, 18 Oct 2017 01:41:38 +0000 (01:41 +0000)]
[modules] When finding the owning module of an instantiated context in template
instantiation, follow lexical parents not semantic ones: we want to find the
module where the pattern was written.

llvm-svn: 316055

6 years ago[ScalarEvolution] Handling for ICmp occuring in the evolution chain.
Jatin Bhateja [Wed, 18 Oct 2017 01:36:16 +0000 (01:36 +0000)]
[ScalarEvolution] Handling for ICmp occuring in the evolution chain.

Summary:
 If a compare instruction is same or inverse of the compare in the
 branch of the loop latch, then return a constant evolution node.
 Currently scope of evaluation is limited to SCEV computation for
 PHI nodes.

 This shall facilitate computations of loop exit counts in cases
 where compare appears in the evolution chain of induction variables.

 Will fix PR 34538
Reviewers: sanjoy, hfinkel, junryoungju

Reviewed By: junryoungju

Subscribers: javed.absar, llvm-commits

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

llvm-svn: 316054

6 years ago[CMake] Build Fuchsia toolchain as -O3
Petr Hosek [Wed, 18 Oct 2017 01:27:54 +0000 (01:27 +0000)]
[CMake] Build Fuchsia toolchain as -O3

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

llvm-svn: 316053

6 years agoVerifier: Ignore CUs pulled in by ODR-uniqued types.
Adrian Prantl [Wed, 18 Oct 2017 01:11:01 +0000 (01:11 +0000)]
Verifier: Ignore CUs pulled in by ODR-uniqued types.

When more than one Module is imported into the same context, such as during
an LTO build before linking the modules, ODR type uniquing may cause types
to point to a different CU. This check does not make sense in this case.

This fixes the error reported in PR34944.

https://bugs.llvm.org/show_bug.cgi?id=34944
rdar://problem/34940685

This reapplies a cleaner implementation of r316049.

llvm-svn: 316052

6 years agoBring back the rest of r315721.
Rafael Espindola [Wed, 18 Oct 2017 01:10:05 +0000 (01:10 +0000)]
Bring back the rest of r315721.

The original patch was reported to break a libcxx bot. Unfortunately I
could not reproduce the issue and the bot log is not available anymore.

This patch changes the handling of shared symbols. I will watch the
bot and see it breaks.

Original message:
--------------------------------------------------------------
Handle shared and lazy symbol in the gnu hash construction.

We were not considering those symbols undefined and they could end up
in the end of the dynamic symbol table.
--------------------------------------------------------------

llvm-svn: 316051

6 years agoRevert "Verifier: Ignore CUs pulled in by ODR-uniqued types."
Adrian Prantl [Wed, 18 Oct 2017 00:54:31 +0000 (00:54 +0000)]
Revert "Verifier: Ignore CUs pulled in by ODR-uniqued types."

This reverts commit r316049.

llvm-svn: 316050

6 years agoVerifier: Ignore CUs pulled in by ODR-uniqued types.
Adrian Prantl [Wed, 18 Oct 2017 00:49:31 +0000 (00:49 +0000)]
Verifier: Ignore CUs pulled in by ODR-uniqued types.

When more than one Module is imported into the same context, such as during
an LTO build before linking the modules, ODR type uniquing may cause types
to point to a different CU. This check does not make sense in this case.

This fixes the error reported in PR34944.

https://bugs.llvm.org/show_bug.cgi?id=34944
rdar://problem/34940685

llvm-svn: 316049

6 years agoUse O_BINARY when opening GCDA file on Windows
Marco Castelluccio [Wed, 18 Oct 2017 00:22:01 +0000 (00:22 +0000)]
Use O_BINARY when opening GCDA file on Windows

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

Apparently, the mode in **fdopen** gets simply ignored and Windows only cares about the mode of the original **open**.

I have verified this both with the simple case from bug 34922 and with a full Firefox build.

Reviewers: zturner

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 316048

6 years ago[aarch64][globalisel] Register banks and classes should have distinct names.
Daniel Sanders [Wed, 18 Oct 2017 00:12:43 +0000 (00:12 +0000)]
[aarch64][globalisel] Register banks and classes should have distinct names.

Otherwise they are ambiguous in MIR.

llvm-svn: 316047

6 years agoBasic: fix __{,U}INTPTR_TYPE__ on ARM
Saleem Abdulrasool [Wed, 18 Oct 2017 00:00:50 +0000 (00:00 +0000)]
Basic: fix __{,U}INTPTR_TYPE__ on ARM

Darwin and OpenBSD are the only platforms which use `long int` for
`__INTPTR_TYPE__`.  The other platforms use `int` in 32-bit, and `long
int` on 64-bit (except for VMS and Windows which are LLP64).  Adjust the
type definitions to match the platform definitions.  We now generate the
same definition as GCC on all the targets.

llvm-svn: 316046

6 years ago[GlobalDCE] Use DenseMap instead of unordered_multimap for GVDependencies.
Michael Zolotukhin [Tue, 17 Oct 2017 23:47:06 +0000 (23:47 +0000)]
[GlobalDCE] Use DenseMap instead of unordered_multimap for GVDependencies.

Summary:
std::unordered_multimap happens to be very slow when the number of elements
grows large. On one of our internal applications we observed a 17x compile time
improvement from changing it to DenseMap.

Reviewers: mehdi_amini, serge-sans-paille, davide

Subscribers: llvm-commits

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

llvm-svn: 316045

6 years agolit: Improve %: normalization.
Peter Collingbourne [Tue, 17 Oct 2017 23:46:34 +0000 (23:46 +0000)]
lit: Improve %: normalization.

The new scheme should match the normalization of embedded paths in
linkrepro tar files.

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

llvm-svn: 316044

6 years agoResubmit "[lit] Raise the logic for enabling clang & lld substitutions to llvm."
Zachary Turner [Tue, 17 Oct 2017 23:43:36 +0000 (23:43 +0000)]
Resubmit "[lit] Raise the logic for enabling clang & lld substitutions to llvm."

The substitution for %debuginfo_tests had been inadvertently removed.
This adds it back.

llvm-svn: 316043

6 years agoBasic: fix `__INTPTR_TYPE__` for Windows ARM
Saleem Abdulrasool [Tue, 17 Oct 2017 22:49:53 +0000 (22:49 +0000)]
Basic: fix `__INTPTR_TYPE__` for Windows ARM

The `IntPtrType` for Windows ARM should be `int` as per MSVC.  Adjust
the type accordingly.

llvm-svn: 316042

6 years ago[Analyzer] Always use non-reference types when creating expressions in BodyFarm.
George Karpenkov [Tue, 17 Oct 2017 22:28:18 +0000 (22:28 +0000)]
[Analyzer] Always use non-reference types when creating expressions in BodyFarm.

Remove an option to use a reference type (on by default!) since a
non-reference type is always needed for creating expressions, functions
with multiple boolean parameters are very hard to use, and in general it
was just a booby trap for further crashes.
Furthermore, generalize call_once test case to fix some of the crashes mentioned
https://bugs.llvm.org/show_bug.cgi?id=34869
Also removes std::call_once crash.

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

llvm-svn: 316041

6 years agoSilence some "implicit conversion of string literal" warnings
Pavel Labath [Tue, 17 Oct 2017 21:52:29 +0000 (21:52 +0000)]
Silence some "implicit conversion of string literal" warnings

llvm-svn: 316038

6 years agoAMDGPU : Fix an error for the llvm.cttz implementation.
Wei Ding [Tue, 17 Oct 2017 21:49:52 +0000 (21:49 +0000)]
AMDGPU : Fix an error for the llvm.cttz implementation.

Differential Revision: http://reviews.llvm.org/D39014

llvm-svn: 316037

6 years agoAArch64: Enable AES instruction fusion on Cyclone.
Matthias Braun [Tue, 17 Oct 2017 21:46:15 +0000 (21:46 +0000)]
AArch64: Enable AES instruction fusion on Cyclone.

Note that cyclone itself doesn't fuse, but newer apple chips do and we
are using cyclone as the default when targeting apple OSes.

The current code also does not capture all fusion patterns of apple CPUs
yet; I am still looking for ways to refactor the code nicely to extend
it.

llvm-svn: 316036

6 years agoAArch64: account for possible frame index operand in compares.
Tim Northover [Tue, 17 Oct 2017 21:43:52 +0000 (21:43 +0000)]
AArch64: account for possible frame index operand in compares.

If the address of a local is used in a comparison, AArch64 can fold the
address-calculation into the comparison via "adds". Unfortunately, a couple of
places (both hit in this one test) are not ready to deal with that yet and just
assume the first source operand is a register.

llvm-svn: 316035

6 years ago[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Tue, 17 Oct 2017 21:27:42 +0000 (21:27 +0000)]
[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 316034

6 years ago[X86][SSE] Tests packuswb/truncation codegen from PR34773
Simon Pilgrim [Tue, 17 Oct 2017 21:14:53 +0000 (21:14 +0000)]
[X86][SSE] Tests packuswb/truncation codegen from PR34773

llvm-svn: 316033

6 years agoFix PR34981, a crash-on-invalid merging dllimport to an invalid redecl.
Nico Weber [Tue, 17 Oct 2017 21:14:02 +0000 (21:14 +0000)]
Fix PR34981, a crash-on-invalid merging dllimport to an invalid redecl.

This is basically like r288207, just the other way round.

llvm-svn: 316032

6 years ago[MachineOutliner][NFC] Clean up prune logic a bit
Jessica Paquette [Tue, 17 Oct 2017 21:11:58 +0000 (21:11 +0000)]
[MachineOutliner][NFC] Clean up prune logic a bit

Move the prune logic in pruneOverlaps to a new function, prune. This lets us
reuse the prune functionality. Makes the code a bit more readable. It'll also
make it easier to emit remarks/debug statements for pruned functions.

llvm-svn: 316031

6 years ago[CFG] Relax Wexceptions warning on rethrow
Erich Keane [Tue, 17 Oct 2017 20:57:24 +0000 (20:57 +0000)]
[CFG] Relax Wexceptions warning on rethrow

As reported here: https://bugs.llvm.org/show_bug.cgi?id=34973

"catch(...)" should catch EVERYTHING, even a rethrow. This
patch changes the order in which things are checked to ensure
that a '...' catch will get a rethrow.

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

llvm-svn: 316030

6 years agoRevert "[cmake] Use find_package to discover zlib"
Vassil Vassilev [Tue, 17 Oct 2017 20:51:25 +0000 (20:51 +0000)]
Revert "[cmake] Use find_package to discover zlib"

We are investigating what went wrong.

llvm-svn: 316029

6 years agoThis test case was missing -fsyntax-only, so I've added it. NFC to the actual test...
Aaron Ballman [Tue, 17 Oct 2017 20:49:30 +0000 (20:49 +0000)]
This test case was missing -fsyntax-only, so I've added it. NFC to the actual test contents, just how the test is executed.

llvm-svn: 316028

6 years agoFix typo in checkTwoLevelHintsCommand
Jessica Paquette [Tue, 17 Oct 2017 20:43:33 +0000 (20:43 +0000)]
Fix typo in checkTwoLevelHintsCommand

BigSize had a copy/paste typo in it. This fixes that.

llvm-svn: 316027

6 years agoEnable support for the [[nodiscard]] attribute from WG14 N2050 when enabling double...
Aaron Ballman [Tue, 17 Oct 2017 20:33:35 +0000 (20:33 +0000)]
Enable support for the [[nodiscard]] attribute from WG14 N2050 when enabling double square bracket attributes in C code.

llvm-svn: 316026

6 years ago[cmake] Use find_package to discover zlib
Vassil Vassilev [Tue, 17 Oct 2017 20:32:27 +0000 (20:32 +0000)]
[cmake] Use find_package to discover zlib

This allows us to use standard cmake utilities to point to non-system zlib
locations.

Patch by Oksana Shadura and me (D39002).

llvm-svn: 316025

6 years agoAMDGPU: Start generating metadata for MaxFlatWorkGroupSize
Konstantin Zhuravlyov [Tue, 17 Oct 2017 20:03:21 +0000 (20:03 +0000)]
AMDGPU: Start generating metadata for MaxFlatWorkGroupSize

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

llvm-svn: 316024

6 years agoRevert "[asan] Deflake one test by running it 3 times."
Evgeniy Stepanov [Tue, 17 Oct 2017 19:57:48 +0000 (19:57 +0000)]
Revert "[asan] Deflake one test by running it 3 times."

Disable this test on Android/x86 only.

llvm-svn: 316023

6 years agoExpose ConsumeAnyToken interface to external clients.
Vassil Vassilev [Tue, 17 Oct 2017 19:38:57 +0000 (19:38 +0000)]
Expose ConsumeAnyToken interface to external clients.

llvm-svn: 316022

6 years agoRefactor std::list node allocation logic.
Eric Fiselier [Tue, 17 Oct 2017 19:12:23 +0000 (19:12 +0000)]
Refactor std::list node allocation logic.

The logic to allocate a node within std::list was repeated
in a bunch of places. This is unneeded. This patch refactors
the shared logic into a single function to reduce duplication.

This patch is part of a set to clean up node construction in
general, but refactoring construction requires some more work
to make it work cleanly in C++03

llvm-svn: 316021

6 years ago[MachineOutliner][NFC] Move decrement logic to OutlinedFunction
Jessica Paquette [Tue, 17 Oct 2017 19:03:23 +0000 (19:03 +0000)]
[MachineOutliner][NFC] Move decrement logic to OutlinedFunction

This commit moves the decrement logic for outlined functions into the class,
and makes OccurrenceCount private. It can now be accessed via
getOccurrenceCount().

This makes it more difficult to accidentally introduce bugs by incorrectly
decrementing the occurrence count on OutlinedFunctions.

llvm-svn: 316020

6 years ago[MachineOutliner][NFC] Move end index calculation into Candidate
Jessica Paquette [Tue, 17 Oct 2017 18:43:15 +0000 (18:43 +0000)]
[MachineOutliner][NFC] Move end index calculation into Candidate

Cleanup to Candidate that moves all end index calculations into
Candidate.endIdx(). For the sake of consistency, StartIdx and Len are now
private members, and can be accessed with length() and startIdx() respectively.

llvm-svn: 316019

6 years agoFix signed overflow detected by ubsan
Vitaly Buka [Tue, 17 Oct 2017 18:33:15 +0000 (18:33 +0000)]
Fix signed overflow detected by ubsan

This overflow does not affect algorithm, so just suppress it.

llvm-svn: 316018

6 years ago[DAGCombine] Add SCALAR_TO_VECTOR undef handling to simplifyShuffleMask.
Simon Pilgrim [Tue, 17 Oct 2017 18:14:48 +0000 (18:14 +0000)]
[DAGCombine] Add SCALAR_TO_VECTOR undef handling to simplifyShuffleMask.

This allows us to simplify later visitVECTOR_SHUFFLE optimizations such as combineShuffleOfScalars.

Noticed whilst working on D38696

llvm-svn: 316017

6 years ago[OpenCL] Restrict swizzle length check to OpenCL mode
Bruno Cardoso Lopes [Tue, 17 Oct 2017 17:54:57 +0000 (17:54 +0000)]
[OpenCL] Restrict swizzle length check to OpenCL mode

Changes behavior introduced in r298369 to only error out on
vector component invalid length access on OpenCL mode.

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

rdar://problem/33568748

llvm-svn: 316016

6 years agoReplace use of SmallVector::back + pop_back with pop_back_val
Erich Keane [Tue, 17 Oct 2017 17:45:21 +0000 (17:45 +0000)]
Replace use of SmallVector::back + pop_back with pop_back_val

I ran across an instance where the value was being loaded
out via back, then immediately popped.  Since pop_back_val
is more efficient at this (it moves out), replace this
instance.

llvm-svn: 316015

6 years ago[llvm-special-case-list-fuzzer] Add fuzz target.
Matt Morehouse [Tue, 17 Oct 2017 17:43:34 +0000 (17:43 +0000)]
[llvm-special-case-list-fuzzer] Add fuzz target.

Summary: Create a fuzzer for sanitizer blacklists.

Patch by: hctim

Reviewers: morehouse

Reviewed By: morehouse

Subscribers: llvm-commits, mgorny, kcc

Differential Revision: https://review.llvm.org/D38981

llvm-svn: 316014

6 years agoSema: use new `getNS{,U}IntegerType` for NS{,U}Integer
Saleem Abdulrasool [Tue, 17 Oct 2017 17:39:32 +0000 (17:39 +0000)]
Sema: use new `getNS{,U}IntegerType` for NS{,U}Integer

Use the new helper methods to get the underlying type for NSUInteger,
NSInteger types.  This avoids spreading the knowledge of the underlying
types in various sites.  For non-LLP64 targets, this has no change.

llvm-svn: 316013

6 years ago[ARM, AArch64] adjust tests trying to maintain their objective; NFC
Sanjay Patel [Tue, 17 Oct 2017 16:54:56 +0000 (16:54 +0000)]
[ARM, AArch64] adjust tests trying to maintain their objective; NFC

A smarter compiler will see that these might be better without a jump table
if we're just using the constant values of the switch.

llvm-svn: 316012

6 years ago[OPENMP] Fix capturing of boolean variables in debug mode.
Alexey Bataev [Tue, 17 Oct 2017 16:47:34 +0000 (16:47 +0000)]
[OPENMP] Fix capturing of boolean variables in debug mode.

If the variables is boolean and we generating inner function with real
types, the codegen may crash because of not loading boolean value from
memory.

llvm-svn: 316011

6 years agolldb-server tests: Add support for testing debugserver
Pavel Labath [Tue, 17 Oct 2017 16:28:28 +0000 (16:28 +0000)]
lldb-server tests: Add support for testing debugserver

Summary:
This adds support for running the lldb-server test suite (currently consisting
of only one test) against the debugserver. Currently, the choice which binary
to test is based on the host system. This will need to be replaced by something
more elaborate if/when lldb-server starts supporting debugging on darwin.

I need to make a couple of tweaks to the test client to work with debugserver:
- debugserver has different command-line arguments - launching code adjusted to
  handle that
- debugserver sends duplicate "medata" fields in the stop reply packet -
  adjusted stop-reply parsing code to handle that
- debugserver replies to the k packet instead of just dropping the connection -
  stopping code adjusted, although we should probably consider aligning the
  behavior of the two stubs in this case

Reviewers: jmajors, beanz

Subscribers: srhines, mgorny, lldb-commits

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

llvm-svn: 316010

6 years agofix shadowing warnings in new tests, try 2
Eric Fiselier [Tue, 17 Oct 2017 16:06:42 +0000 (16:06 +0000)]
fix shadowing warnings in new tests, try 2

llvm-svn: 316009

6 years ago[SimplifyCFG] add test for part of PR34471 (switch squashing); NFC
Sanjay Patel [Tue, 17 Oct 2017 15:56:42 +0000 (15:56 +0000)]
[SimplifyCFG] add test for part of PR34471 (switch squashing); NFC

llvm-svn: 316008

6 years agoRemove shared_pointer from NativeThreadProtocol
Pavel Labath [Tue, 17 Oct 2017 15:52:16 +0000 (15:52 +0000)]
Remove shared_pointer from NativeThreadProtocol

Summary:
The NativeThread class is useless without the containing process (and in
some places it is already assuming the process is always around). This
makes it clear that the NativeProcessProtocol is the object owning the
threads, and makes the destruction order deterministic (first threads,
then process). The NativeProcess is the only thing holding a thread
unique_ptr, and methods that used to hand out thread shared pointers now
return raw pointers or references.

Reviewers: krytarowski, eugene

Subscribers: lldb-commits

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

llvm-svn: 316007

6 years ago[SimplifyCFG] update test to use auto-generated FileCheck asserts; NFC
Sanjay Patel [Tue, 17 Oct 2017 15:50:47 +0000 (15:50 +0000)]
[SimplifyCFG] update test to use auto-generated FileCheck asserts; NFC

llvm-svn: 316006

6 years agoFix pthread_[gs]etname_np detection
Sam McCall [Tue, 17 Oct 2017 15:32:17 +0000 (15:32 +0000)]
Fix pthread_[gs]etname_np detection

llvm-svn: 316005

6 years agoBring back part of r315721.
Rafael Espindola [Tue, 17 Oct 2017 15:29:11 +0000 (15:29 +0000)]
Bring back part of r315721.

The original patch was reported to break a libcxx bot. Unfortunately
I could not reproduce the issue and the bot log is not available anymore.

This patch changes the handling of just lazy symbols. I will watch the
bot and see it breaks.

Original message:
--------------------------------------------------------------
Handle shared and lazy symbol in the gnu hash construction.

We were not considering those symbols undefined and they could end up
in the end of the dynamic symbol table.
--------------------------------------------------------------

llvm-svn: 316004

6 years ago[mips] Provide more detailed comment. NFC
Simon Atanasyan [Tue, 17 Oct 2017 14:39:03 +0000 (14:39 +0000)]
[mips] Provide more detailed comment. NFC

llvm-svn: 316003

6 years ago[ELF] - Simplify. NFC.
George Rimar [Tue, 17 Oct 2017 14:31:29 +0000 (14:31 +0000)]
[ELF] - Simplify. NFC.

llvm-svn: 316002

6 years ago[OpenMP] Implement omp_is_initial_device() as builtin
Jonas Hahnfeld [Tue, 17 Oct 2017 14:28:14 +0000 (14:28 +0000)]
[OpenMP] Implement omp_is_initial_device() as builtin

This allows to return the static value that we know at compile time.

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

llvm-svn: 316001

6 years agoCodeGen: Fix invalid bitcasts for atomic builtins
Yaxun Liu [Tue, 17 Oct 2017 14:19:29 +0000 (14:19 +0000)]
CodeGen: Fix invalid bitcasts for atomic builtins

Currently clang assumes the temporary variables emitted during
codegen of atomic builtins have address space 0, which
is not true for target triple amdgcn---amdgiz and causes invalid
bitcasts.

This patch fixes that.

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

llvm-svn: 316000

6 years ago[clang-rename] Rename enum.
Haojian Wu [Tue, 17 Oct 2017 14:14:41 +0000 (14:14 +0000)]
[clang-rename] Rename enum.

Summary:
* Add unit tests for renaming enum.
* Support unscoped enum constants in expressions.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, mgorny, cfe-commits

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

llvm-svn: 315999

6 years ago[X86][Broadwell] Added the broadwell cpu to the scheduling regression tests.<NFC>
Gadi Haber [Tue, 17 Oct 2017 13:45:39 +0000 (13:45 +0000)]
[X86][Broadwell] Added the broadwell cpu to the scheduling regression tests.<NFC>

NFC.
Added the Broadwell cpu and the BROADWELL prefix to all the scheduling regression tests, as part of prepartion for a larger commit of adding all Broadwell scheduiling.

Reviewers: RKSimon, zvi, aaboud
Differential Revision: https://reviews.llvm.org/D38994

Change-Id: I54bc9065168844c107b1729fcdc1d311ce3ea0a9
llvm-svn: 315998

6 years agofix shadowing warnings in new tests
Eric Fiselier [Tue, 17 Oct 2017 13:45:20 +0000 (13:45 +0000)]
fix shadowing warnings in new tests

llvm-svn: 315997

6 years ago[CMake][OpenMP] Customize default offloading arch
Jonas Hahnfeld [Tue, 17 Oct 2017 13:37:36 +0000 (13:37 +0000)]
[CMake][OpenMP] Customize default offloading arch

For the shuffle instructions in reductions we need at least sm_30
but the user may want to customize the default architecture.

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

llvm-svn: 315996

6 years agoRefactor _LIBCPP_<LITTLE|BIG>_ENDIAN
Eric Fiselier [Tue, 17 Oct 2017 13:16:01 +0000 (13:16 +0000)]
Refactor _LIBCPP_<LITTLE|BIG>_ENDIAN

Previously this macro used 0/1 to indicate if it was set.
This is unlike all other libc++ configuration macros which
use ifdef/ifndef.

This patch makes this macro consistent with everything else.

llvm-svn: 315995

6 years ago[libc++] Fix PR34898 - vector iterator constructors and assign method perform push_ba...
Eric Fiselier [Tue, 17 Oct 2017 13:03:17 +0000 (13:03 +0000)]
[libc++] Fix PR34898 - vector iterator constructors and assign method perform push_back instead of emplace_back.

Summary:
The constructors `vector(Iter, Iter, Alloc = Alloc{})` and `assign(Iter, Iter)` don't correctly perform EmplaceConstruction from the result of dereferencing the iterator. This results in them performing an additional and unneeded copy.

This patch addresses the issue by correctly using `emplace_back` in C++11 and newer.

There are also some bugs in our `insert` implementation, but those will be handled separately.

@mclow.lists We should probably merge this into 5.1, agreed?

Reviewers: mclow.lists, dlj, EricWF

Reviewed By: mclow.lists, EricWF

Subscribers: cfe-commits, mclow.lists

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

llvm-svn: 315994

6 years ago[ELF] - Removed unused class from Options.td. NFC.
George Rimar [Tue, 17 Oct 2017 12:23:51 +0000 (12:23 +0000)]
[ELF] - Removed unused class from Options.td. NFC.

llvm-svn: 315993

6 years agoImprove clamp recognition in ValueTracking.
Nikolai Bozhenov [Tue, 17 Oct 2017 11:50:48 +0000 (11:50 +0000)]
Improve clamp recognition in ValueTracking.

Summary:
ValueTracking was recognizing not all variations of clamp. Swapping of
true value and false value of select was added to fix this problem. This
change breaks the canonical form of cmp inside the matchMinMax function,
that is why additional checks for compare predicates is needed. Added
corresponding test cases.

Reviewers: spatel

Subscribers: llvm-commits

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

Patch by: Artur Gainullin <artur.gainullin@intel.com>

llvm-svn: 315992

6 years agoFix implicit null check with negative offset
Yichao Yu [Tue, 17 Oct 2017 11:47:36 +0000 (11:47 +0000)]
Fix implicit null check with negative offset

Summary:
It seems that negative offset was accidentally allowed in D17967.
AFAICT small negative offset should be valid (always raise segfault) on all archs that I'm aware of (especially x86, which is the only one with this optimization enabled) and such case can be useful when loading hiden metadata from an object.

However, like the positive side, it should only be done within a certain limit.
For now, use the same limit on the positive side for the negative side.
A separate option can be added if needs appear.

Reviewers: mcrosier, skatkov

Reviewed By: skatkov

Subscribers: sanjoy, llvm-commits

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

llvm-svn: 315991

6 years agoFix `FaultMaps` crash when the out streamer is reused
Yichao Yu [Tue, 17 Oct 2017 11:44:34 +0000 (11:44 +0000)]
Fix `FaultMaps` crash when the out streamer is reused

Summary:
Make sure the map is cleared before processing a new module. Similar to what is done on `StackMaps`.

This issue is similar to D38588, though this time for FaultMaps (on x86) rather than ARM/AArch64. Other than possible mixing of information between modules, the crash is caused by the pointers values in the map that was allocated by the bump pointer allocator that is unwinded when emitting the next file. This issue has been around since 3.8.

This issue is likely much harder to write a test for since AFAICT it requires emitting something much more compilcated (and possibly real code) instead of just some random bytes.

Reviewers: skatkov, sanjoy

Reviewed By: skatkov, sanjoy

Subscribers: sanjoy, aemerson, llvm-commits, kristof.beyls

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

llvm-svn: 315990

6 years ago[CodeGen] Refine generation of TBAA info for bit-field lvalues
Ivan A. Kosarev [Tue, 17 Oct 2017 11:20:19 +0000 (11:20 +0000)]
[CodeGen] Refine generation of TBAA info for bit-field lvalues

The main change is that now we generate TBAA info before
constructing the resulting lvalue instead of constructing lvalue
with some default TBAA info and fixing it as necessary
afterwards. We also keep the TBAA info close to lvalue base info,
which is supposed to simplify their future merging.

This patch should not bring in any functional changes.

This is part of D38126 reworked to be a separate patch to
simplify review.

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

llvm-svn: 315989

6 years agoFix shared build of liblldCommon.so on Linux
Alexander Richardson [Tue, 17 Oct 2017 10:39:27 +0000 (10:39 +0000)]
Fix shared build of liblldCommon.so on Linux

llvm-svn: 315988

6 years ago[XRay][compiler-rt] Always place the CPU record first for every buffer
Dean Michael Berris [Tue, 17 Oct 2017 10:33:24 +0000 (10:33 +0000)]
[XRay][compiler-rt] Always place the CPU record first for every buffer

Summary:
In FDR Mode, when we set up a new buffer for a thread that's just
overflowed, we must place the CPU identifier with the TSC record as the
first record. This is so that we can reconstruct all the function
entry/exit with deltas rooted on a TSC record for the CPU at the
beginning of the buffer.

Without doing this, the tools are rejecting the log for cases when we've
overflown and have different buffers that don't have the CPU and TSC
records as the first entry in the buffers.

Reviewers: pelikan

Subscribers: llvm-commits

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

llvm-svn: 315987

6 years ago[CodeGen] Pass TBAA info along with lvalue base info everywhere
Ivan A. Kosarev [Tue, 17 Oct 2017 10:17:43 +0000 (10:17 +0000)]
[CodeGen] Pass TBAA info along with lvalue base info everywhere

This patch addresses the rest of the cases where we pass lvalue
base info, but do not provide corresponding TBAA info.

This patch should not bring in any functional changes.

This is part of D38126 reworked to be a separate patch to make
reviewing easier.

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

llvm-svn: 315986

6 years ago[X86][Skylake] fixed/updated regression test mmx-schedule.ll which failed after r315978.
Gadi Haber [Tue, 17 Oct 2017 10:00:08 +0000 (10:00 +0000)]
[X86][Skylake] fixed/updated regression test mmx-schedule.ll which failed after r315978.

Change-Id: I60cd7e03ea6c3d9a3dc661a882458e83feca66e3
llvm-svn: 315985

6 years ago[CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue base...
Ivan A. Kosarev [Tue, 17 Oct 2017 09:12:13 +0000 (09:12 +0000)]
[CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue base info

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

llvm-svn: 315984

6 years agoMore tests with x86 prefixes which work after rL315899 commit
Andrew V. Tischenko [Tue, 17 Oct 2017 08:49:47 +0000 (08:49 +0000)]
More tests with x86 prefixes which work after rL315899 commit

llvm-svn: 315983

6 years ago[Coverage] Discard deferred region in closing if-else
Vedant Kumar [Tue, 17 Oct 2017 07:47:39 +0000 (07:47 +0000)]
[Coverage] Discard deferred region in closing if-else

A trailing deferred region isn't necessary in a function that ends with
this pattern:

  ...
  else {
    ...
    return;
  }

Special-case this pattern so that the closing curly brace of the
function isn't marked as uncovered. This issue came up in PR34962.

llvm-svn: 315982

6 years ago[Coverage] Explicitly mark the l.h.s of && and || (fixes PR33465)
Vedant Kumar [Tue, 17 Oct 2017 06:51:54 +0000 (06:51 +0000)]
[Coverage] Explicitly mark the l.h.s of && and || (fixes PR33465)

This makes it possible to view sub-line region counts for the l.h.s of
&& and || expressions in coverage reports.

It also fixes PR33465, which shows an example of incorrect coverage
output for an assignment statement containing '||'.

llvm-svn: 315979

6 years ago[X86][SKL] Updated scheduling information for the SkylakeClient target
Gadi Haber [Tue, 17 Oct 2017 06:47:04 +0000 (06:47 +0000)]
[X86][SKL] Updated scheduling information for the SkylakeClient target

Updated the scheduling information for the SkylakeClient target with the following changes:

1. regrouped the instructions after adding load and store latencies.
2. regrouped the instructions after adding identified missing ports in several groups.
The changes were made after revisiting the latencies impact of all the load and store uOps.

Reviewers: zvi, RKSimon, craig.topper
Differential Revision: https://reviews.llvm.org/D38727

Change-Id: I778a308cc11e490e8fa5e27e2047412a1dca029f
llvm-svn: 315978

6 years agoRemove a test after revert of rL315440
Max Kazantsev [Tue, 17 Oct 2017 06:43:31 +0000 (06:43 +0000)]
Remove a test after revert of rL315440

llvm-svn: 315977

6 years ago[NFC] Add test from bug 34937
Max Kazantsev [Tue, 17 Oct 2017 06:37:58 +0000 (06:37 +0000)]
[NFC] Add test from bug 34937

llvm-svn: 315976

6 years agoRevert 315440 on behalf of mkazantsev
Philip Reames [Tue, 17 Oct 2017 06:21:07 +0000 (06:21 +0000)]
Revert 315440 on behalf of mkazantsev

This patch reverts rL315440 because of the bug described at
https://bugs.llvm.org/show_bug.cgi?id=34937

The fix for the bug is on review as D38944, but not yet ready.  Given this is a regression reverting until a fix is ready is called for.

Max would have done the revert himself, but is having trouble doing a build of fresh LLVM for some reason.  I did the build and test to ensure the revert worked as expected on his behalf.

llvm-svn: 315974

6 years ago[globalisel][tablegen] Add a GIM_CheckIsSameOperand test where OtherInsnID and OtherO...
Daniel Sanders [Tue, 17 Oct 2017 05:24:44 +0000 (05:24 +0000)]
[globalisel][tablegen] Add a GIM_CheckIsSameOperand test where OtherInsnID and OtherOpIdx differ

llvm-svn: 315972

6 years ago[X86] Add masked palignr tests to vector-shuffle-masked.ll
Craig Topper [Tue, 17 Oct 2017 04:17:56 +0000 (04:17 +0000)]
[X86] Add masked palignr tests to vector-shuffle-masked.ll

llvm-svn: 315971