platform/upstream/llvm.git
6 years ago[clang-tidy] New checker for exceptions that are created but not thrown
Gabor Horvath [Thu, 15 Feb 2018 09:08:51 +0000 (09:08 +0000)]
[clang-tidy] New checker for exceptions that are created but not thrown

Patch by: Kristof Umann

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

llvm-svn: 325222

6 years ago[clang-format] Improve ObjC headers detection
Jacek Olesiak [Thu, 15 Feb 2018 08:47:56 +0000 (08:47 +0000)]
[clang-format] Improve ObjC headers detection

Summary: Detect ObjC characteristic types when they start a line and add additional keywords.

Reviewers: benhamilton

Reviewed By: benhamilton

Subscribers: klimek, cfe-commits

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

llvm-svn: 325221

6 years ago[clangd] Fix tracing now that spans lifetimes can overlap on a thread.
Sam McCall [Thu, 15 Feb 2018 08:40:54 +0000 (08:40 +0000)]
[clangd] Fix tracing now that spans lifetimes can overlap on a thread.

Summary:
The chrome trace viewer requires events within a thread to strictly nest.
So we need to record the lifetime of the Span objects, not the contexts.

But we still want to show the relationship between spans where a context crosses
threads, so do this with flow events (i.e. arrows).

Before: https://photos.app.goo.gl/q4Dd9u9xtelaXk1v1
After: https://photos.app.goo.gl/5RNLmAMLZR3unvY83

