platform/upstream/llvm.git
6 years ago[X86][SSE] combineTruncateWithSat - use truncateVectorWithPACK to chain PACKUS vXi32...
Simon Pilgrim [Thu, 15 Feb 2018 14:37:59 +0000 (14:37 +0000)]
[X86][SSE] combineTruncateWithSat - use truncateVectorWithPACK to chain PACKUS vXi32-vXi8 saturated truncation

We can use PACKSS/PACKUS to saturate each stage of the chain: PACKSSDW down to [-32768,32767] and then PACKUSWB to [0,255].

llvm-svn: 325243

6 years ago[clangd] Enable snippet completion based on client capabilities.
Ilya Biryukov [Thu, 15 Feb 2018 14:32:57 +0000 (14:32 +0000)]
[clangd] Enable snippet completion based on client capabilities.

Summary: And remove -enable-snippets flag.

Reviewers: hokein, ioeric, sammccall

Reviewed By: ioeric

Subscribers: klimek, jkorous-apple, cfe-commits

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

llvm-svn: 325242

6 years agoAdding msan support for FreeBSD
Kamil Rytarowski [Thu, 15 Feb 2018 14:19:23 +0000 (14:19 +0000)]
Adding msan support for FreeBSD

Summary: Enabling memory sanitiser for X86_64 arch only. To match the sanitiser counterpart.

Patch by: David CARLIER

Reviewers: krytarowski

Reviewed By: krytarowski

Subscribers: dim, emaste, cfe-commits

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

llvm-svn: 325241

6 years agoAdd Xray instrumentation support to FreeBSD
Kamil Rytarowski [Thu, 15 Feb 2018 14:17:15 +0000 (14:17 +0000)]
Add Xray instrumentation support to FreeBSD

Summary:
- Enabling the build.
- Using assembly for the cpuid parts.
- Using thr_self FreeBSD call to get the thread id

Patch by: David CARLIER

Reviewers: dberris, rnk, krytarowski

Reviewed By: dberris, krytarowski

Subscribers: emaste, stevecheckoway, nglevin, srhines, kubamracek, dberris, mgorny, krytarowski, llvm-commits, #sanitizers

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

llvm-svn: 325240

6 years ago[clangd] Fix make_unique ambiguity, NFC
Sam McCall [Thu, 15 Feb 2018 14:16:17 +0000 (14:16 +0000)]
[clangd] Fix make_unique ambiguity, NFC

llvm-svn: 325239

6 years agoAdd Xray instrumentation compile-time/link-time support to FreeBSD
Kamil Rytarowski [Thu, 15 Feb 2018 14:12:21 +0000 (14:12 +0000)]
Add Xray instrumentation compile-time/link-time support to FreeBSD

Summary: Similarly to the GNU driver version, adding proper compile and linker flags.

Patch by: David CARLIER

Reviewers: vitalybuka, krytarowski, dberris

Reviewed By: krytarowski, dberris

Subscribers: emaste, dberris, cfe-commits

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

llvm-svn: 325238

6 years ago[InstCombine] allow X / C -> X * (1.0/C) for vector splat FP constants
Sanjay Patel [Thu, 15 Feb 2018 13:55:52 +0000 (13:55 +0000)]
[InstCombine] allow X / C -> X * (1.0/C) for vector splat FP constants

llvm-svn: 325237

6 years agoAdd -no-canonical-prefixes to allow different build modes.
Martin Bohme [Thu, 15 Feb 2018 13:50:07 +0000 (13:50 +0000)]
Add -no-canonical-prefixes to allow different build modes.

llvm-svn: 325236

6 years ago[X86][SSE] combineTruncateWithSat - use truncateVectorWithPACK to chain PACKSS vXi32...
Simon Pilgrim [Thu, 15 Feb 2018 13:33:15 +0000 (13:33 +0000)]
[X86][SSE] combineTruncateWithSat - use truncateVectorWithPACK to chain PACKSS vXi32-vXi8 saturated truncation

We can use PACKSS to saturate each stage of the chain: PACKSSDW down to [-32768,32767] and then PACKSSWB to [-128,127].

PACKUS is a little trickier and will be handled in a separate patch.

llvm-svn: 325235

6 years ago[DebugInfo] Accept enumeration types without underlying integer type present in
Momchil Velikov [Thu, 15 Feb 2018 13:29:33 +0000 (13:29 +0000)]
[DebugInfo] Accept enumeration types without underlying integer type present in
debug info metadata

