platform/upstream/llvm.git
6 years agoReorder Value.def to optimize code size
Serge Guelton [Mon, 13 Nov 2017 20:57:40 +0000 (20:57 +0000)]
Reorder Value.def to optimize code size

If the first values in Value.def is the range of constant, then the code
generated by `isa<Constant>` is smaller by one operation (basically, an add is
removed). It turns out this small optimization reduces the size of the
statically linked clang binary by 400ko on my laptop. The theoritical
performance gain is non visible from my benchmarks, but the size dropdown is.

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

llvm-svn: 318083

6 years ago[tsan] Fix signal chaining
Vitaly Buka [Mon, 13 Nov 2017 20:49:14 +0000 (20:49 +0000)]
[tsan] Fix signal chaining

Summary: Return saved values only if installed sigaction is our wrapper.

Reviewers: eugenis, dvyukov

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 318082

6 years ago[arm] Fix Unnecessary reloads from GOT.
Evgeniy Stepanov [Mon, 13 Nov 2017 20:45:38 +0000 (20:45 +0000)]
[arm] Fix Unnecessary reloads from GOT.

Summary:
This fixes PR35221.
Use pseudo-instructions to let MachineCSE hoist global address computation.

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

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

llvm-svn: 318081

6 years ago[sanitizer] Update scudo to use new API
Kostya Kortchinsky [Mon, 13 Nov 2017 20:38:22 +0000 (20:38 +0000)]
[sanitizer] Update scudo to use new API

Summary:
The ScudoAllocator uses a SecondaryHeader to keep track of the size and base address of each mmap'd chunk.

This aligns well with what the ReservedAddressRange is trying to do.  This changeset converts the scudo allocator from using the MmapNoAccess/MmapFixed APIs to the ReservedAddressRange::Init and ::Map APIs.  In doing so, it replaces the SecondayHeader struct with the ReservedAddressRange object.

This is part 3 of a 4 part changeset; part 1 https://reviews.llvm.org/D39072 and part 2 https://reviews.llvm.org/D38592

Reviewers: alekseyshl, mcgrathr, cryptoad, phosek

Reviewed By: cryptoad

Subscribers: llvm-commits, cryptoad, kubamracek

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

llvm-svn: 318080

6 years agoReformat a comment. NFC.
Stephane Sezer [Mon, 13 Nov 2017 20:13:25 +0000 (20:13 +0000)]
Reformat a comment. NFC.

llvm-svn: 318079

6 years ago[tsan] Deadly signal handler for tsan
Vitaly Buka [Mon, 13 Nov 2017 19:56:20 +0000 (19:56 +0000)]
[tsan] Deadly signal handler for tsan

Summary: https://github.com/google/sanitizers/issues/637

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 318078

6 years ago[sanitizer] Relax stack check
Vitaly Buka [Mon, 13 Nov 2017 19:56:06 +0000 (19:56 +0000)]
[sanitizer] Relax stack check

-NEXT sometimes does not work as LLVMSymbolizer warning can appear there.

llvm-svn: 318077

6 years ago[Reassociation] regenerate test checks; NFC
Sanjay Patel [Mon, 13 Nov 2017 19:46:28 +0000 (19:46 +0000)]
[Reassociation] regenerate test checks; NFC

llvm-svn: 318076

6 years ago [clang] Remove redundant return [NFC]
Mandeep Singh Grang [Mon, 13 Nov 2017 19:29:31 +0000 (19:29 +0000)]
 [clang] Remove redundant return [NFC]

Reviewers: rsmith, sfantao, mcrosier

Reviewed By: mcrosier

Subscribers: jholewinski, cfe-commits

Tags: #clang

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

llvm-svn: 318074

6 years agoFix clang -Wsometimes-uninitialized warning in SCEV code
Reid Kleckner [Mon, 13 Nov 2017 18:43:11 +0000 (18:43 +0000)]
Fix clang -Wsometimes-uninitialized warning in SCEV code

I don't believe this was a problem in practice, as it's likely that the
boolean wasn't checked unless the backend condition was non-null.

llvm-svn: 318073

6 years agoRemove a std::map and std::set that show up in LLD profiles
Reid Kleckner [Mon, 13 Nov 2017 18:38:53 +0000 (18:38 +0000)]
Remove a std::map and std::set that show up in LLD profiles

For GC roots, add a bit to SymbolBody to ensure that we don't add the
same root twice, and switch to a vector. In addition to being faster,
this may also fix some latent non-determinism. We iterate the GCRoot
list later and it the order should be deterministic.

For fixupExports, we can just use DenseMap. This is a simple string
uniquing task, and we don't iterate the map.

Reviewers: ruiu

Subscribers: llvm-commits

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

llvm-svn: 318072

6 years agoDisable GC and ICF when /debug is present
Reid Kleckner [Mon, 13 Nov 2017 18:38:25 +0000 (18:38 +0000)]
Disable GC and ICF when /debug is present

ICF and GC impair debugging, so MSVC disables these optimizations when
/debug is passed. They are still on by default when no PDB is produced.

This change also makes /opt:ref enable ICF, which is consistent with
MSVC: https://msdn.microsoft.com/en-us/library/bxwfs976.aspx

We should consider making /opt:icf fold readonly data in the near
future. LLD used to do this, but we disabled it because it breaks too
many programs. MSVC only does this if the user explicitly passes
/opt:icf.

Reviewers: ruiu, pcc

Subscribers: llvm-commits

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

llvm-svn: 318071