(This could stand some further improvement, in particular I think we want a
container span whenever we schedule work on a thread. But that's another patch)

Reviewers: ioeric

Subscribers: klimek, ilya-biryukov, jkorous-apple, cfe-commits

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

llvm-svn: 325220

6 years ago[CMake] Add -fno-experimental-isel for testing
Jonas Hahnfeld [Thu, 15 Feb 2018 08:10:22 +0000 (08:10 +0000)]
[CMake] Add -fno-experimental-isel for testing

GlobalISel doesn't yet implement blockaddress and falls back to
SelectionDAG. This results in additional branch instruction to
the next basic block which breaks the OMPT tests.
Disable GlobalISel for now when compiling the tests because fixing
them is not easily possible. See http://llvm.org/PR36313 for full
discussion history.

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

llvm-svn: 325218

6 years ago(NFC)[MachineCombiner] Improve debug output.
Andrew V. Tischenko [Thu, 15 Feb 2018 07:55:02 +0000 (07:55 +0000)]
(NFC)[MachineCombiner] Improve debug output.

llvm-svn: 325217

6 years ago[NFC] Rename isKnownViaSimpleReasoning to isKnownViaNonRecursiveReasoning
Max Kazantsev [Thu, 15 Feb 2018 07:47:17 +0000 (07:47 +0000)]
[NFC] Rename isKnownViaSimpleReasoning to isKnownViaNonRecursiveReasoning

llvm-svn: 325216

6 years ago[NFC] Fix metadata placement in test
Max Kazantsev [Thu, 15 Feb 2018 07:13:18 +0000 (07:13 +0000)]
[NFC] Fix metadata placement in test

llvm-svn: 325215

6 years ago[SCEV] Favor isKnownViaSimpleReasoning over constant ranges check
Max Kazantsev [Thu, 15 Feb 2018 07:09:00 +0000 (07:09 +0000)]
[SCEV] Favor isKnownViaSimpleReasoning over constant ranges check

There is a more powerful but still simple function `isKnownViaSimpleReasoning ` that
does constant range check and few more additional checks. We use it some places (e.g.
when proving implications) and in some other places we only check constant ranges.

Currently, indvar simplifier fails to remove the check in following loop:

  int inc = ...;
  for (int i = inc, j = inc - 1; i < 200; ++i, ++j)
    if (i > j) { ... }

This patch replaces all usages of `isKnownPredicateViaConstantRanges` with
`isKnownViaSimpleReasoning` to have smarter proofs. In particular, it fixes the
case above.

Reviewed-By: sanjoy
Differential Revision: https://reviews.llvm.org/D43175

llvm-svn: 325214

6 years ago[ELF] Simplify handling of AT section attribute.
Igor Kudrin [Thu, 15 Feb 2018 06:13:52 +0000 (06:13 +0000)]
[ELF] Simplify handling of AT section attribute.

This also makes the behavior close to GNU ld's.

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

llvm-svn: 325213

6 years agoTeach sanitizer about NetBSD specific ioctl(2) calls
Kamil Rytarowski [Thu, 15 Feb 2018 03:36:16 +0000 (03:36 +0000)]
Teach sanitizer about NetBSD specific ioctl(2) calls

Summary:
Introduce handling of 1200 NetBSD specific ioctl(2) calls.
Over 100 operations are disabled as unavailable or conflicting
with the existing ones (the same operation number).

Add a script that generates the rules to detect ioctls on NetBSD.
The generate_netbsd_ioctls.awk script has been written
in NetBSD awk(1) (patched nawk) and is compatible with gawk.

Generate lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
with the awk(1) script.

Update sanitizer_platform_limits_netbsd accordingly to add the needed
definitions.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, eugenis, dvyukov

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, mgorny, fedor.sergeev, #sanitizers

Tags: #sanitizers

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

llvm-svn: 325212

6 years ago[analyzer] Inline constructors for destroyable temporaries.
Artem Dergachev [Thu, 15 Feb 2018 03:26:43 +0000 (03:26 +0000)]
[analyzer] Inline constructors for destroyable temporaries.

Since r325210, in cfg-temporary-dtors mode, we can rely on the CFG to tell us
that we're indeed constructing a temporary, so we can trivially construct a
temporary region and inline the constructor.

Much like r325202, this is only done under the off-by-default
cfg-temporary-dtors flag because the temporary destructor, even if available,
will not be inlined and won't have the correct object value (target region).
Unless this is fixed, it is quite unsafe to inline the constructor.

If the temporary is lifetime-extended, the destructor would be an automatic
destructor, which would be evaluated with a "correct" target region - modulo
the series of incorrect relocations performed during the lifetime extension.
It means that at least, values within the object are guaranteed to be properly
escaped or invalidated.

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

llvm-svn: 325211

6 years ago[CFG] Provide construction contexts for temproary objects.
Artem Dergachev [Thu, 15 Feb 2018 03:13:36 +0000 (03:13 +0000)]
[CFG] Provide construction contexts for temproary objects.

Constructors of C++ temporary objects that have destructors now can be queried
to discover that they're indeed constructing temporary objects.

The respective CXXBindTemporaryExpr, which is also repsonsible for destroying
the temporary at the end of full-expression, is now available at the
construction site in the CFG. This is all the context we need to provide for
temporary objects that are not lifetime extended. For lifetime-extended
temporaries, more context is necessary.

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

llvm-svn: 325210

6 years ago[analyzer] Decide on inlining destructors via EvalCallOptions.
Artem Dergachev [Thu, 15 Feb 2018 02:51:58 +0000 (02:51 +0000)]
[analyzer] Decide on inlining destructors via EvalCallOptions.

EvalCallOptions were introduced in r324018 for allowing various parts of
ExprEngine to notify the inlining mechanism, while preparing for evaluating a
function call, of possible difficulties with evaluating the call that they
foresee. Then mayInlineCall() would still be a single place for making the
decision.

Use that mechanism for destructors as well - pass the necessary flags from the
CFG-element-specific destructor handlers.

Part of this patch accidentally leaked into r324018, which led into a change in
tests; this change is reverted now, because even though the change looked
correct, the underlying behavior wasn't. Both of these commits were not intended
to introduce any function changes otherwise.

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

llvm-svn: 325209

6 years agoPrevent recursive MSan interceptors in strftime(3) like functions
Kamil Rytarowski [Thu, 15 Feb 2018 02:48:20 +0000 (02:48 +0000)]
Prevent recursive MSan interceptors in strftime(3) like functions

Summary:
This corrects intercepting this call on NetBSD without false positives.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, eugenis, vitalybuka

Reviewed By: vitalybuka

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 325208

6 years agoPrevent recursive MSan interceptors in fgets(3)
Kamil Rytarowski [Thu, 15 Feb 2018 02:47:35 +0000 (02:47 +0000)]
Prevent recursive MSan interceptors in fgets(3)

Summary:
This corrects intercepting this call on NetBSD without false positives.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, eugenis, vitalybuka

Reviewed By: vitalybuka

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 325207

6 years agoAdd NetBSD syscall hooks skeleton in sanitizers
Kamil Rytarowski [Thu, 15 Feb 2018 02:43:02 +0000 (02:43 +0000)]
Add NetBSD syscall hooks skeleton in sanitizers

Summary:
Implement the skeleton of NetBSD syscall hooks for use with sanitizers.

Add a script that generates the rules to handle syscalls
on NetBSD: generate_netbsd_syscalls.awk. It has been written
in NetBSD awk(1) (patched nawk) and is compatible with gawk.

Generate lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
that is a public header for applications, and included as:
<sanitizer_common/sanitizer_platform_limits_netbsd.h>.

Generate sanitizer_syscalls_netbsd.inc that defines all the
syscall rules for NetBSD. This file is modeled after the Linux
specific file: sanitizer_common_syscalls.inc.

Start recognizing NetBSD syscalls with existing sanitizers:
ASan, ESan, HWASan, TSan, MSan.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, kcc, dvyukov, eugenis

Reviewed By: vitalybuka

Subscribers: hintonda, kubamracek, mgorny, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 325206

6 years agoFix test failure on compilers w/o deduction guides
Eric Fiselier [Thu, 15 Feb 2018 02:41:19 +0000 (02:41 +0000)]
Fix test failure on compilers w/o deduction guides

llvm-svn: 325205

6 years agoFix an issue that lld drops symbol versions for -r.
Rui Ueyama [Thu, 15 Feb 2018 02:40:58 +0000 (02:40 +0000)]
Fix an issue that lld drops symbol versions for -r.

When we are emitting a relocatable output, we should keep the original
symbol name including "@" part. Previously, we drop that part unconditionally
which resulted in dropping versions from symbols.

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

llvm-svn: 325204

6 years agoReapply r325193
Konstantin Zhuravlyov [Thu, 15 Feb 2018 02:37:04 +0000 (02:37 +0000)]
Reapply r325193

llvm-svn: 325203

6 years ago[analyzer] Allow inlining constructors into return values.
Artem Dergachev [Thu, 15 Feb 2018 02:32:32 +0000 (02:32 +0000)]
[analyzer] Allow inlining constructors into return values.

This only affects the cfg-temporary-dtors mode - in this mode we begin inlining
constructors that are constructing function return values. These constructors
have a correct construction context since r324952.

Because temporary destructors are not only never inlined, but also don't have
the correct target region yet, this change is not entirely safe. But this
will be fixed in the subsequent commits, while this stays off behind the
cfg-temporary-dtors flag.

Lifetime extension for return values is still not modeled correctly.

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

llvm-svn: 325202

6 years ago[analyzer] NFC: Remove dead checks when computing DeclStmt construction region.
Artem Dergachev [Thu, 15 Feb 2018 02:30:20 +0000 (02:30 +0000)]
[analyzer] NFC: Remove dead checks when computing DeclStmt construction region.

In CFG, every DeclStmt has exactly one decl, which is always a variable.

It is also pointless to check that the initializer is the constructor because
that's how construction contexts work now.

llvm-svn: 325201

6 years agoRevert r325193 as it breaks buildbots
Konstantin Zhuravlyov [Thu, 15 Feb 2018 02:27:45 +0000 (02:27 +0000)]
Revert r325193 as it breaks buildbots

llvm-svn: 325200

6 years agoAdd new interceptor: lstat(2)
Kamil Rytarowski [Thu, 15 Feb 2018 02:17:06 +0000 (02:17 +0000)]
Add new interceptor: lstat(2)

Summary:
lstat - get file status

Use it on NetBSD.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, eugenis

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 325199

6 years ago[X86] Regnerate test to show scheduling comments. NFC
Craig Topper [Thu, 15 Feb 2018 02:14:20 +0000 (02:14 +0000)]
[X86] Regnerate test to show scheduling comments. NFC

These must have not been printing the last time the test was re-generated.

llvm-svn: 325198

6 years ago[X86] Change 32 and 64 bit versions of LSL instruction have a 16-bit memory operand.
Craig Topper [Thu, 15 Feb 2018 01:21:53 +0000 (01:21 +0000)]
[X86] Change 32 and 64 bit versions of LSL instruction have a 16-bit memory operand.

This matches the Intel and AMD documentation and is consistent with the LAR instruction.

llvm-svn: 325197

6 years agoAMDGPU: Enable PIC by default for amdgcn
Konstantin Zhuravlyov [Thu, 15 Feb 2018 01:01:53 +0000 (01:01 +0000)]
AMDGPU: Enable PIC by default for amdgcn

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

llvm-svn: 325196

6 years agoAdd missing definition for class static after r325193.
Richard Smith [Thu, 15 Feb 2018 01:01:06 +0000 (01:01 +0000)]
Add missing definition for class static after r325193.

llvm-svn: 325195

6 years ago[sanitizer] Fix flakiness in the tests
Vitaly Buka [Thu, 15 Feb 2018 00:40:36 +0000 (00:40 +0000)]
[sanitizer] Fix flakiness in the tests

Seems tests fails if link already exists.
Also removed duplicated part of tests.

llvm-svn: 325194

6 years agoAMDGPU: Cleanup most of the macros
Konstantin Zhuravlyov [Thu, 15 Feb 2018 00:20:26 +0000 (00:20 +0000)]
AMDGPU: Cleanup most of the macros

- Insert __AMD__ macro
- Insert __AMDGPU__ macro
- Insert __devicename__ macro
- Add missing tests for arch macros

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

llvm-svn: 325193

6 years ago[X86] Dont' allow 'outs' and 'ins' in at&t syntax without suffixes.
Craig Topper [Wed, 14 Feb 2018 23:53:26 +0000 (23:53 +0000)]
[X86] Dont' allow 'outs' and 'ins' in at&t syntax without suffixes.

The match would be ambiguous, but at&t asm parsing doesn't support ambiguous matches and will just return the first.

llvm-svn: 325192

6 years ago[X86] Don't use 64 bit hex constants in a 32 bit assembler test.
Craig Topper [Wed, 14 Feb 2018 23:53:24 +0000 (23:53 +0000)]
[X86] Don't use 64 bit hex constants in a 32 bit assembler test.

llvm-svn: 325191

6 years ago[X86] Reverse the operand order of invlpga in at&t syntax to match gas.
Craig Topper [Wed, 14 Feb 2018 23:53:21 +0000 (23:53 +0000)]
[X86] Reverse the operand order of invlpga in at&t syntax to match gas.

llvm-svn: 325190

6 years ago[llvm-objcopy] Fix handling of zero-size segments in llvm-objcopy
Jake Ehrlich [Wed, 14 Feb 2018 23:31:33 +0000 (23:31 +0000)]
[llvm-objcopy] Fix handling of zero-size segments in llvm-objcopy

Some ELF files produced by lld may have zero-size segment placeholders as shown
below. Since GNU_STACK Offset is 0, the current code makes it the lowest used
offset, and relocates all the segments over the ELF header. The resulting
binary is total garbage.

This change fixes how llvm-objcopy handles PT_PHDR properlly by treating ELF
headers and the program header table as segments to allow the layout algorithm
decide where those should go.

Author: vit9696

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

llvm-svn: 325189

6 years agoSupply missing break in case statement.
Adrian McCarthy [Wed, 14 Feb 2018 23:16:36 +0000 (23:16 +0000)]
Supply missing break in case statement.

Summary:
All the tests pass without hitting the situation mentioned in the FIXME, so,
per Aaron Smith's suggestion, this case will now return unconditionally.

Subscribers: sanjoy, mgorny, JDevlieghere

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

llvm-svn: 325188

6 years ago[InstCombine] clean up fold for X / C -> X * (1.0/C); NFCI
Sanjay Patel [Wed, 14 Feb 2018 23:04:17 +0000 (23:04 +0000)]
[InstCombine] clean up fold for X / C -> X * (1.0/C); NFCI

This should work with vector constants too, but it's currently limited to scalar.

llvm-svn: 325187

6 years agoImprove documentation for attribute artificial
Erich Keane [Wed, 14 Feb 2018 23:00:31 +0000 (23:00 +0000)]
Improve documentation for attribute artificial

This patch is related to https://reviews.llvm.org/rC325081

The patch improves documentation for the attribute and removes reference to GCC
documentation.

Patch By: Elizabeth Andrews (eandrews)
Differential Revision: https://reviews.llvm.org/D43321

llvm-svn: 325186

6 years ago[WebAssebmly] Remove use of Optional to fix assertion in gcc
Sam Clegg [Wed, 14 Feb 2018 22:55:38 +0000 (22:55 +0000)]
[WebAssebmly] Remove use of Optional to fix assertion in gcc

This was causing GCC builds with fail with:
Symbols.h:240:3: error: static assertion failed: Symbol types must be
trivially destructible
  static_assert(std::is_trivially_destructible<T>(

The reason this is a gcc-only failure is that OptionalStorage has
as specialization for POD types that isn't built under GCC.

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

llvm-svn: 325185

6 years agoMoved CHECK in test closer to source code
Vitaly Buka [Wed, 14 Feb 2018 22:52:49 +0000 (22:52 +0000)]
Moved CHECK in test closer to source code

llvm-svn: 325184

6 years agoRevert r325158: Convert an assert to a static_assert. NFC.
Rui Ueyama [Wed, 14 Feb 2018 22:43:43 +0000 (22:43 +0000)]
Revert r325158: Convert an assert to a static_assert. NFC.

This reverts commit r325158 because it broke GCC builds.

llvm-svn: 325183

6 years ago[ThinLTO/CFI] Include TYPE_ID summaries into GLOBALVAL_SUMMARY_BLOCK
Vitaly Buka [Wed, 14 Feb 2018 22:41:15 +0000 (22:41 +0000)]
[ThinLTO/CFI] Include TYPE_ID summaries into GLOBALVAL_SUMMARY_BLOCK

Summary:
TypeID summaries are used by CFI and need to be serialized by ThinLTO
indexing for later use by LTO Backend.

Reviewers: tejohnson, pcc

Subscribers: mehdi_amini, inglorion, eraman, hiraditya, llvm-commits

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

llvm-svn: 325182

6 years agoRemove a failing static_assert.
Rui Ueyama [Wed, 14 Feb 2018 22:26:23 +0000 (22:26 +0000)]
Remove a failing static_assert.

This static_assert is legitimate, but it is failing on some build environments.
I'm removing it until it's fixed to unbreak the bots.

llvm-svn: 325181

6 years ago[ORC] Consolidate RTDyldObjectLinkingLayer GetMemMgr and GetResolver into a
Lang Hames [Wed, 14 Feb 2018 22:13:02 +0000 (22:13 +0000)]
[ORC] Consolidate RTDyldObjectLinkingLayer GetMemMgr and GetResolver into a
unified GetResources callback.

Having a single 'GetResources' callback will simplify adding new resources in
the future.

llvm-svn: 325180

6 years ago[ORC] Switch to shared_ptr ownership for AsynchronousSymbolQueries.
Lang Hames [Wed, 14 Feb 2018 22:12:56 +0000 (22:12 +0000)]
[ORC] Switch to shared_ptr ownership for AsynchronousSymbolQueries.

Queries need to stay alive until each owner has set the values they are
responsible for.

llvm-svn: 325179

6 years ago[X86] Don't swap argument on BOUND instruction in at&t syntax.
Craig Topper [Wed, 14 Feb 2018 21:54:58 +0000 (21:54 +0000)]
[X86] Don't swap argument on BOUND instruction in at&t syntax.

The bound instruction does not have reversed operands in gas.

Fixes PR27653.

Patch by Maya Madhavan.

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

llvm-svn: 325178

6 years agoChange the BugDriver to store the current module with std::unique_ptr.
Rafael Espindola [Wed, 14 Feb 2018 21:44:34 +0000 (21:44 +0000)]
Change the BugDriver to store the current module with std::unique_ptr.

While there, change a bunch of helper functions to take references to
avoid adding calls to get().

This should conclude the bugpoint yak shaving.

llvm-svn: 325177

6 years agoUse std::uniue_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 21:25:07 +0000 (21:25 +0000)]
Use std::uniue_ptr. NFC.

llvm-svn: 325176

6 years ago[Debug] Annotate compiler generated range-for loop variables.
Matt Davis [Wed, 14 Feb 2018 21:22:11 +0000 (21:22 +0000)]
[Debug] Annotate compiler generated range-for loop variables.

Summary:
This change aims to simplify debugging by annotating the range-for loop artificial variables (range, begin, end) with the scope depth.

Reviewers: rsmith, dblaikie

Reviewed By: dblaikie

Subscribers: dblaikie, cfe-commits

Tags: #debug-info

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

llvm-svn: 325175

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 21:17:36 +0000 (21:17 +0000)]
Use std::unique_ptr. NFC.

llvm-svn: 325174

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 21:10:29 +0000 (21:10 +0000)]
Use std::unique_ptr. NFC.

