platform/upstream/llvm.git
5 years agoFix Wimplicit-fallthrough warning introduced in rL357466. NFCI.
Simon Pilgrim [Tue, 2 Apr 2019 11:25:38 +0000 (11:25 +0000)]
Fix Wimplicit-fallthrough warning introduced in rL357466. NFCI.

llvm-svn: 357467

5 years ago[PowerPC] Fix issue with inline asm - soft float mode
Strahinja Petrovic [Tue, 2 Apr 2019 11:00:09 +0000 (11:00 +0000)]
[PowerPC] Fix issue with inline asm - soft float mode

This patch prevents floating point register
constraints in soft float mode.

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

llvm-svn: 357466

5 years ago[X86][AVX] Add test case showing failure to fold broadcast load if its also used...
Simon Pilgrim [Tue, 2 Apr 2019 10:31:00 +0000 (10:31 +0000)]
[X86][AVX] Add test case showing failure to fold broadcast load if its also used as a scalar

llvm-svn: 357465

5 years agoMake operator==s consistent between c++ and python APIs
Pavel Labath [Tue, 2 Apr 2019 10:18:46 +0000 (10:18 +0000)]
Make operator==s consistent between c++ and python APIs

Summary:
modify-python-lldb.py had code to insert python equality operators to
some classes. Some of those classes already had c++ equality operators,
and some didn't.

This makes the situation more consistent, by removing all equality
handilng from modify-python-lldb. Instead, I add c++ operators to
classes where they were missing, and expose them in the swig interface
files so that they are available to python too.

The only tricky case was the SBAddress class, which had an operator==
defined as a free function, which is not handled by swig. This function
cannot be removed without breaking ABI, and we cannot add an extra
operator== member, as that would make equality comparisons ambiguous.
For this class, I define a python __eq__ function by hand and have it
delegate to the operator!=, which I have defined as a member function.

This isn't fully NFC, as the semantics of some equality functions in
python changes slightly, but I believe it changes for the better (e.g.,
previously SBBreakpoint.__eq__ would consider two breakpoints with the
same ID as equal, even if they belonged to different targets; now they
are only equal if they belong to the same target).

Reviewers: jingham, clayborg, zturner

Subscribers: jdoerfert, JDevlieghere, lldb-commits

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

llvm-svn: 357463

5 years agoFix tests after r357452
Hans Wennborg [Tue, 2 Apr 2019 10:06:39 +0000 (10:06 +0000)]
Fix tests after r357452

llvm-svn: 357462

5 years agoFix compiler warning, remove extra ";" [NFC]
Mikael Holmen [Tue, 2 Apr 2019 10:01:09 +0000 (10:01 +0000)]
Fix compiler warning, remove extra ";" [NFC]

At least gcc 7.4 complained with
../tools/clang/lib/StaticAnalyzer/Checkers/Taint.cpp:26:53: warning: extra ';' [-Wpedantic]
                                        TaintTagType);
                                                     ^

llvm-svn: 357461

5 years agoEnforce StackID definition in PEI
Sander de Smalen [Tue, 2 Apr 2019 09:46:52 +0000 (09:46 +0000)]
Enforce StackID definition in PEI

There are various places in LLVM where the definition of StackID is not
properly honoured, for example in PEI where objects with a StackID > 0 are
allocated on the default stack (StackID0). This patch enforces that PEI
only considers allocating objects to StackID 0.

Reviewers: arsenm, thegameg, MatzeB

Reviewed By: arsenm

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

llvm-svn: 357460

5 years agoFix flakyness in TestCommandScriptImmediateOutput
Pavel Labath [Tue, 2 Apr 2019 09:45:40 +0000 (09:45 +0000)]
Fix flakyness in TestCommandScriptImmediateOutput

I'm not sure why this surfaced at this particular point, but
TestCommandScriptImmediateOutput (a pexpect test) had a synchronization
issue, where the (lldb) promts it was expecting were getting out of
sync. This happened for two reasons:
- it did not expect the initial (lldb) prompt we print at startup
- launchArgs() returned None, which resulted in an extra "target create
  None" command being issued to lldb (and an extra unhandled prompt
  being printed).

Resolving these two issues seems to fix (or at least, improve) the test.

llvm-svn: 357459

5 years ago[Internalize] Replace uses of std::set with DenseSet
Fangrui Song [Tue, 2 Apr 2019 09:25:31 +0000 (09:25 +0000)]
[Internalize] Replace uses of std::set with DenseSet

This makes it faster and saves 104 bytes for my build.

llvm-svn: 357458

5 years ago[Internalize] Replace fstream with line_iterator for -internalize-public-api-file
Fangrui Song [Tue, 2 Apr 2019 09:11:18 +0000 (09:11 +0000)]
[Internalize] Replace fstream with line_iterator for -internalize-public-api-file

This makes my libLLVMipo.so.9svn smaller by 360 bytes.

llvm-svn: 357457

5 years agoFix llvm_unreachable in TestWriteMemory
Pavel Labath [Tue, 2 Apr 2019 08:56:22 +0000 (08:56 +0000)]
Fix llvm_unreachable in TestWriteMemory

The test was hitting llvm_unreachable in
Platform::GetSoftwareBreakpointTrapOpcode because it could not figure
out the architecture of the process. Since that is not the purpose of
the test, I change the test to use an explicit
CreateTargetWithFileAndTargetTriple command to specify it.

llvm-svn: 357456

5 years agoPDBFPO: Refactor register reference resolution
Pavel Labath [Tue, 2 Apr 2019 08:44:24 +0000 (08:44 +0000)]
PDBFPO: Refactor register reference resolution

Summary:
This refactors moves the register name->number resolution out of the
FPOProgramNodeRegisterRef class. Instead I create a special
FPOProgramNodeSymbol class, which holds unresolved symbols, and move the
resolution into the ResolveRegisterRefs visitor.

The background here is that I'd like to use this code for Breakpad
unwind info, which uses similar syntax to describe unwind info. For
example, a simple breakpad unwind program might look like:
    .cfa: $esp 8 + $ebp: .cfa 8 - ^

To be able to do this, I need to be able to customize register
resolving, as that is presently hardcoded to use codeview register
names, but breakpad supports a lot more architectures with different
register names. Moving the resolution into a separate class will allow
each user to use a different resolution logic.

Reviewers: aleksandr.urakov, zturner, amccarth

Subscribers: jdoerfert, lldb-commits

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