6 years agoNFC, Allow SystemZ SLP tests only when SystemZ is supported.
Dinar Temirbulatov [Mon, 13 Nov 2017 18:35:43 +0000 (18:35 +0000)]
NFC, Allow SystemZ SLP tests only when SystemZ is supported.

llvm-svn: 318070

6 years agoCreate a TempFile class.
Rafael Espindola [Mon, 13 Nov 2017 18:33:44 +0000 (18:33 +0000)]
Create a TempFile class.

This just adds a TempFile class and replaces the use in
FileOutputBuffer with it.

The only difference for now is better error handling. Followup work includes:

- Convert other user of temporary files to it.
- Add support for automatically deleting on windows.
- Add a createUnnamed method that returns a potentially unnamed
  file. It would be actually unnamed on modern linux and have a
  unknown name on windows.

llvm-svn: 318069

6 years ago[globalisel][tablegen] Add support for extload.
Daniel Sanders [Mon, 13 Nov 2017 18:30:23 +0000 (18:30 +0000)]
[globalisel][tablegen] Add support for extload.

llvm-svn: 318068

6 years agonative_divide: provide function implementation instead of macro
Jan Vesely [Mon, 13 Nov 2017 18:28:56 +0000 (18:28 +0000)]
native_divide: provide function implementation instead of macro

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 318067

6 years agonative_recip: provide function implementation instead of macro
Jan Vesely [Mon, 13 Nov 2017 18:28:53 +0000 (18:28 +0000)]
native_recip: provide function implementation instead of macro

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 318066

6 years agonative_rsqrt: Switch implementation to 1 / native_sqrt
Jan Vesely [Mon, 13 Nov 2017 18:28:51 +0000 (18:28 +0000)]
native_rsqrt: Switch implementation to 1 / native_sqrt

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 318065

6 years agonative_tan: Switch implementation to use native_sin/native_cos
Jan Vesely [Mon, 13 Nov 2017 18:28:48 +0000 (18:28 +0000)]
native_tan: Switch implementation to use native_sin/native_cos

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 318064

6 years agomath: Use precomputed constant for log2(10.0)
Jan Vesely [Mon, 13 Nov 2017 18:28:45 +0000 (18:28 +0000)]
math: Use precomputed constant for log2(10.0)

exp10 CTS fails with or without this change

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 318063

6 years agoTry harder to delete the temporary file.
Rafael Espindola [Mon, 13 Nov 2017 18:15:22 +0000 (18:15 +0000)]
Try harder to delete the temporary file.

This changes COFF to use the output buffer that is reset by the error
handler.

llvm-svn: 318062

6 years agoRemove dead include.
Rafael Espindola [Mon, 13 Nov 2017 18:10:37 +0000 (18:10 +0000)]
Remove dead include.

llvm-svn: 318061

6 years agoTry harder to delete the temporary file.
Rafael Espindola [Mon, 13 Nov 2017 18:06:43 +0000 (18:06 +0000)]
Try harder to delete the temporary file.

It is really hard to cover restarts in a debugger, SIGKILL or power
failures. I will try to handle them in a followup patch, but it will
not support all the systems lld has to run on.

RemoveFileOnSignal takes care of crashes.

So what is left is making sure all regular exits delete the file. This
patch does that by moving the buffer to error handling. That is a bit
of a hack, but seemed better than to generalize it to take a callback on
construction.

I will implement this on COFF on the next patch.

llvm-svn: 318060

6 years agofix printing of alias instructions by removing redundant spacing
Petar Jovanovic [Mon, 13 Nov 2017 18:00:24 +0000 (18:00 +0000)]
fix printing of alias instructions by removing redundant spacing

Some alias instructions are printed with an extra space after the tab
character. Fix this by skipping that space when the tab character is printed
so that the instructions are aligned with the rest of the code.

Patch by Milos Stojanovic.

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

llvm-svn: 318059

6 years ago[ValueTracking] use 'auto' with 'dyn_cast'; NFC
Sanjay Patel [Mon, 13 Nov 2017 17:56:23 +0000 (17:56 +0000)]
[ValueTracking] use 'auto' with 'dyn_cast'; NFC

llvm-svn: 318058

6 years ago[X86] Allow X86ISD::Wrapper to be folded into the base of gather/scatter address
Craig Topper [Mon, 13 Nov 2017 17:53:59 +0000 (17:53 +0000)]
[X86] Allow X86ISD::Wrapper to be folded into the base of gather/scatter address

If the base of our gather corresponds to something contained in X86ISD::Wrapper we should be able to fold it into the address.

This patch refactors some of the address matching to more fully use the X86ISelAddressMode struct and the getAddressOperands helper. A new helper function matchVectorAddress is added to call matchWrapper or fall back to matchAddressBase.

We should also be able to support constant offsets from a wrapper, but I'll look into that in a future patch. We may even be able to completely reuse matchAddress here, but I wanted to start simple and work up to it.

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

llvm-svn: 318057

6 years ago[OpenMP] Remove the unused testsuite/ directory
Jonathan Peyton [Mon, 13 Nov 2017 17:44:48 +0000 (17:44 +0000)]
[OpenMP] Remove the unused testsuite/ directory

The testsuite directory is not used or updated and confuses new users to the
OpenMP project. These tests were rewritten using the lit format and put under
the runtime/test directory. This patch removes the entire testsuite/ directory.

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

llvm-svn: 318056

6 years ago[ValueTracking] simplify code in CannotBeNegativeZero() with match(); NFCI
Sanjay Patel [Mon, 13 Nov 2017 17:40:47 +0000 (17:40 +0000)]
[ValueTracking] simplify code in CannotBeNegativeZero() with match(); NFCI

