platform/upstream/llvm.git
7 years ago[SelectionDAG] Add a check to getVectorShuffle to ensure that the only negative index...
Craig Topper [Thu, 19 Oct 2017 20:59:41 +0000 (20:59 +0000)]
[SelectionDAG] Add a check to getVectorShuffle to ensure that the only negative index we allow is -1.

llvm-svn: 316183

7 years ago[X86] Remove LowerEXTRACT_SUBVECTOR handler. All EXTRACT_SUBVECTORs are marked as...
Craig Topper [Thu, 19 Oct 2017 20:59:40 +0000 (20:59 +0000)]
[X86] Remove LowerEXTRACT_SUBVECTOR handler. All EXTRACT_SUBVECTORs are marked as legal.

llvm-svn: 316182

7 years agoAMDGPU: Parse r600 CPU name early and expose FMAF capability
Jan Vesely [Thu, 19 Oct 2017 20:40:13 +0000 (20:40 +0000)]
AMDGPU: Parse r600 CPU name early and expose FMAF capability

Improve amdgcn macro test
Differential Revision: https://reviews.llvm.org/D38667

llvm-svn: 316181

7 years ago[COFF] Avoid forward declaring StringSet, fix build
Martin Storsjo [Thu, 19 Oct 2017 20:19:16 +0000 (20:19 +0000)]
[COFF] Avoid forward declaring StringSet, fix build

This should fix the build after SVN r316178, which worked fine
on GCC 5.4, but failed on clang with errors like these:

MinGW.h:26:3: error: too few template arguments for class template 'StringSet'
  StringSet<> ExcludeSymbols;
  ^
lld/Common/LLVM.h:28:30: note: template is declared here
  template<typename T> class StringSet;

Don't forward declare and add the using directive in the main
lld/Common/LLVM.h header, but just qualify the class name
in MinGW.h instead.

llvm-svn: 316180

7 years ago[CGExprScalar] Add missing types in function GetIntrinsic
Guozhi Wei [Thu, 19 Oct 2017 20:11:23 +0000 (20:11 +0000)]
[CGExprScalar] Add missing types in function GetIntrinsic

In function GetIntrinsic, not all types are covered. Types double and long long are missed, type long is wrongly treated same as int, it should be same as long long. These problems cause compiler crashes when compiling code in PR31161. This patch fixed the problem.

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

llvm-svn: 316179

7 years ago[COFF] Move MinGW specific functions/classes to a separate file. NFC.
Martin Storsjo [Thu, 19 Oct 2017 19:49:38 +0000 (19:49 +0000)]
[COFF] Move MinGW specific functions/classes to a separate file. NFC.

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

llvm-svn: 316178

7 years ago[Sema] Fix assertion failure when checking for unused variables in a dependent context.
Benjamin Kramer [Thu, 19 Oct 2017 19:07:13 +0000 (19:07 +0000)]
[Sema] Fix assertion failure when checking for unused variables in a dependent context.

llvm-svn: 316177

7 years ago[X86][AES] Test AES intrinsics on 32/64-bit targets with/without VEX encoding
Simon Pilgrim [Thu, 19 Oct 2017 19:05:04 +0000 (19:05 +0000)]
[X86][AES] Test AES intrinsics on 32/64-bit targets with/without VEX encoding

Don't just test on 32-bit

llvm-svn: 316176

7 years agoThe cost of splitting a large vector instruction is not being taken into account...
Graham Yiu [Thu, 19 Oct 2017 18:16:31 +0000 (18:16 +0000)]
The cost of splitting a large vector instruction is not being taken into account by the getUserCost function. This was leading to some loops being over unrolled. The cost of a vector instruction is now being multiplied by the cost of the type legalization. This will return a more accurate cost.

Committing on behalf on Brad Nemanich (brad.nemanich@ibm.com)

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

llvm-svn: 316174

7 years agoLogging: Make sure logging machinery is in a consistent state after forking
Pavel Labath [Thu, 19 Oct 2017 17:40:51 +0000 (17:40 +0000)]
Logging: Make sure logging machinery is in a consistent state after forking