llvm-svn: 357455

5 years ago[clangd] Use capacity() instead of size() in RefSlab::bytes()
Ilya Biryukov [Tue, 2 Apr 2019 08:24:37 +0000 (08:24 +0000)]
[clangd] Use capacity() instead of size() in RefSlab::bytes()

Patch by Nathan Ridge.

Reviewers: gribozavr

Reviewed By: gribozavr

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 357454

5 years agoFix a number of bugs in __val_expr's subset operator[].
Eric Fiselier [Tue, 2 Apr 2019 08:05:23 +0000 (08:05 +0000)]
Fix a number of bugs in __val_expr's subset operator[].

The current definitions were entirely broken. They didn't call any
existing constructor and the forgot to friend the expression types they
were trying to construct.

llvm-svn: 357453

5 years agoSimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used...
Hans Wennborg [Tue, 2 Apr 2019 08:01:38 +0000 (08:01 +0000)]
SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)

The code was previously checking that candidates for sinking had exactly
one use or were a store instruction (which can't have uses). This meant
we could sink call instructions only if they had a use.

That limitation seemed a bit arbitrary, so this patch changes it to
"instruction has zero or one use" which seems more natural and removes
the need to special-case stores.

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

llvm-svn: 357452

5 years agoSimplify TestGdbRemoteRegisterState
Pavel Labath [Tue, 2 Apr 2019 07:47:38 +0000 (07:47 +0000)]
Simplify TestGdbRemoteRegisterState

While reviewing D56233 it became clear to me that this test can be
simplified. There's no need for a start-stop cycle in the inferior -- we
can start fiddling with its registers as soon as it is launched.

llvm-svn: 357451

5 years agoar_to_bc.sh: replace readlink -f with custom relative path resolution
Fangrui Song [Tue, 2 Apr 2019 04:58:29 +0000 (04:58 +0000)]
ar_to_bc.sh: replace readlink -f with custom relative path resolution

llvm-ar is a crunchgen-style executable dispatching to dlltool,ranlib,lib,ar based on argv[0].
In our content-addressable storage, readlink -f resolves paths to some
digest and thus lost the original "llvm-ar" filename.

Replace it with a custom path resolution to fix the problem.

llvm-svn: 357450

5 years ago[compiler-rt][test] Make instrprof-set-dir-mode test tolerant of group ID
Matt Davis [Tue, 2 Apr 2019 03:24:12 +0000 (03:24 +0000)]
[compiler-rt][test] Make instrprof-set-dir-mode test tolerant of group ID

Patch from 'troyj':
Hi, I ran into a problem with this test when the source was located in
certain directories. The mkdir(2) man page states that the set-group-ID
bit is inherited from the parent directory, but this test was written in
such a way that it assumes the bit is unset. Whether that assumption is
true depends on where the checkout lives, which leads to some people
being able to reproduce the problem whereas others cannot. I think the
correct fix is to exclude the bit from the check.

Making probinson a reviewer since they reviewed the original test.

Patch landed for troyj, thanks!

Differential Revision: D53832

llvm-svn: 357449

5 years ago[LoopPredication] Simplify widenable condition handling [NFC]
Philip Reames [Tue, 2 Apr 2019 02:42:57 +0000 (02:42 +0000)]
[LoopPredication] Simplify widenable condition handling [NFC]

The code doesn't actually need any of the information about the widenable condition at this level.  The only thing we need is to ensure the WC call is the last thing anded in, and even that is a quirk we should really look to remove.

llvm-svn: 357448

5 years agoAdd an optional list of blocks to avoid when looking for a path in isPotentiallyReach...
Nick Lewycky [Tue, 2 Apr 2019 01:05:48 +0000 (01:05 +0000)]
Add an optional list of blocks to avoid when looking for a path in isPotentiallyReachable.

The leads to some ambiguous overloads, so update three callers.

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

llvm-svn: 357447

5 years ago[X86] Add test cases to fixup-lea.ll for optsize and no size optimization. Add +...
Craig Topper [Tue, 2 Apr 2019 00:54:22 +0000 (00:54 +0000)]
[X86] Add test cases to fixup-lea.ll for optsize and no size optimization. Add +/-slow-incdec command lines

We only form inc/dec in FixupLEAs under minsize today, but all other locations in the compiler for inc/dec with optsize.

llvm-svn: 357446

5 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Tue, 2 Apr 2019 00:54:15 +0000 (00:54 +0000)]
[X86] Autogenerate complete checks. NFC

llvm-svn: 357445

5 years ago[X86] Use unsigned type for opcodes throughout X86FixupLEAs.
Craig Topper [Tue, 2 Apr 2019 00:50:58 +0000 (00:50 +0000)]
[X86] Use unsigned type for opcodes throughout X86FixupLEAs.

All of the interfaces related to opcode in MachineInstr and MCInstrInfo refer to opcodes as unsigned.

llvm-svn: 357444

5 years agoInstSimplify: Add missing case from r357386
Matt Arsenault [Tue, 2 Apr 2019 00:46:19 +0000 (00:46 +0000)]
InstSimplify: Add missing case from r357386

llvm-svn: 357443

5 years ago[AMDGPU] Add more test cases of D59608.
Michael Liao [Tue, 2 Apr 2019 00:36:37 +0000 (00:36 +0000)]
[AMDGPU] Add more test cases of D59608.

Summary: - Add more test cases.

Reviewers: arsenm

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

Tags: #llvm

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

llvm-svn: 357442

5 years agoAMDGPU: Fix test filename
Matt Arsenault [Tue, 2 Apr 2019 00:36:04 +0000 (00:36 +0000)]
AMDGPU: Fix test filename

llvm-svn: 357441

5 years ago[ARM] Optimize expressions like "return x != 0;" for Thumb1.
Eli Friedman [Tue, 2 Apr 2019 00:01:23 +0000 (00:01 +0000)]
[ARM] Optimize expressions like "return x != 0;" for Thumb1.

There's an existing optimization for x != C, but somehow it was missing
a special case for 0.

While I'm here, also cleaned up the code/comments a bit: the second
value produced by the MERGE_VALUES was actually dead, since a CMOV only
produces one result.

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

llvm-svn: 357437

5 years ago[ARM] Don't try to create "push {r12, lr}" in Thumb1 at -Oz.
Eli Friedman [Mon, 1 Apr 2019 23:55:57 +0000 (23:55 +0000)]
[ARM] Don't try to create "push {r12, lr}" in Thumb1 at -Oz.