llvm-svn: 318055

6 years ago[analyzer] ObjCGenerics: Don't warn on cast conversions involving explicit cast
Devin Coughlin [Mon, 13 Nov 2017 17:35:29 +0000 (17:35 +0000)]
[analyzer] ObjCGenerics: Don't warn on cast conversions involving explicit cast

The ObjCGenerics checker warns on a cast when there is no subtyping relationship
between the tracked type of the value and the destination type of the cast. It
does this even if the cast was explicitly written. This means the user can't
write an explicit cast to silence the diagnostic.

This commit treats explicit casts involving generic types as an indication from
the programmer that the Objective-C type system is not rich enough to express
the needed invariant. On explicit casts, the checker now removes any existing
information inferred about the type arguments. Further, it no longer assumes
the casted-to specialized type because the invariant the programmer specifies
in the cast may only hold at a particular program point and not later ones. This
prevents a suppressing cast from requiring a cascade of casts down the
line.

rdar://problem/33603303

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

llvm-svn: 318054

6 years ago[Reassociate] add tests with 'reassoc' FMF; NFC
Sanjay Patel [Mon, 13 Nov 2017 17:29:11 +0000 (17:29 +0000)]
[Reassociate] add tests with 'reassoc' FMF; NFC

llvm-svn: 318053

6 years agoFix netbsd, freebsd and osx builds for ArchSpec move
Pavel Labath [Mon, 13 Nov 2017 16:47:37 +0000 (16:47 +0000)]
Fix netbsd, freebsd and osx builds for ArchSpec move

llvm-svn: 318052

6 years agoAMDGPU: Drop duplicate setOperationAction
Jan Vesely [Mon, 13 Nov 2017 16:46:07 +0000 (16:46 +0000)]
AMDGPU: Drop duplicate setOperationAction

These are set with other scalar int ops few lines up

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

llvm-svn: 318051

6 years ago[SCEV] Handling for ICmp occuring in the evolution chain.
Jatin Bhateja [Mon, 13 Nov 2017 16:43:24 +0000 (16:43 +0000)]
[SCEV] Handling for ICmp occuring in the evolution chain.

Summary:
 If a compare instruction is same or inverse of the compare in the
 branch of the loop latch, then return a constant evolution node.
 This shall facilitate computations of loop exit counts in cases
 where compare appears in the evolution chain of induction variables.

 Will fix PR 34538

Reviewers: sanjoy, hfinkel, junryoungju

Reviewed By: sanjoy, junryoungju

Subscribers: javed.absar, llvm-commits

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

llvm-svn: 318050

6 years agoRevert "[CodeGenPrepare] Check that erased sunken address are not reused"
Simon Dardis [Mon, 13 Nov 2017 16:41:17 +0000 (16:41 +0000)]
Revert "[CodeGenPrepare] Check that erased sunken address are not reused"

This reverts commit r318032. The test broke some sanitizer bots.

llvm-svn: 318049

6 years agoMove ArchSpec to the Utility module
Pavel Labath [Mon, 13 Nov 2017 16:16:33 +0000 (16:16 +0000)]
Move ArchSpec to the Utility module

The rationale here is that ArchSpec is used throughout the codebase,
including in places which should not depend on the rest of the code in
the Core module.

This commit touches many files, but most of it is just renaming of
 #include lines. In a couple of cases, I removed the #include ArchSpec
line altogether, as the file was not using it. In one or two places,
this necessitated adding other #includes like lldb-private-defines.h.

llvm-svn: 318048

6 years ago[ARM GlobalISel] Update legalizer test
Diana Picus [Mon, 13 Nov 2017 16:02:42 +0000 (16:02 +0000)]
[ARM GlobalISel] Update legalizer test

Make one of the legalizer tests a bit more robust by making sure all
values we're interested in are used (either in a store or a return) and
by using loads instead of constants for obtaining values on fewer than
32 bits. This should make the test less fragile to changes in the
legalize combiner, since those loads are legal (as opposed to the
constants, which were being widened and thus produced opportunities for
the legalize combiner).

llvm-svn: 318047

6 years agoRemove last Host usage from ArchSpec
Pavel Labath [Mon, 13 Nov 2017 15:57:20 +0000 (15:57 +0000)]
Remove last Host usage from ArchSpec

Summary:
In D39387, I was quick to jump to conclusion that ArchSpec has no
external dependencies. It turns there still was one call to
HostInfo::GetArchitecture left -- for implementing the "systemArch32"
architecture and friends.

Since GetAugmentedArchSpec is the place we handle these "incomplete"
triples that don't specify os or vendor and "systemArch" looks very much
like an incomplete triple, I move its handling there.

After this ArchSpec *really* does not have external dependencies, and
I'll move it to the Utility module as a follow-up.

Reviewers: zturner, clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 318046

6 years ago[PowerPC][msan] Update msan to handle changed memory layouts in newer kernels
Bill Seurer [Mon, 13 Nov 2017 15:43:19 +0000 (15:43 +0000)]
[PowerPC][msan] Update msan to handle changed memory layouts in newer kernels

In more recent Linux kernels (including those with 47 bit VMAs) the layout of
virtual memory for powerpc64 changed causing the memory sanitizer to not
work properly. This patch adjusts a bit mask in the memory sanitizer to work
on the newer kernels while continuing to work on the older ones as well.

This is the non-runtime part of the patch and finishes it. ref: r317802

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