Summary:
We had a bug where if we had forked (in the ProcessLauncherPosixFork)
while another thread was writing a log message, we would deadlock. This
happened because the fork child inherited the locked log rwmutex, which
would never get unlocked. This meant the child got stuck trying to
disable all log channels.

The bug existed for a while but only started being apparent after
D37930, which started using ThreadLauncher (which uses logging) instead
of std::thread (which does not) for launching TaskPool threads.

The fix is to use pthread_atfork to make sure noone is writing a log
message while we are forking.

Reviewers: zturner, eugene, clayborg

Subscribers: lldb-commits

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

llvm-svn: 316173

7 years agoFix UB - signed integer overflow in regex. Thanks to Tim Shen for the patch. Reviewed...
Marshall Clow [Thu, 19 Oct 2017 17:39:16 +0000 (17:39 +0000)]
Fix UB - signed integer overflow in regex. Thanks to Tim Shen for the patch. Reviewed as https://reviews.llvm.org/D39066

llvm-svn: 316172

7 years agoAMDGPU/Docs: Fix unreadable characters
Konstantin Zhuravlyov [Thu, 19 Oct 2017 17:12:55 +0000 (17:12 +0000)]
AMDGPU/Docs: Fix unreadable characters

llvm-svn: 316171

7 years ago[Hexagon] Fix store conversion from rr to io in optimize addressing modes
Krzysztof Parzyszek [Thu, 19 Oct 2017 16:59:22 +0000 (16:59 +0000)]
[Hexagon] Fix store conversion from rr to io in optimize addressing modes

llvm-svn: 316170

7 years agoExecutionEngine: adjust COFF i386 tautological asserts
Saleem Abdulrasool [Thu, 19 Oct 2017 16:57:40 +0000 (16:57 +0000)]
ExecutionEngine: adjust COFF i386 tautological asserts

Modify static_casts to not be tautological in some COFF i386
relocations.

Patch by Alex Langford!

llvm-svn: 316169

7 years ago[RISCV] RISCVAsmParser: early exit if RISCVOperand isn't immediate as expected
Alex Bradbury [Thu, 19 Oct 2017 16:22:51 +0000 (16:22 +0000)]
[RISCV] RISCVAsmParser: early exit if RISCVOperand isn't immediate as expected

This is necessary to avoid an assertion in the included test case and similar
assembler inputs.

llvm-svn: 316168

7 years ago[RISCV][NFC] Drop unused parameter from createImm helper in RISCVAsmParser
Alex Bradbury [Thu, 19 Oct 2017 16:09:20 +0000 (16:09 +0000)]
[RISCV][NFC] Drop unused parameter from createImm helper in RISCVAsmParser

llvm-svn: 316167

7 years agoFix nodiscard for volatile references
Erich Keane [Thu, 19 Oct 2017 15:58:58 +0000 (15:58 +0000)]
Fix nodiscard for volatile references

As reported here https://bugs.llvm.org/show_bug.cgi?id=34988
[[nodiscard]] warnings were not being suppressed for
volatile-ref return values.

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

llvm-svn: 316166

7 years ago[AMDGPU] Fix bug in enqueued block codegen due to an extra line
Yaxun Liu [Thu, 19 Oct 2017 15:56:13 +0000 (15:56 +0000)]
[AMDGPU] Fix bug in enqueued block codegen due to an extra line

llvm-svn: 316165

7 years agoRevert r315992 because of a found miscompilation failure
Nikolai Bozhenov [Thu, 19 Oct 2017 15:36:18 +0000 (15:36 +0000)]
Revert r315992 because of a found miscompilation failure

llvm-svn: 316164

7 years ago[ELF] - Simplify. NFC.
George Rimar [Thu, 19 Oct 2017 15:03:59 +0000 (15:03 +0000)]
[ELF] - Simplify. NFC.

llvm-svn: 316163

