platform/upstream/llvm.git
6 years ago[WebAssembly] Remove initializers from Config.h
Sam Clegg [Tue, 28 Nov 2017 20:27:21 +0000 (20:27 +0000)]
[WebAssembly] Remove initializers from Config.h

These should get initialized in by Driver.cpp based on
command line options.

Also, sort entries.

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

llvm-svn: 319219

6 years ago[PowerPC] Allow tail calls of fastcc functions from C CallingConv functions.
Sean Fertile [Tue, 28 Nov 2017 20:25:58 +0000 (20:25 +0000)]
[PowerPC] Allow tail calls of fastcc functions from C CallingConv functions.

Allow fastcc callees to be tail-called from ccc callers.

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

llvm-svn: 319218

6 years agoBring r319051 back.
Rafael Espindola [Tue, 28 Nov 2017 20:21:44 +0000 (20:21 +0000)]
Bring r319051 back.

It had been reverted because it depended on r319008 which has been
recommitted.

Original message:

Add a missing test.

We were not testing that we correctly handled a .o with a weak symbol
after a .so.

llvm-svn: 319217

6 years ago[aarch64][globalisel] Define G_ATOMIC_CMPXCHG and G_ATOMICRMW_* and make them legal
Daniel Sanders [Tue, 28 Nov 2017 20:21:15 +0000 (20:21 +0000)]
[aarch64][globalisel] Define G_ATOMIC_CMPXCHG and G_ATOMICRMW_* and make them legal

The IRTranslator cannot generate these instructions at the moment so there's no
issue with not having implemented ISel for them yet. D40092 will add
G_ATOMIC_CMPXCHG_WITH_SUCCESS and G_ATOMICRMW_* to the IRTranslator and a
further patch will add support for lowering G_ATOMIC_CMPXCHG_WITH_SUCCESS into
G_ATOMIC_CMPXCHG with an external success check via the `Lower` action.

The separation of G_ATOMIC_CMPXCHG_WITH_SUCCESS and G_ATOMIC_CMPXCHG is
to import SelectionDAG rules while still supporting targets that prefer to
custom lower the original LLVM-IR-like operation.

llvm-svn: 319216

6 years agoBring back r319008.
Rafael Espindola [Tue, 28 Nov 2017 20:17:58 +0000 (20:17 +0000)]
Bring back r319008.

This includes a fix to mark copy reloc aliases as used.

Original message:

[ELF] Do not keep symbols if they referenced only from discarded sections.

This patch also ensures that in case of "--as-needed" is used,
DT_NEEDED entries are not created if they are required only by
these eliminated symbols.

llvm-svn: 319215

6 years agoAdd missing test.
Rafael Espindola [Tue, 28 Nov 2017 20:13:12 +0000 (20:13 +0000)]
Add missing test.

This would have found the issue with r319008.

llvm-svn: 319214

6 years agoUpdate remote debugging page with many more details.
Greg Clayton [Tue, 28 Nov 2017 20:04:43 +0000 (20:04 +0000)]
Update remote debugging page with many more details.

llvm-svn: 319213

6 years agoFix formatting.
Rui Ueyama [Tue, 28 Nov 2017 20:01:30 +0000 (20:01 +0000)]
Fix formatting.

llvm-svn: 319212

6 years agoFactor out more code to Common/Args.cpp.
Rui Ueyama [Tue, 28 Nov 2017 19:58:45 +0000 (19:58 +0000)]
Factor out more code to Common/Args.cpp.

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

llvm-svn: 319211

6 years ago[SelectionDAG] Make sorting predicate stronger to remove non-deterministic ordering
Mandeep Singh Grang [Tue, 28 Nov 2017 19:55:54 +0000 (19:55 +0000)]
[SelectionDAG] Make sorting predicate stronger to remove non-deterministic ordering

Summary:
Recommitting this with the correct sorting predicate. The Low field of Clusters is a ConstantInt and
cannot be directly compared. So we needed to invoke slt (signed less than) to compare correctly.

This fixes failures in the following tests uncovered by D39245:

LLVM :: CodeGen/ARM/ifcvt3.ll
LLVM :: CodeGen/ARM/switch-minsize.ll
LLVM :: CodeGen/X86/switch.ll
LLVM :: CodeGen/X86/switch-bt.ll
LLVM :: CodeGen/X86/switch-density.ll

Reviewers: hans, fhahn

Reviewed By: hans

Subscribers: aemerson, llvm-commits, kristof.beyls

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

llvm-svn: 319210

6 years ago[X86][SSE] Add SSE_HADDSUB/SSE_PABS/SSE_PALIGN OpndItins
Simon Pilgrim [Tue, 28 Nov 2017 19:39:47 +0000 (19:39 +0000)]
[X86][SSE] Add SSE_HADDSUB/SSE_PABS/SSE_PALIGN OpndItins

Update multi-classes to take the scheduling OpndItins instead of hard coding it.

Will be reused in the AVX512 equivalents.

llvm-svn: 319209

6 years ago[X86] In lowerVectorShuffleAsElementInsertion, if were able to find a scalar i8 or...
Craig Topper [Tue, 28 Nov 2017 19:25:45 +0000 (19:25 +0000)]
[X86] In lowerVectorShuffleAsElementInsertion, if were able to find a scalar i8 or i16 and need to zero extend it, make sure we use a vXi32 type of the full vector width.

Previously, this was hardcoded to v4i32, but if the input type is 256 bits we need to use v8i32.

Fixes PR35443

llvm-svn: 319208

6 years ago[CodeGen] Fix doxygen \file comment style
Francis Visoiu Mistrih [Tue, 28 Nov 2017 19:23:39 +0000 (19:23 +0000)]
[CodeGen] Fix doxygen \file comment style

llvm-svn: 319207

6 years ago[CodeGen] Fix doxygen
Francis Visoiu Mistrih [Tue, 28 Nov 2017 19:15:46 +0000 (19:15 +0000)]
[CodeGen] Fix doxygen

llvm-svn: 319206

6 years ago[InstCombine] auto-generate complete test checks; NFC
Sanjay Patel [Tue, 28 Nov 2017 19:13:23 +0000 (19:13 +0000)]
[InstCombine] auto-generate complete test checks; NFC

llvm-svn: 319205

6 years ago[Hexagon] Make sure to zero-extend bytes before building a vector
Krzysztof Parzyszek [Tue, 28 Nov 2017 19:13:17 +0000 (19:13 +0000)]
[Hexagon] Make sure to zero-extend bytes before building a vector

llvm-svn: 319204