llvm-svn: 318045

6 years ago[PowerPC][tsan] Update tsan to handle changed memory layouts in newer kernels
Bill Seurer [Mon, 13 Nov 2017 15:42:28 +0000 (15:42 +0000)]
[PowerPC][tsan] Update tsan to handle changed memory layouts in newer kernels

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

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

llvm-svn: 318044

6 years agoRemove excess whitespace from syslog message; NFC
Stephan Bergmann [Mon, 13 Nov 2017 15:40:31 +0000 (15:40 +0000)]
Remove excess whitespace from syslog message; NFC

llvm-svn: 318043

6 years ago[ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang
Teresa Johnson [Mon, 13 Nov 2017 15:38:33 +0000 (15:38 +0000)]
[ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang

Recommit of r317951 and r317951 along with what I believe should fix
the remaining buildbot failures - the target triple should be specified
for both the ThinLTO pre-thinlink compile and backend (post-thinlink)
compile to ensure it is consistent.

Original description:
The LTO Config field wasn't being set when invoking a ThinLTO backend
via clang (i.e. for distributed builds).

llvm-svn: 318042

6 years agoInserting a base test for X86 performance nops
Omer Paparo Bivas [Mon, 13 Nov 2017 15:02:39 +0000 (15:02 +0000)]
Inserting a base test for X86 performance nops

Change-Id: I69da08b617d7fae8024c5aee04720eb465f39b81
llvm-svn: 318041

6 years agoCompilerType: Add ability to retrieve an integral template argument
Pavel Labath [Mon, 13 Nov 2017 14:26:21 +0000 (14:26 +0000)]
CompilerType: Add ability to retrieve an integral template argument

Summary:
Despite it's name, GetTemplateArgument was only really working for Type
template arguments. This adds the ability to retrieve integral arguments
as well (which I've needed for the std::bitset data formatter).

I've done this by splitting the function into three pieces. The idea is
that one first calls GetTemplateArgumentKind (first function) to
determine the what kind of a parameter this is. Based on that, one can
then use specialized functions to retrieve the correct value. Currently,
I only implement two of these: GetTypeTemplateArgument and
GetIntegralTemplateArgument.

Reviewers: jingham, clayborg

Subscribers: lldb-commits

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

llvm-svn: 318040

6 years agoRevert "[lldb] Use OrcMCJITReplacement rather than MCJIT as the underlying JIT for...
Pavel Labath [Mon, 13 Nov 2017 14:03:17 +0000 (14:03 +0000)]
Revert "[lldb] Use OrcMCJITReplacement rather than MCJIT as the underlying JIT for LLDB"

This commit really did not introduce any functional changes (for most
people) but it turns out it's not for the reason we thought it was.

The reason wasn't that Orc is a perfect drop-in replacement for MCJIT,
but it was because we were never using Orc in the first place, as it was
not initialized.

Orc's initialization relies on a global constructor in the LLVMOrcJIT.a.
Since this archive does not expose any symbols referenced from other
object files, it does not get linked into liblldb when linking against
llvm components statically. However, in an LLVM_LINK_LLVM_DYLIB=On
build, LLVMOrcJit.a is linked into libLLVM.so using --whole-archive, so
the global constructor does end up firing.

The result of using Orc jit is pr34194, where lldb fails to evaluate
even very simple expressions. This bug can be reproduced in
non-LLVM_LINK_LLVM_DYLIB builds by making sure Orc jit is linked into
liblldb, for example by #including
llvm/ExecutionEngine/OrcMCJITReplacement.h in IRExecutionUnit.cpp (and
adding OrcJIT as a dependency to the relevant CMakeLists.txt file). The
bug reproduces (at least) on linux and osx.

The root cause of the bug seems to be related to relocation processing.
It seems Orc processes relocations earlier than the system it is
replacing. This means the relocation processing happens before we have
had a chance to remap section load addresses to reflect their address in
the target process memory, so they end up pointing to locations in the
lldb's address space instead.

I am not sure whether this is a bug in Orc jit, or in how we are using
it from lldb, but in any case it is preventing us from using Orc right
now. Reverting this fixes LLVM_LINK_LLVM_DYLIB build, and makes it clear
that we are in fact *not* using Orc, and we never really were.

This reverts commit r279327.

llvm-svn: 318039

6 years ago[asan] Add CMake hook to override shadow scale in compiler_rt
Walter Lee [Mon, 13 Nov 2017 14:02:27 +0000 (14:02 +0000)]
[asan] Add CMake hook to override shadow scale in compiler_rt

Allow user to override shadow scale in compiler_rt by passing
-DCOMPILER_RT_ASAN_SHADOW_SCALE=n to CMake.  Propagate the override
shadow scale value via a compiler define to compiler-rt and asan
tests.  Tests will use the define to partially disable unsupported
tests.  Set "-mllvm -asan-mapping-scale=<n>" for compiler_rt tests.

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

llvm-svn: 318038

6 years agoAllow compiler-rt test targets to work with multi-config CMake generators
Greg Bedwell [Mon, 13 Nov 2017 12:57:54 +0000 (12:57 +0000)]
Allow compiler-rt test targets to work with multi-config CMake generators

Multi-config CMake generators need lit to be able to resolve paths of
artifacts from previous build steps at lit time, rather than expect them
to be fully resolved at CMake time as they may contain the build mode.

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

llvm-svn: 318037

6 years ago[X86] test/testn intrinsics lowering to IR. llvm part.
Uriel Korach [Mon, 13 Nov 2017 12:51:18 +0000 (12:51 +0000)]
[X86] test/testn intrinsics lowering to IR. llvm part.

Remove builtins from llvm and add AutoUpgrade support.
Also add fast-isel tests for the TEST and TESTN instructions.

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

llvm-svn: 318036

6 years ago[X86] test/testn intrinsics lowering to IR. clang side
Uriel Korach [Mon, 13 Nov 2017 12:50:52 +0000 (12:50 +0000)]
[X86] test/testn intrinsics lowering to IR. clang side

Change Header files of the intrinsics for lowering test and testn intrinsics to IR code.
Removed test and testn builtins from clang

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

llvm-svn: 318035

6 years agoMove the setting of LLVM_BUILD_MODE to a macro so that we can re-use it in compiler-rt
Greg Bedwell [Mon, 13 Nov 2017 12:40:05 +0000 (12:40 +0000)]
Move the setting of LLVM_BUILD_MODE to a macro so that we can re-use it in compiler-rt

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

llvm-svn: 318034

6 years ago[ARM] Place jump table as the first operand in additions
Momchil Velikov [Mon, 13 Nov 2017 11:56:48 +0000 (11:56 +0000)]
[ARM] Place jump table as the first operand in additions

When generating table jump code for switch statements, place the jump
table label as the first operand in the various addition instructions
in order to enable addressing mode selectors to better match index
computation and possibly fold them into the addressing mode of the
table entry load instruction.

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

llvm-svn: 318033

6 years ago[CodeGenPrepare] Check that erased sunken address are not reused
Simon Dardis [Mon, 13 Nov 2017 11:47:21 +0000 (11:47 +0000)]
[CodeGenPrepare] Check that erased sunken address are not reused

CodeGenPrepare sinks address computations from one basic block to another
and attempts to reuse address computations that have already been sunk. If
the same address computation appears twice with the first instance as an
operand of a load whose result is an operand to a simplifable select,
CodeGenPrepare simplifies the select and recursively erases the now dead
instructions. CodeGenPrepare then attempts to use the erased address
computation for the second load.

Fix this by erasing the cached address value if it has zero uses before
looking for the address value in the sunken address map.

This partially resolves PR35209.

Thanks to Alexander Richardson for reporting the issue!

Reviewers: john.brawn

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

llvm-svn: 318032

6 years agoChange
Jina Nahias [Mon, 13 Nov 2017 11:41:41 +0000 (11:41 +0000)]
Change
// CHECK: shufflevector <8 x double> %0, <8 x double> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 8, i32 9>
To
// CHECK: shufflevector <8 x double> %{{.*}}, <8 x double> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 8, i32 9>
for fixing 318025 commit warning

Change-Id: Id48a1fe1f247fe6a0b84e7189f18d2e637678e79
llvm-svn: 318031

6 years ago[analyzer] Document the issue hash debugging facility
Gabor Horvath [Mon, 13 Nov 2017 11:13:02 +0000 (11:13 +0000)]
[analyzer] Document the issue hash debugging facility

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

llvm-svn: 318030

6 years ago[CodeExtractor] Add missing AllowVarArgs initialization.
Florian Hahn [Mon, 13 Nov 2017 11:08:47 +0000 (11:08 +0000)]
[CodeExtractor] Add missing AllowVarArgs initialization.

llvm-svn: 318029

6 years ago[PartialInliner] Inline vararg functions that forward varargs.
Florian Hahn [Mon, 13 Nov 2017 10:35:52 +0000 (10:35 +0000)]
[PartialInliner] Inline vararg functions that forward varargs.

Summary:
This patch extends the partial inliner to support inlining parts of
vararg functions, if the vararg handling is done in the outlined part.

It adds a `ForwardVarArgsTo` argument to InlineFunction. If it is
non-null, all varargs passed to the inlined function will be added to
all calls to `ForwardVarArgsTo`.

The partial inliner takes care to only pass `ForwardVarArgsTo` if the
varargs handing is done in the outlined function. It checks that vastart
is not part of the function to be inlined.

`test/Transforms/CodeExtractor/PartialInlineNoInline.ll` (already part
of the repo) checks we do not do partial inlining if vastart is used in
a basic block that will be inlined.

Reviewers: davide, davidxl, grosser

Reviewed By: davide, davidxl, grosser

Subscribers: gyiu, grosser, eraman, llvm-commits

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

llvm-svn: 318028

6 years agoTest commit
Sander de Smalen [Mon, 13 Nov 2017 09:57:20 +0000 (09:57 +0000)]
Test commit

llvm-svn: 318027

6 years ago[x86][AVX512] Lowering shuffle i/f intrinsics to LLVM IR
Jina Nahias [Mon, 13 Nov 2017 09:16:39 +0000 (09:16 +0000)]
[x86][AVX512] Lowering shuffle i/f intrinsics to LLVM IR

This patch, together with a matching clang patch (https://reviews.llvm.org/D38672), implements the lowering of X86 shuffle i/f intrinsics to IR.

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

Change-Id: I1e7d359a74743e995ec356237a85214ce55d3661
llvm-svn: 318026

6 years ago[x86][AVX512] Lowering shuffle i/f intrinsics to LLVM IR
Jina Nahias [Mon, 13 Nov 2017 09:15:31 +0000 (09:15 +0000)]
[x86][AVX512] Lowering shuffle i/f intrinsics to LLVM IR

This patch, together with a matching llvm patch (https://reviews.llvm.org/D38671), implements the lowering of X86 shuffle i/f intrinsics to IR.

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

Change-Id: I9b3c2f2b34323bd9ccb21d0c1832f848b88ec047
llvm-svn: 318025

6 years ago[X86][SKX] Adding scheduling info of non-intrinsic + commutable SKX opcodes.
Gadi Haber [Mon, 13 Nov 2017 08:42:07 +0000 (08:42 +0000)]
[X86][SKX] Adding scheduling info of non-intrinsic + commutable SKX opcodes.

Updated the scheduling information of the SKX subtarget  in the file X86SchedSkylakeServer.td under lib/Target/X86 to:
1. add regular opcodes in addition to the suffixed "_Int" opcodes
2. add the (V)MAXCPD/MAXCPS/MAXCSD/MAXCSS/MINCPD/MINCPS/MINCSD/MINCSS
    instructions that are equivalent to their counterparts without the 'C' as they are part of a hack to
    make floating point min/max commutable under fast math.

Reviewers: zvi, RKSimon, craig.topper
Differential Revision: https://reviews.llvm.org/D39833

Change-Id: Ie13702a5ce1b1a08af91ca637a52b6962881e7d6
llvm-svn: 318024

6 years ago[X86] Limit NOPs to 7 bytes when 'slm' is spelled 'silvermont'.
Craig Topper [Mon, 13 Nov 2017 08:17:30 +0000 (08:17 +0000)]
[X86] Limit NOPs to 7 bytes when 'slm' is spelled 'silvermont'.

We support 2 spelling for silvermont and we should accept both here.

llvm-svn: 318023

6 years ago[X86] Use sse_load_f32/f64 to improve load folding of scalar vfscalefss/sd, vrcp14ss...
Craig Topper [Mon, 13 Nov 2017 08:07:33 +0000 (08:07 +0000)]
[X86] Use sse_load_f32/f64 to improve load folding of scalar vfscalefss/sd, vrcp14ss/sd, rsqrt14ss/sd instructions.

llvm-svn: 318022

6 years ago[X86] Regenerate test. NFC
Craig Topper [Mon, 13 Nov 2017 08:07:31 +0000 (08:07 +0000)]
[X86] Regenerate test. NFC

llvm-svn: 318021

6 years agoMI: Print ranges on MMO
Matt Arsenault [Mon, 13 Nov 2017 07:09:20 +0000 (07:09 +0000)]
MI: Print ranges on MMO

llvm-svn: 318020

6 years ago[X86] Use sse_load_f32/f64 to improve load folding for scalar VFPCLASS intrinsics.
Craig Topper [Mon, 13 Nov 2017 06:46:48 +0000 (06:46 +0000)]
[X86] Use sse_load_f32/f64 to improve load folding for scalar VFPCLASS intrinsics.

llvm-svn: 318019

6 years ago[X86] Add tests for missed opportunities to fold a 128-bit vector load into vfpclasss...
Craig Topper [Mon, 13 Nov 2017 06:46:46 +0000 (06:46 +0000)]
[X86] Add tests for missed opportunities to fold a 128-bit vector load into vfpclassss and vpfpclasssd.

llvm-svn: 318018

6 years agoAMDGPU: Preserve nuw in shl add ptr combine
Matt Arsenault [Mon, 13 Nov 2017 05:33:35 +0000 (05:33 +0000)]
AMDGPU: Preserve nuw in shl add ptr combine

llvm-svn: 318017

6 years ago[X86] Fix SQRTSS/SQRTSD/RCPSS/RCPSD intrinsics to use sse_load_f32/sse_load_f64 to...
Craig Topper [Mon, 13 Nov 2017 05:25:24 +0000 (05:25 +0000)]
[X86] Fix SQRTSS/SQRTSD/RCPSS/RCPSD intrinsics to use sse_load_f32/sse_load_f64 to increase load folding opportunities.

llvm-svn: 318016

6 years ago[X86] Add tests for full vector loads to fold-load-unops.ll.
Craig Topper [Mon, 13 Nov 2017 05:25:23 +0000 (05:25 +0000)]
[X86] Add tests for full vector loads to fold-load-unops.ll.

We should be able to fold a full vector load into a scalar intrinsic. Since it's legal to narrow a load.

llvm-svn: 318015

6 years ago[X86] Regenerate fold-load-unops.ll and add and avx512f command line.
Craig Topper [Mon, 13 Nov 2017 05:25:21 +0000 (05:25 +0000)]
[X86] Regenerate fold-load-unops.ll and add and avx512f command line.

llvm-svn: 318014

6 years agoAMDGPU: Fix multi-use shl/add combine
Matt Arsenault [Mon, 13 Nov 2017 05:11:54 +0000 (05:11 +0000)]
AMDGPU: Fix multi-use shl/add combine

This was using a custom function that didn't handle the
addressing modes properly for private. Use
isLegalAddressingMode to avoid duplicating this.

Additionally, skip the combine if there is only one use
since the standard combine will handle it.

llvm-svn: 318013

6 years agoPut the status in the wrong column
Marshall Clow [Mon, 13 Nov 2017 04:15:39 +0000 (04:15 +0000)]
Put the status in the wrong column

llvm-svn: 318012

6 years agoImplement P0550R2: Transformation Trait remove_cvref
Marshall Clow [Mon, 13 Nov 2017 03:59:22 +0000 (03:59 +0000)]
Implement P0550R2: Transformation Trait remove_cvref

llvm-svn: 318011

6 years ago[X86] Attempt to fix signed and unsigned comparison warning.
Craig Topper [Mon, 13 Nov 2017 02:19:13 +0000 (02:19 +0000)]
[X86] Attempt to fix signed and unsigned comparison warning.

llvm-svn: 318010

6 years ago[X86] Use sse_load_f32/f64 in patterns for the memory forms of VRNDSCALESS/SD.
Craig Topper [Mon, 13 Nov 2017 02:03:01 +0000 (02:03 +0000)]
[X86] Use sse_load_f32/f64 in patterns for the memory forms of VRNDSCALESS/SD.

llvm-svn: 318009

6 years ago[X86] Use EVEX encoded VRNDSCALE instructions to implement the legacy round intrinsics.
Craig Topper [Mon, 13 Nov 2017 02:03:00 +0000 (02:03 +0000)]
[X86] Use EVEX encoded VRNDSCALE instructions to implement the legacy round intrinsics.

The VRNDSCALE instructions implement a superset of the (V)ROUND instructions. They are equivalent if the upper 4-bits of the immediate are 0.

This patch lowers the legacy intrinsics to the VRNDSCALE ISD node and masks the upper bits of the immediate to 0. This allows us to take advantage of the larger register encoding space.

We should maybe consider converting VRNDSCALE back to VROUND in the EVEX to VEX pass if the extended registers are not being used.

I notice some load folding opportunities being missed for the VRNDSCALESS/SD instructions that I'll try to fix in future patches.

llvm-svn: 318008

6 years ago[X86] Split VRNDSCALE/VREDUCE/VGETMANT/VRANGE ISD nodes into versions with and withou...
Craig Topper [Mon, 13 Nov 2017 02:02:58 +0000 (02:02 +0000)]
[X86] Split VRNDSCALE/VREDUCE/VGETMANT/VRANGE ISD nodes into versions with and without the rounding operand. NFCI

I want to reuse the VRNDSCALE node for the legacy SSE rounding intrinsics so that those intrinsics can use EVEX instructions. All of these nodes share tablegen multiclasses so I split them all so that they all remain similar in their implementations.

llvm-svn: 318007

6 years agoFix some misc. -enable-var-scope violations
Matt Arsenault [Mon, 13 Nov 2017 01:47:52 +0000 (01:47 +0000)]
Fix some misc. -enable-var-scope violations

llvm-svn: 318006

6 years agoAMDGPU: Select d16 loads into low component of register
Matt Arsenault [Mon, 13 Nov 2017 00:22:09 +0000 (00:22 +0000)]
AMDGPU: Select d16 loads into low component of register

llvm-svn: 318005

6 years agoAMDGPU: Fix -enable-var-scope violations
Matt Arsenault [Sun, 12 Nov 2017 23:53:44 +0000 (23:53 +0000)]
AMDGPU: Fix -enable-var-scope violations

llvm-svn: 318004

6 years agoAMDGPU: Fix missing gfx9 atomic inc/dec tests
Matt Arsenault [Sun, 12 Nov 2017 23:40:12 +0000 (23:40 +0000)]
AMDGPU: Fix missing gfx9 atomic inc/dec tests

The global instructions weren't tested. Plus there
were also some -enable-var-scope violations and
broken check prefixes.

llvm-svn: 318003

6 years ago[sanitizer] Simplify stack check in accert.cc
Vitaly Buka [Sun, 12 Nov 2017 21:15:19 +0000 (21:15 +0000)]
[sanitizer] Simplify stack check in accert.cc
Somehow on arm bots stack does not include main.

llvm-svn: 318002

6 years ago[sanitizer] Try to see test output on armv7
Vitaly Buka [Sun, 12 Nov 2017 20:25:14 +0000 (20:25 +0000)]
[sanitizer] Try to see test output on armv7

llvm-svn: 318001

6 years agoTwo more papers from Albuquerque
Marshall Clow [Sun, 12 Nov 2017 18:52:16 +0000 (18:52 +0000)]
Two more papers from Albuquerque

llvm-svn: 318000

6 years ago[X86] Add an X86ISD::RANGES opcode to use for the scalar intrinsics.
Craig Topper [Sun, 12 Nov 2017 18:51:09 +0000 (18:51 +0000)]
[X86] Add an X86ISD::RANGES opcode to use for the scalar intrinsics.

This fixes a bug where we selected packed instructions for scalar intrinsics.

llvm-svn: 317999

6 years ago[X86] Add test cases and command lines demonstrating how we accidentally select vrang...
Craig Topper [Sun, 12 Nov 2017 18:51:08 +0000 (18:51 +0000)]
[X86] Add test cases and command lines demonstrating how we accidentally select vrangeps/vrangepd from vrangess/vrangesd instrinsics when the rounding mode is CUR_DIRECTION

llvm-svn: 317998

6 years ago[X86] Remove some no longer needed intrinsic lowering code.
Craig Topper [Sun, 12 Nov 2017 18:51:06 +0000 (18:51 +0000)]
[X86] Remove some no longer needed intrinsic lowering code.

llvm-svn: 317997

6 years agoUpdated C++2a status page with new features/defects approved in Albuquerque.
Marshall Clow [Sun, 12 Nov 2017 18:48:42 +0000 (18:48 +0000)]
Updated C++2a status page with new features/defects approved in Albuquerque.

llvm-svn: 317996

6 years ago[llvm] Remove redundant return [NFC]
Mandeep Singh Grang [Sun, 12 Nov 2017 03:47:50 +0000 (03:47 +0000)]
[llvm] Remove redundant return [NFC]

Reviewers: davidxl, olista01, Eugene.Zelenko

Reviewed By: Eugene.Zelenko

Subscribers: sdardis, javed.absar, llvm-commits

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

llvm-svn: 317995

6 years ago[InstCombine] Teach visitICmpInst to not break integer absolute value idioms
Craig Topper [Sun, 12 Nov 2017 02:28:21 +0000 (02:28 +0000)]
[InstCombine] Teach visitICmpInst to not break integer absolute value idioms

Summary:
This patch adds an early out to visitICmpInst if we are looking at a compare as part of an integer absolute value idiom. Similar is already done for min/max.

In the particular case I observed in a benchmark we had an absolute value of a load from an indexed global. We simplified the compare using foldCmpLoadFromIndexedGlobal into a magic bit vector, a shift, and an and. But the load result was still used for the select and the negate part of the absolute valute idiom. So we overcomplicated the code and lost the ability to recognize it as an absolute value.

I've chosen a simpler case for the test here.

Reviewers: spatel, davide, majnemer

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 317994

6 years agoFix AST matcher documentation typo
Dave Lee [Sat, 11 Nov 2017 23:53:27 +0000 (23:53 +0000)]
Fix AST matcher documentation typo

llvm-svn: 317993

6 years agoAdd ObjC exception statement AST matchers
Dave Lee [Sat, 11 Nov 2017 22:46:15 +0000 (22:46 +0000)]
Add ObjC exception statement AST matchers

Summary: Add AST matchers for Objective-C @throw, @try, @catch and @finally.

Reviewers: aaron.ballman, malcolm.parsons, alexshap, compnerd

Reviewed By: aaron.ballman

Subscribers: cfe-commits, klimek

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

llvm-svn: 317992

6 years ago[X86] Use vrndscaleps/pd for 128/256 ffloor/ftrunc/fceil/fnearbyint/frint when avx512...
Craig Topper [Sat, 11 Nov 2017 21:44:51 +0000 (21:44 +0000)]
[X86] Use vrndscaleps/pd for 128/256 ffloor/ftrunc/fceil/fnearbyint/frint when avx512vl is enabled.

This matches what we do for scalar and 512-bit types.

llvm-svn: 317991

6 years ago[X86] Remove avx512-round.ll. The 512-bit rounding tests are now in vec_floor.ll...
Craig Topper [Sat, 11 Nov 2017 21:44:50 +0000 (21:44 +0000)]
[X86] Remove avx512-round.ll. The 512-bit rounding tests are now in vec_floor.ll with 128/256 sizes.

llvm-svn: 317990

6 years ago[X86] Add avx512vl command line to vec_floor.ll. Add 512-bit test cases.
Craig Topper [Sat, 11 Nov 2017 21:44:49 +0000 (21:44 +0000)]
[X86] Add avx512vl command line to vec_floor.ll. Add 512-bit test cases.

llvm-svn: 317989

6 years ago[X86] Add avx512f command line to rounding-ops.ll
Craig Topper [Sat, 11 Nov 2017 21:44:48 +0000 (21:44 +0000)]
[X86] Add avx512f command line to rounding-ops.ll

llvm-svn: 317988

6 years ago[X86] Regenerate rounding-ops.ll with update_llc_test_checks.py
Craig Topper [Sat, 11 Nov 2017 21:44:47 +0000 (21:44 +0000)]
[X86] Regenerate rounding-ops.ll with update_llc_test_checks.py

llvm-svn: 317987

6 years ago[python] [tests] Fix test_linkage for unique external linkage
Michal Gorny [Sat, 11 Nov 2017 20:01:41 +0000 (20:01 +0000)]
[python] [tests] Fix test_linkage for unique external linkage

Starting with r314037, anonymous namespaces no longer give
unique-external linkage to variables. However, this linkage can still be
achieved by using a type which is not exterally visible,
e.g. through being declared in an anonymous namespace but used outside
it. Fix the test to take advantage of that.

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

llvm-svn: 317986

6 years ago[X86] Attempt to match multiple binary reduction ops at once. NFCI
Simon Pilgrim [Sat, 11 Nov 2017 18:16:55 +0000 (18:16 +0000)]
[X86] Attempt to match multiple binary reduction ops at once. NFCI

matchBinOpReduction currently matches against a single opcode, but we already have a case where we repeat calls to try to match against AND/OR and I'll be shortly adding another case for SMAX/SMIN/UMAX/UMIN (D39729).

This NFCI patch alters matchBinOpReduction to try and pattern match against any of the provided list of candidate bin ops at once to save time.

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

llvm-svn: 317985

6 years agoAdjust r316292 - remove the anonymous union for sharing a bitfield in FunctionDecl.
Faisal Vali [Sat, 11 Nov 2017 18:02:29 +0000 (18:02 +0000)]
Adjust r316292 - remove the anonymous union for sharing a bitfield in FunctionDecl.

The anonymous union did NOT save us storage, but instead behaved as if we added an additional integer data member to FunctionDecl.

For additional context, the anonymous union renders the bit fields as non-adjacent and prevents them from sharing the same 'memory location' (i.e. bit-storage) by requiring the anonymous union object to be appropriately aligned.

This was confirmed through discussion with Richard Smith in Albuquerque (ISO C++ Meeting)

https://reviews.llvm.org/rL316292

llvm-svn: 317984

6 years ago[cxx_status] Add resolution of CWG issue 1581, since it's an important, visible change.
Richard Smith [Sat, 11 Nov 2017 18:00:16 +0000 (18:00 +0000)]
[cxx_status] Add resolution of CWG issue 1581, since it's an important, visible change.

llvm-svn: 317983