platform/upstream/llvm.git
6 years agoRepresent runtime preemption in the IR.
Sean Fertile [Thu, 26 Oct 2017 15:00:26 +0000 (15:00 +0000)]
Represent runtime preemption in the IR.

Currently we do not represent runtime preemption in the IR, which has several
drawbacks:

  1) The semantics of GlobalValues differ depending on the object file format
     you are targeting (as well as the relocation-model and -fPIE value).
  2) We have no way of disabling inlining of run time interposable functions,
     since in the IR we only know if a function is link-time interposable.
     Because of this llvm cannot support elf-interposition semantics.
  3) In LTO builds of executables we will have extra knowledge that a symbol
     resolved to a local definition and can't be preemptable, but have no way to
     propagate that knowledge through the compiler.

This patch adds preemptability specifiers to the IR with the following meaning:

dso_local --> means the compiler may assume the symbol will resolve to a
 definition within the current linkage unit and the symbol may be accessed
 directly even if the definition is not within this compilation unit.

dso_preemptable --> means that the compiler must assume the GlobalValue may be
replaced with a definition from outside the current linkage unit at runtime.

To ease transitioning dso_preemptable is treated as a 'default' in that
low-level codegen will still do the same checks it did previously to see if a
symbol should be accessed indirectly. Eventually when IR producers emit the
specifiers on all Globalvalues we can change dso_preemptable to mean 'always
access indirectly', and remove the current logic.

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

llvm-svn: 316668

6 years agoAMDGPU: Handle s_buffer_load_dword hazard on SI
Marek Olsak [Thu, 26 Oct 2017 14:43:02 +0000 (14:43 +0000)]
AMDGPU: Handle s_buffer_load_dword hazard on SI

Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, llvm-commits, t-tye

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

llvm-svn: 316666

6 years ago[LSV] Avoid adding vectors of pointers as candidates
Bjorn Pettersson [Thu, 26 Oct 2017 13:59:15 +0000 (13:59 +0000)]
[LSV] Avoid adding vectors of pointers as candidates

Summary:
We no longer add vectors of pointers as candidates for
load/store vectorization. It does not seem to work anyway,
but without this patch we can end up in asserts when trying
to create casts between an integer type and the pointer of
vectors type.

The test case I've added used to assert like this when trying to
cast between i64 and <2 x i16*>:
opt: ../lib/IR/Instructions.cpp:2565: Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.
#0 PrintStackTraceSignalHandler(void*)
#1 SignalHandler(int)
#2 __restore_rt
#3 __GI_raise
#4 __GI_abort
#5 __GI___assert_fail
#6 llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::Instruction*)
#7 llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>::CreateBitOrPointerCast(llvm::Value*, llvm::Type*, llvm::Twine const&)
#8 Vectorizer::vectorizeStoreChain(llvm::ArrayRef<llvm::Instruction*>, llvm::SmallPtrSet<llvm::Instruction*, 16u>*)

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: nhaehnle, llvm-commits

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

llvm-svn: 316665

6 years ago[LSV] Skip all non-byte sizes, not only less than eight bits
Bjorn Pettersson [Thu, 26 Oct 2017 13:42:55 +0000 (13:42 +0000)]
[LSV] Skip all non-byte sizes, not only less than eight bits

Summary:
The code comments indicate that no effort has been spent on
handling load/stores when the size isn't a multiple of the
byte size correctly. However, the code only avoided types
smaller than 8 bits. So for example a load of an i28 could
still be considered as a candidate for vectorization.

This patch adjusts the code to behave according to the code
comment.

The test case used to hit the following assert when
trying to use "cast" an i32 to i28 using CreateBitOrPointerCast:

opt: ../lib/IR/Instructions.cpp:2565: Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.
#0 PrintStackTraceSignalHandler(void*)
#1 SignalHandler(int)
#2 __restore_rt
#3 __GI_raise
#4 __GI_abort
#5 __GI___assert_fail
#6 llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::Instruction*)
#7 llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>::CreateBitOrPointerCast(llvm::Value*, llvm::Type*, llvm::Twine const&)
#8 (anonymous namespace)::Vectorizer::vectorizeLoadChain(llvm::ArrayRef<llvm::Instruction*>, llvm::SmallPtrSet<llvm::Instruction*, 16u>*)

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: llvm-commits

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

llvm-svn: 316663

6 years ago[Sema] -Wzero-as-null-pointer-constant: don't warn for system macros other than NULL.
Roman Lebedev [Thu, 26 Oct 2017 13:18:14 +0000 (13:18 +0000)]
[Sema] -Wzero-as-null-pointer-constant: don't warn for system macros other than NULL.

Summary:
The warning was initially introduced in D32914 by @thakis,
and the concerns were raised there, and later in rL302247
and PR33771.

I do believe that it makes sense to relax the diagnostic
e.g. in this case, when the expression originates from the
system header, which can not be modified. This prevents
adoption for the diagnostic for codebases which use pthreads
(`PTHREAD_MUTEX_INITIALIZER`), gtest, etc.

As @malcolm.parsons suggests, it *may* make sense to also
not warn for the template types, but it is not obvious to
me how to do that in here.

Though, it still makes sense to complain about `NULL` macro.

While there, add more tests.

Reviewers: dblaikie, thakis, rsmith, rjmccall, aaron.ballman

Reviewed By: thakis

Subscribers: Rakete1111, hans, cfe-commits, thakis, malcolm.parsons

Tags: #clang

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

llvm-svn: 316662

6 years agoTry to fix warnings and windows test failures caused by r316653
Eric Liu [Thu, 26 Oct 2017 13:09:50 +0000 (13:09 +0000)]
Try to fix warnings and windows test failures caused by r316653

llvm-svn: 316661

6 years ago[Simplify] Mark (and sweep) based on latest access relation.
Michael Kruse [Thu, 26 Oct 2017 12:34:36 +0000 (12:34 +0000)]
[Simplify] Mark (and sweep) based on latest access relation.

Previously we marked scalars based on the original access function. However,
when a scalar read access is redirected, the original definition
(or incoming values of a PHI) is not used anymore, and can be deleted
(unless referenced by use that has not been redirected).

llvm-svn: 316660

6 years ago[clangd] Report an error on findDefinitions/signatureHelp on an unopened file instead...
Benjamin Kramer [Thu, 26 Oct 2017 12:28:13 +0000 (12:28 +0000)]
[clangd] Report an error on findDefinitions/signatureHelp on an unopened file instead of crashing.