6 years ago[InstCombine] auto-generate complete test checks; NFC
Sanjay Patel [Tue, 28 Nov 2017 19:07:28 +0000 (19:07 +0000)]
[InstCombine] auto-generate complete test checks; NFC

llvm-svn: 319203

6 years ago[mir] Print/Parse both MOLoad and MOStore when they occur together.
Daniel Sanders [Tue, 28 Nov 2017 18:57:02 +0000 (18:57 +0000)]
[mir] Print/Parse both MOLoad and MOStore when they occur together.

Summary:
They're not always mutually exclusive. read-modify-write atomics are both
at the same time. One example of this is the SWP instructions on AArch64.
Another example is GlobalISel's G_ATOMICRMW_* generic instructions which
will be added in a later patch.

Reviewers: arphaman, aemerson

Reviewed By: aemerson

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

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

llvm-svn: 319202

6 years ago[CUDA] Report "unsupported VLA" errors only on device side.
Artem Belevich [Tue, 28 Nov 2017 18:51:42 +0000 (18:51 +0000)]
[CUDA] Report "unsupported VLA" errors only on device side.

This fixes erroneously reported CUDA compilation errors
in host-side code during device-side compilation.

I've also restricted OpenMP-specific checks to trigger only
if we're compiling with OpenMP enabled.

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

llvm-svn: 319201

6 years agoFix non assert build warnings.
Rafael Espindola [Tue, 28 Nov 2017 18:50:08 +0000 (18:50 +0000)]
Fix non assert build warnings.

llvm-svn: 319200

6 years agoEntryExitInstrumenter: set DebugLocs on the inserted call instructions (PR35412)
Hans Wennborg [Tue, 28 Nov 2017 18:44:26 +0000 (18:44 +0000)]
EntryExitInstrumenter: set DebugLocs on the inserted call instructions (PR35412)

Apparently the verifier requires that inlineable calls in a function
with debug info have debug locations.

llvm-svn: 319199

6 years ago[CodeView] Refactor / Rewrite TypeSerializer and TypeTableBuilder.
Zachary Turner [Tue, 28 Nov 2017 18:33:17 +0000 (18:33 +0000)]
[CodeView] Refactor / Rewrite TypeSerializer and TypeTableBuilder.

The motivation behind this patch is that future directions require us to
be able to compute the hash value of records independently of actually
using them for de-duplication.

The current structure of TypeSerializer / TypeTableBuilder being a
single entry point that takes an unserialized type record, and then
hashes and de-duplicates it is not flexible enough to allow this.

At the same time, the existing TypeSerializer is already extremely
complex for this very reason -- it tries to be too many things. In
addition to serializing, hashing, and de-duplicating, ti also supports
splitting up field list records and adding continuations. All of this
functionality crammed into this one class makes it very complicated to
work with and hard to maintain.

To solve all of these problems, I've re-written everything from scratch
and split the functionality into separate pieces that can easily be
reused. The end result is that one class TypeSerializer is turned into 3
new classes SimpleTypeSerializer, ContinuationRecordBuilder, and
TypeTableBuilder, each of which in isolation is simple and
straightforward.

A quick summary of these new classes and their responsibilities are:

- SimpleTypeSerializer : Turns a non-FieldList leaf type into a series of
  bytes. Does not do any hashing. Every time you call it, it will
  re-serialize and return bytes again. The same instance can be re-used
  over and over to avoid re-allocations, and in exchange for this
  optimization the bytes returned by the serializer only live until the
  caller attempts to serialize a new record.

- ContinuationRecordBuilder : Turns a FieldList-like record into a series
  of fragments. Does not do any hashing. Like SimpleTypeSerializer,
  returns references to privately owned bytes, so the storage is
  invalidated as soon as the caller tries to re-use the instance. Works
  equally well for LF_FIELDLIST as it does for LF_METHODLIST, solving a
  long-standing theoretical limitation of the previous implementation.

- TypeTableBuilder : Accepts sequences of bytes that the user has already
  serialized, and inserts them by de-duplicating with a hash table. For
  the sake of convenience and efficiency, this class internally stores a
  SimpleTypeSerializer so that it can accept unserialized records. The
  same is not true of ContinuationRecordBuilder. The user is required to
  create their own instance of ContinuationRecordBuilder.

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

llvm-svn: 319198

6 years ago[X86][X87] Tag FP_TO_INT_IN_MEM pseudos with hasNoSchedulingInfo
Simon Pilgrim [Tue, 28 Nov 2017 18:10:29 +0000 (18:10 +0000)]
[X86][X87] Tag FP_TO_INT_IN_MEM pseudos with hasNoSchedulingInfo

We don't need scheduling info for pseudos

llvm-svn: 319197

6 years agoHandle binding in --wrap.
Rafael Espindola [Tue, 28 Nov 2017 18:02:22 +0000 (18:02 +0000)]
Handle binding in --wrap.

Copying the binding seems reasonable and matches the bfd behavior.

llvm-svn: 319196

6 years ago[Target] Make a copy of TargetOptions feature list before sorting during CodeGen
Craig Topper [Tue, 28 Nov 2017 18:00:32 +0000 (18:00 +0000)]
[Target] Make a copy of TargetOptions feature list before sorting during CodeGen

Currently CodeGen is calling std::sort on the features vector in TargetOptions for every function, but I don't think CodeGen should be modifying TargetOptions.

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

llvm-svn: 319195

6 years ago[CodeGen] Separate MachineOperand implementation from MachineInstr
Francis Visoiu Mistrih [Tue, 28 Nov 2017 17:58:43 +0000 (17:58 +0000)]
[CodeGen] Separate MachineOperand implementation from MachineInstr

Move the implementation to its own file.

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

llvm-svn: 319194

6 years ago[CodeGen] Cleanup MachineOperand
Francis Visoiu Mistrih [Tue, 28 Nov 2017 17:58:38 +0000 (17:58 +0000)]
[CodeGen] Cleanup MachineOperand

* clang-format
* move doxygen from the implementation to headers
* remove duplicate doxygen

llvm-svn: 319193

6 years agoAMDGPU: Add num spilled s/vgprs to metadata
Konstantin Zhuravlyov [Tue, 28 Nov 2017 17:51:08 +0000 (17:51 +0000)]
AMDGPU: Add num spilled s/vgprs to metadata

This was requested by tools.

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

llvm-svn: 319192

6 years agoSimplify UUID constructors
Stephane Sezer [Tue, 28 Nov 2017 17:50:31 +0000 (17:50 +0000)]
Simplify UUID constructors

Summary: This remove a small amount of duplicated code.

Reviewers: clayborg, zturner, davide

Subscribers: lldb-commits

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

llvm-svn: 319191