It's a little tricky to make this issue show up because
prologue/epilogue emission normally likes to push at least two
registers... but it doesn't when lr is force-spilled due to function
length.  Not sure if that really makes sense, but I decided not to touch
it for now.

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

llvm-svn: 357436

5 years ago[LoopPred] Rename a variable to simply a future patch [NFC]
Philip Reames [Mon, 1 Apr 2019 22:39:54 +0000 (22:39 +0000)]
[LoopPred] Rename a variable to simply a future patch [NFC]

llvm-svn: 357433

5 years ago[AArch64][GlobalISe] Select STRQui for stores into v264s instead of scalarizing
Jessica Paquette [Mon, 1 Apr 2019 22:19:13 +0000 (22:19 +0000)]
[AArch64][GlobalISe] Select STRQui for stores into v264s instead of scalarizing

This improves selection for vector stores into v2s64s. Before we just
scalarized them, but we can just use a STRQui instead.

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

llvm-svn: 357432

5 years ago[CMake] Only the Python scirpt interpreter should link against Python.
Jonas Devlieghere [Mon, 1 Apr 2019 22:03:04 +0000 (22:03 +0000)]
[CMake] Only the Python scirpt interpreter should link against Python.

This patch removes spurious links against Python.

llvm-svn: 357431

5 years agoFix clangd unittest _WIN32 ifdef
Reid Kleckner [Mon, 1 Apr 2019 21:16:17 +0000 (21:16 +0000)]
Fix clangd unittest _WIN32 ifdef

WIN32 is not defined, _WIN32 is, use that instead.

llvm-svn: 357429

5 years ago[Process] Use early returns in Process::WriteMemory (NFC)
Jonas Devlieghere [Mon, 1 Apr 2019 20:39:03 +0000 (20:39 +0000)]
[Process] Use early returns in Process::WriteMemory (NFC)

I found the code of Process::WriteMemory particularly hard to follow
when reviewing Ismail's change in D60022. This simplifies the code and
hopefully prevents similar oversights in the future.

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

llvm-svn: 357428

5 years ago[NFC] Remove dead parameter "FreeInLoop", fix some typos and trailing whitespace.
Nick Lewycky [Mon, 1 Apr 2019 20:37:56 +0000 (20:37 +0000)]
[NFC] Remove dead parameter "FreeInLoop", fix some typos and trailing whitespace.

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

llvm-svn: 357427

5 years ago[lldb-vscode] Add logic to handle EOF when reading from lldb-vscode stdout.
Jorge Gorbe Moya [Mon, 1 Apr 2019 20:37:22 +0000 (20:37 +0000)]
[lldb-vscode] Add logic to handle EOF when reading from lldb-vscode stdout.

Summary:
This change prevents the lldb-vscode test harness from hanging up waiting for
new messages when the lldb-vscode subprocess crashes.

Now, when an EOF from the subprocess pipe is detected we enqueue a `None` packet
in the received packets list. Then, during the message processing loop, we can
use this `None` packet to tell apart the case where lldb-vscode has terminated
unexpectedly from the normal situation where no pending messages means blocking
and waiting for more data.

I believe this should be enough to fix the issues with these tests hanging on
multiple platforms. Once this lands, I'll prepare and test a separate change
removing the @skipIfLinux annotations.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 357426

5 years agoNot all blocks are reachable from entry. Don't assume they are.
Nick Lewycky [Mon, 1 Apr 2019 20:03:16 +0000 (20:03 +0000)]
Not all blocks are reachable from entry. Don't assume they are.

Fixes a bug in isPotentiallyReachable, noticed by inspection.

llvm-svn: 357425

5 years ago[API] Add SBReproducer to LLDB.h
Jonas Devlieghere [Mon, 1 Apr 2019 19:56:15 +0000 (19:56 +0000)]
[API] Add SBReproducer to LLDB.h

llvm-svn: 357424

5 years ago[libcxx] Make sure reference_wrapper works with incomplete types
Louis Dionne [Mon, 1 Apr 2019 19:53:44 +0000 (19:53 +0000)]
[libcxx] Make sure reference_wrapper works with incomplete types

Summary: Completes P0357R3, which was merged into the C++20 Working Draft in San Diego.

Reviewers: EricWF, mclow.lists

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 357423

5 years ago[pstl] Mangle the parallel_strict_scan backend function
Louis Dionne [Mon, 1 Apr 2019 19:34:09 +0000 (19:34 +0000)]
[pstl] Mangle the parallel_strict_scan backend function

llvm-svn: 357422

5 years ago[NFC][LLD] Specify namespaces explicity to fix build failure on GCC 5 after r357383
Matthew Voss [Mon, 1 Apr 2019 19:23:56 +0000 (19:23 +0000)]
[NFC][LLD] Specify namespaces explicity to fix build failure on GCC 5 after r357383

llvm-svn: 357421

5 years ago[Process] Fix WriteMemory return value
Med Ismail Bennani [Mon, 1 Apr 2019 19:08:47 +0000 (19:08 +0000)]
[Process] Fix WriteMemory return value

Summary:
In case of a breakpoint site overlapping with the destination address,
the WriteMemory method reported an incorrect memory size.

Instead of returning the right amount of bytes written, it falls through
the scope and returned 0.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Reviewers: jasonmolenda, friss, jingham

Subscribers: JDevlieghere, davide, lldb-commits, #lldb

Tags: #lldb

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

llvm-svn: 357420

5 years ago[X86] Classify the AVX512 rounding control operand as X86::OPERAND_ROUNDING_CONTROL...
Craig Topper [Mon, 1 Apr 2019 19:08:15 +0000 (19:08 +0000)]
[X86] Classify the AVX512 rounding control operand as X86::OPERAND_ROUNDING_CONTROL instead of MCOI::OPERAND_IMMEDIATE. Add an assert on legal values of rounding control in the encoder and remove an explicit mask.

This should allow llvm-exegesis to intelligently constrain the rounding mode.

The mask in the encoder shouldn't be necessary any more. We used to allow codegen to use 8-11 for rounding mode and the assembler would use 0-3 to mean the same thing so we masked here and in the printer. Codegen now matches the assembler and the printer was updated, but I forgot to update the encoder.

llvm-svn: 357419

5 years ago[llvm-objcopy] Add --keep-symbols option
Yi Kong [Mon, 1 Apr 2019 18:12:43 +0000 (18:12 +0000)]
[llvm-objcopy] Add --keep-symbols option

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