Found by clangd-fuzzer.

llvm-svn: 316659

6 years agoAdd a new attribute definition spelling, Clang<"attr">, that expands to two attribute...
Aaron Ballman [Thu, 26 Oct 2017 12:19:02 +0000 (12:19 +0000)]
Add a new attribute definition spelling, Clang<"attr">, that expands to two attribute spellings: GNU<"attr"> and CXX11<"clang", "attr">. This is similar to how the GCC spelling works and is intended to be used for attributes introduced for Clang.

Changes all existing attributes that currently use GNU<"attr"> and CXX11<"clang", "attr> spellings to instead use the Clang<"attr"> spelling.

No additional tests are necessary because the existing tests already use both spellings for the attributes converted to the new spelling. No functional changes are expected.

llvm-svn: 316658

6 years ago[libunwind] Always use unwind tables in tests
Peter Smith [Thu, 26 Oct 2017 12:02:03 +0000 (12:02 +0000)]
[libunwind] Always use unwind tables in tests

For many targets setting -fno-exceptions will prevent unwinding tables from
being generated for the test programs. As libunwind depends on the tables to
unwind the stack several tests will fail.

This change always adds -funwind-tables so that even when -fno-exceptions
is set unwind tables are generated.

fixes PR33858

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

llvm-svn: 316657

6 years ago[mips] Fix (dis)assembly of abs.fmt for micromips
Simon Dardis [Thu, 26 Oct 2017 11:36:54 +0000 (11:36 +0000)]
[mips] Fix (dis)assembly of abs.fmt for micromips

These instructions were previously marked as codegen only preventing
them from being assembled as microMIPS or disassembled.

Reviewers: atanasyan, abeserminji

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

llvm-svn: 316656

6 years agoIt's a test to demonstrate wrong disassembler with 0x67 prefix
Andrew V. Tischenko [Thu, 26 Oct 2017 11:14:43 +0000 (11:14 +0000)]
It's a test to demonstrate wrong disassembler with 0x67 prefix

llvm-svn: 316655

6 years ago[mips] Fix PR35071
Simon Dardis [Thu, 26 Oct 2017 10:58:36 +0000 (10:58 +0000)]
[mips] Fix PR35071

PR35071 exposed the fact that MipsInstrInfo::removeBranch did not walk past
debug instructions when removing branches for the control flow optimizer, which
lead to duplicated conditional branches. If the target of the branch was a
removable block, only the conditional branch in the terminating position would
have it's MBB operands updated, leaving the first branch with a dangling MBB
operand. The MIPS long branch pass would then trigger an assertion when
attempting to examine the instruction with dangling MBB operand.

This resolves PR35071.

Thanks to Alex Richardson for reporting the issue!

Reviewers: atanasyan

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

llvm-svn: 316654

6 years ago[Tooling] A new framework for executing clang frontend actions.
Eric Liu [Thu, 26 Oct 2017 10:38:14 +0000 (10:38 +0000)]
[Tooling] A new framework for executing clang frontend actions.

Summary:
This defines a `clang::tooling::ToolExecutor` interface that can be extended to support different execution plans including standalone execution on a given set of TUs or parallel execution on all TUs in a codebase.

In order to enable multiprocessing execution, tool actions are expected to output result into a `ToolResults` interface provided by executors. The `ToolResults` interface abstracts how results are stored e.g. in-memory for standalone executions or on-disk for large-scale execution.

New executors can be registered as `ToolExecutorPlugin`s via the `ToolExecutorPluginRegistry`. CLI tools can use `createExecutorFromCommandLineArgs` to create a specific registered executor according to the command-line arguments.

This patch also implements `StandaloneToolExecutor` which has the same behavior as the current `ClangTool` interface, i.e. execute frontend actions on a given set of TUs. At this point, it's simply a wrapper around `ClangTool` at this point.

This is still experimental but expected to replace the existing `ClangTool` interface so that specific tools would not need to worry about execution.

Reviewers: klimek, arphaman, hokein, sammccall

Reviewed By: klimek

Subscribers: cfe-commits, djasper, mgorny, omtcyfz

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

llvm-svn: 316653

6 years ago[clangd] Don't crash on empty textDocument/didChange.
Benjamin Kramer [Thu, 26 Oct 2017 10:36:20 +0000 (10:36 +0000)]
[clangd] Don't crash on empty textDocument/didChange.

Found by clangd-fuzzer.

llvm-svn: 316652

6 years agoUpdate my email addresses, NFC.
Simon Dardis [Thu, 26 Oct 2017 10:16:54 +0000 (10:16 +0000)]
Update my email addresses, NFC.

llvm-svn: 316651

6 years ago[clangd] Don't use /// for non-doxygen comments.
Benjamin Kramer [Thu, 26 Oct 2017 10:07:04 +0000 (10:07 +0000)]
[clangd] Don't use /// for non-doxygen comments.

llvm-svn: 316650

6 years ago[clangd] Add a simple fuzzer. It crashes a lot :)
Benjamin Kramer [Thu, 26 Oct 2017 10:03:11 +0000 (10:03 +0000)]
[clangd] Add a simple fuzzer. It crashes a lot :)

llvm-svn: 316649

6 years ago[ELF] - Dedupliсate FDEs when sections are ICFed.
George Rimar [Thu, 26 Oct 2017 09:13:19 +0000 (09:13 +0000)]
[ELF] - Dedupliсate FDEs when sections are ICFed.

When LLD do ICF for 2 identical sections it leaves 2 duplicate entries in .eh_frame
pointing to the same address. After that it fixes .eh_frame_header's header,
so that it says it contains single FDE, though section itself contains 2
(it contains garbage data at tail).

As a result excessive entries in .eh_frame and excessive dummy data in .eh_frame_header
emited to output. Patch fixes that. This is PR34518.

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

llvm-svn: 316648

6 years ago[PowerPC] Use record-form instruction for Less-or-Equal -1 and Greater-or-Equal 1
Hiroshi Inoue [Thu, 26 Oct 2017 09:01:51 +0000 (09:01 +0000)]
[PowerPC] Use record-form instruction for Less-or-Equal -1 and Greater-or-Equal 1

Currently a record-form instruction is used for comparison of "greater than -1" and "less than 1" by modifying the predicate (e.g. LT 1 into LE 0) in addition to the naive case of comparison against 0.
This patch also enables emitting a record-form instruction for "less than or equal to -1" (i.e. "less than 0") and "greater than or equal to 1" (i.e. "greater than 0") to increase the optimization opportunities.

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

