platform/upstream/llvm.git
6 years ago[DAGCombine] Enable more srl -> load combines
Sam Parker [Thu, 16 Nov 2017 11:28:26 +0000 (11:28 +0000)]
[DAGCombine] Enable more srl -> load combines

Change the calculation for the desired ValueType for non-sign
extending loads, as in those cases we don't care about the
higher bits. This creates a smaller ExtVT and allows for such
combinations as:
(srl (zextload i16, [addr]), 8) -> (zextload i8, [addr + 1])

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

llvm-svn: 318390

6 years ago[mips][mt] Add missing test cases from r318207
Simon Dardis [Thu, 16 Nov 2017 10:50:44 +0000 (10:50 +0000)]
[mips][mt] Add missing test cases from r318207

llvm-svn: 318389

6 years agoExclude untied tasks from checking of task scheduling constraint (TSC).
Andrey Churbanov [Thu, 16 Nov 2017 10:45:07 +0000 (10:45 +0000)]
Exclude untied tasks from checking of task scheduling constraint (TSC).
This can improve performance of tests with untied tasks.

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

llvm-svn: 318388

6 years agoAssert correct removal of SUnit in LatencyPriorityQueue
Benjamin Kramer [Thu, 16 Nov 2017 10:18:07 +0000 (10:18 +0000)]
Assert correct removal of SUnit in LatencyPriorityQueue

The LatencyPriorityQueue doesn't currently check whether the SU being removed really exists in the Queue.
This method fails quietly when SU is not found and removes the last element from the Queue, leading to unexpected behavior.

Unfortunately, this only occurs on our custom target, with the custom scheduler. In our case, when remove() is invoked, it removes the wrong SU at the end of the Queue, which is only discovered later when VerifyScheduledDAG() is invoked and finds that some nodes were not scheduled at all.

As this is only reproducible with a lot of proprietary code, I'm hopeful this assert is straightforward enough to not necessitate a test.

Patch by Ondrej Glasnak!

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

llvm-svn: 318387

6 years ago[TTI][X86] update costs of interleaved load\store of i64\double
Mohammed Agabaria [Thu, 16 Nov 2017 09:38:32 +0000 (09:38 +0000)]
[TTI][X86] update costs of interleaved load\store of i64\double

This patch contains more accurate cost of interelaved load\store of stride 2 for the types int64\double on AVX2.

Reviewers: delena, RKSimon, craig.topper, dorit

Reviewed By: dorit

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

llvm-svn: 318385

6 years ago[COFF] Improve the autoexport check for symbols from import libraries with -opt:noref
Martin Storsjo [Thu, 16 Nov 2017 07:22:44 +0000 (07:22 +0000)]
[COFF] Improve the autoexport check for symbols from import libraries with -opt:noref

If -opt:noref is specified, they can end up with isLive() == 1
when the autoexport check is run.

To reduce the risk of potential issues, only consider exporting
DefinedRegular and DefinedCommon, nothing else.

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

llvm-svn: 318384

6 years ago[docs] Mention that dwarf unwinding should be supported on arm64/windows
Martin Storsjo [Thu, 16 Nov 2017 07:16:36 +0000 (07:16 +0000)]
[docs] Mention that dwarf unwinding should be supported on arm64/windows

This didn't require any further changes to libunwind as long as win64
in general is handled correctly.

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

llvm-svn: 318383

6 years ago[MachineRegisterInfo] Avoid having dbg.values affect code generation
Mikael Holmen [Thu, 16 Nov 2017 07:01:23 +0000 (07:01 +0000)]
[MachineRegisterInfo] Avoid having dbg.values affect code generation

Summary:
Use use_nodbg_empty() rather than use_empty() in
MachineRegisterInfo::EmitLiveInCopies() when determining if a livein
register has any uses or not. Otherwise a single dbg.value can make us
generate different code, meaning -g would affect code generation.

Found when compiling code for my out-of-tree target. Unfortunately I
haven't been able to reproduce the problem on X86 or any of the other
in-tree targets that I tried, so no test case.

Reviewers: MatzeB

Reviewed By: MatzeB

Subscribers: llvm-commits

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

llvm-svn: 318382

6 years ago[IRCE] Fix SCEVExpander's usage in IRCE
Max Kazantsev [Thu, 16 Nov 2017 06:06:27 +0000 (06:06 +0000)]
[IRCE] Fix SCEVExpander's usage in IRCE

When expanding exit conditions for pre- and postloops, we may end up expanding a
recurrency from the loop to in its loop's preheader. This produces incorrect IR.

This patch ensures that IRCE uses SCEVExpander correctly and only expands code which
is safe to expand in this particular location.

Differentian Revision: https://reviews.llvm.org/D39234

llvm-svn: 318381

6 years ago[X86] Update TTI to report that v1iX/v1fX types aren't legal for masked gather/scatte...
Craig Topper [Thu, 16 Nov 2017 06:02:05 +0000 (06:02 +0000)]
[X86] Update TTI to report that v1iX/v1fX types aren't legal for masked gather/scatter/load/store.

The type legalizer will try to scalarize these operations if it sees them, but there is no handling for scalarizing them. This leads to a fatal error. With this change they will now be scalarized by the mem intrinsic scalarizing pass before SelectionDAG.

llvm-svn: 318380

6 years ago[SelectionDAG] Use report_fatal_error instead of llvm_unreachable in some code that...
Craig Topper [Thu, 16 Nov 2017 06:02:03 +0000 (06:02 +0000)]
[SelectionDAG] Use report_fatal_error instead of llvm_unreachable in some code that can be reached if targets don't configure things correctly.