6 years ago[LibFuzzer] Improve comments on `CounterToFeature()` function.
Dan Liew [Tue, 28 Nov 2017 17:41:58 +0000 (17:41 +0000)]
[LibFuzzer] Improve comments on `CounterToFeature()` function.

This is based on discussion in https://reviews.llvm.org/D40376 .

The comments try to explain the reason for the current implementation
and note that it might change in the future, so clients should not
rely on this particular implementation.

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

llvm-svn: 319190

6 years agoSupport the setjmp(3) family of functions in TSan/NetBSD
Kamil Rytarowski [Tue, 28 Nov 2017 17:35:35 +0000 (17:35 +0000)]
Support the setjmp(3) family of functions in TSan/NetBSD

Summary:
This change adds support for the setjmp(3)/longjmp(3)
family of functions on NetBSD.

There are three types of them on NetBSD:

 - setjmp(3) / longjmp(3)
 - sigsetjmp(3) / sigsetjmp(3)
 - _setjmp(3) / _longjmp(3)

Due to historical and compat reasons the symbol
names are mangled:

 - setjmp -> __setjmp14
 - longjmp -> __longjmp14
 - sigsetjmp -> __sigsetjmp14
 - siglongjmp -> __siglongjmp14
 - _setjmp -> _setjmp
 - _longjmp -> _longjmp

This leads to symbol renaming in the existing codebase.

There is no such symbol as __sigsetjmp/__longsetjmp
on NetBSD

Add a comment that GNU-style executable stack
note is not needed on NetBSD. The stack is not
executable without it.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, dvyukov, vitalybuka

Reviewed By: dvyukov

Subscribers: llvm-commits, kubamracek, #sanitizers

Tags: #sanitizers

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

llvm-svn: 319189

6 years agoAdd opt-viewer testing
Adam Nemet [Tue, 28 Nov 2017 17:26:28 +0000 (17:26 +0000)]
Add opt-viewer testing

Detects whether we have the Python modules (pygments, yaml) required by
opt-viewer and hooks this up to REQUIRES.

This fixes https://bugs.llvm.org/show_bug.cgi?id=34129 (the lack of opt-viewer
testing).

It's also related to https://github.com/apple/swift/pull/12938 and the idea is
to expose LLVM_HAVE_OPT_VIEWER_MODULES to the Swift cmake.

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

llvm-svn: 319188

6 years ago[CodeGen] Print register names in lowercase in both MIR and debug output
Francis Visoiu Mistrih [Tue, 28 Nov 2017 17:15:09 +0000 (17:15 +0000)]
[CodeGen] Print register names in lowercase in both MIR and debug output

As part of the unification of the debug format and the MIR format,
always print registers as lowercase.

* Only debug printing is affected. It now follows MIR.

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

llvm-svn: 319187

6 years ago[WebAssembly] Support bitcasted function addresses with varargs.
Dan Gohman [Tue, 28 Nov 2017 17:15:03 +0000 (17:15 +0000)]
[WebAssembly] Support bitcasted function addresses with varargs.

Generalize FixFunctionBitcasts to handle varargs functions. This in
particular fixes the case where clang bitcasts away a varargs when
calling a K&R-style function.

This avoids interacting with tricky ABI details because it operates
at the LLVM IR level before varargs ABI details are exposed.

This fixes PR35385.

llvm-svn: 319186

6 years agoDAG: Legalize truncstores to illegal int types
Matt Arsenault [Tue, 28 Nov 2017 17:11:30 +0000 (17:11 +0000)]
DAG: Legalize truncstores to illegal int types

Truncate to a legal int type, and produce a new
truncstore from a narrower type.

llvm-svn: 319185

6 years ago[X86][X87] Tag FTST x87 instruction scheduler class
Simon Pilgrim [Tue, 28 Nov 2017 16:57:20 +0000 (16:57 +0000)]
[X86][X87] Tag FTST x87 instruction scheduler class

Looking through Agner, FTST is very similar to generic float compare behaviour, so I've added them to the existing IIC_FCOMI (WriteFAdd) tags.

llvm-svn: 319184

6 years ago[clang-tidy] Move more checks from misc- to performance-
Alexander Kornienko [Tue, 28 Nov 2017 16:41:03 +0000 (16:41 +0000)]
[clang-tidy] Move more checks from misc- to performance-

Summary:
rename_check.py misc-move-const-arg performance-move-const-arg
rename_check.py misc-noexcept-move-constructor performance-noexcept-move-constructor

Reviewers: hokein, xazax.hun

Reviewed By: xazax.hun

Subscribers: rnkovacs, klimek, mgorny, xazax.hun, cfe-commits

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

llvm-svn: 319183

6 years ago[InstCombine] add tests from D39421 to show current transforms; NFC
Sanjay Patel [Tue, 28 Nov 2017 16:40:30 +0000 (16:40 +0000)]
[InstCombine] add tests from D39421 to show current transforms; NFC

llvm-svn: 319182

6 years ago[PowerPC][tsan] Update tsan to handle changed memory layouts in newer kernels
Bill Seurer [Tue, 28 Nov 2017 16:28:54 +0000 (16:28 +0000)]
[PowerPC][tsan] Update tsan to handle changed memory layouts in newer kernels

In more recent Linux kernels with 47 bit VMAs the layout of virtual memory
for powerpc64 changed causing the thread sanitizer to not work properly. This
patch adds support for 47 bit VMA kernels for powerpc64.

(second part)

Tested on several 4.x and 3.x kernel releases.

llvm-svn: 319180

6 years agoRefactor functions PrintTemplateArgumentList
Serge Pavlov [Tue, 28 Nov 2017 16:14:14 +0000 (16:14 +0000)]
Refactor functions PrintTemplateArgumentList

These functions were defined as static members of TemplateSpecializationType.
Now they are moved to namespace level. Previously there were different
implementations for lists containing TemplateArgument and TemplateArgumentLoc,
now these implementations share the same code.

This change is a result of refactoring patch D40508. NFC.

llvm-svn: 319178

6 years ago[Support] Add unit test for printLowerCase
Francis Visoiu Mistrih [Tue, 28 Nov 2017 16:11:56 +0000 (16:11 +0000)]
[Support] Add unit test for printLowerCase

Add test case for the function added in r319171.

llvm-svn: 319177

6 years ago[cmake] Remove redundant call to cmake when building host tools.
Don Hinton [Tue, 28 Nov 2017 16:08:57 +0000 (16:08 +0000)]
[cmake] Remove redundant call to cmake when building host tools.

Summary:
Remove the redundant, config-time call to cmake when
building host tools for cross compiles or optimized tablegen..

