OSDN Git Service

android-x86/external-llvm.git
5 years ago[Evaluator] Walk initial elements when handling load through bitcast
Robert Lougher [Thu, 25 Apr 2019 17:00:01 +0000 (17:00 +0000)]
[Evaluator] Walk initial elements when handling load through bitcast

When evaluating a store through a bitcast, the evaluator tries to move the
bitcast from the pointer onto the stored value. If the cast is invalid, it
tries to "introspect" the type to get a valid cast by obtaining a pointer to
the initial element (if the type is nested, this may require walking several
initial elements).

In some situations it is possible to get a bitcast on a load (e.g. with
unions, where the bitcast may not be the same type as the store). However,
equivalent logic to the store to introspect the type is missing. This patch
add this logic.

Note, when developing the patch I was unhappy with adding similar logic
directly to the load case as it could get out of step. Instead, I have
abstracted the "introspection" into a helper function, with the specifics
being handled by a passed-in lambda function.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359205 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GlobalISel][AArch64] Legalize G_FNEARBYINT
Jessica Paquette [Thu, 25 Apr 2019 16:44:40 +0000 (16:44 +0000)]
[GlobalISel][AArch64] Legalize G_FNEARBYINT

Add legalizer support for G_FNEARBYINT. It's the same as G_FCEIL etc.

Since the importer allows us to automatically select this after legalization,
also add tests for selection etc. Also update arm64-vfloatintrinsics.ll.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359204 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GlobalISel] Add IRTranslator support for G_FNEARBYINT
Jessica Paquette [Thu, 25 Apr 2019 16:39:28 +0000 (16:39 +0000)]
[GlobalISel] Add IRTranslator support for G_FNEARBYINT

Translate llvm.nearbyint into G_FNEARBYINT as a simple intrinsic. Update
arm64-irtranslator.ll.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359203 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GlobalISel] Add a G_FNEARBYINT opcode
Jessica Paquette [Thu, 25 Apr 2019 16:36:03 +0000 (16:36 +0000)]
[GlobalISel] Add a G_FNEARBYINT opcode

For eventually selecting llvm.nearbyint. Equivalent to the SelectionDAG
nearbyint node.

Update legalizer-info-validation.mir.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359201 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[JITLink] Make the JITLink MachO/x86-64 eh-frame test work on Windows."
Lang Hames [Thu, 25 Apr 2019 15:18:31 +0000 (15:18 +0000)]
Revert "[JITLink] Make the JITLink MachO/x86-64 eh-frame test work on Windows."

This reverts r359169, as it broke one of the windows bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359198 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Document llvm_enable_dia_sdk variable better
Nico Weber [Thu, 25 Apr 2019 14:56:56 +0000 (14:56 +0000)]
gn build: Document llvm_enable_dia_sdk variable better

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359196 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Make setting llvm_enable_dia_sdk=true work
Nico Weber [Thu, 25 Apr 2019 14:53:53 +0000 (14:53 +0000)]
gn build: Make setting llvm_enable_dia_sdk=true work

If this is set, %INCLUDE% must contain ".../DIA SDK/include"
and %LIB% must contain ".../DIA SKD/lib/amd64" (assuming you're doing a
64-bit build).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359195 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine][X86] Tweak generic expansion of PACKSS/PACKUS to shuffle then truncate...
Simon Pilgrim [Thu, 25 Apr 2019 13:51:57 +0000 (13:51 +0000)]
[InstCombine][X86] Tweak generic expansion of PACKSS/PACKUS to shuffle then truncate. NFCI.

This has no effect on constant folding but will be useful when we expand non-saturating PACKSS/PACKUS intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359191 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Support] json::OStream::flush(), which passes through to the underlying stream
Sam McCall [Thu, 25 Apr 2019 13:33:18 +0000 (13:33 +0000)]
[Support] json::OStream::flush(), which passes through to the underlying stream

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359190 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r359179
Nico Weber [Thu, 25 Apr 2019 13:29:34 +0000 (13:29 +0000)]
gn build: Merge r359179

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359189 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r359174
Nico Weber [Thu, 25 Apr 2019 13:26:54 +0000 (13:26 +0000)]
gn build: Merge r359174

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359188 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r359142
Nico Weber [Thu, 25 Apr 2019 13:25:00 +0000 (13:25 +0000)]
gn build: Merge r359142

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359187 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Support] Add JSON streaming output API, faster where the heavy value types aren...
Sam McCall [Thu, 25 Apr 2019 12:51:42 +0000 (12:51 +0000)]
[Support] Add JSON streaming output API, faster where the heavy value types aren't needed.

Summary:
There's still a little bit of constant factor that could be trimmed (e.g.
more overloads to avoid round-tripping primitives through json::Value).
But this solves the memory scaling problem, and greatly improves the performance
constant factor, and the API should leave room for optimization if needed.

Adapt TimeProfiler to use it, eliminating almost all the performance regression
from r358476.

Performance test on my machine:
perf stat -r 5 ~/llvmbuild-opt/bin/clang++ -w -S -ftime-trace -mllvm -time-trace-granularity=0 spirit.cpp

Handcrafted JSON (HEAD=r358532 with r358476 reverted): 2480ms
json::Value (HEAD): 2757ms (+11%)
After this patch: 2520 ms (+1.6%)

Reviewers: anton-afanasyev, lebedev.ri

Subscribers: kristina, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359186 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine][X86] Add PACKSS/PACKUS tests for truncation where saturation won't...
Simon Pilgrim [Thu, 25 Apr 2019 12:45:11 +0000 (12:45 +0000)]
[InstCombine][X86] Add PACKSS/PACKUS tests for truncation where saturation won't occur

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359185 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Support] Try to unbreak windows buildbot
Ilya Biryukov [Thu, 25 Apr 2019 11:57:40 +0000 (11:57 +0000)]
[Support] Try to unbreak windows buildbot

