platform/upstream/llvm.git
6 years agoFix capitalization of parameter
Erich Keane [Wed, 18 Oct 2017 22:17:16 +0000 (22:17 +0000)]
Fix capitalization of parameter

The .cpp file has this properly capitalized, but
the header does not.  Simply fixed it.

llvm-svn: 316132

6 years ago[AMDGPU] Corrections to memory model description.
Tony Tye [Wed, 18 Oct 2017 22:16:55 +0000 (22:16 +0000)]
[AMDGPU] Corrections to memory model description.

 - Add description on nontemporal support.
 - Correct OpenCL sequentially consistent and fence code sequences.
 - Minor test cleanup.

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

llvm-svn: 316131

6 years ago[clang-format] Sort whole block of using declarations while partially formatting
Krasimir Georgiev [Wed, 18 Oct 2017 22:13:25 +0000 (22:13 +0000)]
[clang-format] Sort whole block of using declarations while partially formatting

Summary:
This patch enables sorting the full block of using declarations when
some line is affected.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 316130

6 years agoRevert "[ScalarEvolution] Handling for ICmp occuring in the evolution chain."
Sanjoy Das [Wed, 18 Oct 2017 22:00:57 +0000 (22:00 +0000)]
Revert "[ScalarEvolution] Handling for ICmp occuring in the evolution chain."

This reverts commit r316054.  There was some confusion over the review process:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20171016/495884.html

llvm-svn: 316129

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

llvm-svn: 316128

6 years ago[Driver] Fix use after free in Hexagon toolchain code.
Benjamin Kramer [Wed, 18 Oct 2017 21:43:42 +0000 (21:43 +0000)]
[Driver] Fix use after free in Hexagon toolchain code.

No functionality change intended.

llvm-svn: 316127

6 years agoFix lit.site.cfg.py.in after rL316123
Sam Clegg [Wed, 18 Oct 2017 20:46:05 +0000 (20:46 +0000)]
Fix lit.site.cfg.py.in after rL316123

llvm-svn: 316126

6 years agoFix a think-o in the design of the stable_XXX sort tests; only shows up for test...
Marshall Clow [Wed, 18 Oct 2017 20:40:57 +0000 (20:40 +0000)]
Fix a think-o in the design of the stable_XXX sort tests; only shows up for test cases > 255 elements

llvm-svn: 316125

6 years ago[AVR] Fix the select_mbb_placement_bug.ll test
Dylan McKay [Wed, 18 Oct 2017 20:04:57 +0000 (20:04 +0000)]
[AVR] Fix the select_mbb_placement_bug.ll test

llvm-svn: 316124

6 years agoDon't set static-libs test feature when using LLVM_LINK_LLVM_DYLIB
Sam Clegg [Wed, 18 Oct 2017 19:37:30 +0000 (19:37 +0000)]
Don't set static-libs test feature when using LLVM_LINK_LLVM_DYLIB

This was causing execname-options.ll to fail on the wasm
waterfall.

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

llvm-svn: 316123

6 years ago[llvm-cov] Suppress sub-line highlights in simple cases
Vedant Kumar [Wed, 18 Oct 2017 18:52:29 +0000 (18:52 +0000)]
[llvm-cov] Suppress sub-line highlights in simple cases

llvm-cov tends to highlight too many regions because its policy is to
highlight all region entry segments. This can look confusing to users:
not all region entry segments are interesting and deserve highlighting.
Emitting these highlights only when the region count differs from the
line count is a more user-friendly policy.

llvm-svn: 316109

6 years ago[llvm-cov] Pass LineCoverageStats in SourceCoverageView. NFC.
Vedant Kumar [Wed, 18 Oct 2017 18:52:28 +0000 (18:52 +0000)]
[llvm-cov] Pass LineCoverageStats in SourceCoverageView. NFC.

Instead of copying around the wrapped segment and the list of line
segments, just pass a reference to a LineCoverageStats object. This
simplifies the interface. It also makes an upcoming change to suppress
distracting highlights possible.

llvm-svn: 316108

6 years ago[llvm-cov] Highlight gaps in consecutive uncovered regions
Vedant Kumar [Wed, 18 Oct 2017 18:52:27 +0000 (18:52 +0000)]
[llvm-cov] Highlight gaps in consecutive uncovered regions

llvm-cov typically doesn't highlight gap segments, but it should if the
gap occurs after an uncovered region in order to preserve continuity.

llvm-svn: 316107

6 years agolldb-server tests: Fix undefined behavior
Pavel Labath [Wed, 18 Oct 2017 18:52:16 +0000 (18:52 +0000)]
lldb-server tests: Fix undefined behavior