The config-time call to cmake is redundant because it will always get
called again when the CONFIGURE_LLVM_${target_name} target fires at
build-time.  This speeds up initial configuration, but has no affect
on build behavior.

Reviewers: beanz

Reviewed By: beanz

Subscribers: mgorny, llvm-commits

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

llvm-svn: 319176

6 years ago[X86][X87] Tag FABS/FCHS/FSQRT/FSIN/FCOS x87 instruction scheduler classes
Simon Pilgrim [Tue, 28 Nov 2017 15:03:42 +0000 (15:03 +0000)]
[X86][X87] Tag FABS/FCHS/FSQRT/FSIN/FCOS x87 instruction scheduler classes

Atom's FABS/FCHS/FSQRT latencies taken from Agner.

Note: I just added FSIN and FCOS to the existing IIC_FSINCOS itinerary, which is actually a more costly instruction.
llvm-svn: 319175

6 years ago[clang-tidy] Ignore ExprWithCleanups when looking for else-after-throw
Malcolm Parsons [Tue, 28 Nov 2017 14:57:47 +0000 (14:57 +0000)]
[clang-tidy] Ignore ExprWithCleanups when looking for else-after-throw

Summary:
The readability-else-after-return check was not warning about
an else after a throw of an exception that had arguments that needed
to be cleaned up.

Reviewers: aaron.ballman, alexfh, djasper

Reviewed By: aaron.ballman

Subscribers: lebedev.ri, klimek, xazax.hun, cfe-commits

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

llvm-svn: 319174

6 years agoUse getStoreSize() in various places instead of 'BitSize >> 3'.
Jonas Paulsson [Tue, 28 Nov 2017 14:44:32 +0000 (14:44 +0000)]
Use getStoreSize() in various places instead of 'BitSize >> 3'.

This is needed for cases when the memory access is not as big as the width of
the data type. For instance, storing i1 (1 bit) would be done in a byte (8
bits).

Using 'BitSize >> 3' (or '/ 8') would e.g. give the memory access of an i1 a
size of 0, which for instance makes alias analysis return NoAlias even when
it shouldn't.

There are no tests as this was done as a follow-up to the bugfix for the case
where this was discovered (r318824). This handles more similar cases.

Review: Björn Petterson
https://reviews.llvm.org/D40339

llvm-svn: 319173

6 years ago[X86][X86] Add some x87 schedule tests
Simon Pilgrim [Tue, 28 Nov 2017 14:35:52 +0000 (14:35 +0000)]
[X86][X86] Add some x87 schedule tests

Still missing some instructions: mainly loads/stores/system ops, all flagged as TODO.

llvm-svn: 319172

6 years ago[Support] Merge toLower / toUpper implementations
Francis Visoiu Mistrih [Tue, 28 Nov 2017 14:22:27 +0000 (14:22 +0000)]
[Support] Merge toLower / toUpper implementations

Merge the ones from StringRef and StringExtras.

llvm-svn: 319171

6 years ago[clang-tidy] Fix tests for ReplaceRandomShuffleCheck
Gabor Horvath [Tue, 28 Nov 2017 13:54:52 +0000 (13:54 +0000)]
[clang-tidy] Fix tests for ReplaceRandomShuffleCheck

Patch by: Daniel Kolozsvari!

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

llvm-svn: 319170

6 years ago[ELF] Read ARM BuildAttributes section to determine supported features.
Peter Smith [Tue, 28 Nov 2017 13:51:48 +0000 (13:51 +0000)]
[ELF] Read ARM BuildAttributes section to determine supported features.

lld assumes some ARM features that are not available in all Arm
processors. In particular:
- The blx instruction present for interworking.
- The movt/movw instructions are used in Thunks.
- The J1=1 J2=1 encoding of branch immediates to improve Thumb wide
  branch range are assumed to be present.

This patch reads the ARM Attributes section to check for the
architecture the object file was compiled with. If none of the objects
have an architecture that supports either of these features a warning
will be given. This is most likely to affect armv6 as used in the first
Raspberry Pi.

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

llvm-svn: 319169

6 years ago[CodeGen] Rename functions PrintReg* to printReg*
Francis Visoiu Mistrih [Tue, 28 Nov 2017 12:42:37 +0000 (12:42 +0000)]
[CodeGen] Rename functions PrintReg* to printReg*

LLVM Coding Standards:
  Function names should be verb phrases (as they represent actions), and
  command-like function should be imperative. The name should be camel
  case, and start with a lower case letter (e.g. openFile() or isFoo()).

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

llvm-svn: 319168

6 years ago[X86][3DNow] Add instruction itinerary and scheduling classes for femms/prefetch...
Simon Pilgrim [Tue, 28 Nov 2017 12:37:35 +0000 (12:37 +0000)]
[X86][3DNow] Add instruction itinerary and scheduling classes for femms/prefetch/prefetchw

llvm-svn: 319167

6 years ago[ARM][AArch64] Workaround ARM/AArch64 peculiarity in clearing icache.
Peter Smith [Tue, 28 Nov 2017 12:34:05 +0000 (12:34 +0000)]
[ARM][AArch64] Workaround ARM/AArch64 peculiarity in clearing icache.

Certain ARM implementations treat icache clear instruction as a memory read,
and CPU segfaults on trying to clear cache on !PROT_READ page.
We workaround this in Memory::protectMappedMemory by adding
PROT_READ to affected pages, clearing the cache, and then setting
desired protection.

This fixes "AllocationTests/MappedMemoryTest.***/3" unit-tests on
affected hardware.

Reviewers: psmith, zatrazz, kristof.beyls, lhames

Reviewed By: lhames

Subscribers: llvm-commits, krytarowski, peter.smith, jgreenhalgh, aemerson,
             rengolin

Patch by maxim-kuvrykov!

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

llvm-svn: 319166

6 years ago[XRay][compiler-rt][Darwin] Minimal XRay build support in Darwin
Dean Michael Berris [Tue, 28 Nov 2017 11:49:22 +0000 (11:49 +0000)]
[XRay][compiler-rt][Darwin] Minimal XRay build support in Darwin

This change is the first in a series of changes to get the XRay runtime
building on macOS. This first allows us to build the minimal parts of
XRay to get us started on supporting macOS development. These include:

  - CMake changes to allow targeting x86_64 initially.
  - Allowing for building the initialisation routines without
    `.preinit_array` support.
  - Use __sanitizer::SleepForMillis() to work around the lack of
    clock_nanosleep on macOS.
  - Deprecate the xray_fdr_log_grace_period_us flag, and introduce
    the xray_fdr_log_grace_period_ms flag instead, to use
    milliseconds across platforms.

Reviewers: kubamracek