After r359179.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359183 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoParallel: only allow the first TaskGroup to run tasks parallelly
Fangrui Song [Thu, 25 Apr 2019 11:33:30 +0000 (11:33 +0000)]
Parallel: only allow the first TaskGroup to run tasks parallelly

Summary:
Concurrent (e.g. nested) llvm::parallel::for_each() may lead to dead
locks. See PR35788 (fixed by rLLD322041) and PR41508 (fixed by D60757).

When parallel_for_each() is about to return, in ~Latch() called by
~TaskGroup(), a thread (in the default executor) may block in
Latch::sync() waiting for Count to become zero. If all threads in the
default executor are blocked, it is a dead lock.

To fix this, force serial execution if the current TaskGroup is not the
first one. For a nested llvm::parallel::for_each(), this parallelizes
the outermost loop and serializes inner loops.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359182 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objdump] Prep for adding newlines before and after "Disassembly of section...
Fangrui Song [Thu, 25 Apr 2019 10:25:52 +0000 (10:25 +0000)]
[llvm-objdump] Prep for adding newlines before and after "Disassembly of section ...:"

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359181 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ConstantRange] [a, b) udiv a full range is [0, umax(b)).
Florian Hahn [Thu, 25 Apr 2019 10:12:43 +0000 (10:12 +0000)]
[ConstantRange] [a, b) udiv a full range is [0, umax(b)).

Reviewers: nikic, spatel, efriedma

Reviewed By: nikic

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359180 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Testing] Move clangd::Annotations to llvm testing support
Ilya Biryukov [Thu, 25 Apr 2019 10:08:31 +0000 (10:08 +0000)]
[Testing] Move clangd::Annotations to llvm testing support

Summary:
Annotations allow writing nice-looking unit test code when one needs
access to locations from the source code, e.g. running code completion
at particular offsets in a file. See comments in Annotations.cpp for
more details on the API.

Also got rid of a duplicate annotations parsing code in clang's code
complete tests.

Reviewers: gribozavr, sammccall

Reviewed By: gribozavr

Subscribers: mgorny, hiraditya, ioeric, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359179 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[yaml2obj] - Don't crash on invalid inputs.
George Rimar [Thu, 25 Apr 2019 09:59:55 +0000 (09:59 +0000)]
[yaml2obj] - Don't crash on invalid inputs.

yaml2obj might crash on invalid input when unable to parse the YAML.

Recently a crash with a very similar nature was fixed for an empty files.
This patch revisits the fix and does it in yaml::Input instead.
It seems to be more correct way to handle such situation.

With that crash for invalid inputs is also fixed now.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359178 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix include order. NFCI.
Simon Pilgrim [Thu, 25 Apr 2019 09:49:37 +0000 (09:49 +0000)]
Fix include order. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359177 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] combineBitcastvxi1 - add support for bitcasting to non-scalar integers
Simon Pilgrim [Thu, 25 Apr 2019 09:34:36 +0000 (09:34 +0000)]
[X86][SSE] combineBitcastvxi1 - add support for bitcasting to non-scalar integers

Truncate the movmsk scalar integer result to the equivalent scalar integer width as before but then bitcast to the requested type.

We still have the issue identified in PR41594 but D61114 should handle this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359176 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Support] Add a GTest matcher for Optional<T>
Ilya Biryukov [Thu, 25 Apr 2019 09:03:32 +0000 (09:03 +0000)]
[Support] Add a GTest matcher for Optional<T>

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359174 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC][LoopIdiomRecognize] Some basic baseline tests for bcmp loop idiom
Roman Lebedev [Thu, 25 Apr 2019 08:33:47 +0000 (08:33 +0000)]
[NFC][LoopIdiomRecognize] Some basic baseline tests for bcmp loop idiom

Doubt this is the final test coverage, but this appears to have good
coverage already, so i figure i might as well precommit it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359173 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MIPS] Use custom bitcast lowering to avoid excessive instructions
Simon Atanasyan [Thu, 25 Apr 2019 07:47:28 +0000 (07:47 +0000)]
[MIPS] Use custom bitcast lowering to avoid excessive instructions

On Mips32r2 bitcast can be expanded to two sw instructions and an ldc1
when using bitcast i64 to double or an sdc1 and two lw instructions when
using bitcast double to i64. By introducing custom lowering that uses
mtc1/mthc1 we can avoid excessive instructions.

Patch by Mirko Brkusanin.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359171 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Remove part of an if condition that should always be true.
Craig Topper [Thu, 25 Apr 2019 06:08:02 +0000 (06:08 +0000)]
[X86] Remove part of an if condition that should always be true.

The IndexReg will always be non-null at this point. Earlier in the function, if
IndexReg was null we set it to CurDAG->getRegister(0, VT) which made it
non-null.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359170 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Make the JITLink MachO/x86-64 eh-frame test work on Windows.
Lang Hames [Thu, 25 Apr 2019 05:24:40 +0000 (05:24 +0000)]
[JITLink] Make the JITLink MachO/x86-64 eh-frame test work on Windows.

This should fix the MachO/x86-64 eh-frame regression test by ensuring that
the symbols __ZTIi and ___gxx_personality_v0 are defined on all platforms.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359169 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-rtdyld] Add support for passing command line arguments to rtdyld-run code.
Lang Hames [Thu, 25 Apr 2019 05:02:10 +0000 (05:02 +0000)]
[llvm-rtdyld] Add support for passing command line arguments to rtdyld-run code.

The --args option can now be used to pass arguments to code linked with
llvm-rtdyld. E.g.