For example, this is currently reachable by X86 if you use a masked store intrinsic with a v1iX type.

Using a fatal error seems like a better user experience if someone were to encounter this on a release build. There are several other similar places that have been converted from unreachable to fatal error previously.

llvm-svn: 318379

6 years agoMore of P0600 - '[[nodiscard]] in the Library' mark empty() as nodiscard in filesyste...
Marshall Clow [Thu, 16 Nov 2017 05:48:32 +0000 (05:48 +0000)]
More of P0600 - '[[nodiscard]] in the Library' mark empty() as nodiscard in filesystem::path

llvm-svn: 318378

6 years ago[SCEV][NFC] Introduce isSafeToExpandAt function to SCEVExpander
Max Kazantsev [Thu, 16 Nov 2017 05:10:56 +0000 (05:10 +0000)]
[SCEV][NFC] Introduce isSafeToExpandAt function to SCEVExpander

This function checks that:
1) It is safe to expand a SCEV;
2) It is OK to materialize it at the specified location.
For example, attempt to expand a loop's AddRec to the same loop's preheader should fail.

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

llvm-svn: 318377

6 years ago[libFuzzer] disable test/fuzzer/merge-sigusr.test on Mac while investigating the...
Kostya Serebryany [Thu, 16 Nov 2017 04:52:05 +0000 (04:52 +0000)]
[libFuzzer] disable test/fuzzer/merge-sigusr.test on Mac while investigating the bot failure

llvm-svn: 318376

6 years agoMore of P0600 - '[[nodiscard]] in the Library' mark empty() as nodiscard in match_res...
Marshall Clow [Thu, 16 Nov 2017 04:48:34 +0000 (04:48 +0000)]
More of P0600 - '[[nodiscard]] in the Library' mark empty() as nodiscard in match_results. <regex>

llvm-svn: 318375

6 years agoFix thinko in last commit.
Eric Christopher [Thu, 16 Nov 2017 03:25:02 +0000 (03:25 +0000)]
Fix thinko in last commit.

llvm-svn: 318374

6 years agoAdd NDEBUG checks around LLVM_DUMP_METHOD functions for Wunused-function warnings.
Eric Christopher [Thu, 16 Nov 2017 03:18:15 +0000 (03:18 +0000)]
Add NDEBUG checks around LLVM_DUMP_METHOD functions for Wunused-function warnings.

llvm-svn: 318373

6 years agoNeed to work around the gcc Wunused-function bug as far back as gcc 6.1, update accor...
Eric Christopher [Thu, 16 Nov 2017 03:18:13 +0000 (03:18 +0000)]
Need to work around the gcc Wunused-function bug as far back as gcc 6.1, update accordingly.

llvm-svn: 318372

6 years agoAdd NDEBUG checks around LLVM_DUMP_METHOD functions for Wunused-function warnings.
Eric Christopher [Thu, 16 Nov 2017 03:18:09 +0000 (03:18 +0000)]
Add NDEBUG checks around LLVM_DUMP_METHOD functions for Wunused-function warnings.

llvm-svn: 318371

6 years agoFix APInt bit size in processDbgDeclares
Yaxun Liu [Thu, 16 Nov 2017 02:54:49 +0000 (02:54 +0000)]
Fix APInt bit size in processDbgDeclares

processDbgDeclares assumes pointer size is the same for different addr spaces.
It uses pointer size for addr space 0 for all pointers, which causes assertion
in stripAndAccumulateInBoundsConstantOffsets for amdgcn---amdgiz since
pointer in addr space 5 has different size than in addr space 0.

This patch fixes that.

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

llvm-svn: 318370

6 years ago[asan] Fallback to non-ifunc dynamic shadow on android<22.
Evgeniy Stepanov [Thu, 16 Nov 2017 02:52:19 +0000 (02:52 +0000)]
[asan] Fallback to non-ifunc dynamic shadow on android<22.

Summary: Android < 22 does not support ifunc.

Reviewers: pcc

Subscribers: srhines, kubamracek, hiraditya, llvm-commits

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

llvm-svn: 318369

6 years ago[X86] Custom type legalize v2f32 masked gathers instead of trying to cleanup after...
Craig Topper [Thu, 16 Nov 2017 02:07:45 +0000 (02:07 +0000)]
[X86] Custom type legalize v2f32 masked gathers instead of trying to cleanup after type legalization.

llvm-svn: 318368

6 years ago[DeclPrinter] Extract function PrintConstructorInitializers, NFC
Alex Lorenz [Thu, 16 Nov 2017 01:31:27 +0000 (01:31 +0000)]
[DeclPrinter] Extract function PrintConstructorInitializers, NFC

Patch by Nikolai Kosjar!

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

llvm-svn: 318367

6 years agoadd check to avoid throwing objc exception according to Google Objective-C guide
Yan Zhang [Thu, 16 Nov 2017 01:28:29 +0000 (01:28 +0000)]
add check to avoid throwing objc exception according to Google Objective-C guide

Summary:
This is a small check to avoid throwing objc exceptions.
In specific it will detect the usage of @throw statement and throw warning.

Reviewers: hokein, benhamilton

Reviewed By: hokein, benhamilton

Subscribers: cfe-commits, mgorny

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

llvm-svn: 318366

6 years ago[DeclPrinter] Honor TerseOutput for constructors
Alex Lorenz [Thu, 16 Nov 2017 01:28:25 +0000 (01:28 +0000)]
[DeclPrinter] Honor TerseOutput for constructors

Patch by Nikolai Kosjar!

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

llvm-svn: 318365