Subscribers: llvm-commits, krytarowski, nglevin, mgorny

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

llvm-svn: 319165

6 years agoAdd a new pass to speculate around PHI nodes with constant (integer) operands when...
Chandler Carruth [Tue, 28 Nov 2017 11:32:31 +0000 (11:32 +0000)]
Add a new pass to speculate around PHI nodes with constant (integer) operands when profitable.

The core idea is to (re-)introduce some redundancies where their cost is
hidden by the cost of materializing immediates for constant operands of
PHI nodes. When the cost of the redundancies is covered by this,
avoiding materializing the immediate has numerous benefits:
1) Less register pressure
2) Potential for further folding / combining
3) Potential for more efficient instructions due to immediate operand

As a motivating example, consider the remarkably different cost on x86
of a SHL instruction with an immediate operand versus a register
operand.

This pattern turns up surprisingly frequently, but is somewhat rarely
obvious as a significant performance problem.

The pass is entirely target independent, but it does rely on the target
cost model in TTI to decide when to speculate things around the PHI
node. I've included x86-focused tests, but any target that sets up its
immediate cost model should benefit from this pass.

There is probably more that can be done in this space, but the pass
as-is is enough to get some important performance on our internal
benchmarks, and should be generally performance neutral, but help with
more extensive benchmarking is always welcome.

One awkward part is that this pass has to be scheduled after
*everything* that can eliminate these kinds of redundancies. This
includes SimplifyCFG, GVN, etc. I'm open to suggestions about better
places to put this. We could in theory make it part of the codegen pass
pipeline, but there doesn't really seem to be a good reason for that --
it isn't "lowering" in any sense and only relies on pretty standard cost
model based TTI queries, so it seems to fit well with the "optimization"
pipeline model. Still, further thoughts on the pipeline position are
welcome.

I've also only implemented this in the new pass manager. If folks are
very interested, I can try to add it to the old PM as well, but I didn't
really see much point (my use case is already switched over to the new
PM).

I've tested this pretty heavily without issue. A wide range of
benchmarks internally show no change outside the noise, and I don't see
any significant changes in SPEC either. However, the size class
computation in tcmalloc is substantially improved by this, which turns
into a 2% to 4% win on the hottest path through tcmalloc for us, so
there are definitely important cases where this is going to make
a substantial difference.

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

llvm-svn: 319164

6 years agoCorrect mangled_sp on NetBSD/amd64 in TSan
Kamil Rytarowski [Tue, 28 Nov 2017 11:21:27 +0000 (11:21 +0000)]
Correct mangled_sp on NetBSD/amd64 in TSan

The proper index is 6, not 2.

Patch extracted from https://reviews.llvm.org/D40337

Reviewed and accepted by <dvyukov>.

Sponsored by <The NetBSD Foundation>

llvm-svn: 319163

6 years agoelf-core: Convert remaining register context to use register set maps
Pavel Labath [Tue, 28 Nov 2017 11:10:23 +0000 (11:10 +0000)]
elf-core: Convert remaining register context to use register set maps

In https://reviews.llvm.org/D39681, we started using a map instead
passing a long list of register sets to the ppc64le register context.
However, existing register contexts were still using the old method.

This converts the remaining register contexts to use this approach.
While doing that, I've had to modify the approach a bit:
- the general purpose register set is still kept as a separate field,
because this one is always present, and it's parsing is somewhat
different than that of other register sets.
- since the same register sets have different IDs on different operating
systems, but we use the same register context class to represent
different register sets, I've needed to add a layer of indirection to
translate os-specific constants (e.g. NETBSD::NT_AMD64_FPREGS) into more
generic terms (e.g. floating point register set).

While slightly more complicated, this setup allows for better separation
of concerns. The parsing code in ProcessElfCore can focus on parsing
OS-specific core file notes, and can completely ignore
architecture-specific register sets (by just storing any unrecognised
notes in a map). These notes will then be passed on to the
architecture-specific register context, which can just deal with
architecture specifics, because the OS-specific note types are hidden in
a register set description map.

This way, adding an register set, which is already supported on other
OSes, to a new OS, should in most cases be as simple as adding a new
entry into the register set description map.

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

llvm-svn: 319162

6 years agoFix floating point register write on new x86 linux kernels
Pavel Labath [Tue, 28 Nov 2017 10:56:54 +0000 (10:56 +0000)]
Fix floating point register write on new x86 linux kernels

Summary:
New linux kernels (on systems that support the XSAVES instruction) will
not update the inferior registers unless the corresponding flag in the
XSAVE header is set. Normally this flag will be set in our image of the
XSAVE area (since we obtained it from the kernel), but if the inferior
has never used the corresponding register set, the respective flag can
be clear.

This fixes the issue by making sure we explicitly set the flags
corresponding to the registers we modify. I don't try to precisely match
the flags to set on each write, as the rules could get quite complicated
-- I use a simpler over-approximation instead.

This was already caught by test_fp_register_write, but that was only
because the code that ran before main() did not use some of the register
sets. Since nothing in this test relies on being stopped in main(), I
modify the test to stop at the entry point instead, so we can be sure
the inferior did not have a chance to access these registers.

Reviewers: clayborg, valentinagiusti

Subscribers: lldb-commits

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

llvm-svn: 319161

6 years agoHandle symbol renaming of sigaction for NetBSD
Kamil Rytarowski [Tue, 28 Nov 2017 10:54:58 +0000 (10:54 +0000)]
Handle symbol renaming of sigaction for NetBSD

Summary:
NetBSD uses the __sigaction14 symbol name for historical and compat
reasons for the sigaction(2) function name.

Rename the interceptors and users of sigaction to sigaction_symname
and reuse it in the code base.

This change fixes 4 failing tests in TSan/NetBSD:

 - ThreadSanitizer-x86_64 :: signal_errno.cc
 - ThreadSanitizer-x86_64 :: signal_malloc.cc
 - ThreadSanitizer-x86_64 :: signal_sync2.cc
 - ThreadSanitizer-x86_64 :: signal_thread.cc

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, eugenis, dvyukov, kcc

Reviewed By: dvyukov

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 319160

6 years ago[clangd] Switch from YAMLParser to JSONExpr
Sam McCall [Tue, 28 Nov 2017 09:37:43 +0000 (09:37 +0000)]
[clangd] Switch from YAMLParser to JSONExpr