We were creating a StringRef pointing to a temporary string. Problem manifested
itself when running the test on osx.

llvm-svn: 316106

6 years ago[refactor] Add a doc comment to the test function in the selection
Alex Lorenz [Wed, 18 Oct 2017 18:51:48 +0000 (18:51 +0000)]
[refactor] Add a doc comment to the test function in the selection
unittest.

As suggested by Haojian Wu!

llvm-svn: 316105

6 years ago[refactor] selection: new CodeRangeASTSelection represents a set of selected
Alex Lorenz [Wed, 18 Oct 2017 18:48:58 +0000 (18:48 +0000)]
[refactor] selection: new CodeRangeASTSelection represents a set of selected
consecutive statements

This commit adds a CodeRangeASTSelection value to the refactoring library. This
value represents a set of selected statements in one body of code.

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

llvm-svn: 316104

6 years ago[clang-proto-fuzzer] Use ToT protobuf-mutator.
Matt Morehouse [Wed, 18 Oct 2017 18:38:04 +0000 (18:38 +0000)]
[clang-proto-fuzzer] Use ToT protobuf-mutator.

llvm-svn: 316103

6 years ago[Hexagon] Handling of new HVX flags and target-features
Sumanth Gundapaneni [Wed, 18 Oct 2017 18:10:13 +0000 (18:10 +0000)]
[Hexagon] Handling of new HVX flags and target-features

This patch has the following changes
A new flag "-mhvx-length={64B|128B}" is introduced to specify the length of the vector.
Previously we have used "-mhvx-double" for 128 Bytes. This adds the target-feature "+hvx-length{64|128}b"

The "-mhvx" flag must be provided on command line to enable HVX for Hexagon. If no -mhvx-length flag
is specified, a default length is picked from the arch mentioned in this priority order from either -mhvx=vxx
or -mcpu. For v60 and v62 the default length is 64 Byte. For unknown versions, the length is 128 Byte. The
-mhvx flag adds the target-feature "+hvxv{hvx_version}"

The 64 Byte mode is soon going to be deprecated. A warning is emitted if 64 Byte is enabled. A warning is
still emitted for the default 64 Byte as well. This warning can be suppressed with a -Wno flag.

The "-mhvx-double" and "-mno-hvx-double" flags are deprecated. A warning is emitted if the driver sees
them on commandline. "-mhvx-double" is an alias to "-mhvx-length=128B"

The compilation will error out if -mhvx-length is specified with out an -mhvx/-mhvx= flag

The macro HVX_LENGTH is defined and is set to the length of the vector.
Eg: #define HVX_LENGTH 64

The macro HVX_ARCH is defined and is set to the version of the HVX.
Eg: #define HVX_ARCH 62

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

llvm-svn: 316102

6 years ago[Hexagon] New HVX target features.
Sumanth Gundapaneni [Wed, 18 Oct 2017 18:07:07 +0000 (18:07 +0000)]
[Hexagon] New HVX target features.

This patch lets the llvm tools handle the new HVX target features that
are added by frontend (clang). The target-features are of the form
"hvx-length64b" for 64 Byte HVX mode, "hvx-length128b" for 128 Byte mode HVX.
"hvx-double" is an alias to "hvx-length128b" and is soon will be deprecated.
The hvx version target feature is upgated form "+hvx" to "+hvxv{version_number}.
Eg: "+hvxv62"

For the correct HVX code generation, the user must use the following
target features.
For 64B mode: "+hvxv62" "+hvx-length64b"
For 128B mode: "+hvxv62" "+hvx-length128b"

Clang picks a default length if none is specified. If for some reason,
no hvx-length is specified to llvm, the compilation will bail out.
There is a corresponding clang patch.

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

llvm-svn: 316101

6 years agoAMDGPU/Docs: Make target naming consistent
Konstantin Zhuravlyov [Wed, 18 Oct 2017 17:59:20 +0000 (17:59 +0000)]
AMDGPU/Docs: Make target naming consistent

  - R600 Arch: Use Radeon HD XXXX Series
  - GCN Arch: Use GFXX

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

llvm-svn: 316100

6 years ago[Hexagon] Update Hexagon ArchEnum and sync some downstream changes(NFC)
Sumanth Gundapaneni [Wed, 18 Oct 2017 17:45:22 +0000 (17:45 +0000)]
[Hexagon] Update Hexagon ArchEnum and sync some downstream changes(NFC)

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

llvm-svn: 316099

6 years ago[Hexagon] Mark vector loads as predicable, update instruction mappings
Krzysztof Parzyszek [Wed, 18 Oct 2017 17:36:46 +0000 (17:36 +0000)]
[Hexagon] Mark vector loads as predicable, update instruction mappings