llvm-svn: 357418

5 years agoELF: Perform per-section .ARM.exidx processing during combineEhFrameSections(). NFCI.
Peter Collingbourne [Mon, 1 Apr 2019 18:01:18 +0000 (18:01 +0000)]
ELF: Perform per-section .ARM.exidx processing during combineEhFrameSections(). NFCI.

And rename the function to combineEhSections(). This makes the processing
of .ARM.exidx even more similar to .eh_frame and means that we can avoid an
additional loop over InputSections.

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

llvm-svn: 357417

5 years ago[SLP] getVectorElementSize and isTreeTinyAndNotFullyVectorizable are const methods...
Simon Pilgrim [Mon, 1 Apr 2019 17:48:03 +0000 (17:48 +0000)]
[SLP] getVectorElementSize and isTreeTinyAndNotFullyVectorizable are const methods. NFCI.

llvm-svn: 357416

5 years ago[CodeGen] Generate follow-up metadata for loops with more than one transformation.
Michael Kruse [Mon, 1 Apr 2019 17:47:41 +0000 (17:47 +0000)]
[CodeGen] Generate follow-up metadata for loops with more than one transformation.

Before this patch, CGLoop would dump all transformations for a loop into
a single LoopID without encoding any order in which to apply them.
rL348944 added the possibility to encode a transformation order using
followup-attributes.

When a loop has more than one transformation, use the follow-up
attribute define the order in which they are applied. The emitted order
is the defacto order as defined by the current LLVM pass pipeline,
which is:

  LoopFullUnrollPass
  LoopDistributePass
  LoopVectorizePass
  LoopUnrollAndJamPass
  LoopUnrollPass
  MachinePipeliner

This patch should therefore not change the assembly output, assuming
that all explicit transformations can be applied, and no implicit
transformations in-between. In the former case,
WarnMissedTransformationsPass should emit a warning (except for
MachinePipeliner which is not implemented yet). The latter could be
avoided by adding 'llvm.loop.disable_nonforced' attributes.

Because LoopUnrollAndJamPass processes a loop nest, generation of the
MDNode is delayed to after the inner loop metadata have been processed.
A temporary LoopID is therefore used to annotate instructions and
RAUW'ed by the actual LoopID later.

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

llvm-svn: 357415

5 years ago[SLP] getGatherCost and isFullyVectorizableTinyTree are const methods. NFCI.
Simon Pilgrim [Mon, 1 Apr 2019 17:32:46 +0000 (17:32 +0000)]
[SLP] getGatherCost and isFullyVectorizableTinyTree are const methods. NFCI.

llvm-svn: 357414

5 years agoFix PR#41323 'Race condition in steady_clock::now for _LIBCPP_WIN32API'. thanks to...
Marshall Clow [Mon, 1 Apr 2019 17:23:30 +0000 (17:23 +0000)]
Fix PR#41323 'Race condition in steady_clock::now for _LIBCPP_WIN32API'. thanks to Ivan Afanasyev for the report.

llvm-svn: 357413

5 years ago[OPENMP]Allocate clause allocator in target region.
Alexey Bataev [Mon, 1 Apr 2019 16:56:59 +0000 (16:56 +0000)]
[OPENMP]Allocate clause allocator in target region.

According to OpenMP 5.0, 2.11.4 allocate Clause, Restrictions, allocate
clauses that appear on a target construct or on constructs in a target
region must specify an allocator expression unless a requires directive
with the dynamic_allocators clause is present in the same compilation
unit. Patch adds a check for this restriction.

llvm-svn: 357412

5 years ago[libc++] Declare std::tuple_element as struct instead of class
Louis Dionne [Mon, 1 Apr 2019 16:39:34 +0000 (16:39 +0000)]
[libc++] Declare std::tuple_element as struct instead of class

Similarly to https://reviews.llvm.org/rL350972, this revision changes
std::tuple_element from class to struct.

Fixes PR41331.
Thanks to Jan Wilken Dörrie for the patch.

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

llvm-svn: 357411

5 years agoFix PR41130 - 'operator/ of std::chrono::duration and custom type'. Thanks to Zulan...
Marshall Clow [Mon, 1 Apr 2019 16:38:02 +0000 (16:38 +0000)]
Fix PR41130 - 'operator/ of std::chrono::duration and custom type'. Thanks to Zulan for the report, and Howard for the direction of the fix.

llvm-svn: 357410

5 years agoCommit accidentally omitted test case.
Caroline Tice [Mon, 1 Apr 2019 16:29:40 +0000 (16:29 +0000)]
Commit accidentally omitted test case.

This test case was approved as part of
https://reviews.llvm.org/D49434, but was accidentally
omitted from the final commit.

llvm-svn: 357409

5 years ago[LoopPred] Be uniform about proving generated conditions
Philip Reames [Mon, 1 Apr 2019 16:26:08 +0000 (16:26 +0000)]
[LoopPred] Be uniform about proving generated conditions

We'd been optimizing the case where the predicate was obviously true, do the same for the false case.  Mostly just for completeness sake, but also may improve compile time in loops which will exit through the guard.  Such loops are presumed rare in fastpath code, but may be present down untaken paths, so optimizing for them is still useful.

llvm-svn: 357408

5 years ago[NVPTX] Fix the codegen for llvm.round.
Bixia Zheng [Mon, 1 Apr 2019 16:10:26 +0000 (16:10 +0000)]
[NVPTX] Fix the codegen for llvm.round.

Summary:
Previously, we translate llvm.round to PTX cvt.rni, which rounds to the
even interger when the source is equidistant between two integers. This
is not correct as llvm.round should round away from zero. This change
replaces llvm.round with a round away from zero implementation through
target specific custom lowering.

Modify a few affected tests to not check for cvt.rni. Instead, we check
for the use of a few constants used in implementing round. We are also
adding CUDA runnable tests to check for the values produced by
llvm.round to test-suites/External/CUDA.

Reviewers: tra

Subscribers: jholewinski, sanjoy, jlebar, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 357407

5 years ago[LoopPred] Delete the old condition expressions if unused
Philip Reames [Mon, 1 Apr 2019 16:05:15 +0000 (16:05 +0000)]
[LoopPred] Delete the old condition expressions if unused

LoopPredication was replacing the original condition, but leaving the instructions to compute the old conditions around.  This would get cleaned up by other passes of course, but we might as well do it eagerly.  That also makes the test output less confusing.