llvm-svn: 325173

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 20:59:39 +0000 (20:59 +0000)]
Use std::unique_ptr. NFC.

llvm-svn: 325172

6 years agoClean up -fdiscard-value-name handling
Eric Fiselier [Wed, 14 Feb 2018 20:56:52 +0000 (20:56 +0000)]
Clean up -fdiscard-value-name handling

llvm-svn: 325171

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 20:53:38 +0000 (20:53 +0000)]
Use std::unique_ptr. NFC.

llvm-svn: 325170

6 years ago[Hexagon] Split HVX vector pair loads/stores, expand unaligned loads
Krzysztof Parzyszek [Wed, 14 Feb 2018 20:46:06 +0000 (20:46 +0000)]
[Hexagon] Split HVX vector pair loads/stores, expand unaligned loads

llvm-svn: 325169

6 years agoRemoved superfluous semicolon to fix -Wpedantic gcc warning. NFCI.
Simon Pilgrim [Wed, 14 Feb 2018 20:43:47 +0000 (20:43 +0000)]
Removed superfluous semicolon to fix -Wpedantic gcc warning. NFCI.

llvm-svn: 325168

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 20:25:18 +0000 (20:25 +0000)]
Use std::unique_ptr. NFC.

llvm-svn: 325167

6 years ago[CodeGen] Print predecessors, successors, then liveins in -debug printing
Francis Visoiu Mistrih [Wed, 14 Feb 2018 20:23:05 +0000 (20:23 +0000)]
[CodeGen] Print predecessors, successors, then liveins in -debug printing