All loads of form V6_vL32b_{,cur,nt,tmp,nt_cur,nt_tmp}_{ai,pi,ppu} are
predicable on v62 (but not on v60). Mark them all as predicable in the
instruction definitions, and handle the v60 case in HII::isPredicable.

llvm-svn: 316098

6 years agoAMDGPU: Rename MaxFlatWorkgroupSize to MaxFlatWorkGroupSize for consistency
Konstantin Zhuravlyov [Wed, 18 Oct 2017 17:31:09 +0000 (17:31 +0000)]
AMDGPU: Rename MaxFlatWorkgroupSize to MaxFlatWorkGroupSize for consistency

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

llvm-svn: 316097

6 years agoEnable support for the [[maybe_unused]] attribute from WG14 N2053 when enabling doubl...
Aaron Ballman [Wed, 18 Oct 2017 16:59:27 +0000 (16:59 +0000)]
Enable support for the [[maybe_unused]] attribute from WG14 N2053 when enabling double square bracket attributes in C code.

llvm-svn: 316096

6 years agoFix regex bug with ^\W. Thanks to Tim Shen for the patch. Reviewed as https://reviews...
Marshall Clow [Wed, 18 Oct 2017 16:49:22 +0000 (16:49 +0000)]
Fix regex bug with ^\W. Thanks to Tim Shen for the patch. Reviewed as https://reviews.llvm.org/D37955

llvm-svn: 316095

6 years ago[clang-tidy] Fix 32bit platform MSVC
Jonas Toth [Wed, 18 Oct 2017 16:40:19 +0000 (16:40 +0000)]
[clang-tidy] Fix 32bit platform MSVC

The previous fix only worked for 64bit MSVC, this one should fix all different
architectures.

llvm-svn: 316094

6 years ago[clang-tidy] Fix buildbot for msvc
Jonas Toth [Wed, 18 Oct 2017 16:28:06 +0000 (16:28 +0000)]
[clang-tidy] Fix buildbot for msvc

The testcase defined `FILE` as `unsigned long`, but MSVC expect `unsigned long long`.

llvm-svn: 316093

6 years ago[clang-tidy] introduce legacy resource functions to 'cppcoreguidelines-owning-memory'
Jonas Toth [Wed, 18 Oct 2017 16:14:15 +0000 (16:14 +0000)]
[clang-tidy] introduce legacy resource functions to 'cppcoreguidelines-owning-memory'

Summary:
This patch introduces support for legacy C-style resource functions that must obey
the 'owner<>' semantics.

- added legacy creators like malloc,fopen,...
- added legacy consumers like free,fclose,...

This helps codes that mostly benefit from owner:
Legacy, C-Style code that isn't feasable to port directly to RAII but needs a step in between
to identify actual resource management and just using the resources.

Reviewers: aaron.ballman, alexfh, hokein

Reviewed By: aaron.ballman

Subscribers: nemanjai, JDevlieghere, xazax.hun, kbarton

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

llvm-svn: 316092

6 years ago[RISCV] Bugfix createRISCVELFObjectWriter
Alex Bradbury [Wed, 18 Oct 2017 16:11:31 +0000 (16:11 +0000)]
[RISCV] Bugfix createRISCVELFObjectWriter

r315275 set the IsLittleEndian parameter incorrectly. This patch corrects
this, and adds a test to ensure such mistakes will be caught in the future.

llvm-svn: 316091

6 years agoSupport Objective-C/C++ source files in check_clang_tidy.py
Haojian Wu [Wed, 18 Oct 2017 15:56:39 +0000 (15:56 +0000)]
Support Objective-C/C++ source files in check_clang_tidy.py

check_clang_tidy.py currently only handles C and C++ source files.

This extends the logic to also handle Objective-C (.m) and
Objective-C++ (.mm) files.

However, by default, clang compiles .m/.mm files using Objective-C 1.0
syntax. Objective-C 2.0 has been the default in Xcode for about 10
years, and Objective-C Automatic Reference Counting (ARC) for about 6
years, so this enables both by default.

(Clients which actually want to test clang-tidy checks for Objective-C
 1.0 or non-ARC files can pass custom flags to check_clang_tidy.py
 after --, which will disable the Objective-C 2.0 and ARC flags).

I did not add logic to handle running clang-tidy on Objective-C header
files alone; they also use the .h file extension, so we'd need to
look inside their contents.

I included a new test to confirm the new behavior.

Depends On D38963

Patch by Ben Hamilton!

llvm-svn: 316090