7 years ago[X86] Replace custom scalar integer absolute matching with ISD::ABS lowering.
Simon Pilgrim [Thu, 19 Oct 2017 15:02:24 +0000 (15:02 +0000)]
[X86] Replace custom scalar integer absolute matching with ISD::ABS lowering.

x86 has its own copy of integer absolute pattern matching to combine directly to a SUB+CMOV.

This patch removes the x86 combine and adds custom lowering support for ISD::ABS instead, allowing us to use the DAGCombiner version.

Additional test cases are already covered by iabs.ll (rL315706 and rL315711).

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

llvm-svn: 316162

7 years agoFix MSVC signed/unsigned comparison warning
Simon Pilgrim [Thu, 19 Oct 2017 15:00:31 +0000 (15:00 +0000)]
Fix MSVC signed/unsigned comparison warning

llvm-svn: 316161

7 years ago[X86] Add scalar (abs (abs x)) -> (abs x) combine test.
Simon Pilgrim [Thu, 19 Oct 2017 14:59:26 +0000 (14:59 +0000)]
[X86] Add scalar (abs (abs x)) -> (abs x) combine test.

Before landing D38895

llvm-svn: 316160

7 years ago[RISCV] Prepare for the use of variable-sized register classes
Alex Bradbury [Thu, 19 Oct 2017 14:29:03 +0000 (14:29 +0000)]
[RISCV] Prepare for the use of variable-sized register classes

While parameterising by XLen, also take the opportunity to clean up the
formatting of the RISCV .td files.

This commit unifies the in-tree code with my patchset at
<https://github.com/lowrisc/riscv-llvm>.

llvm-svn: 316159

7 years agoRevert rL316156 due to failure on APFloatTest.fromToStringSpecials
Max Kazantsev [Thu, 19 Oct 2017 12:22:39 +0000 (12:22 +0000)]
Revert rL316156 due to failure on APFloatTest.fromToStringSpecials

llvm-svn: 316158

7 years ago[analyzer] Dump signed integers in SymIntExpr and IntSymExpr correctly
Gabor Horvath [Thu, 19 Oct 2017 11:58:21 +0000 (11:58 +0000)]
[analyzer] Dump signed integers in SymIntExpr and IntSymExpr correctly

Patch by: Adam Balogh!

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

llvm-svn: 316157

7 years agoFix APFloat from string conversion for Inf
Serguei Katkov [Thu, 19 Oct 2017 11:16:03 +0000 (11:16 +0000)]
Fix APFloat from string conversion for Inf

The method IEEEFloat::convertFromStringSpecials() does not recognize
the "+Inf" and "-Inf" strings but these strings are printed for
the double Infinities by the IEEEFloat::toString().

This patch adds the "+Inf" and "-Inf" strings to the list of recognized
patterns in IEEEFloat::convertFromStringSpecials().

Reviewers: sberg, bogner, majnemer, timshen, rnk, skatkov, gottesmm, bkramer, scanon
Reviewed By: skatkov
Subscribers: apilipenko, reames, llvm-commits
Differential Revision: https://reviews.llvm.org/D38030

llvm-svn: 316156

7 years ago[ARM GlobalISel] Fix liveins in test. NFC
Diana Picus [Thu, 19 Oct 2017 09:28:19 +0000 (09:28 +0000)]
[ARM GlobalISel] Fix liveins in test. NFC

llvm-svn: 316155

7 years ago[ARM GlobalISel] Remove redundant tests
Diana Picus [Thu, 19 Oct 2017 08:50:28 +0000 (08:50 +0000)]
[ARM GlobalISel] Remove redundant tests

These test cases don't really add anything that isn't covered by other
tests as well, so we can safely remove them.

llvm-svn: 316154

7 years agoRevert 316150 which reinstated r316025.
Vassil Vassilev [Thu, 19 Oct 2017 08:44:19 +0000 (08:44 +0000)]
Revert 316150 which reinstated r316025.

It fails on some bots and now we know how to reproduce it.