llvm-svn: 357406

5 years agoAttempt to fix failing buildbot (ppc64le)
Gabor Marton [Mon, 1 Apr 2019 15:48:29 +0000 (15:48 +0000)]
Attempt to fix failing buildbot (ppc64le)

llvm-svn: 357405

5 years ago[Tests] Autogen all the LoopPredication tests
Philip Reames [Mon, 1 Apr 2019 15:35:30 +0000 (15:35 +0000)]
[Tests] Autogen all the LoopPredication tests

I'm about to make some changes to the pass which cause widespread - but uninteresting - test diffs.  Prepare the tests for easy updating.

llvm-svn: 357404

5 years ago[Tests] Add tests for a possible loop predication transform variant
Philip Reames [Mon, 1 Apr 2019 15:32:07 +0000 (15:32 +0000)]
[Tests] Add tests for a possible loop predication transform variant

As highlighted by tests, if one of the operands is loop variant, but guaranteed to have the same value on all iterations, we have a missed oppurtunity.

llvm-svn: 357403

5 years ago[ASTImporter] Convert ODR diagnostics inside ASTImporter implementation
Gabor Marton [Mon, 1 Apr 2019 15:29:55 +0000 (15:29 +0000)]
[ASTImporter] Convert ODR diagnostics inside ASTImporter implementation

Summary:
ASTStructuralEquivalence uses a flag to indicate whether ODR diagnostics
should be considered errors or warnings as module Sema is more strict than
ASTMerge. The implementation of ASTImporter should allso follow
along the same lines.

Reviewers: martong, a.sidorin, shafik, a_sidorin

Reviewed By: shafik, a_sidorin

Subscribers: rnkovacs, martong, dkrupp, Szelethus, cfe-commits

Tags: #clang

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

Patch by Endre Fulop!

llvm-svn: 357402

5 years ago[pstl] Indent preprocessor directives as part of the clang-format rules
Louis Dionne [Mon, 1 Apr 2019 15:21:46 +0000 (15:21 +0000)]
[pstl] Indent preprocessor directives as part of the clang-format rules

Summary:
Indenting preprocessor directives provides a significant gain in
readability. We do it for normal if statements, and it makes sense
to do it for preprocessor ifs too.

Reviewers: rodgert, MikeDvorskiy

Subscribers: jkorous, dexonsmith, jdoerfert, libcxx-commits

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

llvm-svn: 357401

5 years ago[AMDGPU] Pre-allocate WWM registers to reduce VGPR pressure.
Neil Henning [Mon, 1 Apr 2019 15:19:52 +0000 (15:19 +0000)]
[AMDGPU] Pre-allocate WWM registers to reduce VGPR pressure.

This change incorporates an effort by Connor Abbot to change how we deal
with WWM operations potentially trashing valid values in inactive lanes.

Previously, the SIFixWWMLiveness pass would work out which registers
were being trashed within WWM regions, and ensure that the register
allocator did not have any values it was depending on resident in those
registers if the WWM section would trash them. This worked perfectly
well, but would cause sometimes severe register pressure when the WWM
section resided before divergent control flow (or at least that is where
I mostly observed it).

This fix instead runs through the WWM sections and pre allocates some
registers for WWM. It then reserves these registers so that the register
allocator cannot use them. This results in a significant register
saving on some WWM shaders I'm working with (130 -> 104 VGPRs, with just
this change!).

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

llvm-svn: 357400

5 years ago[lldb] [Process/elf-core] Support aarch64 NetBSD core dumps
Michal Gorny [Mon, 1 Apr 2019 15:08:24 +0000 (15:08 +0000)]
[lldb] [Process/elf-core] Support aarch64 NetBSD core dumps

Include support for NetBSD core dumps from evbarm/aarch64 system,
and matching test cases for them.

Based on earlier work by Kamil Rytarowski.

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

llvm-svn: 357399

5 years agogn build: Merge r357383
Nico Weber [Mon, 1 Apr 2019 14:59:50 +0000 (14:59 +0000)]
gn build: Merge r357383

llvm-svn: 357398

5 years ago[AArch64] Add v8.5-a Memory Tagging STZGM instruction
David Spickett [Mon, 1 Apr 2019 14:56:37 +0000 (14:56 +0000)]
[AArch64] Add v8.5-a Memory Tagging STZGM instruction

This instruction writes a block of allocation tags
and stores zero to the associated data locations.

It differs from STGM by 1 bit and has the same
arguments.

The specification can be found here:
https://developer.arm.com/docs/ddi0596/c

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

llvm-svn: 357397

5 years ago[RISCV] Attach VK_RISCV_CALL to symbols upon creation
Alex Bradbury [Mon, 1 Apr 2019 14:53:17 +0000 (14:53 +0000)]
[RISCV] Attach VK_RISCV_CALL to symbols upon creation

This patch replaces the addition of VK_RISCV_CALL in RISCVMCCodeEmitter by
creating the RISCVMCExpr when tail/call are parsed, or in the codegen case
when the callee symbols are created.

This required adding a new CallSymbol operand to allow only adding
VK_RISCV_CALL to tail/call instructions.

This patch will allow further expansion of parsing and codegen to easily
include PLT symbols which must generate the R_RISCV_CALL_PLT relocation.

Differential Revision: https://reviews.llvm.org/D55560
Patch by Lewis Revill.

llvm-svn: 357396

5 years ago[AArch64] Add v8.5-a Memory Tagging STGM/LDGM instructions
David Spickett [Mon, 1 Apr 2019 14:52:18 +0000 (14:52 +0000)]
[AArch64] Add v8.5-a Memory Tagging STGM/LDGM instructions

The STGV/LDGV instructions were replaced with
STGM/LDGM. The encodings remain the same but there
is no longer writeback so there are no unpredictable
encodings to check for.

The specfication can be found here:
https://developer.arm.com/docs/ddi0596/c

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

llvm-svn: 357395

5 years ago[ASTImporter] Make ODR error handling configurable
Gabor Marton [Mon, 1 Apr 2019 14:46:53 +0000 (14:46 +0000)]
[ASTImporter] Make ODR error handling configurable

Summary:
ODR errors are not necessarily true errors during the import of ASTs.
ASTMerge and CrossTU should use the warning equivalent of every CTU error,
while Sema should emit errors as before.

Reviewers: martong, a_sidorin, shafik, a.sidorin