6 years agoupdate_mir_test_checks: Handle empty liveins
Justin Bogner [Wed, 18 Oct 2017 15:38:56 +0000 (15:38 +0000)]
update_mir_test_checks: Handle empty liveins

An empty livein block doesn't make much sense (why not just omit it?)
but they're legal and some tests have them, so its best to handle it.

llvm-svn: 316089

6 years agoupdate_mir_test_checks: Do a better job of disambiguating names
Justin Bogner [Wed, 18 Oct 2017 15:37:09 +0000 (15:37 +0000)]
update_mir_test_checks: Do a better job of disambiguating names

Matching prefixes isn't good enough, because it leads to things like
calling the first constant C3 just because there were two copies
before it. Tighten up the check to match more precisely, but also be
careful about ambiguity when dealing with target opcodes that end in a
number.

llvm-svn: 316088

6 years agoAArch64/GISel: Fix a couple of tests that were testing the wrong thing
Justin Bogner [Wed, 18 Oct 2017 15:34:33 +0000 (15:34 +0000)]
AArch64/GISel: Fix a couple of tests that were testing the wrong thing

Fix a couple of tests that were extending the wrong vreg, and
regenerate their checks with update_mir_test_checks. This looks like
it was a copy-paste or test update error.

llvm-svn: 316087

6 years agoSilencing a redefinition warning that was not germane to the test.
Aaron Ballman [Wed, 18 Oct 2017 14:48:33 +0000 (14:48 +0000)]
Silencing a redefinition warning that was not germane to the test.

llvm-svn: 316086

6 years ago[ARM] Fix disassembly for conditional VMRS and VMSR instructions in ARM mode
Andre Vieira [Wed, 18 Oct 2017 14:47:37 +0000 (14:47 +0000)]
[ARM] Fix disassembly for conditional VMRS and VMSR instructions in ARM mode

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

llvm-svn: 316085

6 years ago[mips] Fix analyzeBranch to handle debug data
Simon Dardis [Wed, 18 Oct 2017 14:35:29 +0000 (14:35 +0000)]
[mips] Fix analyzeBranch to handle debug data

In the case where there was a conditional branch followed by a unconditional
branch with debug instruction separating them, MipsInstrInfo::analyzeBranch
would not skip past debug instruction when searching for the second branch
which give erroneous results about the control flow of the block.

This could lead to the branch folder to merge the non-fall through case
into it's predecessor, leaving the conditional branch with a dangling
basic block operand.

This resolves PR34975.

Thanks to Alexander Richardson for reporting the issue!

Reviewers: atanasyan

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

llvm-svn: 316084

6 years agoEnable support for the [[fallthrough]] attribute from WG14 N2052 when enabling double...
Aaron Ballman [Wed, 18 Oct 2017 14:33:27 +0000 (14:33 +0000)]
Enable support for the [[fallthrough]] attribute from WG14 N2052 when enabling double square bracket attributes in C code.

llvm-svn: 316083

6 years agoFixup patch for revision rL316070.
Nikolai Bozhenov [Wed, 18 Oct 2017 14:24:50 +0000 (14:24 +0000)]
Fixup patch for revision rL316070.

Added check that type of CmpConst and source type of trunc are equal
for correct matching of the case when we can set widened C constant
equal to CmpConstant.

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

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

llvm-svn: 316082

6 years ago[mips] Move test to correct directory. NFCI
Simon Dardis [Wed, 18 Oct 2017 13:59:48 +0000 (13:59 +0000)]
[mips] Move test to correct directory. NFCI

llvm-svn: 316081

6 years agoAdding new test for
Michael Zuckerman [Wed, 18 Oct 2017 13:51:31 +0000 (13:51 +0000)]
Adding new test for
bug fix 316067 https://bugs.llvm.org/show_bug.cgi?id=34978

This test checks that the x86-interleaved ends without any
assertion.

Change-Id: I1e970482a4d0404516cbc85517fc091bb21c35a8
llvm-svn: 316080

6 years agoUntabify.
NAKAMURA Takumi [Wed, 18 Oct 2017 13:31:28 +0000 (13:31 +0000)]
Untabify.

llvm-svn: 316079

6 years ago[ELF] - Removed outdated comment. NFC.
George Rimar [Wed, 18 Oct 2017 13:22:21 +0000 (13:22 +0000)]
[ELF] - Removed outdated comment. NFC.

llvm-svn: 316078

6 years ago[ELF] - Moved, fixed outdated comment. NFC.
George Rimar [Wed, 18 Oct 2017 13:06:18 +0000 (13:06 +0000)]
[ELF] - Moved, fixed outdated comment. NFC.

It was at wrong place.

llvm-svn: 316077

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