Summary:
 - Converted Protocol.h parse() functions to take JSON::Expr.
   These no longer detect and log unknown fields, as this is not that
   useful and no longer free.
   I haven't changed the error handling too much: fields that were
   treated as optional before are still optional, even when it's wrong.
   Exception: object properties with the wrong type are now ignored.
 - Made JSONRPCDispatcher parse using json::parse
 - The bug where 'method' must come before 'params' in the stream is
 fixed as a side-effect. (And the same bug in executeCommand).
 - Some parser crashers fixed as a side effect.
   e.g. https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3890
 - The debug stream now prettyprints the input messages with --pretty.
 - Request params are attached to traces when tracing is enabled.
 - Fixed some bugs in tests (errors tolerated by YAMLParser, and
 off-by-ones in Content-Length that our null-termination was masking)
 - Fixed a random double-escape bug in ClangdLSPServer (it was our last
 use of YAMLParser!)

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 319159

6 years ago[TailRecursionElimination] Skip debug intrinsics.
Florian Hahn [Tue, 28 Nov 2017 09:32:25 +0000 (09:32 +0000)]
[TailRecursionElimination] Skip debug intrinsics.

Summary:
I think we do not need to analyze debug intrinsics here, as they should
not impact codegen. This has 2 benefits: 1) slightly less work to do and
2) avoiding generating optimization remarks for converting calls to
debug intrinsics to tail calls, which are not really helpful for users.

Based on work by Sander de Smalen.

Reviewers: davide, trentxintong, aprantl

Reviewed By: aprantl

Subscribers: llvm-commits, JDevlieghere

Tags: #debug-info

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

llvm-svn: 319158

6 years ago[clangd] Add missing (but documented!) JSONExpr typed accessors
Sam McCall [Tue, 28 Nov 2017 09:25:09 +0000 (09:25 +0000)]
[clangd] Add missing (but documented!) JSONExpr typed accessors

Summary:
Noticed this when I tried to port the Protocol.h parsers.
And tests for the inspect API, which caught a small bug.

Reviewers: ioeric

Subscribers: ilya-biryukov

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

llvm-svn: 319157

6 years agoAMDGPU: Re-organize the outer loop of SILoadStoreOptimizer
Nicolai Haehnle [Tue, 28 Nov 2017 08:42:46 +0000 (08:42 +0000)]
AMDGPU: Re-organize the outer loop of SILoadStoreOptimizer

Summary:
The entire algorithm operates per basic-block, so for cache locality
it should be better to re-optimize a basic-block immediately rather than
in a separate loop.

I don't have performance measurements.

Change-Id: I85106570bd623c4ff277faaa50ee43258e1ddcc5

Reviewers: arsenm, rampitec

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

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

llvm-svn: 319156

6 years agoAMDGPU: Consistently check for immediates in SIInstrInfo::FoldImmediate
Nicolai Haehnle [Tue, 28 Nov 2017 08:41:50 +0000 (08:41 +0000)]
AMDGPU: Consistently check for immediates in SIInstrInfo::FoldImmediate

Summary:
The PeepholeOptimizer pass calls this function solely based on checking
DefMI->isMoveImmediate(), which only checks the MoveImm bit of the
instruction description. So it's up to FoldImmediate itself to properly
check that DefMI *actually* moves from an immediate.

I don't have a separate test case for this, but the next patch introduces
a test case which happens to crash without this change.

This error is caught by the assertion in MachineOperand::getImm().

Change-Id: I88e7cdbcf54d75e1a296822e6fe5f9a5f095bbf8

Reviewers: arsenm, rampitec

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

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

llvm-svn: 319155

6 years agoRevert r319008, "[ELF] Do not keep symbols if they referenced only from discarded...
Igor Kudrin [Tue, 28 Nov 2017 08:39:40 +0000 (08:39 +0000)]
Revert r319008, "[ELF] Do not keep symbols if they referenced only from discarded sections."
and r319051, "Add a missing test."

r319008 broke the LTO bots;
r319051 depends on changes in r319008.

llvm-svn: 319154

6 years ago[SCEV][NFC] More efficient caching in CompareValueComplexity
Max Kazantsev [Tue, 28 Nov 2017 08:26:43 +0000 (08:26 +0000)]
[SCEV][NFC] More efficient caching in CompareValueComplexity

Currently, we use a set of pairs to cache responces like `CompareValueComplexity(X, Y) == 0`. If we had
proved that `CompareValueComplexity(S1, S2) == 0` and `CompareValueComplexity(S2, S3) == 0`,
this cache does not allow us to prove that `CompareValueComplexity(S1, S3)` is also `0`.

This patch replaces this set with `EquivalenceClasses` that merges Values into equivalence sets so that
any two values from the same set are equal from point of `CompareValueComplexity`. This, in particular,
allows us to prove the fact from example above.

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

llvm-svn: 319153

6 years agoFix shared library builds of lld, broken in SVN r319138
Martin Storsjo [Tue, 28 Nov 2017 08:12:03 +0000 (08:12 +0000)]
Fix shared library builds of lld, broken in SVN r319138

llvm-svn: 319152

6 years ago[COFF] Interpret a period as a separator for section suffix just like '$'
Martin Storsjo [Tue, 28 Nov 2017 08:08:37 +0000 (08:08 +0000)]
[COFF] Interpret a period as a separator for section suffix just like '$'

This allows grouping all sections like ".ctors.12345" into ".ctors".

For MinGW, the numerical values for such ctors are all zero-padded,
so a lexical sort is good enough.

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

llvm-svn: 319151

6 years ago[COFF] Implement constructor priorities
Martin Storsjo [Tue, 28 Nov 2017 08:07:18 +0000 (08:07 +0000)]
[COFF] Implement constructor priorities

The priorities in the section name suffixes are zero padded,
allowing the linker to just do a lexical sort.

Add zero padding for .ctors sections in ELF as well.

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

llvm-svn: 319150

6 years ago[SCEV][NFC] More efficient caching in CompareSCEVComplexity
Max Kazantsev [Tue, 28 Nov 2017 07:48:12 +0000 (07:48 +0000)]
[SCEV][NFC] More efficient caching in CompareSCEVComplexity

Currently, we use a set of pairs to cache responces like `CompareSCEVComplexity(X, Y) == 0`. If we had
proved that `CompareSCEVComplexity(S1, S2) == 0` and `CompareSCEVComplexity(S2, S3) == 0`,
this cache does not allow us to prove that `CompareSCEVComplexity(S1, S3)` is also `0`.

This patch replaces this set with `EquivalenceClasses` any two values from the same set are equal from
point of `CompareSCEVComplexity`. This, in particular, allows us to prove the fact from example above.

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

llvm-svn: 319149

6 years agorun-clang-tidy: Use check_call instead of check_output
Kevin Funk [Tue, 28 Nov 2017 07:17:01 +0000 (07:17 +0000)]
run-clang-tidy: Use check_call instead of check_output