llvm-svn: 316153

7 years agoFix a few nits in RenamingAction.
Haojian Wu [Thu, 19 Oct 2017 08:20:55 +0000 (08:20 +0000)]
Fix a few nits in RenamingAction.

* Add missing override keyword.
* avoid unnecessary copy of std::string.

llvm-svn: 316152

7 years agoConst fix for YAMLParser.
Sam McCall [Thu, 19 Oct 2017 08:13:49 +0000 (08:13 +0000)]
Const fix for YAMLParser.

llvm-svn: 316151

7 years agoReinstate r316025, reverted in r316029.
Vassil Vassilev [Thu, 19 Oct 2017 08:04:22 +0000 (08:04 +0000)]
Reinstate r316025, reverted in r316029.

Original commit message:
"[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)."

The new patch brings back the old behavior in the cases where find_package
cannot find zlib.

llvm-svn: 316150

7 years ago[Headers] Fix typoed __ARM_DWARF_EH__ ifdefs
Martin Storsjo [Thu, 19 Oct 2017 07:40:45 +0000 (07:40 +0000)]
[Headers] Fix typoed __ARM_DWARF_EH__ ifdefs

These typos appeared in SVN r309226 and r309327.

llvm-svn: 316149

7 years ago[COFF] Exclude certain static libraries and object files when exporting all symbols
Martin Storsjo [Thu, 19 Oct 2017 06:56:04 +0000 (06:56 +0000)]
[COFF] Exclude certain static libraries and object files when exporting all symbols

This more or less matches what GNU ld does.

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

llvm-svn: 316148

7 years ago[Coverage] Simplify r316141. NFC.
Vedant Kumar [Thu, 19 Oct 2017 06:16:23 +0000 (06:16 +0000)]
[Coverage] Simplify r316141. NFC.

llvm-svn: 316147

7 years ago[NFC][IRCE] Filter out empty ranges early
Max Kazantsev [Thu, 19 Oct 2017 05:33:28 +0000 (05:33 +0000)]
[NFC][IRCE] Filter out empty ranges early

llvm-svn: 316146

7 years ago[MergeFunctions] Don't blindly RAUW a GlobalValue with a ConstantExpr.
whitequark [Thu, 19 Oct 2017 04:47:48 +0000 (04:47 +0000)]
[MergeFunctions] Don't blindly RAUW a GlobalValue with a ConstantExpr.

MergeFunctions uses (through FunctionComparator) a map of GlobalValues
to identifiers because it needs to compare functions and globals
do not have an inherent total order. Thus, FunctionComparator
(through GlobalNumberState) has a ValueMap<GlobalValue *>.

r315852 added a RAUW on globals that may have been previously
encountered by the FunctionComparator, which would replace
a GlobalValue * key with a ConstantExpr *, which is illegal.

This commit adjusts that code path to remove the function being
replaced from the ValueMap as well.

llvm-svn: 316145

7 years agoSimplify.
Rafael Espindola [Thu, 19 Oct 2017 01:32:18 +0000 (01:32 +0000)]
Simplify.

llvm-svn: 316144

7 years agoFix buffer overflow.
Rafael Espindola [Thu, 19 Oct 2017 01:25:48 +0000 (01:25 +0000)]
Fix buffer overflow.

We were reading past the end of the buffer.

llvm-svn: 316143

7 years ago[CMake] Allow parent projects to use in-source builds
Chris Bieneman [Thu, 19 Oct 2017 00:43:48 +0000 (00:43 +0000)]
[CMake] Allow parent projects to use in-source builds

LLVM checks if it is performing an in-source build and then stop the
build. However, this check is also triggered if LLVM is being build as
part of a parent project, which prevents the parent project itself from
using in-source builds. For example, CMake allows a parent project to
specify the output of its subproject:

add_subdirectory(llvm llvm_build)

This tells CMake to conduct an out-tree build of LLVM, which without
this patch will still fails because what is being tested is the parent
project, not LLVM. This is fixed by using the "CURRENT" variable, which
is only concerned by the CMakeLists that is actually bein processed at
the moment.