Reorder them to match MIR.

Predecessors are only comments, and they're not usually printed in MIR.

llvm-svn: 325166

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 20:21:20 +0000 (20:21 +0000)]
Use std::unique_ptr. NFC.

llvm-svn: 325165

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 20:13:01 +0000 (20:13 +0000)]
Use std::unique_ptr. NFC.

llvm-svn: 325164

6 years agoUse std::unique_ptr. NFC.
Rafael Espindola [Wed, 14 Feb 2018 19:58:41 +0000 (19:58 +0000)]
Use std::unique_ptr. NFC.

llvm-svn: 325163

6 years agoGlobalISel: Add templated functions and pattern matcher support for some more opcodes
Volkan Keles [Wed, 14 Feb 2018 19:58:36 +0000 (19:58 +0000)]
GlobalISel: Add templated functions and pattern matcher support for some more opcodes

Summary:
This patch adds templated functions to MachineIRBuilder for some opcodes
and adds pattern matcher support for G_AND and G_OR.

Reviewers: aditya_nandakumar

Reviewed By: aditya_nandakumar

Subscribers: rovka, kristof.beyls, llvm-commits

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

llvm-svn: 325162

6 years ago[InstCombine] add tests and comments for fdiv X, C; NFC
Sanjay Patel [Wed, 14 Feb 2018 19:54:51 +0000 (19:54 +0000)]
[InstCombine] add tests and comments for fdiv X, C; NFC