$ llvm-rtdyld file1.o file2.o --args a b c

is equivalent to:

$ ld -o program file1.o file2.o
$ ./program a b c

This is the rtdyld counterpart to the jitlink change in r359115, and makes
benchmarking and comparison between the tools easier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359168 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoEnable LoopVectorization by default.
Alina Sbirlea [Thu, 25 Apr 2019 04:49:48 +0000 (04:49 +0000)]
Enable LoopVectorization by default.

Summary:
When refactoring vectorization flags, vectorization was disabled by default in the new pass manager.
This patch re-enables is for both managers, and changes the assumptions opt makes, based on the new defaults.
Comments in opt.cpp should clarify the intended use of all flags to enable/disable vectorization.

Reviewers: chandlerc, jgorbe

Subscribers: jlebar, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359167 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objdump] errorToErrorCode+message -> toString
Fangrui Song [Thu, 25 Apr 2019 04:31:26 +0000 (04:31 +0000)]
[llvm-objdump] errorToErrorCode+message -> toString

For test/Object/elf-invalid-phdr.test, the intended error message got lost due to errorToErrorCode().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359166 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoConsolidate existing utilities for interpreting vector predicate maskes [NFC]
Philip Reames [Thu, 25 Apr 2019 02:30:17 +0000 (02:30 +0000)]
Consolidate existing utilities for interpreting vector predicate maskes [NFC]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359163 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix unused variable warning in LoopFusion pass.
Kit Barton [Thu, 25 Apr 2019 02:10:02 +0000 (02:10 +0000)]
Fix unused variable warning in LoopFusion pass.

Do not wrap the contents of printFusionCandidates in the LLVM_DEBUG macro. This
fixes an unused variable warning generated when compiling without asserts but
with -DENABLE_LLVM_DUMP.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359161 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Be consistent w/handling of masked intrinsics style wise [NFC]
Philip Reames [Thu, 25 Apr 2019 01:18:56 +0000 (01:18 +0000)]
[InstCombine] Be consistent w/handling of masked intrinsics style wise [NFC]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359160 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[utils] Add a lldb data formatter for llvm::SmallString.
Davide Italiano [Thu, 25 Apr 2019 00:03:02 +0000 (00:03 +0000)]
[utils] Add a lldb data formatter for llvm::SmallString.

Result:

(lldb) p val
(llvm::SmallString<32>) $31 = "patatino"

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359157 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix spelling error. NFC
Austin Kerbow [Wed, 24 Apr 2019 23:32:21 +0000 (23:32 +0000)]
Fix spelling error. NFC

Summary: Test commit.

Reviewers: msearles, jkorous

Reviewed By: jkorous

Subscribers: dexonsmith, arsenm, jvesely, nhaehnle, hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359154 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agollvm-cvtres: Make new dupe resource error a bit friendlier
Nico Weber [Wed, 24 Apr 2019 23:26:30 +0000 (23:26 +0000)]
llvm-cvtres: Make new dupe resource error a bit friendlier

For well-known type IDs, include the name of the type.

To not duplicate the ID->name map, make llvm-readobj call this new
function as well.  It has slightly different output, so this also
requires updating a few tests.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359153 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoposix_spawn should retry upon EINTR
JF Bastien [Wed, 24 Apr 2019 23:24:53 +0000 (23:24 +0000)]
posix_spawn should retry upon EINTR

Summary:
We've seen cases of bots failing with:
  clang: error: unable to execute command: posix_spawn failed: Interrupted system call

Add a small retry loop to posix_spawn in case this happens. Don't retry too much in case there's some systemic problem going on, but retry a few times.
<rdar://problem/50181448>

Reviewers: Bigcheese, arphaman

Subscribers: jkorous, dexonsmith, kristina, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359152 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMark new jitlink test XFAIL for windows
Reid Kleckner [Wed, 24 Apr 2019 23:11:17 +0000 (23:11 +0000)]
Mark new jitlink test XFAIL for windows

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359151 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRecommitting r358783 and r358786 "[MS] Emit S_HEAPALLOCSITE debug info" with fixes...
Amy Huang [Wed, 24 Apr 2019 23:02:48 +0000 (23:02 +0000)]
Recommitting r358783 and r358786 "[MS] Emit S_HEAPALLOCSITE debug info" with fixes for buildbot error (undefined assembler label).

Summary:
This emits labels around heapallocsite calls and S_HEAPALLOCSITE debug
info in codeview. Currently only changes FastISel, so emitting labels still
needs to be implemented in SelectionDAG.

Reviewers: rnk

Subscribers: aprantl, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359149 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombiner] scale repeated FP divisor by splat factor
Sanjay Patel [Wed, 24 Apr 2019 22:28:58 +0000 (22:28 +0000)]
[DAGCombiner] scale repeated FP divisor by splat factor

If we have a vector FP division with a splatted divisor, use the existing transform
that converts 'x/y' into 'x * (1.0/y)' to allow more conversions. This can then
potentially be converted into a scalar FP division by existing combines (rL358984)
as seen in the tests here.

That can be a potentially big perf difference if scalar fdiv has better timing
(including avoiding possible frequency throttling for vector ops).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359147 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PowerPC] Allow using initial-exec TLS with PIC
Joerg Sonnenberger [Wed, 24 Apr 2019 22:12:22 +0000 (22:12 +0000)]
[PowerPC] Allow using initial-exec TLS with PIC