Summary:
Streamlines the output under Python 3.x.

Before:
```
b'Enabled checks:\n    clang-analyzer-apiModeling.google.GTest\n ...
```

After:
```
Enabled checks:
    clang-analyzer-apiModeling.google.GTest
...
```

Reviewers: cfe-commits, alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere

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

Change-Id: I6287104bc73926ae6d0f66c15c250c3cb44bee33
llvm-svn: 319148

6 years ago[GVN] Prevent ScalarPRE from hoisting across instructions that don't pass control...
Max Kazantsev [Tue, 28 Nov 2017 07:07:55 +0000 (07:07 +0000)]
[GVN] Prevent ScalarPRE from hoisting across instructions that don't pass control flow to successors

This is to address a problem similar to those in D37460 for Scalar PRE. We should not
PRE across an instruction that may not pass execution to its successor unless it is safe
to speculatively execute it.

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

llvm-svn: 319147

6 years agoRevert "Add opt-viewer testing"
Adam Nemet [Tue, 28 Nov 2017 06:22:29 +0000 (06:22 +0000)]
Revert "Add opt-viewer testing"

This reverts commit r319073.

Bot fails with a mismatch that looks like pygments-generated HTML.

llvm-svn: 319146

6 years ago[test] Fix a typo in a test comment. NFC.
Martin Storsjo [Tue, 28 Nov 2017 05:47:24 +0000 (05:47 +0000)]
[test] Fix a typo in a test comment. NFC.

llvm-svn: 319145

6 years ago[WebAssembly] Handle errors better in fast-isel.
Dan Gohman [Tue, 28 Nov 2017 05:36:42 +0000 (05:36 +0000)]
[WebAssembly] Handle errors better in fast-isel.

Fast-isel routines need to bail out in the case that fast-isel
fails on the operands.

This fixes https://bugs.llvm.org/show_bug.cgi?id=35064

llvm-svn: 319144

6 years ago[X86] Remove some unused pattern fragments from td file. NFC
Craig Topper [Tue, 28 Nov 2017 05:23:57 +0000 (05:23 +0000)]
[X86] Remove some unused pattern fragments from td file. NFC

llvm-svn: 319143

6 years ago[DAGCombine] Disable finding better chains for stores at O0
Simon Dardis [Tue, 28 Nov 2017 04:07:59 +0000 (04:07 +0000)]
[DAGCombine] Disable finding better chains for stores at O0

Unoptimized IR can have linear sequences of stores to an array, where the
initial GEP for the first store is formed from the pointer to the array, and the
GEP for each store after the first is formed from the previous GEP with some
offset in an inductive fashion.

The (large) resulting DAG when analyzed by DAGCombine undergoes an excessive
number of combines as each store node is examined every time its' offset node
is combined with any child of the offset. One of the transformations is
findBetterNeighborChains which assists MergeConsecutiveStores. The former
relies on repeated chain walking to do its' work, however MergeConsecutiveStores
is disabled at O0 which makes the transformation redundant.

Any optimization level other than O0 would invoke InstCombine which would
resolve the chain of GEPs into flat base + offset GEP for each store which
does not exhibit the repeated examination of each store to the array.

Disabling this optimization fixes an excessive compile time issue (30~ minutes
for the test case provided) at O0.

Reviewers: niravd, craig.topper, t.p.northover

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

llvm-svn: 319142

6 years agoMachineVerifier: Improve register operand checks
Matthias Braun [Tue, 28 Nov 2017 03:54:20 +0000 (03:54 +0000)]
MachineVerifier: Improve register operand checks

This fixes cases where we wouldn't perform various register operand
checks just because we didn't happen to have a definition in the
MCInstrDesc. This changes the code to only skip the tests that actually
depend on the MCInstrDesc definition.

This makes the machine verifier spot the problem from
https://llvm.org/PR33071 after the pass that actually caused it.

llvm-svn: 319141

6 years agoMachineVerifier: Improve PHI operand checking
Matthias Braun [Tue, 28 Nov 2017 03:54:19 +0000 (03:54 +0000)]
MachineVerifier: Improve PHI operand checking

Additional checks for phi operands:
- first operand should be a virtual register def. It should not be
  tied, implicit, internalread, earlyclobber or a read.
- The other operands should be register/mbb operands next to each other
- The register operands should not be implicit, internalread,
  earlyclobber, debug or tied.
- We can perform most of the PHI checks even for unreachable blocks.

llvm-svn: 319140

6 years agolit: Bring back -Dtool=xxx feature lost in r313928
Matthias Braun [Tue, 28 Nov 2017 03:23:07 +0000 (03:23 +0000)]
lit: Bring back -Dtool=xxx feature lost in r313928

llvm-svn: 319139

6 years agoFactor out common code to Common/Strings.cpp.
Rui Ueyama [Tue, 28 Nov 2017 02:15:26 +0000 (02:15 +0000)]
Factor out common code to Common/Strings.cpp.

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

llvm-svn: 319138

6 years agoUse FILE_FLAG_DELETE_ON_CLOSE for TempFile on windows.
Rafael Espindola [Tue, 28 Nov 2017 01:41:22 +0000 (01:41 +0000)]
Use FILE_FLAG_DELETE_ON_CLOSE for TempFile on windows.

We won't see the temp file no more.

llvm-svn: 319137

6 years ago[X86] Make zero extend from v16i1/v8i1 to v16i8/v8i16/v16i16 not scalarize under...
Craig Topper [Tue, 28 Nov 2017 01:36:33 +0000 (01:36 +0000)]
[X86] Make zero extend from v16i1/v8i1 to v16i8/v8i16/v16i16 not scalarize under AVX512.

llvm-svn: 319136

6 years ago[X86] Add command line without AVX512BW/AVX512VL to bitcast-int-to-vector-bool-zext.ll.
Craig Topper [Tue, 28 Nov 2017 01:36:31 +0000 (01:36 +0000)]
[X86] Add command line without AVX512BW/AVX512VL to bitcast-int-to-vector-bool-zext.ll.

llvm-svn: 319135

6 years agoMove code. NFC.
Rafael Espindola [Tue, 28 Nov 2017 01:34:20 +0000 (01:34 +0000)]
Move code. NFC.

This moves the TempFile implementation so that it can use system
specific code.

llvm-svn: 319134

6 years agoReland r319090, "COFF: Do not create SectionChunks for discarded comdat sections...
Peter Collingbourne [Tue, 28 Nov 2017 01:30:07 +0000 (01:30 +0000)]
Reland r319090, "COFF: Do not create SectionChunks for discarded comdat sections." with a fix for debug sections.