llvm-svn: 325161

6 years agoPass a module reference to CloneModule.
Rafael Espindola [Wed, 14 Feb 2018 19:50:40 +0000 (19:50 +0000)]
Pass a module reference to CloneModule.

It can never be null and most callers were already using references or
std::unique_ptr.

llvm-svn: 325160

6 years ago[clang-format] Recognize percents as format specifiers in protos
Krasimir Georgiev [Wed, 14 Feb 2018 19:47:58 +0000 (19:47 +0000)]
[clang-format] Recognize percents as format specifiers in protos

Summary:
Frequently, a percent in protos denotes a formatting specifier for string replacement.
Thus it is desirable to keep the percent together with what follows after it.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 325159

6 years agoConvert an assert to a static_assert. NFC.
Sam Clegg [Wed, 14 Feb 2018 19:28:46 +0000 (19:28 +0000)]
Convert an assert to a static_assert. NFC.

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

llvm-svn: 325158

6 years agoUpdate examples for API change. NFC.
Rafael Espindola [Wed, 14 Feb 2018 19:23:27 +0000 (19:23 +0000)]
Update examples for API change. NFC.

llvm-svn: 325157

6 years agoUpdate for llvm change. NFC.
Rafael Espindola [Wed, 14 Feb 2018 19:11:37 +0000 (19:11 +0000)]
Update for llvm change. NFC.

llvm-svn: 325156

6 years agoPass a reference to a module to the bitcode writer.
Rafael Espindola [Wed, 14 Feb 2018 19:11:32 +0000 (19:11 +0000)]
Pass a reference to a module to the bitcode writer.

This simplifies most callers as they are already using references or
std::unique_ptr.

llvm-svn: 325155

6 years ago[Modules] Add more language features to be used with requires-declaration
Bruno Cardoso Lopes [Wed, 14 Feb 2018 19:01:03 +0000 (19:01 +0000)]
[Modules] Add more language features to be used with requires-declaration

Features added: c99, c11, c17, cplusplus14 and cplusplus17.

rdar://problem/36328787
rdar://problem/36668431

llvm-svn: 325154