... when generating DWARF.

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

llvm-svn: 325234

6 years ago[clangd] Make functions of ClangdServer callback-based
Ilya Biryukov [Thu, 15 Feb 2018 13:15:47 +0000 (13:15 +0000)]
[clangd] Make functions of ClangdServer callback-based

Summary:
As a consequence, all LSP operations are now handled asynchronously,
i.e. they never block the main processing thread. However, if
-run-synchronously flag is specified, clangd still runs everything on
the main thread.

Reviewers: sammccall, ioeric, hokein

Reviewed By: sammccall, ioeric

Subscribers: klimek, jkorous-apple, cfe-commits

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

llvm-svn: 325233

6 years ago[SelectionDAG] Add initial implementation of TargetLowering::SimplifyDemandedVectorElts
Simon Pilgrim [Thu, 15 Feb 2018 12:14:15 +0000 (12:14 +0000)]
[SelectionDAG] Add initial implementation of TargetLowering::SimplifyDemandedVectorElts

This is mainly a move of simplifyShuffleOperands from DAGCombiner::visitVECTOR_SHUFFLE to create a more general purpose TargetLowering::SimplifyDemandedVectorElts implementation.

Further features can be moved/added in future patches.

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

llvm-svn: 325232

6 years ago[ARM] f16 vcmp fixes
Sjoerd Meijer [Thu, 15 Feb 2018 10:33:07 +0000 (10:33 +0000)]
[ARM] f16 vcmp fixes

This adds f16 VCMP match rules and fixes the test cases.

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

llvm-svn: 325228

6 years agoRevert r325224 "Report fatal error in the case of out of memory"
Serge Pavlov [Thu, 15 Feb 2018 09:45:59 +0000 (09:45 +0000)]
Revert r325224 "Report fatal error in the case of out of memory"

It caused fails on some buildbots.

llvm-svn: 325227

6 years agoSpecify namespace for realloc
Serge Pavlov [Thu, 15 Feb 2018 09:35:36 +0000 (09:35 +0000)]
Specify namespace for realloc

llvm-svn: 325226

6 years ago[clang-tidy] Make a test pass on platforms where exceptions disabled by default.
Gabor Horvath [Thu, 15 Feb 2018 09:24:55 +0000 (09:24 +0000)]
[clang-tidy] Make a test pass on platforms where exceptions disabled by default.

llvm-svn: 325225

6 years agoReport fatal error in the case of out of memory
Serge Pavlov [Thu, 15 Feb 2018 09:20:26 +0000 (09:20 +0000)]
Report fatal error in the case of out of memory

Analysis of fails in the case of out of memory errors can be tricky on
Windows. Such error emerges at the point where memory allocation function
fails, but manifests itself when null pointer is used. These two points
may be distant from each other. Besides, next runs may not exhibit
allocation error.

Usual programming practice does not require checking result of 'operator
new' because it throws 'std::bad_alloc' in the case of allocation error.
However, LLVM is usually built with exceptions turned off, so 'new' can
return null pointer. This change installs custom new handler, which causes
fatal error in the case of out of memory. The handler is installed
automatically prior to call to 'main' during construction of a static
object defined in 'lib/Support/ErrorHandling.cpp'. If the application does
not use this file, the handler may be installed manually by a call to
'llvm::install_out_of_memory_new_handler', declared in
'include/llvm/Support/ErrorHandling.h".

There are calls to C allocation functions, malloc, calloc and realloc.
They are used for interoperability with C code, when allocated object has
variable size and when it is necessary to avoid call of constructors. In
many calls the result is not checked against null pointer. To simplify
checks, new functions are defined in the namespace 'llvm' with the
same names as these C function. These functions produce fatal error if
allocation fails. User should use 'llvm::malloc' instead of 'std::malloc'
in order to use the safe variant. This change replaces 'std::malloc'
in the cases when the result of allocation function is not checked against
null pointer.

Finally, there are plain C code, that uses malloc and similar functions. If
the result is not checked, assert statements are added.

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

llvm-svn: 325224

6 years ago[clang-tidy] Minor documentation fix
Gabor Horvath [Thu, 15 Feb 2018 09:19:23 +0000 (09:19 +0000)]
[clang-tidy] Minor documentation fix

llvm-svn: 325223

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