Using initial-exec TLS variables is a reasonable performance
optimisation for system libraries. Use the correct PIC mechanism to get
hold of the GOT to avoid text relocations.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359146 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd period at end of comment.
Sean Fertile [Wed, 24 Apr 2019 21:51:30 +0000 (21:51 +0000)]
Add period at end of comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359144 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Attempt to fix use-after-poison from r359121.
Craig Topper [Wed, 24 Apr 2019 21:48:24 +0000 (21:48 +0000)]
[X86] Attempt to fix use-after-poison from r359121.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359143 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] gfx1010 SOP instructions
Stanislav Mekhanoshin [Wed, 24 Apr 2019 20:44:34 +0000 (20:44 +0000)]
[AMDGPU] gfx1010 SOP instructions

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359139 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SLP] Fix crash after r358519, by V. Porpodas.
Alexey Bataev [Wed, 24 Apr 2019 20:21:32 +0000 (20:21 +0000)]
[SLP] Fix crash after r358519, by V. Porpodas.

Summary: The code did not check if operand was undef before casting it to Instruction.

Reviewers: RKSimon, ABataev, dtemirbulatov

Reviewed By: ABataev

Subscribers: uabelho

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359136 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoTry once more to ensure constant initializaton of ManagedStatics
Reid Kleckner [Wed, 24 Apr 2019 20:13:23 +0000 (20:13 +0000)]
Try once more to ensure constant initializaton of ManagedStatics

First, use the old style of linker initialization for MSVC 2019 in
addition to 2017. MSVC 2019 emits a dynamic initializer for
ManagedStatic when compiled in debug mode, and according to zturner,
also sometimes in release mode. I wasn't able to reproduce that, but it
seems best to stick with the old code that works.

When clang is using the MSVC STL, we have to give ManagedStatic a
constexpr constructor that fully zero initializes all fields, otherwise
it emits a dynamic initializer. The MSVC STL implementation of
std::atomic has a non-trivial (but constexpr) default constructor that
zero initializes the atomic value. Because one of the fields has a
non-trivial constructor, ManagedStatic ends up with a non-trivial ctor.
The ctor is not constexpr, so clang ends up emitting a dynamic
initializer, even though it simply does zero initialization. To make it
constexpr, we must initialize all fields of the ManagedStatic.

However, while the constructor that takes a pointer is marked constexpr,
clang says it does not evaluate to a constant because it contains a cast
from a pointer to an integer. I filed this as:
https://developercommunity.visualstudio.com/content/problem/545566/stdatomic-value-constructor-is-not-actually-conste.html

Once we do that, we can add back the
LLVM_REQUIRE_CONSTANT_INITIALIZATION marker, and so far as I'm aware it
compiles successfully on all supported targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359135 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd optional arg to profile count getters to filter
Xinliang David Li [Wed, 24 Apr 2019 19:51:16 +0000 (19:51 +0000)]
Add optional arg to profile count getters to filter
synthetic profile count.

Differential Revision: http://reviews.llvm.org/D61025

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359131 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Prevent folding a load into an AND if that AND is really a ZEXT_INREG that...
Craig Topper [Wed, 24 Apr 2019 19:28:38 +0000 (19:28 +0000)]
[X86] Prevent folding a load into an AND if that AND is really a ZEXT_INREG that should use movzx.

This can save a 32-bit immediate move.

We would shrink the load and fold it if it was non-volatile, but that's trickier to check for.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359129 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agollvm-cvtres: Remove a default argument. No behavior change.
Nico Weber [Wed, 24 Apr 2019 19:13:38 +0000 (19:13 +0000)]
llvm-cvtres: Remove a default argument. No behavior change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359128 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert using fcopyfile(3) to implement sys::fs::copy_file(Twine, int) on macOS
Adrian Prantl [Wed, 24 Apr 2019 19:08:43 +0000 (19:08 +0000)]
Revert using fcopyfile(3) to implement sys::fs::copy_file(Twine, int) on macOS

It turns out that I mesread the man page and fcopyfile(3) does not
actually support COPYFILE_CLONE for files.

<rdar://problem/50148757>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359127 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoDebugInfo: Emit only declarations (not whole definitions) of non-unit user defined...
David Blaikie [Wed, 24 Apr 2019 18:09:44 +0000 (18:09 +0000)]
DebugInfo: Emit only declarations (not whole definitions) of non-unit user defined types into type units

While this doesn't come up in reasonable cases currently (the only user
defined types not in type units are ones without linkage - which makes
for near-ODR violations, because it'd be a type with linkage referencing
a type without linkage - such a type can't be validly defined in more
than one TU, so arguably it shouldn't be in a type unit to begin with -
but it's a convenient way to demonstrate an issue that will become more
revalent with homed modular debug info type definitions - which also
don't need to be in type units but more legitimately so).

Precursor to the Clang change to de-type-unit (by omitting the
'identifier') types homed due to strong linkage vtables. (making that
change without this one would lead to major type duplication in type
units)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359122 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Remove dead nodes left after ReplaceAllUsesWith calls during address matching
Craig Topper [Wed, 24 Apr 2019 18:02:07 +0000 (18:02 +0000)]
[X86] Remove dead nodes left after ReplaceAllUsesWith calls during address matching

ReplaceAllUsesWith doesn't remove the node that was replaced. So its left around in the graph messing up use counts on other nodes.

One thing to note, is that this isn't valid if the node being deleted is the root node of an LEA match that gets rejected. In that case the node needs to stay alive because the isel table walking code would still have a reference to it that its going to try to match next. I don't think that's the case here though because the nodes being deleted here should be "and", "srl", and "zero_extend" none of which can be the root node of an LEA match.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359121 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] gfx1010 sgpr register changes
Stanislav Mekhanoshin [Wed, 24 Apr 2019 17:28:30 +0000 (17:28 +0000)]
[AMDGPU] gfx1010 sgpr register changes

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359117 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Add tests for bitcasting vXi1 bool vectors to non-simple types.
Simon Pilgrim [Wed, 24 Apr 2019 17:25:45 +0000 (17:25 +0000)]
[X86][SSE] Add tests for bitcasting vXi1 bool vectors to non-simple types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359116 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Add support for passing arguments to jit-linked code.
Lang Hames [Wed, 24 Apr 2019 17:23:05 +0000 (17:23 +0000)]
[JITLink] Add support for passing arguments to jit-linked code.