6 years ago[coff] correctly emit safeseh entries for handlers defined in dlls
Bob Haarman [Thu, 16 Nov 2017 01:22:01 +0000 (01:22 +0000)]
[coff] correctly emit safeseh entries for handlers defined in dlls

Summary:
We previously assumed that all SafeSEH handlers are
DefinedRegular symbols. This is not the case for handlers defined in
DLLs. As a result, we were failing to emit entries in the SafeSEH
table for those handlers. This change fixes that.

Fixes PR35324.

Reviewers: rnk, ruiu

Reviewed By: rnk

Subscribers: llvm-commits

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

llvm-svn: 318364

6 years agoLTO: clarify why we need to gracefully handle sys::fs::rename failures
Bob Haarman [Thu, 16 Nov 2017 01:16:52 +0000 (01:16 +0000)]
LTO: clarify why we need to gracefully handle sys::fs::rename failures

Reviewers: pcc, rafael

Reviewed By: pcc

Subscribers: mehdi_amini, llvm-commits, hiraditya

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

llvm-svn: 318362

6 years agoConvert a use of createUniqueFile to TempFile::create.
Rafael Espindola [Thu, 16 Nov 2017 01:06:36 +0000 (01:06 +0000)]
Convert a use of createUniqueFile to TempFile::create.

llvm-svn: 318361

6 years agobpf: enable llvm-objdump to print out symbolized jmp target
Yonghong Song [Thu, 16 Nov 2017 00:52:30 +0000 (00:52 +0000)]
bpf: enable llvm-objdump to print out symbolized jmp target

Add hook in BPF backend so that llvm-objdump can print out
the jmp target with label names, e.g.,
  ...
  if r1 != 2 goto 6 <LBB0_2>
  ...
  goto 7 <LBB0_4>
  ...
 LBB0_2:
  ...
 LBB0_4:
  ...

Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
llvm-svn: 318358

6 years agoFix alignment of arm64 fpu register context structure
Jason Molenda [Thu, 16 Nov 2017 00:50:29 +0000 (00:50 +0000)]
Fix alignment of arm64 fpu register context structure
so it has the same padding as the kernel's definition
which is written in terms of uint128_t.  Original patch
by Ryan Mansfield.

<rdar://problem/35468499>

llvm-svn: 318357

6 years ago[globalisel][tablegen] Generate rule coverage and use it to identify untested rules
Daniel Sanders [Thu, 16 Nov 2017 00:46:35 +0000 (00:46 +0000)]
[globalisel][tablegen] Generate rule coverage and use it to identify untested rules

Summary:
This patch adds a LLVM_ENABLE_GISEL_COV which, like LLVM_ENABLE_DAGISEL_COV,
causes TableGen to instrument the generated table to collect rule coverage
information. However, LLVM_ENABLE_GISEL_COV goes a bit further than
LLVM_ENABLE_DAGISEL_COV. The information is written to files
(${CMAKE_BINARY_DIR}/gisel-coverage-* by default). These files can then be
concatenated into ${LLVM_GISEL_COV_PREFIX}-all after which TableGen will
read this information and use it to emit warnings about untested rules.

This technique could also be used by SelectionDAG and can be further
extended to detect hot rules and give them priority over colder rules.