Tests:
Ran `make check-llvm`.

Patch by Henrique Jung <henriquenj_AT_gmail_DOT_com>

llvm-svn: 316142

7 years ago[llvm-cov] Move LineCoverageIterator to libCoverage. NFC.
Vedant Kumar [Wed, 18 Oct 2017 23:58:28 +0000 (23:58 +0000)]
[llvm-cov] Move LineCoverageIterator to libCoverage. NFC.

LineCoverageIterator makes it easy for clients of coverage data to
determine line execution counts for a file or function. The coverage
iteration logic is tricky enough that it really pays not to have
multiple copies of it. Hopefully having just one implementation in LLVM
will make the iteration logic easier to test, reuse, and update.

This commit is NFC but I've added a unit test to go along with it just
because it's easy to do now.

llvm-svn: 316141

7 years ago[llvm-cov] Use the coverage namespace. NFC.
Vedant Kumar [Wed, 18 Oct 2017 23:58:27 +0000 (23:58 +0000)]
[llvm-cov] Use the coverage namespace. NFC.

This is a simple code cleanup. It will facilitate moving
LineCoverageIterator to libCoverage.

llvm-svn: 316140

7 years agoGISel: Canonicalize select tests using update_mir_test_checks
Justin Bogner [Wed, 18 Oct 2017 23:33:31 +0000 (23:33 +0000)]
GISel: Canonicalize select tests using update_mir_test_checks

This runs `udpate_mir_test_checks --add-vreg-checks` on the tests taht
are already more or less in the format that generates, so that there
will be less churn in some upcoming changes.

llvm-svn: 316139

7 years agoAArch64/GISel: Modernize the localizer test
Justin Bogner [Wed, 18 Oct 2017 23:26:24 +0000 (23:26 +0000)]
AArch64/GISel: Modernize the localizer test

llvm-svn: 316138

7 years agoCanonicalize a large number of mir tests using update_mir_test_checks
Justin Bogner [Wed, 18 Oct 2017 23:18:12 +0000 (23:18 +0000)]
Canonicalize a large number of mir tests using update_mir_test_checks

This converts a large and somewhat arbitrary set of tests to use
update_mir_test_checks. I ran the script on all of the tests I expect
to need to modify for an upcoming mir syntax change and kept the ones
that obviously didn't change the tests in ways that might make it
harder to understand.

llvm-svn: 316137

7 years agoDon't suppress instantiation of definitions for variables subject to explicit
Richard Smith [Wed, 18 Oct 2017 22:45:01 +0000 (22:45 +0000)]
Don't suppress instantiation of definitions for variables subject to explicit
instantiation declarations if they are usable from constant expressions.

We are permitted to instantiate in these cases, and required to do so in order
to have an initializer available for use within constant evaluation.

llvm-svn: 316136

7 years ago[PM] Refactor the bounds checking pass to remove a method only called in
Chandler Carruth [Wed, 18 Oct 2017 22:42:36 +0000 (22:42 +0000)]
[PM] Refactor the bounds checking pass to remove a method only called in
one place.

llvm-svn: 316135

7 years agoupdate_mir_test_checks: Support adding checks for vreg classes
Justin Bogner [Wed, 18 Oct 2017 22:39:55 +0000 (22:39 +0000)]
update_mir_test_checks: Support adding checks for vreg classes

This is a temporary hack to support adding checks for the "registers:"
block of mir functions. This is necessary to convert a number of tests
so that there's less churn when we change the MIR printer to put the
vreg classes on defs instead of in their own block.

llvm-svn: 316134

7 years agoupdate_mir_test_checks: Improve message when updating fails
Justin Bogner [Wed, 18 Oct 2017 22:36:08 +0000 (22:36 +0000)]
update_mir_test_checks: Improve message when updating fails

llvm-svn: 316133

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

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

llvm-svn: 316079

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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