llvm-svn: 316647

6 years agoFix overloaded static functions in SemaCodeComplete
Benjamin Kramer [Thu, 26 Oct 2017 08:41:28 +0000 (08:41 +0000)]
Fix overloaded static functions in SemaCodeComplete

https://bugs.llvm.org/show_bug.cgi?id=33904
Happens when static function is accessed via the class variable. That leads to incorrect overloads number because the variable is considered as the first argument.

struct Bar {
  static void foo(); static void foo(int);
};

int main() {
  Bar b;
  b.foo(/*complete here*/); // did not work before
  Bar::foo(/*complete here*/); // worked fine
}

Patch by Ivan Donchevskii!

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

llvm-svn: 316646

6 years ago[clang-tidy ObjC] [2/3] Support non-C++ files in ClangTidyTest
Haojian Wu [Thu, 26 Oct 2017 08:37:25 +0000 (08:37 +0000)]
[clang-tidy ObjC] [2/3] Support non-C++ files in ClangTidyTest

Summary:
This is part 2 of 3 of a series of changes to improve
Objective-C linting in clang-tidy.

Currently, `clang::tidy::test::runCheckOnCode()` assumes all files
are C++ and unconditionally adds `-std=c++11` to the list of
`clang-tidy` options.

This updates the logic to check the extension of the source file
and only add `-std=c++11` if the extension indicates C++ or
Objective-C++.

Depends On D39188

Test Plan:

  ninja ClangTidyTests && \
  ./tools/clang/tools/extra/unittests/clang-tidy/ClangTidyTests

Patch by Ben Hamilton!

Reviewers: hokein, alexfh

Reviewed By: hokein

Subscribers: Wizard

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

llvm-svn: 316645

6 years agoTidy up CountingFunctionInserter a little. NFC.
Hans Wennborg [Thu, 26 Oct 2017 08:29:08 +0000 (08:29 +0000)]
Tidy up CountingFunctionInserter a little. NFC.

Use StringRef for CountingFunctionName, remove erroneous comment
copied from InstructionNamer, and drop some trailing whitespace.

llvm-svn: 316644

6 years ago[clang-tidy ObjC] [1/3] New module `objc` for Objective-C checks
Haojian Wu [Thu, 26 Oct 2017 08:23:20 +0000 (08:23 +0000)]
[clang-tidy ObjC] [1/3] New module `objc` for Objective-C checks

Summary:
This is part 1 of 3 of a series of changes to improve Objective-C
linting in clang-tidy.

This introduces a new clang-tidy module, `objc`, specifically for
Objective-C / Objective-C++ checks.

The module is currently empty; D39142 adds the first check.

Test Plan: `ninja check-clang-tools`

Patch by Ben Hamilton!

Reviewers: hokein, alexfh

Reviewed By: hokein

Subscribers: Wizard, mgorny

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

llvm-svn: 316643

6 years ago[DeLICM] Add more tests for loop layouts. NFC.
Michael Kruse [Thu, 26 Oct 2017 08:03:28 +0000 (08:03 +0000)]
[DeLICM] Add more tests for loop layouts. NFC.

llvm-svn: 316642

6 years ago[AsmParser][TableGen] Add VariantID argument to the generated mnemonic spell check...
Craig Topper [Thu, 26 Oct 2017 06:46:41 +0000 (06:46 +0000)]
[AsmParser][TableGen] Add VariantID argument to the generated mnemonic spell check function so it can use the correct table based on variant.

I'm considering implementing the mnemonic spell checker for x86, and that would require the separate intel and att variants.

llvm-svn: 316641

6 years ago[AsmParser][TableGen] Make the generated mnemonic spell checker function a file local...
Craig Topper [Thu, 26 Oct 2017 06:46:40 +0000 (06:46 +0000)]
[AsmParser][TableGen] Make the generated mnemonic spell checker function a file local static function.

Also only emit in targets that specificially request it. This is required so we don't get an unused static function error.

llvm-svn: 316640

6 years ago[X86] Use correct type for return value of ComputeAvailableFeatures in the AsmParser...
Craig Topper [Thu, 26 Oct 2017 06:46:38 +0000 (06:46 +0000)]
[X86] Use correct type for return value of ComputeAvailableFeatures in the AsmParser. NFC

There aren't enough used bits to make this a functional change, but we should fix it for consistency.

llvm-svn: 316639

6 years ago[sanitizer] Fix internal symbolized build on Debian 9
Vitaly Buka [Thu, 26 Oct 2017 06:08:01 +0000 (06:08 +0000)]
[sanitizer] Fix internal symbolized build on Debian 9

llvm-svn: 316637

6 years ago[LSan] Enable -fsanitize=leak for PPC64 Linux.
Alex Shlyapnikov [Thu, 26 Oct 2017 03:09:53 +0000 (03:09 +0000)]
[LSan] Enable -fsanitize=leak for PPC64 Linux.

Summary: .

Reviewers: eugenis

Subscribers: cfe-commits

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

llvm-svn: 316636

6 years ago[lit] Respect LLVM_LIT_TOOLS_DIR when looking for 'tar' on Windows.
Igor Kudrin [Thu, 26 Oct 2017 02:31:36 +0000 (02:31 +0000)]
[lit] Respect LLVM_LIT_TOOLS_DIR when looking for 'tar' on Windows.

Changes in D38977 expect 'tar' to be found in one of PATH directories.
On Windows, one might opt to use LLVM_LIT_TOOLS_DIR rather than add MSYS
tools directory to the PATH. In that case, tests for lld failed on run.

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

llvm-svn: 316635

6 years ago[Transforms] Revert r316630 changes in Scalar/MergeICmps.cpp to fix broken build...
Eugene Zelenko [Thu, 26 Oct 2017 01:25:14 +0000 (01:25 +0000)]
[Transforms] Revert r316630 changes in Scalar/MergeICmps.cpp to fix broken build bots (NFC).

llvm-svn: 316634

6 years ago[LSan] Adjust LSan allocator limits for PPC64.
Alex Shlyapnikov [Thu, 26 Oct 2017 01:22:48 +0000 (01:22 +0000)]
[LSan] Adjust LSan allocator limits for PPC64.

Summary: Now the limits are the same as for ASan allocator.

Reviewers: cryptoad

Subscribers: llvm-commits

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

llvm-svn: 316633