Reviewed By: a_sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, jdoerfert, cfe-commits

Tags: #clang

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

Patch by Endre Fulop!

llvm-svn: 357394

5 years ago[RISCV] Generate address sequences suitable for mcmodel=medium
Alex Bradbury [Mon, 1 Apr 2019 14:42:56 +0000 (14:42 +0000)]
[RISCV] Generate address sequences suitable for mcmodel=medium

This patch adds an implementation of a PC-relative addressing sequence to be
used when -mcmodel=medium is specified. With absolute addressing, a 'medium'
codemodel may cause addresses to be out of range. This is because while
'medium' implies a 2 GiB addressing range, this 2 GiB can be at any offset as
opposed to 'small', which implies the first 2 GiB only.

Note that LLVM/Clang currently specifies code models differently to GCC, where
small and medium imply the same functionality as GCC's medlow and medany
respectively.

Differential Revision: https://reviews.llvm.org/D54143
Patch by Lewis Revill.

llvm-svn: 357393

5 years ago[AArch64] Add v8.5-a Memory Tagging GMID_EL1 register
David Spickett [Mon, 1 Apr 2019 14:41:14 +0000 (14:41 +0000)]
[AArch64] Add v8.5-a Memory Tagging GMID_EL1 register

The latest version of the MTE spec added a system
register 'GMID_EL1'. It contains the block size used
by the LDGM and STGM instructions and is read only.

The specification can be found here:
https://developer.arm.com/docs/ddi0596/c

llvm-svn: 357392

5 years agoFix builder.
Alexandre Ganea [Mon, 1 Apr 2019 14:37:36 +0000 (14:37 +0000)]
Fix builder.

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/24702/steps/check-fuzzer/logs/stdio

llvm-svn: 357391

5 years ago[OPENMP] Check that allocated variables are used in private clauses.
Alexey Bataev [Mon, 1 Apr 2019 14:25:31 +0000 (14:25 +0000)]
[OPENMP] Check that allocated variables are used in private clauses.

According to OpenMP 5.0 standard, 2.11.4 allocate Clause, Restrictions,
For any list item that is specified in the allocate clause on a
directive, a data-sharing attribute clause that may create a private
copy of that list item must be specified on the same directive. Patch
adds the checks for this restriction.

llvm-svn: 357390

5 years ago[InstCombine] Handle vector gep with scalar argument in evaluateInDifferentElementOrder
Mikael Holmen [Mon, 1 Apr 2019 14:10:10 +0000 (14:10 +0000)]
[InstCombine] Handle vector gep with scalar argument in evaluateInDifferentElementOrder

Summary:
This fixes PR41270.

The recursive function evaluateInDifferentElementOrder expects to be called
on a vector Value, so when we call it on a vector GEP's arguments, we must
first check that the argument is indeed a vector.

Reviewers: reames, spatel

Reviewed By: spatel

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 357389

5 years agoX86: Fix override warning
Matt Arsenault [Mon, 1 Apr 2019 14:08:26 +0000 (14:08 +0000)]
X86: Fix override warning

llvm-svn: 357388

5 years agoRevert "[InstCombine] Handle vector gep with scalar argument in evaluateInDifferentEl...
Mikael Holmen [Mon, 1 Apr 2019 14:06:45 +0000 (14:06 +0000)]
Revert "[InstCombine] Handle vector gep with scalar argument in evaluateInDifferentElementOrder"

This reverts commit 75216a6dbcfe5fb55039ef06a07e419fa875f4a5.

I'll recommit with a better commit message with reference to the
phabricator review.

llvm-svn: 357387

5 years agoInstSimplify: Add baseline test for upcoming change
Matt Arsenault [Mon, 1 Apr 2019 14:03:44 +0000 (14:03 +0000)]
InstSimplify: Add baseline test for upcoming change

llvm-svn: 357386

5 years ago[InstCombine] Handle vector gep with scalar argument in evaluateInDifferentElementOrder
Mikael Holmen [Mon, 1 Apr 2019 13:48:56 +0000 (13:48 +0000)]
[InstCombine] Handle vector gep with scalar argument in evaluateInDifferentElementOrder

This fixes PR41270.

The recursive function evaluateInDifferentElementOrder expects to be called
on a vector Value, so when we call it on a vector GEP's arguments, we must
first check that the argument is indeed a vector.

llvm-svn: 357385

5 years ago[X86] Make post-ra scheduling macrofusion-aware.
Clement Courbet [Mon, 1 Apr 2019 13:48:50 +0000 (13:48 +0000)]
[X86] Make post-ra scheduling macrofusion-aware.

Subscribers: MatzeB, arsenm, jvesely, nhaehnle, hiraditya, javed.absar, llvm-commits

Tags: #llvm

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

llvm-svn: 357384

5 years ago[LLD][COFF] Early dependency detection
Alexandre Ganea [Mon, 1 Apr 2019 13:36:59 +0000 (13:36 +0000)]
[LLD][COFF] Early dependency detection

We introduce a new class hierarchy for debug types merging (in DebugTypes.h). The end-goal is to parallelize the type merging - please see the plan in D59226.

Previously, dependency discovery was done on the fly, much later, during the type merging loop. Unfortunately, parallelizing the type merging requires the dependencies to be merged in first, before any dependent ObjFile, thus this early discovery.

The overall intention for this path is to discover debug information dependencies at a much earlier stage, when processing input files. Currently, two types of dependency are supported: PDB type servers (when compiling with MSVC /Zi) and precompiled headers OBJs (when compiling with MSVC /Yc and /Yu). Once discovered, an explicit link is added into the dependent ObjFile, through the new debug types class hierarchy introduced in DebugTypes.h.

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

llvm-svn: 357383

5 years ago[InstCombine] eliminate commuted select-shuffles + binop (PR41304)
Sanjay Patel [Mon, 1 Apr 2019 13:36:40 +0000 (13:36 +0000)]
[InstCombine] eliminate commuted select-shuffles + binop (PR41304)

If we have a commutable vector binop with inverted select-shuffles,
we don't care about the order of the operands in each vector lane:

LHS = shuffle V1, V2, <0, 5, 6, 3>
RHS = shuffle V2, V1, <0, 5, 6, 3>
LHS + RHS --> <V1[0]+V2[0], V2[1]+V1[1], V2[2]+V1[2], V1[3]+V2[3]> --> V1 + V2