Usage:
* Enable LLVM_ENABLE_GISEL_COV in CMake
* Build the compiler and run some tests
* cat gisel-coverage-[0-9]* > gisel-coverage-all
* Delete lib/Target/*/*GenGlobalISel.inc*
* Build the compiler

Known issues:
* ${LLVM_GISEL_COV_PREFIX}-all must be generated as a manual
  step due to a lack of a portable 'cat' command. It should be the
  concatenation of all ${LLVM_GISEL_COV_PREFIX}-[0-9]* files.
* There's no mechanism to discard coverage information when the ruleset
  changes

Depends on D39742

Reviewers: ab, qcolombet, t.p.northover, aditya_nandakumar, rovka

Reviewed By: rovka

Subscribers: vsk, arsenm, nhaehnle, mgorny, kristof.beyls, javed.absar, igorb, llvm-commits

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

llvm-svn: 318356

6 years agoTry to fix WebAssembly build after r318352
Reid Kleckner [Thu, 16 Nov 2017 00:32:19 +0000 (00:32 +0000)]
Try to fix WebAssembly build after r318352

llvm-svn: 318355

6 years ago[GVNHoist] Fix a signed/unsigned comparison warning that occurs in 32-bit builds...
Craig Topper [Thu, 16 Nov 2017 00:19:59 +0000 (00:19 +0000)]
[GVNHoist] Fix a signed/unsigned comparison warning that occurs in 32-bit builds with gcc.

std::distance returns ptrdiff_t which is signed. 64-bit builds don't notice because type promotion widens the unsigned first.

llvm-svn: 318354

6 years ago[CodeGen] Fix the branch probability assertion in r318202
Rong Xu [Thu, 16 Nov 2017 00:14:05 +0000 (00:14 +0000)]
[CodeGen] Fix the branch probability assertion in r318202

Due to integer precision, we might have numerator greater than denominator in
the branch probability scaling. Add a check to prevent this from happening.

llvm-svn: 318353

6 years agoAdd backend name to Target to enable runtime info to be fed back into TableGen
Daniel Sanders [Wed, 15 Nov 2017 23:55:44 +0000 (23:55 +0000)]
Add backend name to Target to enable runtime info to be fed back into TableGen

Summary:
Make it possible to feed runtime information back to tablegen to enable
profile-guided tablegen-eration, detection of untested tablegen definitions, etc.

Being a cross-compiler by nature, LLVM will potentially collect data for multiple
architectures (e.g. when running 'ninja check'). We therefore need a way for
TableGen to figure out what data applies to the backend it is generating at the
time. This patch achieves that by including the name of the 'def X : Target ...'
for the backend in the TargetRegistry.

Reviewers: qcolombet

Reviewed By: qcolombet

Subscribers: jholewinski, arsenm, jyknight, aditya_nandakumar, sdardis, nemanjai, ab, nhaehnle, t.p.northover, javed.absar, qcolombet, llvm-commits, fedor.sergeev

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

llvm-svn: 318352

6 years ago[AArch64] Adjust the cost model for Exynos M1 and M2
Evandro Menezes [Wed, 15 Nov 2017 23:49:58 +0000 (23:49 +0000)]
[AArch64] Adjust the cost model for Exynos M1 and M2

Fix the modeling of FP stores.

llvm-svn: 318351

6 years ago[GISel][NFC]: Move getOpcodeDef from the LegalizationArtifactCombiner into GlobalISel...
Aditya Nandakumar [Wed, 15 Nov 2017 23:45:04 +0000 (23:45 +0000)]
[GISel][NFC]: Move getOpcodeDef from the LegalizationArtifactCombiner into GlobalISel/Utils for use elsewhere

llvm-svn: 318350

6 years ago[LSan] Export __lsan_init
Alex Shlyapnikov [Wed, 15 Nov 2017 23:42:48 +0000 (23:42 +0000)]
[LSan] Export __lsan_init

Summary:
lsan_preinit.cc is meant to be linked into executable and calls
lsan_init from .preinit_array section. But if liblsan is a shared library,
then this doesn't work, because the symbol is not exported. This patch fixes
that. The counterparts like asan_init or __tsan_init already do have
SANITIZER_INTERFACE_ATTRIBUTE.

Committing on behalf of jakubjelinek.

Reviewers: alekseyshl, kcc

Subscribers: llvm-commits

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

llvm-svn: 318349

6 years ago[POSIX] Replace assert with llvm_unreachable(). NFCI.
Davide Italiano [Wed, 15 Nov 2017 23:39:41 +0000 (23:39 +0000)]
[POSIX] Replace assert with llvm_unreachable(). NFCI.

llvm-svn: 318348

6 years agoclang/module.modulemap: clang/Basic/X86Target.def may be textual header.
NAKAMURA Takumi [Wed, 15 Nov 2017 23:04:44 +0000 (23:04 +0000)]
clang/module.modulemap: clang/Basic/X86Target.def may be textual header.

llvm-svn: 318347

6 years agoAdd X86Target.def that was forgotten in r30734
Erich Keane [Wed, 15 Nov 2017 22:36:24 +0000 (22:36 +0000)]
Add X86Target.def that was forgotten in r30734

llvm-svn: 318345

6 years agoSplit x86 "Processor" info into its own def file. [NFC]
Erich Keane [Wed, 15 Nov 2017 22:25:39 +0000 (22:25 +0000)]
Split x86 "Processor" info into its own def file. [NFC]

A first step toward removing the repetition of
features/CPU info in the x86 target info, this
patch pulls all the processor information out into
its own .def file.

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

llvm-svn: 318343

6 years ago[InstCombine] add sub narrowing tests; NFC
Sanjay Patel [Wed, 15 Nov 2017 22:19:55 +0000 (22:19 +0000)]
[InstCombine] add sub narrowing tests; NFC

This might be the root cause of PR35295:
https://bugs.llvm.org/show_bug.cgi?id=35295

llvm-svn: 318342

6 years ago[AST, Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Wed, 15 Nov 2017 22:00:04 +0000 (22:00 +0000)]
[AST, Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 318341

6 years agoAMDGPU: Replace i64 add/sub lowering
Matt Arsenault [Wed, 15 Nov 2017 21:51:43 +0000 (21:51 +0000)]
AMDGPU: Replace i64 add/sub lowering

Use VOP3 add/addc like usual.

This has some tradeoffs. Inline immediates fold
a little better, but other constants are worse off.
SIShrinkInstructions could be made smarter to handle
these cases.

This allows us to avoid selecting scalar adds where we
need to track the carry in scc and replace its users.
This makes it easier to use the carryless VALU adds.

llvm-svn: 318340

6 years ago[clangd] Loosen more brittle tests
Sam McCall [Wed, 15 Nov 2017 21:50:53 +0000 (21:50 +0000)]
[clangd] Loosen more brittle tests

llvm-svn: 318339

6 years ago[WebAssembly] Update cfg-stackify.ll to remove the workaround added in r318288.
Dan Gohman [Wed, 15 Nov 2017 21:38:33 +0000 (21:38 +0000)]
[WebAssembly] Update cfg-stackify.ll to remove the workaround added in r318288.

Remove -switch-peel-threshold=100 and update the expected results in test10
in cfg-stackify.ll.

llvm-svn: 318338

6 years ago[clangd] Revert broken r318329 and disable tests on PS4
Sam McCall [Wed, 15 Nov 2017 21:33:56 +0000 (21:33 +0000)]
[clangd] Revert broken r318329 and disable tests on PS4

(Clearly this is not a permanent solution)

llvm-svn: 318337

6 years agoFix some typos in a comment.
Francis Ricci [Wed, 15 Nov 2017 21:19:20 +0000 (21:19 +0000)]
Fix some typos in a comment.

llvm-svn: 318336

6 years ago[AArch64] Refactor the loads and stores optimizer
Evandro Menezes [Wed, 15 Nov 2017 21:06:22 +0000 (21:06 +0000)]
[AArch64] Refactor the loads and stores optimizer

Move remaining inline matching of instructions of some optimizations into
separate functions, like in the other optimizations.  Otherwise, NFC.

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

llvm-svn: 318335

6 years agoSimplify file handling in dsymutil.
Rafael Espindola [Wed, 15 Nov 2017 20:55:53 +0000 (20:55 +0000)]
Simplify file handling in dsymutil.

This moves the file handling out of DwarfLinker.cpp.

This fixes what is at least an oddity if not a bug. DwarfLinker.cpp
was using ToolOutputFile, which uses RemoveFileOnSignal. The issue is
that dsymutil.cpp uses that too. It is now clear from the interface
that only dsymutil.cpp is responsible for creating and deleting files.

llvm-svn: 318334

6 years ago[X86] Add some explanatory comments to the ProcessorFeatures enum in Host.cpp.
Craig Topper [Wed, 15 Nov 2017 20:42:49 +0000 (20:42 +0000)]
[X86] Add some explanatory comments to the ProcessorFeatures enum in Host.cpp.

llvm-svn: 318331

6 years ago[X86] Add a return to the end of a switch to prevent an accidental fallthrough in...
Craig Topper [Wed, 15 Nov 2017 20:42:47 +0000 (20:42 +0000)]
[X86] Add a return to the end of a switch to prevent an accidental fallthrough in the future.

llvm-svn: 318330

6 years ago[clangd] Fix flag name from r318327
Sam McCall [Wed, 15 Nov 2017 20:10:14 +0000 (20:10 +0000)]
[clangd] Fix flag name from r318327

llvm-svn: 318329

6 years agoMore of P0600 - '[[nodiscard]] in the Library' mark empty() as nodiscard in string...
Marshall Clow [Wed, 15 Nov 2017 20:02:27 +0000 (20:02 +0000)]
More of P0600 - '[[nodiscard]] in the Library' mark empty() as nodiscard in string, string_view, and the free function std::empty(). Removed tabs from <string_view>, which is why the diff is so big.

llvm-svn: 318328

6 years ago[clangd] Try to unbreak tests on PS4 by targeting PC explicitly
Sam McCall [Wed, 15 Nov 2017 19:38:09 +0000 (19:38 +0000)]
[clangd] Try to unbreak tests on PS4 by targeting PC explicitly

llvm-svn: 318327

6 years ago[test] Alignment must be > __STDCPP_DEFAULT_NEW_ALIGNMENT__ to call aligned new
Casey Carter [Wed, 15 Nov 2017 19:14:45 +0000 (19:14 +0000)]
[test] Alignment must be > __STDCPP_DEFAULT_NEW_ALIGNMENT__ to call aligned new

Differential Revision: D39221

llvm-svn: 318325

6 years ago[llvm-objcopy] Change -O binary to respect section removal and behave like GNU objcopy
Jake Ehrlich [Wed, 15 Nov 2017 19:13:31 +0000 (19:13 +0000)]
[llvm-objcopy] Change -O binary to respect section removal and behave like GNU objcopy

The original -O binary implementation just copied segment data from the
object and dumped it into a file. This doesn't take into account any
operations performed on objects such as section removal. GNU objcopy has
some specific behavior that we'd also like to respect. For instance
using -O binary and -j <some_section> will dump <some_section> to a
file. This change implements GNU objcopy style -O binary to as close of
an approximation as I can determine.

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

llvm-svn: 318324

6 years ago[InstCombine] trunc (binop X, C) --> binop (trunc X, C')
Sanjay Patel [Wed, 15 Nov 2017 19:12:01 +0000 (19:12 +0000)]
[InstCombine] trunc (binop X, C) --> binop (trunc X, C')

Note that one-use and shouldChangeType() are checked ahead of the switch.

Without the narrowing folds, we can produce inferior vector code as shown in PR35299:
https://bugs.llvm.org/show_bug.cgi?id=35299

llvm-svn: 318323

6 years agoUse TempFile in lto caching.
Rafael Espindola [Wed, 15 Nov 2017 19:09:22 +0000 (19:09 +0000)]
Use TempFile in lto caching.

This requires a small change to TempFile: allowing a discard after a
failed keep.

With this the cache now handles signals and reuses a fd instead of
reopening the file.

llvm-svn: 318322

6 years ago[PowerPC] Implement mayBeEmittedAsTailCall for PPC
Sean Fertile [Wed, 15 Nov 2017 18:58:27 +0000 (18:58 +0000)]
[PowerPC] Implement mayBeEmittedAsTailCall for PPC

Implements TargetLowering callback 'mayBeEmittedAsTailCall' that enables
CodeGenPrepare to duplicate returns when they might enable a tail-call.

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

llvm-svn: 318321

6 years ago[InstCombine] Salvage debug info during initial DCE
Reid Kleckner [Wed, 15 Nov 2017 18:51:12 +0000 (18:51 +0000)]
[InstCombine] Salvage debug info during initial DCE

InstCombine salvages debug info for every instruction it erases from its
worklist, but it wasn't doing it during its initial DCE when populating
its worklist. This fixes that.

This should help improve availability of 'this' in optimized debug info
when casts are necessary.

llvm-svn: 318320

6 years ago[InstCombine] add tests for missing trunc folds; NFC
Sanjay Patel [Wed, 15 Nov 2017 18:09:43 +0000 (18:09 +0000)]
[InstCombine] add tests for missing trunc folds; NFC

As noted in PR35299:
https://bugs.llvm.org/show_bug.cgi?id=35299
...this is likely the root cause for a mis-vectorization transform.

llvm-svn: 318319

6 years ago[docs] Mention opt -metarenamer in the bugpoint docs
Vedant Kumar [Wed, 15 Nov 2017 18:05:19 +0000 (18:05 +0000)]
[docs] Mention opt -metarenamer in the bugpoint docs

Thanks to arsenm and davide for the suggestion!

llvm-svn: 318318

6 years ago[clangd] clang-format the source code. NFC.
Ilya Biryukov [Wed, 15 Nov 2017 18:04:56 +0000 (18:04 +0000)]
[clangd] clang-format the source code. NFC.

llvm-svn: 318317

6 years ago[clangd] Fix time units in clangd performance trace
Sam McCall [Wed, 15 Nov 2017 17:53:46 +0000 (17:53 +0000)]
[clangd] Fix time units in clangd performance trace

llvm-svn: 318316

6 years agoTry to fix test/SemaCXX/deleted-operator.cpp after r318309
Hans Wennborg [Wed, 15 Nov 2017 17:47:58 +0000 (17:47 +0000)]
Try to fix test/SemaCXX/deleted-operator.cpp after r318309

The number of 'built-in candidate' notes now varies since __float128 may
or may not be a candidate depending on the target.

llvm-svn: 318314

6 years agoClean up the tests for free data(), size() and empty()
Marshall Clow [Wed, 15 Nov 2017 17:47:09 +0000 (17:47 +0000)]
Clean up the tests for free data(), size() and empty()

llvm-svn: 318313

6 years ago[AArch64] Adjust the cost model for Exynos M1 and M2
Evandro Menezes [Wed, 15 Nov 2017 17:39:37 +0000 (17:39 +0000)]
[AArch64] Adjust the cost model for Exynos M1 and M2

Fix the modeling of loads and stores using the pre or post indexed
addressing modes.

llvm-svn: 318312

6 years agoDrop conflicting sh_entsize values.
Rafael Espindola [Wed, 15 Nov 2017 17:35:22 +0000 (17:35 +0000)]
Drop conflicting sh_entsize values.

An output section can include elements from two input sections with
different sh_entsize. When that happens the output section itself
should not have a sh_entsize.

llvm-svn: 318311

6 years agoRemove an unnecessary constraint.
Rafael Espindola [Wed, 15 Nov 2017 17:31:27 +0000 (17:31 +0000)]
Remove an unnecessary constraint.

Our current implementation of SHF_MERGE can already handle over
aligned elements.

llvm-svn: 318310

6 years agoBuiltinOperatorOverloadBuilder: Don't consider types that are unavailable on the...
Hans Wennborg [Wed, 15 Nov 2017 17:11:53 +0000 (17:11 +0000)]
BuiltinOperatorOverloadBuilder: Don't consider types that are unavailable on the target (PR35174)

In the PR, Clang ended up in a situation where it tried to mangle the
__float128 type, which isn't supported when targetingt MSVC, because
Clang instantiated a variable template with that type when searching for
a conversion to use in an arithmetic expression.

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

llvm-svn: 318309

6 years ago[X86] Add CBW/CDQ/CDQE/CQO/CWD/CWDE to WriteALU schedule class
Simon Pilgrim [Wed, 15 Nov 2017 17:11:24 +0000 (17:11 +0000)]
[X86] Add CBW/CDQ/CDQE/CQO/CWD/CWDE to WriteALU schedule class

Some CPUs are already overriding these sign extension instructions but we should be able to use the WriteALU schedule class by default.

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

llvm-svn: 318308

6 years ago[SLP] Added more missed optimization remarks
Adam Nemet [Wed, 15 Nov 2017 17:04:53 +0000 (17:04 +0000)]
[SLP] Added more missed optimization remarks

Summary:
Added more remarks to SLP pass, in particular "missed" optimization remarks.
Also proposed several tests for new functionality.

Patch by Vladimir Miloserdov!

For reference you may look at: https://reviews.llvm.org/rL302811

Reviewers: anemet, fhahn

Reviewed By: anemet

Subscribers: javed.absar, lattner, petecoup, yakush, llvm-commits

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

llvm-svn: 318307

6 years agoPropagate sh_entsize out.
Rafael Espindola [Wed, 15 Nov 2017 16:56:20 +0000 (16:56 +0000)]
Propagate sh_entsize out.

No difference in practice other than having sh_entsize in the output.

This should simplify the patch for handling SHF_MERGE in -r.

Based on a patch by George Rimar.

llvm-svn: 318306

6 years ago[PowerPC] Split out the tailcall calling convention checks. NFC.
Sean Fertile [Wed, 15 Nov 2017 16:53:41 +0000 (16:53 +0000)]
[PowerPC] Split out the tailcall calling convention checks. NFC.

Move the calling convention checks for tail-call eligibility for the 64-bit
SysV ABI into a separate function. This is so that it can be shared with
'mayBeEmittedAsTailCall' in a subsequent change.

llvm-svn: 318305

6 years agoASTMatchers.h: Fix ODR violations by avoiding internal linkage variables in headers
David Blaikie [Wed, 15 Nov 2017 16:52:12 +0000 (16:52 +0000)]
ASTMatchers.h: Fix ODR violations by avoiding internal linkage variables in headers

Internal linkage variables ODR referenced from inline functions create
ODR violations (the same inline function ends up having different
definitions in each TU, since it references different variables - rather
than one definition).

This also happens to break modular code generation - so this is the last
fix to allow clang to compile with modular code generation.

llvm-svn: 318304

6 years agolibfuzzer: Fix file listing on some filesystems
Kostya Serebryany [Wed, 15 Nov 2017 16:45:17 +0000 (16:45 +0000)]
libfuzzer: Fix file listing on some filesystems

Summary:
For some filesystems, readdir will not populate dirent::d_type with valuable information. This causes libfuzzer to proceed with an empty corpus, instead of the file it contains.

This has been tested on a server using XFS.

It should fix https://bugs.llvm.org//show_bug.cgi?id=25991

Reviewers: kcc

Reviewed By: kcc

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

llvm-svn: 318303

6 years ago[libFuzzer] respect max_len during merge
Kostya Serebryany [Wed, 15 Nov 2017 16:42:52 +0000 (16:42 +0000)]
[libFuzzer] respect max_len during merge

llvm-svn: 318302

6 years ago[scudo] Soft and hard RSS limit checks
Kostya Kortchinsky [Wed, 15 Nov 2017 16:40:27 +0000 (16:40 +0000)]
[scudo] Soft and hard RSS limit checks

Summary:
This implements an opportunistic check for the RSS limit.

For ASan, this was implemented thanks to a background thread checking the
current RSS vs the set limit every 100ms. This was deemed problematic for Scudo
due to potential Android concerns (Zygote as pointed out by Aleksey) as well as
the general inconvenience of having a permanent background thread.

If a limit (soft or hard) is specified, we will attempt to update the RSS limit
status (exceeded or not) every 100ms. This is done in an opportunistic way: if
we can update it, we do it, if not we return the current status, mostly because
we don't need it to be fully consistent (it's done every 100ms anyway). If the
limit is exceeded `allocate` will act as if OOM for a soft limit, or just die
for a hard limit.

We use the `common_flags()`'s `hard_rss_limit_mb` & `soft_rss_limit_mb` for
configuration of the limits.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 318301

6 years ago[PassManager, SimplifyCFG] add test for PR34603 / D38566; NFC
Sanjay Patel [Wed, 15 Nov 2017 16:37:30 +0000 (16:37 +0000)]
[PassManager, SimplifyCFG] add test for PR34603 / D38566; NFC

This is a recommit of r316908 which was reverted by r317444.

llvm-svn: 318300

6 years ago[(new) Pass Manager] instantiate SimplifyCFG with the same options as the old PM
Sanjay Patel [Wed, 15 Nov 2017 16:33:11 +0000 (16:33 +0000)]
[(new) Pass Manager] instantiate SimplifyCFG with the same options as the old PM

This is a recommit of r316869 which was speculatively reverted with r317444 and
subsequently shown to not be the cause of PR35210. That crash should be fixed
after r318237.

Original commit message:

The old PM sets the options of what used to be known as "latesimplifycfg" on the
instantiation after the vectorizers have run, so that's what we'redoing here.

FWIW, there's a later SimplifyCFGPass instantiation in both PMs where we do not
set the "late" options. I'm not sure if that's intentional or not.

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

llvm-svn: 318299

6 years ago[Reassociate] simplify code; NFCI
Sanjay Patel [Wed, 15 Nov 2017 16:19:17 +0000 (16:19 +0000)]
[Reassociate] simplify code; NFCI

llvm-svn: 318298

6 years ago[AArch64][SVE] Asm: Report SVE parsing diagnostics only once
Sander de Smalen [Wed, 15 Nov 2017 15:44:43 +0000 (15:44 +0000)]
[AArch64][SVE] Asm: Report SVE parsing diagnostics only once

Summary:
Prevent an issue where a diagnostic is reported multiple times by bailing out with a ParseFail if an invalid SVE register element qualifier/suffix is specified, for example:

 <stdin>:10:18: error: invalid sve vector kind qualifier
 add z20.h, z2.h, z31.x
                 ^
 <stdin>:10:18: error: invalid sve vector kind qualifier
 add z20.h, z2.h, z31.x

 ...

 <stdin>:10:18: error: invalid sve vector kind qualifier
 add z20.h, z2.h, z31.x
                 ^

Reviewers: fhahn, rengolin

Reviewed By: rengolin

Subscribers: aemerson, javed.absar, tschuett, llvm-commits, kristof.beyls

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

llvm-svn: 318297

6 years ago[mips] Improve genConstMult() to work with arbitrary precision
Petar Jovanovic [Wed, 15 Nov 2017 15:24:04 +0000 (15:24 +0000)]
[mips] Improve genConstMult() to work with arbitrary precision

APInt is now used instead of uint64_t in function genConstMult() allowing
multiplication optimizations with constants of arbitrary length.

Patch by Milos Stojanovic.

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

llvm-svn: 318296

6 years ago[llvm-opt-fuzzer] Add opt fuzzer to the test-depends list.
Igor Laevsky [Wed, 15 Nov 2017 15:07:37 +0000 (15:07 +0000)]
[llvm-opt-fuzzer] Add opt fuzzer to the test-depends list.
This should help with the buildbot failures after rL318293.

llvm-svn: 318295

6 years ago[llvm-opt-fuzzer] Only run tests for the x86 target.
Igor Laevsky [Wed, 15 Nov 2017 13:35:42 +0000 (13:35 +0000)]
[llvm-opt-fuzzer] Only run tests for the x86 target.
This fixes build bot failures after rL318293.

llvm-svn: 318294

6 years ago[llvm-opt-fuzzer] NFC. Add sanity tests.
Igor Laevsky [Wed, 15 Nov 2017 12:36:57 +0000 (12:36 +0000)]
[llvm-opt-fuzzer] NFC. Add sanity tests.

llvm-svn: 318293

6 years ago[libclang] Fix cursors for in-class initializer of field declarations
Benjamin Kramer [Wed, 15 Nov 2017 12:20:41 +0000 (12:20 +0000)]
[libclang] Fix cursors for in-class initializer of field declarations

Fixes PR33745.

Patch by Nikolai Kosjar!

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

llvm-svn: 318292

6 years ago[ARM] Split Arm jump table branch into i12 and rs suffixed versions
Momchil Velikov [Wed, 15 Nov 2017 12:02:55 +0000 (12:02 +0000)]
[ARM] Split Arm jump table branch into i12 and rs suffixed versions

This is a refactoring/cleanup of Arm `addrmode2` operand class. The patch
removes it completely.

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

llvm-svn: 318291

6 years ago[OpenCL] Fix code generation of function-scope constant samplers.
Alexey Bader [Wed, 15 Nov 2017 11:38:17 +0000 (11:38 +0000)]
[OpenCL] Fix code generation of function-scope constant samplers.

Summary:
Constant samplers are handled as static variables and clang's code generation
library, which leads to llvm::unreachable. We bypass emitting sampler variable
as static since it's translated to a function call later.

Reviewers: yaxunl, Anastasia

Reviewed By: yaxunl, Anastasia

Subscribers: cfe-commits

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

llvm-svn: 318290

6 years ago[DebugInfo] Fix potential CU mismatch for SubprogramScopeDIEs.
Jonas Devlieghere [Wed, 15 Nov 2017 10:57:05 +0000 (10:57 +0000)]
[DebugInfo] Fix potential CU mismatch for SubprogramScopeDIEs.

In constructAbstractSubprogramScopeDIE there can be a potential mismatch
between `this` and the CU of ContextDIE when a scope is shared between
two DISubprograms belonging to a different CU. In that case, `this` is
the CU that was specified in the IR, but the CU of ContextDIE is that of
the first subprogram that was emitted. This patch fixes the mismatch by
looking up the CU of ContextDIE, and switching to use that.

This fixes PR35212 (https://bugs.llvm.org/show_bug.cgi?id=35212)

Patch by Philip Craig!

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

llvm-svn: 318289

6 years agoWorkaround CodeGen/WebAssembly/cfg-stackify.ll failure after r318202
Ilya Biryukov [Wed, 15 Nov 2017 10:50:43 +0000 (10:50 +0000)]
Workaround CodeGen/WebAssembly/cfg-stackify.ll failure after r318202

By disabling the introduced optimization.

llvm-svn: 318288

6 years ago[clangd] Support returning a limited number of completion results.
Sam McCall [Wed, 15 Nov 2017 09:16:29 +0000 (09:16 +0000)]
[clangd] Support returning a limited number of completion results.

Summary:
All results are scored, we only process CodeCompletionStrings for the winners.
We now return CompletionList rather than CompletionItem[] (both are valid).
sortText is now based on CodeCompletionResult::orderedName (mostly the same).

This is the first clangd-only completion option, so plumbing changed.
It requires a small clangd patch (exposing CodeCompletionResult::orderedName).

(This can't usefully be enabled yet: we don't support server-side filtering)

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 318287

6 years ago[clang] Expose orderedString from CodeCompletionResult. NFC
Sam McCall [Wed, 15 Nov 2017 09:15:06 +0000 (09:15 +0000)]
[clang] Expose orderedString from CodeCompletionResult. NFC

llvm-svn: 318286

6 years ago[MinGW] Ignore the --build-id, --pie-executable and --disable-auto-image-base options
Martin Storsjo [Wed, 15 Nov 2017 08:18:28 +0000 (08:18 +0000)]
[MinGW] Ignore the --build-id, --pie-executable and --disable-auto-image-base options

LLD already writes a build id if debug info is enabled.

Some projects set --pie-executable to avoid GNU ld bugs about stripping
base relocations from an executable when they actually are used.
Since -fixed:no is the default (and we don't support setting the
-fixed option via the MinGW frontend), we don't need to handle this.

--disable-auto-image-base is ignored just like --enable-auto-image-base
(as we ignore from before).

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

llvm-svn: 318285

6 years ago[COFF] Always include the size of the string table size field
Martin Storsjo [Wed, 15 Nov 2017 08:18:25 +0000 (08:18 +0000)]
[COFF] Always include the size of the string table size field

Even if we don't actually write any string table contents, the
4 byte size for the string table will always be written. Make
sure we accommodate for this in the file size. Since this size
is aligned up, this would seldom be an issue in practice.

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

llvm-svn: 318284

6 years ago[MinGW] Implement the --[no-]gc-sections and --icf options
Martin Storsjo [Wed, 15 Nov 2017 08:18:20 +0000 (08:18 +0000)]
[MinGW] Implement the --[no-]gc-sections and --icf options

GNU ld doesn't seem to support --icf at all, but this was suggested
in D39885, and GNU gold seems to support it.

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

llvm-svn: 318283

6 years ago[MinGW] Implement support for the --image-base option
Martin Storsjo [Wed, 15 Nov 2017 08:18:15 +0000 (08:18 +0000)]
[MinGW] Implement support for the --image-base option

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

llvm-svn: 318282

6 years ago[MinGW] Add support for --dynamicbase, ignore --nxcompat, --tsaware and --high-entropy-va
Martin Storsjo [Wed, 15 Nov 2017 08:18:11 +0000 (08:18 +0000)]
[MinGW] Add support for --dynamicbase, ignore --nxcompat, --tsaware and --high-entropy-va

All of these are disabled by default in GNU ld, but enabled by default
in lld.

Disable dynamicbase by default since it potentially could cause
compatibility issues, but just ignore the others since the lld
default should be fine for most concievable cases.

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

llvm-svn: 318281