6 years ago[RegisterClassInfo] Invalidate the register pressure set limit cache when reserved...
Craig Topper [Wed, 14 Feb 2018 18:53:29 +0000 (18:53 +0000)]
[RegisterClassInfo] Invalidate the register pressure set limit cache when reserved regs or callee saved regs change

Previously we only invalidated the pressure set limit cached when the TargetRegisterInfo pointer changes. But as reserved regs and callee saved regs are used as part of calculating the limits we should invalidate when those change too.

I encountered this when reverting a patch from the 6.0 branch. One of the x86 test files had a function that used rbp as a frame pointer, making it reserved. It was followed by another function which didn't use rbp but had the same TRI so the pressure set limit cache was not invalidated. If i removed the function that used rbp as a frame pointer from the file, the remaining function then got a different register pressure limit for the GR16 pressure set. This caused the machine scheduler to change the scheduling for the function. This was an unexpected change from just deleting a function.

I don't have a test case for trunk because the particular x86 test case is different enough from the 6.0 branch to not be affected now.

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

llvm-svn: 325153

6 years agoMake --export-dynamic-symbol to add undefined symbols even if --export-dynamic is...
Rui Ueyama [Wed, 14 Feb 2018 18:38:33 +0000 (18:38 +0000)]
Make --export-dynamic-symbol to add undefined symbols even if --export-dynamic is given.

This patch addresses a minor compatibility issue with GNU linkers.
Previously, --export-dynamic-symbol is completely ignored if you
pass --export-dynamic together.

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

llvm-svn: 325152

6 years agoMove llvm::computeLoopSafetyInfo from LICM.cpp to LoopUtils.cpp. NFC
David Green [Wed, 14 Feb 2018 18:34:53 +0000 (18:34 +0000)]
Move llvm::computeLoopSafetyInfo from LICM.cpp to LoopUtils.cpp. NFC

Move computeLoopSafetyInfo, defined in Transforms/Utils/LoopUtils.h,
into the corresponding LoopUtils.cpp, as opposed to LICM where it resides
at the moment. This will allow other functions from Transforms/Utils
to reference it.

llvm-svn: 325151

6 years ago[WebAssembly] Use a Symbol class heirarchy. NFC.
Sam Clegg [Wed, 14 Feb 2018 18:27:59 +0000 (18:27 +0000)]
[WebAssembly] Use a Symbol class heirarchy. NFC.

This brings wasm into line with ELF and COFF in terms of
symbol types are represented.

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

llvm-svn: 325150

6 years ago[X86][SSE] truncateVectorWithPACK - Use src type instead of dst to select between...
Simon Pilgrim [Wed, 14 Feb 2018 18:23:58 +0000 (18:23 +0000)]
[X86][SSE] truncateVectorWithPACK - Use src type instead of dst to select between PACK*SDW/PACK*SWB

Try to keep PACK*SDW/PACK*SWB as wide as possible, this helps ComputeNumSignBits as it can only peek through bitcasts to wider types, pre-AVX2 codegen was already doing this as it could peek through bitcasts/subvectors more easily than AVX2 could through shuffles.

This shouldn't affect existing results as calls to truncateVectorWithPACK ensure we have enough sign bits to pack to the same value, but it should make it possible to use truncateVectorWithPACK chains to perform saturation in combineTruncateWithSat with a future patch.

llvm-svn: 325149

6 years ago[InstCombine] Don't fold select(C, Z, binop(select(C, X, Y), W)) -> select(C, Z,...
Craig Topper [Wed, 14 Feb 2018 18:08:33 +0000 (18:08 +0000)]
[InstCombine] Don't fold select(C, Z, binop(select(C, X, Y), W)) -> select(C, Z, binop(Y, W)) if the binop is rem or div.

The select may have been preventing a division by zero or INT_MIN/-1 so removing it might not be safe.

Fixes PR36362.

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

llvm-svn: 325148

6 years agoAdd a catch for std::length_error for the case where the string can't handle 2GB...
Marshall Clow [Wed, 14 Feb 2018 18:05:25 +0000 (18:05 +0000)]
Add a catch for std::length_error for the case where the string can't handle 2GB. (like say 32-bit big-endian)

llvm-svn: 325147

6 years ago[AMDGPU] Remove non-temporal flag from argument loads
Stanislav Mekhanoshin [Wed, 14 Feb 2018 18:05:14 +0000 (18:05 +0000)]
[AMDGPU] Remove non-temporal flag from argument loads

Kernel arguments likely read by all workitems and should not bypass
cache. Fixes performance hit in sub-dword argument loads.

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

llvm-svn: 325146

6 years ago[OpenMP] Fix trailing space when printing pragmas, by Joel. E. Denny
Alexey Bataev [Wed, 14 Feb 2018 17:38:47 +0000 (17:38 +0000)]
[OpenMP] Fix trailing space when printing pragmas, by Joel. E. Denny

Summary:
-ast-print prints omp pragmas with a trailing space.  While this
behavior is likely of little concern to most users, surely it's
unintentional, and it's annoying for some source-level work I'm
pursuing.  This patch focuses on omp pragmas, but it also fixes
init_seg and loop hint pragmas because they share implementation.

The testing strategy here is to add usually just one '{{$}}' per
relevant -ast-print test file.  This seems to achieve good code
coverage.  However, this strategy is probably easy to forget as the
tests evolve.  That's probably fine as this fix is far from critical.
The main goal of the testing is to aid the initial review.