If /debug was not specified, readSection will return a null
pointer for debug sections. If the debug section is associative with
another section, we need to make sure that the section returned from
readSection is not a null pointer before adding it as an associative
section.

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

llvm-svn: 319133

6 years agoRemove some duplicated code in UUID.cpp
Stephane Sezer [Tue, 28 Nov 2017 01:26:07 +0000 (01:26 +0000)]
Remove some duplicated code in UUID.cpp

Summary: Formatting needs to be done only once. Ran check-lldb and nothing changes.

Reviewers: clayborg, davide

Reviewed By: clayborg, davide

Subscribers: zturner, davide, lldb-commits

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

llvm-svn: 319132

6 years agoThis reverts commit r319096 and r319097.
Rafael Espindola [Tue, 28 Nov 2017 01:25:38 +0000 (01:25 +0000)]
This reverts commit r319096 and r319097.

Revert "[SROA] Propagate !range metadata when moving loads."
Revert "[Mem2Reg] Clang-format unformatted parts of this file. NFCI."

Davide says they broke a bot.

llvm-svn: 319131

6 years agoARM: Fix PR32578
Matthias Braun [Tue, 28 Nov 2017 01:17:52 +0000 (01:17 +0000)]
ARM: Fix PR32578

https://llvm.org/PR32578

I simplified and converted the reproducer into a lit test.

Patch by Vedant Kumar!

llvm-svn: 319130

6 years ago[WebAssembly] Add options for using the nontrapping-fptoint feature.
Dan Gohman [Tue, 28 Nov 2017 01:13:45 +0000 (01:13 +0000)]
[WebAssembly] Add options for using the nontrapping-fptoint feature.

This adds ways to control use of WebAssembly's new nontrapping-fptoint
feature.

llvm-svn: 319129

6 years ago[WebAssembly] Fix trapping behavior in fptosi/fptoui.
Dan Gohman [Tue, 28 Nov 2017 01:13:40 +0000 (01:13 +0000)]
[WebAssembly] Fix trapping behavior in fptosi/fptoui.

This adds code to protect WebAssembly's `trunc_s` family of opcodes
from values outside their domain. Even though such conversions have
full undefined behavior in C/C++, LLVM IR's `fptosi` and `fptoui` do
not, and only return undef.

This also implements the proposed non-trapping float-to-int conversion
feature and uses that instead when available.

llvm-svn: 319128

6 years agoStore the real binding of shared symbols.
Rafael Espindola [Tue, 28 Nov 2017 01:04:51 +0000 (01:04 +0000)]
Store the real binding of shared symbols.

Currently we mark every shared symbol as STB_WEAK.

That is a hack to make it easy to decide when a .so is needed or not
because of a reference to a given symbol.

That hack leaks when we create copy relocations as shown by the update
to relocation-copy-alias.s.

This patch stores the original binding when we first read a shared
symbol. We still have to update the binding to weak if we see a weak
undef, but I find the logic easier to read where it is now.

llvm-svn: 319127

6 years agoSROA: Avoid creating a fragment expression that covers the entire variable.
Adrian Prantl [Tue, 28 Nov 2017 00:57:53 +0000 (00:57 +0000)]
SROA: Avoid creating a fragment expression that covers the entire variable.

Fixes PR35416.

https://bugs.llvm.org/show_bug.cgi?id=35416

llvm-svn: 319126

6 years agoMove getVariableSize from Verifier.cpp into DIVariable::getSize() (NFC)
Adrian Prantl [Tue, 28 Nov 2017 00:57:51 +0000 (00:57 +0000)]
Move getVariableSize from Verifier.cpp into DIVariable::getSize() (NFC)

llvm-svn: 319125

6 years ago[X86] Remove unnecessary fp<->int setOperationAction lines from a hasVLX block. NFCI
Craig Topper [Tue, 28 Nov 2017 00:41:12 +0000 (00:41 +0000)]
[X86] Remove unnecessary fp<->int setOperationAction lines from a hasVLX block. NFCI

These lines all exist identically either under SSE2, AVX2 or AVX512. Given that VLX implies all of those, these aren't providing anything new.

llvm-svn: 319124

6 years agoInsert padding before the __cxa_exception header to ensure the thrown
Akira Hatanaka [Tue, 28 Nov 2017 00:36:29 +0000 (00:36 +0000)]
Insert padding before the __cxa_exception header to ensure the thrown
object is sufficiently aligned.

r303175 annotated field unwindHeader of __cxa_exception with attribute
'aligned' to ensure the thrown object following the __cxa_exception
header was sufficiently aligned. This caused changes in the field
offsets of __cxa_exception relative to the start of the thrown object,
which was an ABI breaking change for some clients.

Instead of annotating field unwindHeader, this commit inserts extra
space before the header. This ensures the thrown object following the
header is sufficiently aligned without changing the field offsets, thus
avoiding any ABI breakages.

rdar://problem/25364625
rdar://problem/35556163

llvm-svn: 319123

6 years ago[X86] Remove duplicate calls to setOperationAction. NFCI
Craig Topper [Tue, 28 Nov 2017 00:16:42 +0000 (00:16 +0000)]
[X86] Remove duplicate calls to setOperationAction. NFCI

These same calls exist a few lines down.

llvm-svn: 319122

6 years agoAdd an F_Delete flag.
Rafael Espindola [Tue, 28 Nov 2017 00:12:44 +0000 (00:12 +0000)]
Add an F_Delete flag.

For now this only changes the handle Access.

llvm-svn: 319121

6 years ago[DAGCombiner] Don't combine aext(setcc) if the setcc is already using the target...
Craig Topper [Mon, 27 Nov 2017 23:51:40 +0000 (23:51 +0000)]
[DAGCombiner] Don't combine aext(setcc) if the setcc is already using the target's preferred result type.

With AVX512 vXi1 types are legal so we shouldn't be extending them.

This change is similar to existing code in the zext(setcc) combine.

llvm-svn: 319120

6 years ago[DAGCombiner] Use EVT::changeVectorElementTypeToInteger() instead of implementing...
Craig Topper [Mon, 27 Nov 2017 23:51:31 +0000 (23:51 +0000)]
[DAGCombiner] Use EVT::changeVectorElementTypeToInteger() instead of implementing manually.

llvm-svn: 319119

6 years agoAdd OpenFlags to the create(Unique|Temporary)File interfaces.
Rafael Espindola [Mon, 27 Nov 2017 23:44:11 +0000 (23:44 +0000)]
Add OpenFlags to the create(Unique|Temporary)File interfaces.

This will allow a future F_Delete flag to be specified when we want
the file to be automatically deleted on close.

llvm-svn: 319117