PR41304:
https://bugs.llvm.org/show_bug.cgi?id=41304
...is currently titled as an SLP enhancement, but at least for the
given example, we can reduce that in instcombine because we are just
eliminating shuffles.

As noted in the TODO, this could be generalized, but I haven't thought
through those patterns completely, so this is limited to what appears
to be always safe.

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

llvm-svn: 357382

5 years ago[X86MacroFusion][NFC] Add more tests.
Clement Courbet [Mon, 1 Apr 2019 13:18:34 +0000 (13:18 +0000)]
[X86MacroFusion][NFC] Add more tests.

In preparation for D59688.

llvm-svn: 357381

5 years ago[X86] Fix a test from r357317
Krasimir Georgiev [Mon, 1 Apr 2019 11:42:54 +0000 (11:42 +0000)]
[X86] Fix a test from r357317

Summary:
The missing `<` causes the lld command to override the test file, which fails in
environments marking the test files as readonly.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 357380

5 years ago[X86][SSE] Add fcmp constant folding tests
Simon Pilgrim [Mon, 1 Apr 2019 10:54:04 +0000 (10:54 +0000)]
[X86][SSE] Add fcmp constant folding tests

Initial test coverage for D60006

llvm-svn: 357379

5 years ago[RISCV] Add seto pattern expansion
Luis Marques [Mon, 1 Apr 2019 09:54:14 +0000 (09:54 +0000)]
[RISCV] Add seto pattern expansion

Adds a `seto` pattern expansion. Without it the lowerings of `fcmp one` and
`fcmp ord` would be inefficient due to an unoptimized double negation.

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

llvm-svn: 357378

5 years ago[ELF] Rename SyntheticSection::empty to more appropriate isNeeded() with opposite...
Fangrui Song [Mon, 1 Apr 2019 08:16:08 +0000 (08:16 +0000)]
[ELF] Rename SyntheticSection::empty to more appropriate isNeeded() with opposite meaning

Summary:
Some synthetic sections can be empty while still being needed, thus they
can't be removed by removeUnusedSyntheticSections(). Rename this member
function to more appropriate isNeeded() with the opposite meaning.

No functional change intended.

Reviewers: ruiu, espindola

Reviewed By: ruiu

Subscribers: jhenderson, grimar, emaste, arichardson, llvm-commits

Tags: #llvm

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

llvm-svn: 357377

5 years ago[Linux/x86] Fix writing of non-gpr registers on newer processors
Pavel Labath [Mon, 1 Apr 2019 08:11:46 +0000 (08:11 +0000)]
[Linux/x86] Fix writing of non-gpr registers on newer processors

Summary:
We're using ptrace(PTRACE_SETREGSET, NT_X86_XSTATE) to write all non-gpt
registers on x86 linux. Unfortunately, this method has a quirk, where
the kernel rejects all attempts to write to this area if one supplies a
buffer which is smaller than the area size (even though the kernel will
happily accept partial reads from it).

This means that if the CPU supports some new registers/extensions that
we don't know about (in my case it was the PKRU extension), we will fail
to write *any* non-gpr registers, even those that we know about.

Since this is a situation that's likely to appear again and again, I add
code to NativeRegisterContextLinux_x86_64 to detect the runtime size of
the area, and allocate an appropriate buffer. This does not mean that we
will start automatically supporting all new extensions, but it does mean
that the new extensions will not prevent the old ones from working.

This fixes tests attempting to write to non-gpr registers on new intel
processors (cca Kaby Lake Refresh).

Reviewers: jankratochvil, davezarzycki

Subscribers: lldb-commits

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

llvm-svn: 357376

5 years ago[X86] Use ISD::INTRINSIC_VOID in getTgtMemIntrinsic for truncating stores and scatter...
Craig Topper [Mon, 1 Apr 2019 05:26:12 +0000 (05:26 +0000)]
[X86] Use ISD::INTRINSIC_VOID in getTgtMemIntrinsic for truncating stores and scatter intrinsics.

This is the appropriate opcode for only having a chain output. Though I'm not
sure it matters much.

llvm-svn: 357375

5 years ago[RISCV] Don't evaluatePCRelLo if a relocation will be forced (e.g. due to linker...
Alex Bradbury [Mon, 1 Apr 2019 02:38:27 +0000 (02:38 +0000)]
[RISCV] Don't evaluatePCRelLo if a relocation will be forced (e.g. due to linker relaxation)

A pcrel_lo will point to the associated pcrel_hi fixup which in turn points to
the real target. RISCVMCExpr::evaluatePCRelLo will work around this
indirection in order to allow the fixup to be evaluate properly. However, if
relocations are forced (e.g. due to linker relaxation is enabled) then its
evaluation is undesired and will result in a relocation with the wrong target.

This patch modifies evaluatePCRelLo so it will not try to evaluate if the
fixup will be forced as a relocation. A new helper method is added to
RISCVAsmBackend to query this.

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

llvm-svn: 357374

5 years agoSimplify. NFC.
Rui Ueyama [Mon, 1 Apr 2019 00:25:17 +0000 (00:25 +0000)]
Simplify. NFC.

llvm-svn: 357373

5 years agoReplace `typedef A B` with `using B = A`. NFC.
Rui Ueyama [Mon, 1 Apr 2019 00:11:24 +0000 (00:11 +0000)]
Replace `typedef A B` with `using B = A`. NFC.

I did this using Perl.

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

llvm-svn: 357372

5 years agoSpelling correction for docs for cppcoreguidelines-owning-memory
Sylvestre Ledru [Sun, 31 Mar 2019 21:53:00 +0000 (21:53 +0000)]
Spelling correction for docs for cppcoreguidelines-owning-memory

Summary: There's a typo in the docs, as mentioned in the title. Please see the diff.

Reviewers: JonasToth

Subscribers: sylvestre.ledru, nemanjai, kbarton, cfe-commits

Tags: #clang-tools-extra, #clang

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

llvm-svn: 357371

5 years agoMake common_type's implementation common
Eric Fiselier [Sun, 31 Mar 2019 20:49:06 +0000 (20:49 +0000)]
Make common_type's implementation common

Summary:
Currently the C++03 implementation of common_type has much different behavior than the C++11 one. This causes bugs, including inside `<chrono>`.

This patch unifies the two implementations as best it can. The more code they share, the less their behavior can diverge.

Reviewers: mclow.lists, ldionne, sbenza

Reviewed By: mclow.lists, ldionne