The --args option can now be used to pass arguments to code linked with
llvm-jitlink. E.g.

$ llvm-jitlink file1.o file2.o --args a b c

is equivalent to:

$ ld -o program file1.o file2.o
$ ./program a b c

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359115 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LLVM-C] Deprecate the LLVMValueRef-returning metadata creation functions
Robert Widmann [Wed, 24 Apr 2019 17:05:08 +0000 (17:05 +0000)]
[LLVM-C] Deprecate the LLVMValueRef-returning metadata creation functions

Summary: There is still some value in using these functions while the remaining LLVMValueRef-based accessors are still around, but LLVMMDNodeInContext in particular has some wonky semantics that make it worth replacing outright.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359114 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] Add gfx1010 target definitions
Stanislav Mekhanoshin [Wed, 24 Apr 2019 17:03:15 +0000 (17:03 +0000)]
[AMDGPU] Add gfx1010 target definitions

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359113 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine][X86] Use generic expansion of PACKSS/PACKUS for constant folding. NFCI.
Simon Pilgrim [Wed, 24 Apr 2019 16:53:17 +0000 (16:53 +0000)]
[InstCombine][X86] Use generic expansion of PACKSS/PACKUS for constant folding. NFCI.

This patch rewrites the existing PACKSS/PACKUS constant folding code to expand as a generic expansion.

This is a first NFCI step toward expanding PACKSS/PACKUS intrinsics which are acting as non-saturating truncations (although technically the expansion could be used in all cases - but we'll probably want to be conservative).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359111 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[llvm-objdump] errorToErrorCode+message -> toString"
JF Bastien [Wed, 24 Apr 2019 16:49:30 +0000 (16:49 +0000)]
Revert "[llvm-objdump] errorToErrorCode+message -> toString"

Revert r359100

It breaks llvm/test/Object/elf-invalid-phdr.test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359110 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agollvm-undname: Fix assert-on->4GiB-string-literal, found by oss-fuzz
Nico Weber [Wed, 24 Apr 2019 16:09:38 +0000 (16:09 +0000)]
llvm-undname: Fix assert-on->4GiB-string-literal, found by oss-fuzz

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359109 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Refer to FDE's CIE (not the most recent CIE) when parsing eh-frame.
Lang Hames [Wed, 24 Apr 2019 15:15:55 +0000 (15:15 +0000)]
[JITLink] Refer to FDE's CIE (not the most recent CIE) when parsing eh-frame.

Frame Descriptor Entries (FDEs) have a pointer back to a Common Information
Entry (CIE) that describes how the rest FDE should be parsed. JITLink had been
assuming that FDEs always referred to the most recent CIE encountered, but the
spec allows them to point back to any previously encountered CIE. This patch
fixes JITLink to look up the correct CIE for the FDE.

The testcase is a MachO binary with an FDE that refers to a CIE that is not the
one immediately proceeding it (the layout can be viewed wit
'dwarfdump --eh-frame <testcase>'. This test case had to be a binary as llvm-mc
now sorts FDEs (as of r356216) to ensure FDEs *do* point to the most recent CIE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359105 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objdump] Delete redundant check
Fangrui Song [Wed, 24 Apr 2019 15:09:23 +0000 (15:09 +0000)]
[llvm-objdump] Delete redundant check

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359102 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[obj2yamp] - Simplify and cleanup the code in ELFDumper<ELFT>::dumpGroup a bit. NFC.
George Rimar [Wed, 24 Apr 2019 15:03:53 +0000 (15:03 +0000)]
[obj2yamp] - Simplify and cleanup the code in ELFDumper<ELFT>::dumpGroup a bit. NFC.

This makes the variables naming to match LLVM style,
simplifies the code used to extract the group members,
simplifies the loop and reorders the code around a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359101 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objdump] errorToErrorCode+message -> toString
Fangrui Song [Wed, 24 Apr 2019 15:03:46 +0000 (15:03 +0000)]
[llvm-objdump] errorToErrorCode+message -> toString

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359100 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU][MC] Parser cleanup and refactoring
Dmitry Preobrazhensky [Wed, 24 Apr 2019 14:06:15 +0000 (14:06 +0000)]
[AMDGPU][MC] Parser cleanup and refactoring

Reviewers: artem.tamazov, arsenm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359096 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] make sure horizontal op and broadcast types match to simplify (PR41414)
Sanjay Patel [Wed, 24 Apr 2019 14:05:08 +0000 (14:05 +0000)]
[x86] make sure horizontal op and broadcast types match to simplify (PR41414)

If the types don't match, we can't just remove the shuffle.
There may be some other opportunity for optimization here,
but this should prevent the crashing seen in:
https://bugs.llvm.org/show_bug.cgi?id=41414

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359095 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LLVM-C] Use dyn_cast instead of unwrap in LLVMGetDebugLoc functions
whitequark [Wed, 24 Apr 2019 13:30:03 +0000 (13:30 +0000)]
[LLVM-C] Use dyn_cast instead of unwrap in LLVMGetDebugLoc functions

Summary:
The `unwrap<Type>` calls can assert with:
```
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast
```
so replace them with `dyn_cast`.

Reviewers: whitequark, abdulras, hiraditya, compnerd

Reviewed By: whitequark

