platform/upstream/llvm.git
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

6 years ago[MinGW] Handle --large-address-aware
Martin Storsjo [Wed, 15 Nov 2017 08:18:06 +0000 (08:18 +0000)]
[MinGW] Handle --large-address-aware

In GNU ld, this option is only available on i386, not on x86_64
(where it's enabled by default with no option to disable it either).

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

llvm-svn: 318280

6 years ago[Lint] Don't warn about passing alloca'd value to tail call if using byval
Mikael Holmen [Wed, 15 Nov 2017 07:46:48 +0000 (07:46 +0000)]
[Lint] Don't warn about passing alloca'd value to tail call if using byval

Summary:
This fixes PR35241.

When using byval, the data is effectively copied as part of the call
anyway, so the pointer returned by the alloca will not be leaked to the
callee and thus there is no reason to issue a warning.

Reviewers: rnk

Reviewed By: rnk

Subscribers: Ka-Ka, llvm-commits

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

llvm-svn: 318279

6 years ago[X86] Redefine the 128-bit version of VPGATHERQD and VGATHERQPS to use a VK2 mask...
Craig Topper [Wed, 15 Nov 2017 07:46:43 +0000 (07:46 +0000)]
[X86] Redefine the 128-bit version of VPGATHERQD and VGATHERQPS to use a VK2 mask instead of a VK4 mask.

This allows us to remove extra extend creation during lowering and more accurately reflects the semantics of the instruction.

While there add an extra output VT to X86 masked gather node to better match the isel pattern predicate. Currently we're exploiting the fact that the isel table doesn't count how many output results a node actually has if the result type of any can be inferred from the first result and the type constraints defined in tablegen. I think we might ultimately want to lower all MGATHER/MSCATTER to an X86ISD node with the extra mask result and stop relying on this hole in the isel checking.

llvm-svn: 318278

6 years agoTolerate even more [[nodiscard]] in the STL. Reviewed as https://reviews.llvm.org...
Billy Robert O'Neal III [Wed, 15 Nov 2017 07:45:07 +0000 (07:45 +0000)]
Tolerate even more [[nodiscard]] in the STL. Reviewed as https://reviews.llvm.org/D39080

llvm-svn: 318277

6 years agoTolerate [[nodiscard]] annotations in the STL. Reviewed as https://reviews.llvm.org...
Billy Robert O'Neal III [Wed, 15 Nov 2017 07:40:37 +0000 (07:40 +0000)]
Tolerate [[nodiscard]] annotations in the STL. Reviewed as https://reviews.llvm.org/D39033

llvm-svn: 318276

6 years agoGISelWorkList.h: Fix -fmodules build in rL318210.
NAKAMURA Takumi [Wed, 15 Nov 2017 07:34:35 +0000 (07:34 +0000)]
GISelWorkList.h: Fix -fmodules build in rL318210.

llvm-svn: 318275

6 years agoASTMatchers.h: Avoid warnings due to "@throw". [-Wdocumentation]
NAKAMURA Takumi [Wed, 15 Nov 2017 06:53:45 +0000 (06:53 +0000)]
ASTMatchers.h: Avoid warnings due to "@throw". [-Wdocumentation]

llvm-svn: 318274

6 years agoFix llvm/test/Transforms/LoopRotate/pr35210.ll in rL318237, it uses debug options.
NAKAMURA Takumi [Wed, 15 Nov 2017 06:46:58 +0000 (06:46 +0000)]
Fix llvm/test/Transforms/LoopRotate/pr35210.ll in rL318237, it uses debug options.

llvm-svn: 318273

6 years agoNFC Remove default argument of DataLayout::getPointerABIAlignment
Fangrui Song [Wed, 15 Nov 2017 06:17:32 +0000 (06:17 +0000)]
NFC Remove default argument of DataLayout::getPointerABIAlignment

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

llvm-svn: 318272

6 years ago[X86] Add getHostCPUName support for the Gemini Lake model number which also uses...
Craig Topper [Wed, 15 Nov 2017 06:02:43 +0000 (06:02 +0000)]
[X86] Add getHostCPUName support for the Gemini Lake model number which also uses Goldmont.

llvm-svn: 318271

6 years ago[X86] Add getHostCPUName support for cannonlake.
Craig Topper [Wed, 15 Nov 2017 06:02:42 +0000 (06:02 +0000)]
[X86] Add getHostCPUName support for cannonlake.

This adds an explicit model number check and fallback path to the unknown family 6 detection.

llvm-svn: 318270

6 years agoFirst part of P0600 - '[[nodiscard] in the standard library'. Mark the 'empty()'...
Marshall Clow [Wed, 15 Nov 2017 05:51:26 +0000 (05:51 +0000)]
First part of P0600 - '[[nodiscard] in the standard library'. Mark the 'empty()' methods of all the containers as nodiscard. If you're calling empty() w/o looking at the result, you probably meanto to call 'clear()'. c++2a only

llvm-svn: 318269

6 years agoStill more missing tests - this time for the unordered containers
Marshall Clow [Wed, 15 Nov 2017 05:25:36 +0000 (05:25 +0000)]
Still more missing tests - this time for the unordered containers

llvm-svn: 318268

6 years ago[InstCombine] Simplify binops that are only used by a select and are fed by a select...
Craig Topper [Wed, 15 Nov 2017 05:23:02 +0000 (05:23 +0000)]
[InstCombine] Simplify binops that are only used by a select and are fed by a select with the same condition.

Summary:
This patch optimizes a binop sandwiched between 2 selects with the same condition. Since we know its only used by the select we can propagate the appropriate input value from the earlier select.

As I'm writing this I realize I may need to avoid doing this for division in case the select was protecting a divide by zero?

Reviewers: spatel, majnemer

Reviewed By: majnemer

Subscribers: llvm-commits

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

llvm-svn: 318267

6 years ago[PowerPC] fix up in redundant compare elimination
Hiroshi Inoue [Wed, 15 Nov 2017 04:23:26 +0000 (04:23 +0000)]
[PowerPC] fix up in redundant compare elimination

This patch fixes a potential problem in my previous commit (https://reviews.llvm.org/rL312514) by introducing an additional check.

llvm-svn: 318266

6 years agomath: Implement minmag
Jan Vesely [Wed, 15 Nov 2017 04:10:39 +0000 (04:10 +0000)]
math: Implement minmag

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

6 years agomath: Implement maxmag
Jan Vesely [Wed, 15 Nov 2017 04:10:37 +0000 (04:10 +0000)]
math: Implement maxmag

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

6 years agoMake the test more strict. NFC.
Rafael Espindola [Wed, 15 Nov 2017 04:00:54 +0000 (04:00 +0000)]
Make the test more strict. NFC.

llvm-svn: 318263

6 years agoRoll back r318260 because it is causing the windows bot to
Jason Molenda [Wed, 15 Nov 2017 03:41:47 +0000 (03:41 +0000)]
Roll back r318260 because it is causing the windows bot to
break.  The alignas(__uint128_t) is not recognized with MSVC
it looks like.  Zachary, is there a similar type on windows?
I suppose I can go with alignas(16) here but I'd prefer to
specify the type alignment that I want & let the ABI dictate
how much padding is required.

llvm-svn: 318262

6 years ago[XRay][compiler-rt][x86_64] Align the stack before and after calling handlers
Dean Michael Berris [Wed, 15 Nov 2017 03:35:42 +0000 (03:35 +0000)]
[XRay][compiler-rt][x86_64] Align the stack before and after calling handlers

Summary:
This change fixes the XRay trampolines aside from the __xray_CustomEvent
trampoline to align the stack to 16-byte boundaries before calling the
handler. Before this change we've not been explicitly aligning the stack
to 16-byte boundaries, which makes it dangerous when calling handlers
that leave the stack in a state that isn't strictly 16-byte aligned
after calling the handlers.

We add a test that makes sure we can handle these cases appropriately
after the changes, and prevents us from regressing the state moving
forward.

Fixes http://llvm.org/PR35294.

Reviewers: pelikan, pcc

Subscribers: llvm-commits

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

llvm-svn: 318261

6 years agoTwo small fixes to handle arm64 fpu register contexts in
Jason Molenda [Wed, 15 Nov 2017 03:18:24 +0000 (03:18 +0000)]
Two small fixes to handle arm64 fpu register contexts in
a Mach-O file load command correctly, patch by Ryan
Mansfield.

<rdar://problem/35468499>

llvm-svn: 318260

6 years agoNamed the macro wrong in the test.
Marshall Clow [Wed, 15 Nov 2017 03:08:39 +0000 (03:08 +0000)]
Named the macro wrong in the test.

llvm-svn: 318259

6 years agoPR35214: don't crash if we see an array of unknown bound added to an empty but invali...
Richard Smith [Wed, 15 Nov 2017 03:03:56 +0000 (03:03 +0000)]
PR35214: don't crash if we see an array of unknown bound added to an empty but invalid designator.

llvm-svn: 318258

6 years ago[docs] Document a way to simplify names in bugpoint output
Vedant Kumar [Wed, 15 Nov 2017 02:58:45 +0000 (02:58 +0000)]
[docs] Document a way to simplify names in bugpoint output

llvm-svn: 318257

6 years agoMore missing tests - array<>::size() and array<>::max_size()
Marshall Clow [Wed, 15 Nov 2017 02:31:14 +0000 (02:31 +0000)]
More missing tests - array<>::size() and array<>::max_size()

llvm-svn: 318256

6 years agoUpdate Appveyor LLVM install link to be current and non-broken
Eric Fiselier [Wed, 15 Nov 2017 01:37:11 +0000 (01:37 +0000)]
Update Appveyor LLVM install link to be current and non-broken

llvm-svn: 318247

6 years agoAMDGPU: Add separate definitions for DS insts without m0 use
Matt Arsenault [Wed, 15 Nov 2017 01:34:06 +0000 (01:34 +0000)]
AMDGPU: Add separate definitions for DS insts without m0 use

llvm-svn: 318246

6 years ago[modules] Fix crash in complex class merging scenario.
Richard Smith [Wed, 15 Nov 2017 01:33:46 +0000 (01:33 +0000)]
[modules] Fix crash in complex class merging scenario.

When we merge together class definitions, we can end up with the canonical
declaration of a field not being the one that was lexically within the
canonical definition of the class. Additionally, when we merge class
definitions via update records (eg, for a template specialization whose
declaration is instantiated in one module and whose definition is instantiated
in multiple others), we can end up with the list of lexical contents for the
class not including a particular declaration of a field whose lexical parent is
that class definition. In the worst case, we have a field whose canonical
declaration's lexical parent has no fields, and in that case this attempt to
number the fields by walking the fields in the declaration of the class that
contained one of the canonical fields will fail.

Instead, when numbering fields in a class, do the obvious thing: walk the
fields in the definition.

I'm still trying to reduce a testcase; the setup that leads to the above
scenario seems to be quite fragile.

llvm-svn: 318245

6 years agoAdded tests for xxx.size() and xxx.empty() for all the sequence containers
Marshall Clow [Wed, 15 Nov 2017 01:33:33 +0000 (01:33 +0000)]
Added tests for xxx.size() and xxx.empty() for all the sequence containers

llvm-svn: 318244

6 years ago[X86] Correct the spelling of pentiumpro in X86TargetParser.def
Craig Topper [Wed, 15 Nov 2017 01:01:50 +0000 (01:01 +0000)]
[X86] Correct the spelling of pentiumpro in X86TargetParser.def

Thanks to Erich Keane for spotting this.

llvm-svn: 318243

6 years agoAMDGPU: Don't use MUBUF vaddr if address may overflow
Matt Arsenault [Wed, 15 Nov 2017 00:45:43 +0000 (00:45 +0000)]
AMDGPU: Don't use MUBUF vaddr if address may overflow

Effectively revert r263964. Before we would not
allow this if vaddr was not known to be positive.

llvm-svn: 318240

6 years agoRevert r318193 "[SLPVectorizer] Failure to beneficially vectorize 'copyable' elements...
Hans Wennborg [Wed, 15 Nov 2017 00:38:13 +0000 (00:38 +0000)]
Revert r318193 "[SLPVectorizer] Failure to beneficially vectorize 'copyable' elements in integer binary ops."

It crashes building sqlite; see reply on the llvm-commits thread.

> [SLPVectorizer] Failure to beneficially vectorize 'copyable' elements in integer binary ops.
>
>         Patch tries to improve vectorization of the following code:
>
>         void add1(int * __restrict dst, const int * __restrict src) {
>           *dst++ = *src++;
>           *dst++ = *src++ + 1;
>           *dst++ = *src++ + 2;
>           *dst++ = *src++ + 3;
>         }
>         Allows to vectorize even if the very first operation is not a binary add, but just a load.
>
>         Fixed issues related to previous commit.
>
>         Reviewers: spatel, mzolotukhin, mkuper, hfinkel, RKSimon, filcab, ABataev
>
>         Reviewed By: ABataev, RKSimon
>
>         Subscribers: llvm-commits, RKSimon
>
>         Differential Revision: https://reviews.llvm.org/D28907

llvm-svn: 318239

6 years ago[cfi-verify] Validate there are no register clobbers between CFI-check and instructio...
Mitch Phillips [Wed, 15 Nov 2017 00:35:26 +0000 (00:35 +0000)]
[cfi-verify] Validate there are no register clobbers between CFI-check and instruction execution.

Summary:
This patch adds another failure mode for `validateCFIProtection(..)`, wherein any register that affects the indirect control flow instruction is clobbered to between the CFI-check and the instruction's execution.

Also includes a modification to make MCInstrDesc::hasDefOfPhysReg public.

Reviewers: vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Subscribers: llvm-commits, pcc, kcc

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

llvm-svn: 318238

6 years ago[LoopRotate] processLoop should return true even if it just simplified the loop latch...
Craig Topper [Wed, 15 Nov 2017 00:22:42 +0000 (00:22 +0000)]
[LoopRotate] processLoop should return true even if it just simplified the loop latch without making any other changes

Simplifying a loop latch changes the IR and we need to make sure the pass manager knows to invalidate analysis passes if that happened.

PR35210 discovered a case where we failed to invalidate the post dominator tree after this simplification because we no changes other than simplifying the loop latch.

Fixes PR35210.

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

llvm-svn: 318237

6 years ago[asan] Prevent rematerialization of &__asan_shadow.
Evgeniy Stepanov [Wed, 15 Nov 2017 00:11:51 +0000 (00:11 +0000)]
[asan] Prevent rematerialization of &__asan_shadow.

Summary:
In the mode when ASan shadow base is computed as the address of an
external global (__asan_shadow, currently on android/arm32 only),
regalloc prefers to rematerialize this value to save register spills.
Even in -Os. On arm32 it is rather expensive (2 loads + 1 constant
pool entry).

This changes adds an inline asm in the function prologue to suppress
this behavior. It reduces AsanTest binary size by 7%.

Reviewers: pcc, vitalybuka

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

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

llvm-svn: 318235

6 years agoSimplify CpuIs code to use include from LLVM
Erich Keane [Wed, 15 Nov 2017 00:11:24 +0000 (00:11 +0000)]
Simplify CpuIs code to use include from LLVM

LLVM exposes a file in the backend (X86TargetParser.def) that
contains information about the correct list of CpuIs values.

This patch removes 2 of the copied and pasted versions of this
list from clang and instead includes the data from the .def file.

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

llvm-svn: 318234

6 years ago[profile] Update InstrProfData.inc to sync with llvm
Vedant Kumar [Tue, 14 Nov 2017 23:57:58 +0000 (23:57 +0000)]
[profile] Update InstrProfData.inc to sync with llvm

llvm-svn: 318230

6 years ago[PGO] Detect more structural changes with the stable hash
Vedant Kumar [Tue, 14 Nov 2017 23:56:53 +0000 (23:56 +0000)]
[PGO] Detect more structural changes with the stable hash

Lifting from Bob Wilson's notes: The hash value that we compute and
store in PGO profile data to detect out-of-date profiles does not
include enough information. This means that many significant changes to
the source will not cause compiler warnings about the profile being out
of date, and worse, we may continue to use the outdated profile data to
make bad optimization decisions.  There is some tension here because
some source changes won't affect PGO and we don't want to invalidate the
profile unnecessarily.

This patch adds a new hashing scheme which is more sensitive to loop
nesting, conditions, and out-of-order control flow. Here are examples
which show snippets which get the same hash under the current scheme,
and different hashes under the new scheme:

Loop Nesting Example
--------------------

  // Snippet 1
  while (foo()) {
    while (bar()) {}
  }

  // Snippet 2
  while (foo()) {}
  while (bar()) {}

Condition Example
-----------------

  // Snippet 1
  if (foo())
    bar();
  baz();

  // Snippet 2
  if (foo())
    bar();
  else
    baz();

Out-of-order Control Flow Example
---------------------------------

  // Snippet 1
  while (foo()) {
    if (bar()) {}
    baz();
  }

  // Snippet 2
  while (foo()) {
    if (bar())
      continue;
    baz();
  }

In each of these cases, it's useful to differentiate between the
snippets because swapping their profiles gives bad optimization hints.

The new hashing scheme considers some logical operators in an effort to
detect more changes in conditions. This isn't a perfect scheme. E.g, it
does not produce the same hash for these equivalent snippets:

  // Snippet 1
  bool c = !a || b;
  if (d && e) {}

  // Snippet 2
  bool f = d && e;
  bool c = !a || b;
  if (f) {}

This would require an expensive data flow analysis. Short of that, the
new hashing scheme looks reasonably complete, based on a scan over the
statements we place counters on.

Profiles which use the old version of the PGO hash remain valid and can
be used without issue (there are tests in tree which check this).

rdar://17068282

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

llvm-svn: 318229

6 years ago[PGO] Bump the indexed profile format version
Vedant Kumar [Tue, 14 Nov 2017 23:56:48 +0000 (23:56 +0000)]
[PGO] Bump the indexed profile format version

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

llvm-svn: 318228