Subscribers: libcxx-commits

Tags: #libc

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

llvm-svn: 357370

5 years agogn build: Add build files for most clang-tools-extra unit tests
Nico Weber [Sun, 31 Mar 2019 16:49:54 +0000 (16:49 +0000)]
gn build: Add build files for most clang-tools-extra unit tests

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

llvm-svn: 357369

5 years ago[InstCombine] add tests for inverted select-shuffles + binop (PR41304); NFC
Sanjay Patel [Sun, 31 Mar 2019 15:45:47 +0000 (15:45 +0000)]
[InstCombine] add tests for inverted select-shuffles + binop (PR41304); NFC

llvm-svn: 357368

5 years ago[x86] allow movmsk with 2-element reductions
Sanjay Patel [Sun, 31 Mar 2019 15:11:34 +0000 (15:11 +0000)]
[x86] allow movmsk with 2-element reductions

One motivation for making this change is that the lack of using movmsk is likely
a main source of perf difference between clang and gcc on the C-Ray benchmark as
shown here:
https://www.phoronix.com/scan.php?page=article&item=gcc-clang-2019&num=5
...but this change alone isn't enough to solve that problem.

The 'all-of' examples show what is likely the worst case trade-off: we end up with
an extra instruction (or 2 if we count the 'xor' register clearing). The 'any-of'
examples look clearly better using movmsk because we've traded 2 vector instructions
for 2 scalar instructions, and movmsk may have better timing than the generic 'movq'.

If we examine the llvm-mca output for these cases, it appears that even though the
'all-of' movmsk variant looks worse on paper, it would perform better on both
Haswell and Jaguar.

  $ llvm-mca -mcpu=haswell no_movmsk.s -timeline
  Iterations:        100
  Instructions:      400
  Total Cycles:      504
  Total uOps:        400

  Dispatch Width:    4
  uOps Per Cycle:    0.79
  IPC:               0.79
  Block RThroughput: 1.0

  $ llvm-mca -mcpu=haswell movmsk.s -timeline
  Iterations:        100
  Instructions:      600
  Total Cycles:      358
  Total uOps:        600

  Dispatch Width:    4
  uOps Per Cycle:    1.68
  IPC:               1.68
  Block RThroughput: 1.5

  $ llvm-mca -mcpu=btver2 no_movmsk.s -timeline
  Iterations:        100
  Instructions:      400
  Total Cycles:      407
  Total uOps:        400

  Dispatch Width:    2
  uOps Per Cycle:    0.98
  IPC:               0.98
  Block RThroughput: 2.0

  $ llvm-mca -mcpu=btver2 movmsk.s -timeline
  Iterations:        100
  Instructions:      600
  Total Cycles:      311
  Total uOps:        600

  Dispatch Width:    2
  uOps Per Cycle:    1.93
  IPC:               1.93
  Block RThroughput: 3.0

Finally, there may be CPUs where movmsk is horribly slow (old AMD small cores?), but if
that's true, then we're also almost certainly making the wrong transform already for
reductions with >2 elements, so that should be fixed independently.

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

llvm-svn: 357367

5 years ago[InstCombine] canonicalize select shuffles by commuting
Sanjay Patel [Sun, 31 Mar 2019 15:01:30 +0000 (15:01 +0000)]
[InstCombine] canonicalize select shuffles by commuting

In PR41304:
https://bugs.llvm.org/show_bug.cgi?id=41304
...we have a case where we want to fold a binop of select-shuffle (blended) values.

Rather than try to match commuted variants of the pattern, we can canonicalize the
shuffles and check for mask equality with commuted operands.

We don't produce arbitrary shuffle masks in instcombine, but select-shuffles are a
special case that the backend is required to handle because we already canonicalize
vector select to this shuffle form.

So there should be no codegen difference from this change. It's possible that this
improves CSE in IR though.

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

llvm-svn: 357366

5 years agofix typo: "\t" => " "
Liang Zou [Sun, 31 Mar 2019 14:49:00 +0000 (14:49 +0000)]
fix typo: "\t" => "  "

Reviewers: llvm.org, Jim

Reviewed By: Jim

Subscribers: arsenm, jvesely, nhaehnle, rupprecht, llvm-commits

Tags: #llvm

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

llvm-svn: 357365

5 years ago[gnustep-objc] Make the GNUstep v2 ABI work for Windows DLLs.
David Chisnall [Sun, 31 Mar 2019 11:22:33 +0000 (11:22 +0000)]
[gnustep-objc] Make the GNUstep v2 ABI work for Windows DLLs.

Summary:
Based on a patch by Dustin Howett, modified to not change the ABI for
ELF platforms.

Use more Windows-like section names.

This also makes things more readable by PE/COFF debug tools that assume
sections fit in the first header.

With these changes in, it is now possible to build a working WinObjC
with clang and the WinObjC version of GNUstep libobjc (upstream GNUstep
libobjc + a work around for incremental linking, which can be removed
once LINK.EXE gains a feature to opt sections out of receiving extra
padding during an incremental link).

Patch by Dustin Howett!

Reviewers: DHowett-MSFT

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 357364

5 years agoCOMDAT-fold block descriptors.
David Chisnall [Sun, 31 Mar 2019 11:22:26 +0000 (11:22 +0000)]
COMDAT-fold block descriptors.

Without this change, linking multiple objects containing block
descriptors together on Windows will generate duplicate symbol errors.

Patch by Dustin Howett!

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

llvm-svn: 357363

5 years ago[objc-gnustep] Use .init_array not .ctors when requested.
David Chisnall [Sun, 31 Mar 2019 11:22:19 +0000 (11:22 +0000)]
[objc-gnustep] Use .init_array not .ctors when requested.

This doesn't make a difference most of the time but FreeBSD/ARM doesn't
run anything in the .ctors array.

llvm-svn: 357362

5 years agoSafepointIRVerifier port to new Pass Manager
Fedor Sergeev [Sun, 31 Mar 2019 10:15:39 +0000 (10:15 +0000)]
SafepointIRVerifier port to new Pass Manager

Straightforward port of StatepointIRVerifier pass to new Pass Manager framework.

Fix By: skatkov
Reviewed By: fedor.sergeev
Differential Revision: https://reviews.llvm.org/D59825

This is a re-land of r357147/r357148 with LLVM_ENABLE_MODULES build fixed.
Adding IR/SafepointIRVerifier.h into its own module.

llvm-svn: 357361