This patch also adds a fixme for "#pragma unroll", which prints as
"#pragma unroll (enable)", which is invalid syntax.

Reviewers: ABataev

Reviewed By: ABataev

Subscribers: guansong, cfe-commits

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

llvm-svn: 325145

6 years ago[InstCombine] regenerate checks; NFC
Sanjay Patel [Wed, 14 Feb 2018 17:37:32 +0000 (17:37 +0000)]
[InstCombine] regenerate checks; NFC

llvm-svn: 325144

6 years ago[DWARF] Fix incorrect prologue end line record.
Paul Robinson [Wed, 14 Feb 2018 17:35:52 +0000 (17:35 +0000)]
[DWARF] Fix incorrect prologue end line record.

The prologue-end line record must be emitted after the last
instruction that is part of the function frame setup code and before
the instruction that marks the beginning of the function body.

Patch by Carlos Alberto Enciso!

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

llvm-svn: 325143

6 years ago[InstCombine] simplify isFMulOrFDivWithConstant(); NFCI
Sanjay Patel [Wed, 14 Feb 2018 17:16:33 +0000 (17:16 +0000)]
[InstCombine] simplify isFMulOrFDivWithConstant(); NFCI

llvm-svn: 325142

6 years ago[InstCombine] replace isa/cast with dyn_cast; NFC
Sanjay Patel [Wed, 14 Feb 2018 16:56:44 +0000 (16:56 +0000)]
[InstCombine] replace isa/cast with dyn_cast; NFC

llvm-svn: 325141

6 years ago[InstCombine] refactor folds for mul with negated operands; NFCI
Sanjay Patel [Wed, 14 Feb 2018 16:50:55 +0000 (16:50 +0000)]
[InstCombine] refactor folds for mul with negated operands; NFCI

This keeps with our current usage of 'match' and is easier to see that
the optional NSW only applies in the non-constant operand case.

llvm-svn: 325140

6 years agoStore defined macros in MCContext.
Rafael Espindola [Wed, 14 Feb 2018 16:34:27 +0000 (16:34 +0000)]
Store defined macros in MCContext.

So that macros defined in inline assembly blocks are available to the
whole file.

This provides a consistent behavior with other assembly directives,
since equations for example are already preserved between inline
assembly blocks.

PR: 36110

Patch by Roger!

llvm-svn: 325139

6 years ago[x86] add baseline vector compare tests for D42948; NFC
Sanjay Patel [Wed, 14 Feb 2018 16:15:15 +0000 (16:15 +0000)]
[x86] add baseline vector compare tests for D42948; NFC

llvm-svn: 325138

6 years agoRemove vestigial remnants of the test crash info hook
Pavel Labath [Wed, 14 Feb 2018 16:08:26 +0000 (16:08 +0000)]
Remove vestigial remnants of the test crash info hook

llvm-svn: 325137

6 years ago[CUDA] Allow external variables in separate compilation
Jonas Hahnfeld [Wed, 14 Feb 2018 16:04:03 +0000 (16:04 +0000)]
[CUDA] Allow external variables in separate compilation

According to the CUDA Programming Guide this is prohibited in
whole program compilation mode. This makes sense because external
references cannot be satisfied in that mode anyway. However,
such variables are allowed in separate compilation mode which
is a valid use case.

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

llvm-svn: 325136

6 years ago[SelectionDAG][X86] Fix incorrect offset generated for VMASKMOV
Alexander Ivchenko [Wed, 14 Feb 2018 15:55:24 +0000 (15:55 +0000)]
[SelectionDAG][X86] Fix incorrect offset generated for VMASKMOV

When creating high MachineMemOperand for MSTORE/MLOAD we supply
it with the original PointerInfo, while the pointer itself had been incremented.
The patch adds the proper offset to the PointerInfo.

llvm-svn: 325135

6 years ago[SLP] Allow vectorization of reversed loads.
Alexey Bataev [Wed, 14 Feb 2018 15:29:15 +0000 (15:29 +0000)]
[SLP] Allow vectorization of reversed loads.

Summary:
Reversed loads are handled as gathering. But we can just reshuffle
these values. Patch adds support for vectorization of reversed loads.

Reviewers: RKSimon, spatel, mkuper, hfinkel

Subscribers: llvm-commits

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

llvm-svn: 325134

6 years agoRevert r324991 "Fix for PR32992. Static const classes not exported."
Hans Wennborg [Wed, 14 Feb 2018 15:19:46 +0000 (15:19 +0000)]
Revert r324991 "Fix for PR32992. Static const classes not exported."

This broke the Chromium build on Windows; see https://crbug.com/812231

> Fix for PR32992. Static const classes not exported.
>
> Patch by zahiraam!
>
> Differential Revision: https://reviews.llvm.org/D42968

llvm-svn: 325133

6 years ago[clangd] Fix data race in ClangdThreadingTest.StressTest
Ilya Biryukov [Wed, 14 Feb 2018 15:19:20 +0000 (15:19 +0000)]
[clangd] Fix data race in ClangdThreadingTest.StressTest

Prior to this patch, same instance of VFS was shared for concurrent
processing of the files in ClangdThreadingTest.StressTest.

It caused a data race as the same instance of InMemoryFileSystem was
mutated from multiple threads using setCurrentWorkingDirectory().

llvm-svn: 325132