Subscribers: llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359093 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[yaml2obj] Replace num_zeros with write_zeros
Fangrui Song [Wed, 24 Apr 2019 13:23:15 +0000 (13:23 +0000)]
[yaml2obj] Replace num_zeros with write_zeros

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359091 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[yaml2elf] - Replace a loop with write_zeros(). NFC.
George Rimar [Wed, 24 Apr 2019 13:02:15 +0000 (13:02 +0000)]
[yaml2elf] - Replace a loop with write_zeros(). NFC.

And apply clang-format to the method changed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359090 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add shouldFoldConstantShiftPairToMask override placeholder. NFCI.
Simon Pilgrim [Wed, 24 Apr 2019 12:34:08 +0000 (12:34 +0000)]
[X86] Add shouldFoldConstantShiftPairToMask override placeholder. NFCI.

Prep work toward fixing PR40758

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359088 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoLet llvm-cvtres (and lld-link) report duplicate resources
Nico Weber [Wed, 24 Apr 2019 11:42:59 +0000 (11:42 +0000)]
Let llvm-cvtres (and lld-link) report duplicate resources

If two .res files contain the same resource, cvtres.exe (and hence
link.exe) reject the input with this message:

    CVTRES : fatal error CVT1100: duplicate resource.  type:STRING, name:101, language:0x0409
    LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt

llvm-cvtres (and lld-link) used to silently pick one of the duplicate
resources instead. This patch makes them report an error as well.
We slightly improve on cvtres by printing the name of two .res files
containing duplicate entries as well.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359083 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Add masked bit test cases for PR26697
Simon Pilgrim [Wed, 24 Apr 2019 10:34:15 +0000 (10:34 +0000)]
[X86][SSE] Add masked bit test cases for PR26697

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359082 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd "const" in GetUnderlyingObjects. NFC
Bjorn Pettersson [Wed, 24 Apr 2019 06:55:50 +0000 (06:55 +0000)]
Add "const" in GetUnderlyingObjects. NFC

Summary:
Both the input Value pointer and the returned Value
pointers in GetUnderlyingObjects are now declared as
const.

It turned out that all current (in-tree) uses of
GetUnderlyingObjects were trivial to update, being
satisfied with have those Value pointers declared
as const. Actually, in the past several of the users
had to use const_cast, just because of ValueTracking
not providing a version of GetUnderlyingObjects with
"const" Value pointers. With this patch we get rid
of those const casts.

Reviewers: hfinkel, materi, jkorous

Reviewed By: jkorous

Subscribers: dexonsmith, jkorous, jholewinski, sdardis, eraman, hiraditya, jrtc27, atanasyan, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359072 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Mips][CodeGen] Remove MachineFunction::setSubtarget. Change Mips to just copy the...
Craig Topper [Wed, 24 Apr 2019 06:48:31 +0000 (06:48 +0000)]
[Mips][CodeGen] Remove MachineFunction::setSubtarget. Change Mips to just copy the subtarget from the MachineFunction instead of recalculating it.

Summary:
The MachineFunction should have been created with the correct subtarget. As
long as there is no way to change it, MipsTargetMachine can just capture it
directly from the MachineFunction without calling getSubtargetImpl again.

While there, const correct the Subtarget pointer to avoid a const_cast.

I believe the Mips16Subtarget and NoMips16Subtarget members are never used, but
I'll leave there removal for a separate patch.

Reviewers: echristo, atanasyan

Reviewed By: atanasyan

Subscribers: sdardis, arichardson, hiraditya, jrtc27, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359071 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CommandLine] Provide parser<unsigned long> instantiation to allow cl::opt<uint64_t...
Fangrui Song [Wed, 24 Apr 2019 02:40:20 +0000 (02:40 +0000)]
[CommandLine] Provide parser<unsigned long> instantiation to allow cl::opt<uint64_t> on LP64 platforms

Summary:
And migrate opt<unsigned long long> to opt<uint64_t>

Fixes PR19665

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359068 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agollvm-cvtres: Accept /? as help flag, like cvtres.exe
Nico Weber [Wed, 24 Apr 2019 02:11:24 +0000 (02:11 +0000)]
llvm-cvtres: Accept /? as help flag, like cvtres.exe

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359064 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r359050 more
Nico Weber [Wed, 24 Apr 2019 00:59:24 +0000 (00:59 +0000)]
gn build: Merge r359050 more

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359058 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r359050
Nico Weber [Wed, 24 Apr 2019 00:44:14 +0000 (00:44 +0000)]
gn build: Merge r359050

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359056 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert [AliasAnalysis] AAResults preserves AAManager.
Alina Sbirlea [Wed, 24 Apr 2019 00:28:29 +0000 (00:28 +0000)]
Revert [AliasAnalysis] AAResults preserves AAManager.

Triggers use-after-free.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359055 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Remarks] Fix documentation indentation
Francis Visoiu Mistrih [Wed, 24 Apr 2019 00:27:59 +0000 (00:27 +0000)]
[Remarks] Fix documentation indentation

Fix the documentation bot:

http://lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/30450/steps/docs-llvm-html/logs/stdio

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359053 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Remarks] Add string deduplication using a string table
Francis Visoiu Mistrih [Wed, 24 Apr 2019 00:06:24 +0000 (00:06 +0000)]
[Remarks] Add string deduplication using a string table

* Add support for uniquing strings in the remark streamer and emitting the string table in the remarks section.

* Add parsing support for the string table in the RemarkParser.

From this remark:

```
--- !Missed
Pass:     inline
Name:     NoDefinition
DebugLoc: { File: 'test-suite/SingleSource/UnitTests/2002-04-17-PrintfChar.c',
            Line: 7, Column: 3 }
Function: printArgsNoRet
Args:
  - Callee:   printf
  - String:   ' will not be inlined into '
  - Caller:   printArgsNoRet
    DebugLoc: { File: 'test-suite/SingleSource/UnitTests/2002-04-17-PrintfChar.c',
                Line: 6, Column: 0 }
  - String:   ' because its definition is unavailable'
...
```