6 years ago[Analyzer] [Tests] Consistently use exit codes. Use code=42 to signify different...
George Karpenkov [Thu, 26 Oct 2017 01:13:22 +0000 (01:13 +0000)]
[Analyzer] [Tests] Consistently use exit codes. Use code=42 to signify different results

llvm-svn: 316632

6 years agoAllow StmtPrinter to supress implicit 'this' and 'self' base expressions
Alex Lorenz [Thu, 26 Oct 2017 00:56:54 +0000 (00:56 +0000)]
Allow StmtPrinter to supress implicit 'this' and 'self' base expressions

This will be useful for certain refactoring actions.

rdar://34202062

llvm-svn: 316631

6 years ago[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Thu, 26 Oct 2017 00:55:39 +0000 (00:55 +0000)]
[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 316630

6 years agoMakefile.rules: move CFLAGS_EXTRAS to the end of compile line
Pavel Labath [Wed, 25 Oct 2017 23:56:17 +0000 (23:56 +0000)]
Makefile.rules: move CFLAGS_EXTRAS to the end of compile line

This makes sure that any options specified there override generic
compiler options.

This fixes TestBreakpointIt.py

llvm-svn: 316629

6 years ago[libFuzzer] trying to make a test more stable on Mac
Kostya Serebryany [Wed, 25 Oct 2017 23:24:45 +0000 (23:24 +0000)]
[libFuzzer] trying to make a test more stable on Mac

llvm-svn: 316627

6 years agoFix SizeOfImage in the PE header.
Rui Ueyama [Wed, 25 Oct 2017 23:00:40 +0000 (23:00 +0000)]
Fix SizeOfImage in the PE header.

IIUC, SizeOfImage is the distance from the end of the last section to
the image base, rounded up to the page size. So the previous code is
wrong.

Should fix https://bugs.llvm.org/show_bug.cgi?id=34949

(It is nice to know that lld is already being used to create Putty
distribution binaries.)

llvm-svn: 316626

6 years agoAttempt to unbreak the expensive-checks-win bot
Matthew Simpson [Wed, 25 Oct 2017 22:46:34 +0000 (22:46 +0000)]
Attempt to unbreak the expensive-checks-win bot

llvm-svn: 316625

6 years ago[lld] unified COFF and ELF error handling on new Common/ErrorHandler
Bob Haarman [Wed, 25 Oct 2017 22:28:38 +0000 (22:28 +0000)]
[lld] unified COFF and ELF error handling on new Common/ErrorHandler

Summary:
The COFF linker and the ELF linker have long had similar but separate
Error.h and Error.cpp files to implement error handling. This change
introduces new error handling code in Common/ErrorHandler.h, changes the
COFF and ELF linkers to use it, and removes the old, separate
implementations.

Reviewers: ruiu

Reviewed By: ruiu

Subscribers: smeenai, jyknight, emaste, sdardis, nemanjai, nhaehnle, mgorny, javed.absar, kbarton, fedor.sergeev, llvm-commits

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

llvm-svn: 316624

6 years agoFix fatal error message displaying
Jonathan Peyton [Wed, 25 Oct 2017 22:05:02 +0000 (22:05 +0000)]
Fix fatal error message displaying

Replacing call to __kmp_msg(kmp_ms_fatal,...) with __kmp_fatal(...) caused an
issue when incomplete message is displayed in case an error message is followed
by another message (e.g. by a hint messa)ge. This is because __kmp_fatal()
passes incomplete list of arguments to __kmp_msg().

Patch by Olga Malysheva

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

llvm-svn: 316623

6 years agoUnassign sections if they are "assigned" to /DISCARD/.
Rui Ueyama [Wed, 25 Oct 2017 22:03:21 +0000 (22:03 +0000)]
Unassign sections if they are "assigned" to /DISCARD/.

"/DISCARD/" is a special section name in the linker script to discard
input sections. Previously, we handled it as if it were a real section,
so an input section can be assigned but dead. However, allowing sections
to be

 - assigned and alive (will be emitted),
 - not assigned and dead (removed), or
 - assigned but dead (???)

feels logically wrong and practically error-prone. This patch removes
the last combination of the states.

llvm-svn: 316622

6 years agoHandle PragmaDebug in PPChainedCallbacks
Alex Lorenz [Wed, 25 Oct 2017 22:01:23 +0000 (22:01 +0000)]
Handle PragmaDebug in PPChainedCallbacks

The test is in clang-tools-extra/test/pp-trace

llvm-svn: 316621

6 years ago[scudo] Remove comment about security of the 32-bit allocator
Kostya Kortchinsky [Wed, 25 Oct 2017 22:00:26 +0000 (22:00 +0000)]
[scudo] Remove comment about security of the 32-bit allocator

Summary:
The 32-bit allocator is now on par with the 64-bit in terms of security (chunks
randomization is done, batches separation is done).

Unless objection, the comment can go away.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 316620

6 years agoRe-land "[dwarfdump] Add -lookup option"
Jonas Devlieghere [Wed, 25 Oct 2017 21:56:41 +0000 (21:56 +0000)]
Re-land "[dwarfdump] Add -lookup option"

Add the option to lookup an address in the debug information and print
out the file, function, block and line table details.

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

llvm-svn: 316619

6 years ago[Analyzer] [Tests] Do not discard output from CmpRuns.py when running integration...
George Karpenkov [Wed, 25 Oct 2017 21:49:46 +0000 (21:49 +0000)]
[Analyzer] [Tests] Do not discard output from CmpRuns.py when running integration tests

Contrary to the deleted comment, in most cases CmpRuns.py produces a
fairly small amount of output, which is useful to see straight away to
see what has changed when executing the integration tests.

llvm-svn: 316618

6 years ago[Analyzer] Give more descriptive name to BdyFrm field.
George Karpenkov [Wed, 25 Oct 2017 21:49:41 +0000 (21:49 +0000)]
[Analyzer] Give more descriptive name to BdyFrm field.

Discussion at: https://reviews.llvm.org/D39220

llvm-svn: 316617

6 years agoFix CodeGen/AMDGPU/fcanonicalize-elimination.ll on FreeBSD 11.0
Alexander Richardson [Wed, 25 Oct 2017 21:44:21 +0000 (21:44 +0000)]
Fix CodeGen/AMDGPU/fcanonicalize-elimination.ll on FreeBSD 11.0

Summary:
On FreeBSD11.0 the FileCheck NOT string "1.0" will be matched by
`.amd_amdgpu_isa "amdgcn-unknown-freebsd11.0--gfx802"` at the end of the
file. Add a CHECK for that directive to avoid failing the test.

Reviewers: rampitec, kzhuravl

Reviewed By: rampitec, kzhuravl

Subscribers: emaste, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits, krytarowski

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

llvm-svn: 316616

6 years ago[SCEV] Fix an assertion failure in the max backedge taken count
Sanjoy Das [Wed, 25 Oct 2017 21:41:00 +0000 (21:41 +0000)]
[SCEV] Fix an assertion failure in the max backedge taken count

Max backedge taken count is always expected to be a constant; and this is
usually true by construction -- it is a SCEV expression with constant inputs.
However, if the max backedge expression ends up being computed to be a udiv with
a constant zero denominator[0], SCEV does not fold the result to a constant
since there is no constant it can fold it to (SCEV has no representation for
"infinity" or "undef").

However, in computeMaxBECountForLT we already know the denominator is positive,
and thus at least 1; and we can use this fact to avoid dividing by zero.

[0]: We can end up with a constant zero denominator if the signed range of the
stride is more precise than the unsigned range.

llvm-svn: 316615

6 years agoAdd a comment to clarify a future change
Sanjoy Das [Wed, 25 Oct 2017 21:40:59 +0000 (21:40 +0000)]
Add a comment to clarify a future change

llvm-svn: 316614

6 years ago[msan] Intercept __strxfrm_l.
Evgeniy Stepanov [Wed, 25 Oct 2017 21:40:17 +0000 (21:40 +0000)]
[msan] Intercept __strxfrm_l.

llvm-svn: 316613

6 years agoRevert r316582 [Local] Fix a bug in the domtree update logic for MergeBasicBlockIntoO...
Balaram Makam [Wed, 25 Oct 2017 21:32:54 +0000 (21:32 +0000)]
Revert r316582 [Local] Fix a bug in the domtree update logic for MergeBasicBlockIntoOnlyPred.

Summary: This reverts commit r316582. It looks like this commit broke tests on one buildbot:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/5719

. . .
Failing Tests (1):
    LLVM :: Transforms/CalledValuePropagation/simple-arguments.ll

Reviewers:

Subscribers:

llvm-svn: 316612

6 years ago[CUDA] Print an error if you try to compile with < sm_30 on CUDA 9.
Justin Lebar [Wed, 25 Oct 2017 21:32:06 +0000 (21:32 +0000)]
[CUDA] Print an error if you try to compile with < sm_30 on CUDA 9.

Summary:
CUDA 9's minimum sm is sm_30.

Ideally we should also make sm_30 the default when compiling with CUDA
9, but that seems harder than it should be.

Subscribers: sanjoy

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

llvm-svn: 316611

6 years agoAdd FileVerifier::isCFIProtected().
Mitch Phillips [Wed, 25 Oct 2017 21:21:16 +0000 (21:21 +0000)]
Add FileVerifier::isCFIProtected().

Add a CFI protection check that is implemented by building a graph and inspecting the output to deduce if the indirect CF instruction is CFI protected. Also added the output of this instruction to printIndirectInstructions().

Reviewers: vlad.tsyrklevich

Subscribers: llvm-commits, kcc, pcc, mgorny

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

llvm-svn: 316610

6 years agoMove StopInfoOverride callback to the new architecture plugin
Pavel Labath [Wed, 25 Oct 2017 21:05:31 +0000 (21:05 +0000)]
Move StopInfoOverride callback to the new architecture plugin

This creates a new Architecture plugin and moves the stop info override
callback to this place. The motivation for this is to remove complex
dependencies from the ArchSpec class because it is used in a lot of
places that (should) know nothing about Process instances and StopInfo
objects.

I also add a test for the functionality covered by the override
callback.

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

llvm-svn: 316609

6 years agoMove testcases/arm_emulation to testcases/arm/emulation
Pavel Labath [Wed, 25 Oct 2017 21:05:10 +0000 (21:05 +0000)]
Move testcases/arm_emulation to testcases/arm/emulation

This creates space for addidional arm-specific tests. I will be adding
one of those in a follow-up commit.

llvm-svn: 316608

6 years agoEnable -pie and --enable-new-dtags by default on Android.
Evgeniy Stepanov [Wed, 25 Oct 2017 20:39:22 +0000 (20:39 +0000)]
Enable -pie and --enable-new-dtags by default on Android.

Summary:
Also enable -no-pie on Gnu toolchain (previously available on Darwin only).

Non-PIE executables won't even start on recent Android, and DT_RPATH is ignored by the loader.

Reviewers: srhines, danalbert

Subscribers: cfe-commits

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

llvm-svn: 316606

6 years agoIgnore implicity casts for zero-as-null-pointer-constant warning
Erich Keane [Wed, 25 Oct 2017 20:23:13 +0000 (20:23 +0000)]
Ignore implicity casts for zero-as-null-pointer-constant warning

The repro in https://bugs.llvm.org/show_bug.cgi?id=34362
caused the left nullptr to be cast to a int* implicitly, which
resulted diagnosing this falsely.

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

llvm-svn: 316605

6 years agoHexagon: Fold a single-use textual header into its use
David Blaikie [Wed, 25 Oct 2017 19:52:21 +0000 (19:52 +0000)]
Hexagon: Fold a single-use textual header into its use

llvm-svn: 316604

6 years agoMake the combiner check if shifts are legal before creating them
Aditya Nandakumar [Wed, 25 Oct 2017 18:49:18 +0000 (18:49 +0000)]
Make the combiner check if shifts are legal before creating them

Summary: Make sure shifts are legal/specified by the legalizerinfo before creating it

Reviewers: qcolombet, dsanders, rovka, t.p.northover

Subscribers: llvm-commits

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

llvm-svn: 316602

6 years ago[Hexagon] Account for negative offset when limiting max deviation
Krzysztof Parzyszek [Wed, 25 Oct 2017 18:46:40 +0000 (18:46 +0000)]
[Hexagon] Account for negative offset when limiting max deviation

In getOffsetRange, Max can be set to 0 to force the extender replacement
to be at or below the original value. This would cause the new offset to
be non-negative, which is preferred for memory instructions (to reduce
the likelihood of it getting constant-extended due to predication). The
problem happens when the range is shifted by an offset (present in the
instruction being examined) and the offset is negative. The entire range
for the allowable deviation will then be strictly negative. This creates
a problem, since 0 is assumed to be a valid deviation.

llvm-svn: 316601

6 years agoSimplify.
Rui Ueyama [Wed, 25 Oct 2017 18:09:54 +0000 (18:09 +0000)]
Simplify.

ArrayRef<T>() equals to ArrayRef<T>(nullptr, 0), so it looks like
we don't need to handle size 0 as a special case.

llvm-svn: 316600

6 years agoCodeGen: fix PPC Darwin variadics
Saleem Abdulrasool [Wed, 25 Oct 2017 17:56:50 +0000 (17:56 +0000)]
CodeGen: fix PPC Darwin variadics

Darwin uses char * for the variadic list type (va_list).  We use the PPC
SVR4 ABI for PPC, which uses a structure type for the va_list.  When
constructing the GEP, we would fail due to the incorrect handling for
the va_list.  Correct this to use the right type.

llvm-svn: 316599

6 years agoTry to unbreak Linux sanitizers
Kamil Rytarowski [Wed, 25 Oct 2017 17:56:36 +0000 (17:56 +0000)]
Try to unbreak Linux sanitizers

Add fallback definition of internal_syscall_ptr and internal_syscall64
for Linux/x86_64 and Linux/aarch64.

llvm-svn: 316598

6 years agoRemove dead function declaration.
Peter Collingbourne [Wed, 25 Oct 2017 17:42:00 +0000 (17:42 +0000)]
Remove dead function declaration.

llvm-svn: 316597

6 years ago[sanitizer] Random shuffling of chunks for the 32-bit Primary Allocator
Kostya Kortchinsky [Wed, 25 Oct 2017 17:24:56 +0000 (17:24 +0000)]
[sanitizer] Random shuffling of chunks for the 32-bit Primary Allocator

Summary:
The 64-bit primary has had random shuffling of chunks for a while, this
implements it for the 32-bit primary. Scudo is currently the only user of
`kRandomShuffleChunks`.

This change consists of a few modifications:
- move the random shuffling functions out of the 64-bit primary to
  `sanitizer_common.h`. Alternatively I could move them to
  `sanitizer_allocator.h` as they are only used in the allocator, I don't feel
  strongly either way;
- small change in the 64-bit primary to make the `rand_state` initialization
  `UNLIKELY`;
- addition of a `rand_state` in the 32-bit primary's `SizeClassInfo` and
  shuffling of chunks when populating the free list.
- enabling the `random_shuffle.cpp` test on platforms using the 32-bit primary
  for Scudo.

Some comments on why the shuffling is done that way. Initially I just
implemented a `Shuffle` function in the `TransferBatch` which was simpler but I
came to realize this wasn't good enough: for chunks of 10000 bytes for example,
with a `CompactSizeClassMap`, a batch holds only 1 chunk, meaning shuffling the
batch has no effect, while a region is usually 1MB, eg: 104 chunks of that size.
So I decided to "stage" the newly gathered chunks in a temporary array that
would be shuffled prior to placing the chunks in batches.
The result is looping twice through n_chunks even if shuffling is not enabled,
but I didn't notice any significant significant performance impact.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: srhines, llvm-commits, kubamracek

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

llvm-svn: 316596

6 years ago[Sanitizers] ASan: detect new/delete calls with mismatched alignment.
Alex Shlyapnikov [Wed, 25 Oct 2017 17:21:37 +0000 (17:21 +0000)]
[Sanitizers] ASan: detect new/delete calls with mismatched alignment.

ASan allocator stores the requested alignment for new and new[] calls
and on delete and delete[] verifies that alignments do match.

The representable alignments are: default alignment, 8, 16, 32, 64, 128,
256 and 512 bytes. Alignments > 512 are stored as 512, hence two
different alignments > 512 will pass the check (possibly masking the bug),
but limited memory requirements deemed to be a resonable tradeoff for
relaxed conditions.

The feature is controlled by new_delete_type_mismatch flag, the same one
protecting new/delete matching size check.

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

Issue: https://github.com/google/sanitizers/issues/799
llvm-svn: 316595

6 years ago[cmake] Restrict resource file usage to Windows build hosts
Shoaib Meenai [Wed, 25 Oct 2017 17:11:28 +0000 (17:11 +0000)]
[cmake] Restrict resource file usage to Windows build hosts

Resource file compilation requires a working resource compiler.
Unfortunately, llvm-rc isn't quite there yet [1], and cmake's rc
invocation only works on Windows [2]. Until both those issues are
addressed, disable resource file usage on non-Windows build hosts, to
unblock Windows cross-compilation. This is also consistent with the
existing comment, which says "If *on Windows* and building with MSVC".

[1] http://lists.llvm.org/pipermail/llvm-dev/2017-October/118433.html
[2] https://public.kitware.com/pipermail/cmake/2017-October/066441.html

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

llvm-svn: 316594

6 years ago[X86] Add avx512vpopcntdq to Knights Mill
Craig Topper [Wed, 25 Oct 2017 17:10:58 +0000 (17:10 +0000)]
[X86] Add avx512vpopcntdq to Knights Mill

As indicated by Table 1-1 in Intel Architecture Instruction Set Extensions and Future Features Programming Reference from October 2017.

llvm-svn: 316593

6 years ago[X86] Add avx512vpopcntdq to Knights Mill
Craig Topper [Wed, 25 Oct 2017 17:10:32 +0000 (17:10 +0000)]
[X86] Add avx512vpopcntdq to Knights Mill

As indicated by Table 1-1 in Intel Architecture Instruction Set Extensions and Future Features Programming Reference from October 2017.

llvm-svn: 316592

6 years agoAdd NetBSD improvements in sanitizers
Kamil Rytarowski [Wed, 25 Oct 2017 17:09:05 +0000 (17:09 +0000)]
Add NetBSD improvements in sanitizers

Summary:
Changes:

 * Add initial msan stub support.
 * Handle NetBSD specific pthread_setname_np(3).
 * NetBSD supports __attribute__((tls_model("initial-exec"))),
   define it in SANITIZER_TLS_INITIAL_EXEC_ATTRIBUTE.
 * Add ReExec() specific bits for NetBSD.
 * Simplify code and add syscall64 and syscall_ptr for !NetBSD.
 * Correct bunch of syscall wrappers for NetBSD.
 * Disable test/tsan/map32bit on NetBSD as not applicable.
 * Port test/tsan/strerror_r to a POSIX-compliant OSes.
 * Disable __libc_stack_end on NetBSD.
 * Disable ReadNullSepFileToArray() on NetBSD.
 * Define struct_ElfW_Phdr_sz, detected missing symbol by msan.
 * Change type of __sanitizer_FILE from void to char. This helps
   to reuse this type as an array. Long term it will be properly
   implemented along with SANITIZER_HAS_STRUCT_FILE setting to 1.
 * Add initial NetBSD support in lib/tsan/go/buildgo.sh.
 * Correct referencing stdout and stderr in tsan_interceptors.cc
   on NetBSD.
 * Document NetBSD x86_64 specific virtual memory layout in
   tsan_platform.h.
 * Port tests/rtl/tsan_test_util_posix.cc to NetBSD.
 * Enable NetBSD tests in test/msan/lit.cfg.
 * Enable NetBSD tests in test/tsan/lit.cfg.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, eugenis, kcc, dvyukov

Reviewed By: dvyukov

Subscribers: #sanitizers, llvm-commits, kubamracek

Tags: #sanitizers

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

llvm-svn: 316591

6 years agoAMDGPU: Cleanup memory legalizer load/store tests
Konstantin Zhuravlyov [Wed, 25 Oct 2017 17:04:46 +0000 (17:04 +0000)]
AMDGPU: Cleanup memory legalizer load/store tests

llvm-svn: 316590

6 years ago[asan] Don't print rows of shadow bytes outside shadow memory
Reid Kleckner [Wed, 25 Oct 2017 16:54:12 +0000 (16:54 +0000)]
[asan] Don't print rows of shadow bytes outside shadow memory

Summary:
They might not be mapped on some platforms such as Win64.  In
particular, this happens if the user address is null. There will not be
any shadow memory 5*16 bytes before the user address. This happens on
Win64 in the error_report_callback.cc test case. It's not clear why this
isn't a problem on Linux as well.

Fixes PR35058

Reviewers: vitalybuka

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 316589

6 years agomath: Implement native_log10
Jan Vesely [Wed, 25 Oct 2017 16:49:22 +0000 (16:49 +0000)]
math: Implement native_log10

Use llvm instrinsic by default
Provide amdgpu workaround

v2: drop old amd copyrights

Reviewer: Aaron Watry
Reviewed-by: Vedran Miletić <vedran@miletic.net>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 316588

6 years agoamdgpu/math: Don't use llvm instrinsic for native_log
Jan Vesely [Wed, 25 Oct 2017 16:49:17 +0000 (16:49 +0000)]
amdgpu/math: Don't use llvm instrinsic for native_log

AMDGPU targets don't have insturction for it,
so it'll be expanded to C * log2 anyway.

v2: use native_log2 instead of the more precise sw implementation
v3: move to amdgpu
v4: drop old AMD copyright

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 316587

6 years agoAMDGPU/NFC: Rename memory legalizer tests:
Konstantin Zhuravlyov [Wed, 25 Oct 2017 16:45:28 +0000 (16:45 +0000)]
AMDGPU/NFC: Rename memory legalizer tests:

  - memory-legalizer-atomic-load.ll -> memory-legalizer-load.ll
  - memory-legalizer-atomic-store.ll -> memory-legalizer-store.ll

llvm-svn: 316586

6 years ago[OPENMP] Improve debug info for taskgroup implicitly generated
Alexey Bataev [Wed, 25 Oct 2017 15:54:04 +0000 (15:54 +0000)]
[OPENMP] Improve debug info for taskgroup implicitly generated
expressions.

llvm-svn: 316585

6 years ago[OPENMP] Constify function parameters, NFC.
Alexey Bataev [Wed, 25 Oct 2017 15:44:52 +0000 (15:44 +0000)]
[OPENMP] Constify function parameters, NFC.

llvm-svn: 316584

6 years ago[ELF] - Implement --orphan-handling option.
George Rimar [Wed, 25 Oct 2017 15:20:30 +0000 (15:20 +0000)]
[ELF] - Implement --orphan-handling option.

It is PR34946.

Spec (http://man7.org/linux/man-pages/man1/ld.1.html) tells about
--orphan-handling=MODE, option where MODE can be one of four:
"place", "discard", "warn", "error".
Currently we already report orphans when -verbose given,
what becomes excessive with option implemented.

Patch stops reporting orphans when -versbose is given,
and support "place", "warn" and "error" modes.
It is not yet clear that "discard" mode is useful so it is not supported.

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

llvm-svn: 316583

6 years ago[Local] Fix a bug in the domtree update logic for MergeBasicBlockIntoOnlyPred.
Balaram Makam [Wed, 25 Oct 2017 14:55:48 +0000 (14:55 +0000)]
[Local] Fix a bug in the domtree update logic for MergeBasicBlockIntoOnlyPred.

Summary: For some irreducible CFG the domtree nodes might be dead, do not update domtree for dead nodes.

Reviewers: kuhar, dberlin, hfinkel

Reviewed By: kuhar

Subscribers: llvm-commits, mcrosier

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

llvm-svn: 316582

6 years agoDon't try to use a non-existent header on FreeBSD/mips.
John Baldwin [Wed, 25 Oct 2017 14:53:16 +0000 (14:53 +0000)]
Don't try to use a non-existent header on FreeBSD/mips.

Reviewers: dim

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

llvm-svn: 316581

6 years ago[ELF] - Linkerscript: fix issue with SUBALIGN.
George Rimar [Wed, 25 Oct 2017 14:50:51 +0000 (14:50 +0000)]
[ELF] - Linkerscript: fix issue with SUBALIGN.

This is PR34886.

SUBALIGN command currently triggers failture if result expression
is zero. Patch fixes the issue, treating zero as 1, what is consistent with
other places and ELF spec it seems.

Patch also adds "is power of 2" check for this and other expressions
returning alignment.

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

llvm-svn: 316580

6 years agoAdd support of the next Debian (Debian buster - version 10)
Sylvestre Ledru [Wed, 25 Oct 2017 14:25:28 +0000 (14:25 +0000)]
Add support of the next Debian (Debian buster - version 10)

llvm-svn: 316579

6 years agoAlso update IsUbuntu() with Ubuntu Bionic
Sylvestre Ledru [Wed, 25 Oct 2017 14:23:27 +0000 (14:23 +0000)]
Also update IsUbuntu() with Ubuntu Bionic
Follow up of r316577

llvm-svn: 316578

6 years agoAdd support of the next Ubuntu (Ubuntu 18.04 - Bionic Beaver)
Sylvestre Ledru [Wed, 25 Oct 2017 14:21:33 +0000 (14:21 +0000)]
Add support of the next Ubuntu (Ubuntu 18.04 - Bionic Beaver)

llvm-svn: 316577

6 years agoAdd CalledValuePropagation pass
Matthew Simpson [Wed, 25 Oct 2017 13:40:08 +0000 (13:40 +0000)]
Add CalledValuePropagation pass

This patch adds a new pass for attaching !callees metadata to indirect call
sites. The pass propagates values to call sites by performing an IPSCCP-like
analysis using the generic sparse propagation solver. For indirect call sites
having a small set of possible callees, the attached metadata indicates what
those callees are. The metadata can be used to facilitate optimizations like
intersecting the function attributes of the possible callees, refining the call
graph, performing indirect call promotion, etc.

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

llvm-svn: 316576

6 years ago[mips] Clean up some whitespace (NFC).
Simon Dardis [Wed, 25 Oct 2017 13:35:53 +0000 (13:35 +0000)]
[mips] Clean up some whitespace (NFC).

Also test that my email address was updated.

llvm-svn: 316575

6 years ago[inlineasm] Fix crash when number of matched input constraint operands overflows...
Daniil Fukalov [Wed, 25 Oct 2017 12:51:32 +0000 (12:51 +0000)]
[inlineasm] Fix crash when number of matched input constraint operands overflows signed char

In a case when number of output constraint operands that has matched input operands
doesn't fit to signed char, TargetLowering::ParseConstraints() can try to access
ConstraintOperands (that is std::vector) with negative index.

Reviewers: rampitec, arsenm

Differential Review: https://reviews.llvm.org/D39125

llvm-svn: 316574

6 years ago[ARM GlobalISel] Remove redundant testcases. NFC
Diana Picus [Wed, 25 Oct 2017 12:22:21 +0000 (12:22 +0000)]
[ARM GlobalISel] Remove redundant testcases. NFC

Remove the G_FADD testcases from arm-legalizer.mir, they are covered by
arm-legalizer-fp.mir (I probably forgot to delete them when I created
that test).

llvm-svn: 316573

6 years ago[ARM GlobalISel] Update test after r316479. NFC
Diana Picus [Wed, 25 Oct 2017 12:22:16 +0000 (12:22 +0000)]
[ARM GlobalISel] Update test after r316479. NFC

No need to check register classes in the register block anymore, since
we can now much more conveniently check them at their def.

llvm-svn: 316572

6 years ago[rename] support renaming class member.
Haojian Wu [Wed, 25 Oct 2017 11:54:45 +0000 (11:54 +0000)]
[rename] support renaming class member.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, cfe-commits, mgorny

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

llvm-svn: 316571

6 years ago[ARM GlobalISel] Fix call opcodes
Diana Picus [Wed, 25 Oct 2017 11:42:40 +0000 (11:42 +0000)]
[ARM GlobalISel] Fix call opcodes

We were generating BLX for all the calls, which was incorrect in most
cases. Update ARMCallLowering to generate BL for direct calls, and BLX,
BX_CALL or BMOVPCRX_CALL for indirect calls.

llvm-svn: 316570

6 years ago[ARM GlobalISel] Split test into 3. NFC
Diana Picus [Wed, 25 Oct 2017 11:21:15 +0000 (11:21 +0000)]
[ARM GlobalISel] Split test into 3. NFC

Separate the test cases that deal with calls from the rest of the IR
Translator tests.

We split into 2 different files, one for testing parameter and result
lowering, and one for testing the various different kinds of calls that
can occur (BL, BLX, BX_CALL etc).

llvm-svn: 316569

6 years ago[SCEV] Enhance SCEVFindUnsafe for division
Max Kazantsev [Wed, 25 Oct 2017 11:07:43 +0000 (11:07 +0000)]
[SCEV] Enhance SCEVFindUnsafe for division

This patch allows SCEVFindUnsafe algorithm to tread division by any non-positive
value as safe. Previously, it could only recognize non-zero constants.

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

llvm-svn: 316568

6 years agoRe-land "[CodeGen][ExpandMemcmp][NFC] Allow memcmp to expand to vector loads (1)"
Clement Courbet [Wed, 25 Oct 2017 11:02:09 +0000 (11:02 +0000)]
Re-land "[CodeGen][ExpandMemcmp][NFC] Allow memcmp to expand to vector loads (1)"

Compute the actual decomposition only after deciding whether to expand
of not. Else, it's easy to make the compiler OOM with:
`memcpy(dst, src, 0xffffffffffffffff);`, which typically happens if
someone mistakenly passes a negative value. Add a test.

This reverts commit f8fc02fbd4ab33383c010d33675acf9763d0bd44.

llvm-svn: 316567

6 years ago[llvm-dwarfdump] - Fix array out of bounds access crash.
George Rimar [Wed, 25 Oct 2017 10:23:49 +0000 (10:23 +0000)]
[llvm-dwarfdump] - Fix array out of bounds access crash.

This fixes possible out of bound access in
DWARFDie::getFirstChild()
which might happen when .debug_info section is corrupted,
like shown in testcase.

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

llvm-svn: 316566

6 years ago[clangd] Added a callback-based codeComplete in clangd.
Ilya Biryukov [Wed, 25 Oct 2017 09:35:10 +0000 (09:35 +0000)]
[clangd] Added a callback-based codeComplete in clangd.

Reviewers: klimek, bkramer, sammccall, krasimir

Reviewed By: sammccall

Subscribers: rwols, cfe-commits

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

llvm-svn: 316565

6 years ago[clangd] Handle exit notification (proper shutdown)
Ilya Biryukov [Wed, 25 Oct 2017 08:45:41 +0000 (08:45 +0000)]
[clangd] Handle exit notification (proper shutdown)

Summary:
This changes the onShutdown handler to do essentially nothing (for now), and
instead exits the runloop when we receive the exit notification from the client.

Some clients may wait on the reply from the shutdown request before sending an
exit notification. If we exit the runloop already in the shutdown request, a
client might block forever.

This also gives us the opportunity to do any global cleanups and/or
serializations of PCH preambles to disk, but I've left that out for now.

See the LSP protocol documentation for details.

Reviewers: malaperle, krasimir, bkramer, sammccall, ilya-biryukov

Reviewed By: malaperle, sammccall, ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 316564

6 years ago[ARM] OrCombineToBFI function
Sam Parker [Wed, 25 Oct 2017 08:37:33 +0000 (08:37 +0000)]
[ARM] OrCombineToBFI function

Extract the functionality to combine OR to BFI into its own function.

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

llvm-svn: 316563