6 years ago[OMPT][test] Correct warning about added wrapper functions
Jonas Hahnfeld [Wed, 14 Feb 2018 15:15:24 +0000 (15:15 +0000)]
[OMPT][test] Correct warning about added wrapper functions

This affects all outlined functions, not just tasks! Only show warning
when using Clang 5.0 or later.

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

llvm-svn: 325131

6 years ago[ARM] f16 stack spill/reloads
Sjoerd Meijer [Wed, 14 Feb 2018 15:09:09 +0000 (15:09 +0000)]
[ARM] f16 stack spill/reloads

This adds support for handling f16 stack spills/reloads.

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

llvm-svn: 325130

6 years agoFix GCC -Wlogical-op-parentheses warning. NFCI.
Simon Pilgrim [Wed, 14 Feb 2018 15:07:36 +0000 (15:07 +0000)]
Fix GCC -Wlogical-op-parentheses warning. NFCI.

llvm-svn: 325129

6 years ago[X86] Reduce Store Forward Block issues in HW - Recommit after fixing Bug 36346
Lama Saba [Wed, 14 Feb 2018 14:58:53 +0000 (14:58 +0000)]
[X86] Reduce Store Forward Block issues in HW - Recommit after fixing Bug 36346

If a load follows a store and reloads data that the store has written to memory, Intel microarchitectures can in many cases forward the data directly from the store to the load, This "store forwarding" saves cycles by enabling the load to directly obtain the data instead of accessing the data from cache or memory.
A "store forward block" occurs in cases that a store cannot be forwarded to the load. The most typical case of store forward block on Intel Core microarchiticutre that a small store cannot be forwarded to a large load.
The estimated penalty for a store forward block is ~13 cycles.

This pass tries to recognize and handle cases where "store forward block" is created by the compiler when lowering memcpy calls to a sequence
of a load and a store.

The pass currently only handles cases where memcpy is lowered to XMM/YMM registers, it tries to break the memcpy into smaller copies.
breaking the memcpy should be possible since there is no atomicity guarantee for loads and stores to XMM/YMM.

Change-Id: Ic41aa9ade6512e0478db66e07e2fde41b4fb35f9
llvm-svn: 325128

6 years ago[X86][SSE] Relax type legality for combineTruncateWithSat PACKSS/PACKUS truncation
Simon Pilgrim [Wed, 14 Feb 2018 14:14:29 +0000 (14:14 +0000)]
[X86][SSE] Relax type legality for combineTruncateWithSat PACKSS/PACKUS truncation

While the AVX512 VTRUNCS/VTRUNCUS instructions require legal types, truncateVectorWithPACK handles cases with multiples of legal types through splitting/concatenation. So we just need to ensure that the src/dst scalar types are correct and leave truncateVectorWithPACK to handle the rest of it.

llvm-svn: 325127

6 years agoRecommit r325001: [CallSiteSplitting] Support splitting of blocks with instrs before...
Florian Hahn [Wed, 14 Feb 2018 13:59:12 +0000 (13:59 +0000)]
Recommit r325001: [CallSiteSplitting] Support splitting of blocks with instrs before call.

For basic blocks with instructions between the beginning of the block
and a call we have to duplicate the instructions before the call in all
split blocks and add PHI nodes for uses of the duplicated instructions
after the call.

Currently, the threshold for the number of instructions before a call
is quite low, to keep the impact on binary size low.

Reviewers: junbuml, mcrosier, davidxl, davide

Reviewed By: junbuml

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

llvm-svn: 325126

6 years ago[ELF] Add warnings for various symbols that cannot be ordered
James Henderson [Wed, 14 Feb 2018 13:36:22 +0000 (13:36 +0000)]
[ELF] Add warnings for various symbols that cannot be ordered

There are a number of different situations when symbols are requested
to be ordered in the --symbol-ordering-file that cannot be ordered for
some reason. To assist with identifying these symbols, and either
tidying up the order file, or the inputs, a number of warnings have
been added. As some users may find these warnings unhelpful, due to how
they use the symbol ordering file, a switch has also been added to
disable these warnings.

The cases where we now warn are:

 * Entries in the order file that don't correspond to any symbol in the input
 * Undefined symbols
 * Absolute symbols
 * Symbols imported from shared objects
 * Symbols that are discarded, due to e.g. --gc-sections or /DISCARD/ linker script sections
 * Multiple of the same entry in the order file

Reviewed by: rafael, ruiu

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

llvm-svn: 325125

6 years agoAdd make targets for running all lld tests
Nicholas Wilson [Wed, 14 Feb 2018 13:28:53 +0000 (13:28 +0000)]
Add make targets for running all lld tests

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

llvm-svn: 325124

6 years ago[AST] Fix passing large-array-init.cpp on builds without asserts
Ivan A. Kosarev [Wed, 14 Feb 2018 13:27:48 +0000 (13:27 +0000)]
[AST] Fix passing large-array-init.cpp on builds without asserts

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

llvm-svn: 325123

6 years ago[LoopInterchange] Incrementally update the dominator tree.
Florian Hahn [Wed, 14 Feb 2018 13:13:15 +0000 (13:13 +0000)]
[LoopInterchange] Incrementally update the dominator tree.

We can use incremental dominator tree updates to avoid re-calculating
the dominator tree after interchanging 2 loops.

Reviewers: dmgreen, kuhar

Reviewed By: kuhar

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

llvm-svn: 325122