to:

```
--- !Missed
Pass: 0
Name: 1
DebugLoc: { File: 3, Line: 7, Column: 3 }
Function: 2
Args:
  - Callee:   4
  - String:   5
  - Caller:   2
    DebugLoc: { File: 3, Line: 6, Column: 0 }
  - String:   6
...
```

And the string table in the .remarks/__remarks section containing:

```
inline\0NoDefinition\0printArgsNoRet\0
test-suite/SingleSource/UnitTests/2002-04-17-PrintfChar.c\0printf\0
will not be inlined into \0 because its definition is unavailable\0
```

This is mostly supposed to be used for testing purposes, but it gives us
a 2x reduction in the remark size, and is an incremental change for the
updates to the remarks file format.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359050 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Lint] Permit aliasing noalias readonly arguments
Josh Stone [Tue, 23 Apr 2019 23:43:47 +0000 (23:43 +0000)]
[Lint] Permit aliasing noalias readonly arguments

Summary:
If two arguments are both readonly, then they have no memory dependency
that would violate noalias, even if they do actually overlap.

Reviewers: hfinkel, efriedma

Reviewed By: efriedma

Subscribers: efriedma, hiraditya, llvm-commits, tstellar

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359047 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][GlobalISel] Select G_INTRINSIC_ROUND
Jessica Paquette [Tue, 23 Apr 2019 23:03:03 +0000 (23:03 +0000)]
[AArch64][GlobalISel] Select G_INTRINSIC_ROUND

Add selection support for G_INTRINSIC_ROUND, add a selection test, and add
check lines to arm64-vfloatintrinsics.ll and f16-instructions.ll.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359046 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][GlobalISel] Mark G_INTRINSIC_ROUND as a pre-isel floating point opcode
Jessica Paquette [Tue, 23 Apr 2019 22:47:00 +0000 (22:47 +0000)]
[AArch64][GlobalISel] Mark G_INTRINSIC_ROUND as a pre-isel floating point opcode

Add G_INTRINSIC_ROUND to isPreISelGenericFloatingPointOpcode to ensure that its
input and output are assigned the correct register bank.

Add a regbankselect test to verify that we get what we expect here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359044 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoThe error message for mismatched value sites is very cryptic.
Dmitry Mikulin [Tue, 23 Apr 2019 22:26:55 +0000 (22:26 +0000)]
The error message for mismatched value sites is very cryptic.
Make it more readable for an average user.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359043 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CMake] Use add_dependencies in add_llvm_install_targets
Alex Langford [Tue, 23 Apr 2019 21:59:07 +0000 (21:59 +0000)]
[CMake] Use add_dependencies in add_llvm_install_targets

Summary:
The CMake documentation says that the `DEPENDS` field of
add_custom_target is for files and output of custom commands. Adding a
dependency on a target should be done with `add_dependency`.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359042 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CGP] Look through bitcasts when duplicating returns for tail calls
Francis Visoiu Mistrih [Tue, 23 Apr 2019 21:57:46 +0000 (21:57 +0000)]
[CGP] Look through bitcasts when duplicating returns for tail calls

The simple case of:

```
int *callee();
void *caller(void *a) {
  if (a == NULL)
    return callee();
  return a;
}
```

would generate a regular call instead of a tail call because we don't
look through the bitcast of the call to `callee` when duplicating the
return blocks.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359041 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add codegen prepare test exercising a bitcast + tail call
Francis Visoiu Mistrih [Tue, 23 Apr 2019 21:57:43 +0000 (21:57 +0000)]
[X86] Add codegen prepare test exercising a bitcast + tail call

In preparation of https://reviews.llvm.org/D60837, add this test where
we don't perform a tail call because we don't look through a bitcast.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359040 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Emit br_table for most switch instructions
Heejin Ahn [Tue, 23 Apr 2019 21:30:30 +0000 (21:30 +0000)]
[WebAssembly] Emit br_table for most switch instructions

Summary:
Always convert switches to br_tables unless there is only one case,
which is equivalent to a simple branch. This reduces code size for wasm,
and we defer possible jump table optimizations to the VM.
Addresses PR41502.

Reviewers: kripken, sunfish

Subscribers: dschuff, sbc100, jgravelle-google, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359038 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Make LBB markers not affected by test order
Heejin Ahn [Tue, 23 Apr 2019 21:17:03 +0000 (21:17 +0000)]
[WebAssembly] Make LBB markers not affected by test order

Summary:
This way we can change the order of tests or delete some of them without
affecting tests for other functions.

Reviewers: tlively

Subscribers: sunfish, dschuff, sbc100, jgravelle-google, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359036 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[MS] Emit S_HEAPALLOCSITE debug info" because of ToTWin64(db)
Amy Huang [Tue, 23 Apr 2019 21:12:58 +0000 (21:12 +0000)]
Revert "[MS] Emit S_HEAPALLOCSITE debug info" because of ToTWin64(db)
buildbot failure.

This reverts commit d07d6d617713bececf57f3547434dd52f0f13f9e and
c774f687b6880484a126ed3e3d737e74c926f0ae.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359034 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][GlobalISel] Legalize G_INTRINSIC_ROUND
Jessica Paquette [Tue, 23 Apr 2019 21:11:57 +0000 (21:11 +0000)]
[AArch64][GlobalISel] Legalize G_INTRINSIC_ROUND

Add it to the same rule as G_FCEIL etc. Add a legalizer test, and add a missing
switch case to AArch64LegalizerInfo.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359033 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MemorySSA] LCSSA preserves MemorySSA.
Alina Sbirlea [Tue, 23 Apr 2019 20:59:44 +0000 (20:59 +0000)]
[MemorySSA] LCSSA preserves MemorySSA.

Summary:
Enabling MemorySSA in the old pass manager leads to MemorySSA being run
twice due to the fact that LCSSA and LoopSimplify do not preserve
MemorySSA. This is the first step to address that: target LCSSA.

LCSSA does not make any changes that invalidate MemorySSA, so it
preserves it by design. It must preserve AA as well, for this to hold.

After this patch, MemorySSA is still run twice in the old pass manager.
Step two follows: target LoopSimplify.

Subscribers: mehdi_amini, jlebar, Prazek, llvm-commits, george.burgess.iv, chandlerc

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359032 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Tue, 23 Apr 2019 20:52:00 +0000 (20:52 +0000)]
[X86] Autogenerate complete checks. NFC

Prep for D60993

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359031 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][GlobalISel] Actually select G_INTRINSIC_TRUNC
Jessica Paquette [Tue, 23 Apr 2019 20:46:19 +0000 (20:46 +0000)]
[AArch64][GlobalISel] Actually select G_INTRINSIC_TRUNC

Apparently FileCheck wasn't actually matching the fallback check lines in
arm64-vfloatintrinsics.ll properly. So, there were selection fallbacks for
G_INTRINSIC_TRUNC there.

Actually hook it up into AArch64InstructionSelector.cpp and write a proper
selection test.

I guess I'll figure out the FileCheck magic to make the fallback checks work
properly in arm64-vfloatintrinsics.ll.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359030 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ObjC][ARC] Check the basic block size before calling
Akira Hatanaka [Tue, 23 Apr 2019 19:49:03 +0000 (19:49 +0000)]
[ObjC][ARC] Check the basic block size before calling
DominatorTree::dominate.

ARC contract pass has an optimization that replaces the uses of the
argument of an ObjC runtime function call with the call result.

For example:

; Before optimization
%1 = tail call i8* @foo1()
%2 = tail call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* %1)
store i8* %1, i8** @g0, align 8

; After optimization
%1 = tail call i8* @foo1()
%2 = tail call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* %1)
store i8* %2, i8** @g0, align 8 // %1 is replaced with %2

Before replacing the argument use, DominatorTree::dominate is called to
determine whether the user instruction is dominated by the ObjC runtime
function call instruction. The call to DominatorTree::dominate can be
expensive if the two instructions belong to the same basic block and the
size of the basic block is large. This patch checks the basic block size
and just bails out if the size exceeds the limit set by command line
option "arc-contract-max-bb-size".

rdar://problem/49477063

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359027 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoReapply: "DebugInfo: Emit only one kind of accelerated access/name table""
David Blaikie [Tue, 23 Apr 2019 19:00:45 +0000 (19:00 +0000)]
Reapply: "DebugInfo: Emit only one kind of accelerated access/name table""

Originally committed in r358931
Reverted in r358997

Seems this change made Apple accelerator tables miss names (because
names started respecting the CU NameTableKind GNU & assuming that
shouldn't produce accelerated names too), which is never correct (apple
accelerator tables don't have separators or CU lists - if present, they
must describe all names in all CUs).

Original Description:
Currently to opt in to debug_names in DWARFv5, the IR must contain
'nameTableKind: Default' which also enables debug_pubnames.

Instead, only allow one of {debug_names, apple_names, debug_pubnames,
debug_gnu_pubnames}.

nameTableKind: Default gives debug_names in DWARFv5 and greater,
debug_pubnames in v4 and earlier - and apple_names when tuning for lldb
on MachO.
nameTableKind: GNU always gives gnu_pubnames

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359026 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ThinLTO] Pass down opt level to LTO backend and handle -O0 LTO in new PM
Teresa Johnson [Tue, 23 Apr 2019 18:56:19 +0000 (18:56 +0000)]
[ThinLTO] Pass down opt level to LTO backend and handle -O0 LTO in new PM

Summary:
The opt level was not being passed down to the ThinLTO backend when
invoked via clang (for distributed ThinLTO).

This exposed an issue where the new PM was asserting if the Thin or
regular LTO backend pipelines were invoked with -O0 (not a new issue,
could be provoked by invoking in-process *LTO backends via linker using
new PM and -O0). Fix this similar to the old PM where -O0 only does the
necessary lowering of type metadata (WPD and LowerTypeTest passes) and
then quits, rather than asserting.

Reviewers: xur

Subscribers: mehdi_amini, inglorion, eraman, hiraditya, steven_wu, dexonsmith, cfe-commits, llvm-commits, pcc

Tags: #clang, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359025 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agollvm-cvtres: Split addChild(ID) into two functions
Nico Weber [Tue, 23 Apr 2019 18:46:53 +0000 (18:46 +0000)]
llvm-cvtres: Split addChild(ID) into two functions

Before, there was an IsData parameter. Now, there are two different
functions for data nodes and ID nodes. No behavior change, needed for a
follow-up change to make two data nodes (but not two ID nodes) with the
same ID an error.

For consistency, rename another addChild() overload to addNameChild().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359024 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][GlobalISel] Teach regbankselect about G_INTRINSIC_TRUNC
Jessica Paquette [Tue, 23 Apr 2019 18:20:47 +0000 (18:20 +0000)]
[AArch64][GlobalISel] Teach regbankselect about G_INTRINSIC_TRUNC

Add it to isPreISelGenericFloatingPointOpcode, and add a regbankselect test.

Update arm64-vfloatintrinsics.ll now that we can select it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359022 91177308-0d34-0410-b5e6-96231b3b80d8