platform/upstream/llvm.git
7 years ago[x86] regenerate checks; NFC
Sanjay Patel [Fri, 17 Mar 2017 23:04:18 +0000 (23:04 +0000)]
[x86] regenerate checks; NFC

llvm-svn: 298166

7 years agoModules: Cache PCMs in memory and avoid a use-after-free
Duncan P. N. Exon Smith [Fri, 17 Mar 2017 22:55:13 +0000 (22:55 +0000)]
Modules: Cache PCMs in memory and avoid a use-after-free

Clang's internal build system for implicit modules uses lock files to
ensure that after a process writes a PCM it will read the same one back
in (without contention from other -cc1 commands).  Since PCMs are read
from disk repeatedly while invalidating, building, and importing, the
lock is not released quickly.  Furthermore, the LockFileManager is not
robust in every environment.  Other -cc1 commands can stall until
timeout (after about eight minutes).

This commit changes the lock file from being necessary for correctness
to a (possibly dubious) performance hack.  The remaining benefit is to
reduce duplicate work in competing -cc1 commands which depend on the
same module.  Follow-up commits will change the internal build system to
continue after a timeout, and reduce the timeout.  Perhaps we should
reconsider blocking at all.

This also fixes a use-after-free, when one part of a compilation
validates a PCM and starts using it, and another tries to swap out the
PCM for something new.

The PCMCache is a new type called MemoryBufferCache, which saves memory
buffers based on their filename.  Its ownership is shared by the
CompilerInstance and ModuleManager.

  - The ModuleManager stores PCMs there that it loads from disk, never
    touching the disk if the cache is hot.

  - When modules fail to validate, they're removed from the cache.

  - When a CompilerInstance is spawned to build a new module, each
    already-loaded PCM is assumed to be valid, and is frozen to avoid
    the use-after-free.

  - Any newly-built module is written directly to the cache to avoid the
    round-trip to the filesystem, making lock files unnecessary for
    correctness.

Original patch by Manman Ren; most testcases by Adrian Prantl!

llvm-svn: 298165

7 years ago[x86] regenerate checks; NFC
Sanjay Patel [Fri, 17 Mar 2017 22:47:21 +0000 (22:47 +0000)]
[x86] regenerate checks; NFC

llvm-svn: 298164

7 years agoFix docs-llvm-html build.
Evgeniy Stepanov [Fri, 17 Mar 2017 22:31:13 +0000 (22:31 +0000)]
Fix docs-llvm-html build.

llvm-svn: 298163

7 years ago[Outliner] Add outliner for AArch64
Jessica Paquette [Fri, 17 Mar 2017 22:26:55 +0000 (22:26 +0000)]
[Outliner] Add outliner for AArch64

This commit adds the necessary target hooks for outlining in AArch64. It also
refactors the switch statement used in `getMemOpBaseRegImmOfsWidth` into a
more general function, `getMemOpInfo`. This allows the outliner to share that
code without copying and pasting it.

The AArch64 outliner can be run using -mllvm -enable-machine-outliner, as with
the X86-64 outliner.

The test for this pass verifies that the outliner does, in fact outline
functions, fixes up the stack accesses properly, and can correctly generate a
tail call. In the future, this test should be replaced with a MIR test, so that
we can properly test immediate offset overflows in fixed-up instructions.

llvm-svn: 298162

7 years ago[SCEV] Use const Loop *L instead of Loop *L. NFC
Eli Friedman [Fri, 17 Mar 2017 22:19:52 +0000 (22:19 +0000)]
[SCEV] Use const Loop *L instead of Loop *L. NFC

Use const pointer in the trip count and trip multiple calculations.

Patch by Huihui Zhang <huihuiz@codeaurora.org>

llvm-svn: 298161

7 years ago[Sema] Unbreak GCC -Werror build (enum compare).
Davide Italiano [Fri, 17 Mar 2017 22:19:20 +0000 (22:19 +0000)]
[Sema] Unbreak GCC -Werror build (enum compare).

llvm-svn: 298160

7 years ago[asan] Fix dead stripping of globals on Linux (compiler-rt)
Evgeniy Stepanov [Fri, 17 Mar 2017 22:17:38 +0000 (22:17 +0000)]
[asan] Fix dead stripping of globals on Linux (compiler-rt)

Runtime support for the new instrumentation of globals based on !associated, and a bunch of tests.

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

llvm-svn: 298159

7 years ago[asan] Fix dead stripping of globals on Linux.
Evgeniy Stepanov [Fri, 17 Mar 2017 22:17:29 +0000 (22:17 +0000)]
[asan] Fix dead stripping of globals on Linux.

Use a combination of !associated, comdat, @llvm.compiler.used and
custom sections to allow dead stripping of globals and their asan
metadata. Sometimes.

Currently this works on LLD, which supports SHF_LINK_ORDER with
sh_link pointing to the associated section.

This also works on BFD, which seems to treat comdats as
all-or-nothing with respect to linker GC. There is a weird quirk
where the "first" global in each link is never GC-ed because of the
section symbols.

At this moment it does not work on Gold (as in the globals are never
stripped).

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

llvm-svn: 298158

7 years agoAdd !associated metadata.
Evgeniy Stepanov [Fri, 17 Mar 2017 22:17:24 +0000 (22:17 +0000)]
Add !associated metadata.

This is an ELF-specific thing that adds SHF_LINK_ORDER to the global's section
pointing to the metadata argument's section. The effect of that is a reverse dependency
between sections for the linker GC.

!associated does not change the behavior of global-dce. The global
may also need to be added to llvm.compiler.used.

Since SHF_LINK_ORDER is per-section, !associated effectively enables
fdata-sections for the affected globals, the same as comdats do.

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

llvm-svn: 298157

7 years ago[SelectionDAG] Remove redundant stores more aggressively.
Eli Friedman [Fri, 17 Mar 2017 22:15:50 +0000 (22:15 +0000)]
[SelectionDAG] Remove redundant stores more aggressively.

Handle TokenFactors more aggressively in
SDValue::reachesChainWithoutSideEffects.  This isn't really a
very effective change anymore because of other changes to
chain handling, but it's a cheap check, and the expanded
comments are still useful.

It might be possible to loosen the hasOneUse() requirement with a
deeper analysis, but a naive implementation of that check would be
expensive.

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

llvm-svn: 298156

7 years agoELF: Change check(Expected<T>, const Twine &) to call toString instead of converting...
Peter Collingbourne [Fri, 17 Mar 2017 22:06:36 +0000 (22:06 +0000)]
ELF: Change check(Expected<T>, const Twine &) to call toString instead of converting to an error code.

llvm-svn: 298155

7 years ago[ELF] Restore GC handling of LINK_ORDER, C-named sections.
Evgeniy Stepanov [Fri, 17 Mar 2017 22:04:52 +0000 (22:04 +0000)]
[ELF] Restore GC handling of LINK_ORDER, C-named sections.

__start_xxx symbol keeps section xxx alive only if it is not
SHF_LINK_ORDER. Such sections can be used for user metadata, when
__start_xxx is used to iterate over section contents at runtime, and
the liveness is determined solely by the linked (associated) section.

This was earlier implemented in r294592, and broken in r296723.

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

llvm-svn: 298154

7 years agoLTO: Work around libstdc++ version mismatch bug, see D31063 review thread.
Peter Collingbourne [Fri, 17 Mar 2017 21:49:09 +0000 (21:49 +0000)]
LTO: Work around libstdc++ version mismatch bug, see D31063 review thread.

llvm-svn: 298127

7 years agoImplement DR 373 "Lookup on namespace qualified name in using-directive"
Matthias Gehre [Fri, 17 Mar 2017 21:41:20 +0000 (21:41 +0000)]
Implement DR 373 "Lookup on namespace qualified name in using-directive"

Summary:
3.4.6 [basic.lookup.udir] paragraph 1:
In a using-directive or namespace-alias-definition, during the lookup for a namespace-name or for a name in a nested-name-specifier, only namespace names are considered.

Reviewers: rsmith, aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 298126

7 years agoAMDGPU: Fix broken condition in hazard recognizer
Matt Arsenault [Fri, 17 Mar 2017 21:36:28 +0000 (21:36 +0000)]
AMDGPU: Fix broken condition in hazard recognizer

Fixes bug 32248.

llvm-svn: 298125

7 years agorecommend using llvm-ar when finding undefined references and empty archives
Bob Haarman [Fri, 17 Mar 2017 21:32:49 +0000 (21:32 +0000)]
recommend using llvm-ar when finding undefined references and empty archives

Summary:
When we perform LTO builds with a version of ar that does not
understand LLVM bitcode objects, we end up with undefined references,
because our archive files do not list the bitcode symbols in their
indices. The error messages do not make it clear what the real problem
is. This change adds a note that points out the likely problem and
solution. It is similar in spirit to r282633, but aims to avoid false
positives by only triggering when we see both undefined references and
archives without symbols in their indices.

Fixes PR32281.

Reviewers: davide, ruiu, tejohnson

Subscribers: llvm-commits

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

llvm-svn: 298124

7 years agoallow for specification of compiler/lldb executables basename
Tim Hammerquist [Fri, 17 Mar 2017 21:00:35 +0000 (21:00 +0000)]
allow for specification of compiler/lldb executables basename

llvm-svn: 298123

7 years ago[coverity] Fix uninit variable.
Vassil Vassilev [Fri, 17 Mar 2017 20:58:08 +0000 (20:58 +0000)]
[coverity] Fix uninit variable.

Patch by John Harvey!

llvm-svn: 298122

7 years agoAMDGPU: Fix handling of constant phi input loop conditions
Matt Arsenault [Fri, 17 Mar 2017 20:52:21 +0000 (20:52 +0000)]
AMDGPU: Fix handling of constant phi input loop conditions

If the loop condition was an i1 phi with a constantexpr input, this
would add a loop intrinsic fed by a phi dependent on a call to
if.break in the same block. Insert the call in the loop header.

llvm-svn: 298121

7 years ago[PGO] Change the internal options description. nfc.
Rong Xu [Fri, 17 Mar 2017 20:51:44 +0000 (20:51 +0000)]
[PGO] Change the internal options description. nfc.

llvm-svn: 298120

7 years agoAMDGPU: Cleanup control flow intrinsics
Matt Arsenault [Fri, 17 Mar 2017 20:41:45 +0000 (20:41 +0000)]
AMDGPU: Cleanup control flow intrinsics

Move backend internal intrinsics along with the rest of the
normal intrinsics, and use the Intrinsic::getDeclaration
API instead of manually constructing the type list.

It's surprising this was working before. fdiv.fast had
the wrong number of parameters. The control flow intrinsic
declaration attributes were not being applied, and
their types were inconsistent. The actual IR use types
did not match the declaration, and were closer to the
types used for the patterns. The brcond lowering
was changing the types, so introduce new nodes for those.

llvm-svn: 298119

7 years ago[x86] clean up setcc with negated operand transform and add missing test; NFCI
Sanjay Patel [Fri, 17 Mar 2017 20:29:40 +0000 (20:29 +0000)]
[x86] clean up setcc with negated operand transform and add missing test; NFCI

llvm-svn: 298118

7 years ago[ubsan] Add e2e test for -fsanitize=nullability
Vedant Kumar [Fri, 17 Mar 2017 20:27:33 +0000 (20:27 +0000)]
[ubsan] Add e2e test for -fsanitize=nullability

llvm-svn: 298117

7 years ago[X86] Emit fewer instructions to allocate >16GB stack frames
Reid Kleckner [Fri, 17 Mar 2017 20:25:49 +0000 (20:25 +0000)]
[X86] Emit fewer instructions to allocate >16GB stack frames

Summary:
Use this code pattern when RAX is live, instead of emitting up to 2
billion adjustments:
  pushq %rax
  movabsq +-$Offset+-8, %rax
  addq %rsp, %rax
  xchg %rax, (%rsp)
  movq (%rsp), %rsp

Try to clean this code up a bit while I'm here. In particular, hoist the
logic that handles the entire adjustment with `movabsq $imm, %rax` out
of the loop.

This negates the offset in the prologue and uses ADD because X86 only
has a two operand subtract which always subtracts from the destination
register, which can no longer be RSP.

Fixes PR31962

Reviewers: majnemer, sdardis

Subscribers: llvm-commits

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

llvm-svn: 298116

7 years ago[PGO] Add omitted test cases.
Rong Xu [Fri, 17 Mar 2017 20:05:13 +0000 (20:05 +0000)]
[PGO] Add omitted test cases.

llvm-svn: 298115

7 years ago[CodeGenPrep]Restructure promoting Ext to form ExtLoad
Jun Bum Lim [Fri, 17 Mar 2017 19:05:21 +0000 (19:05 +0000)]
[CodeGenPrep]Restructure promoting Ext to form ExtLoad

Summary:
Instead of just looking for a load which is mergable with Ext to form ExtLoad, trying to promote Exts as long as the cost is acceptable. This change is not a NFC as it continue promoting Exts even after finding a load during promotions; the change in arm64-codegen-prepare-extload.ll described in 2.b might show the case.
This change was motivated from D26524.  Based on this change, I will move the transformation performed in aarch64-type-promotion into CGP.

Reviewers: jmolloy, qcolombet, mcrosier, javed.absar

Reviewed By: qcolombet

Subscribers: rengolin, llvm-commits, aemerson

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

llvm-svn: 298114

7 years agoResubmit r295469 [PGO] Suspend SIGKILL for PR_SET_PDEATHSIG in profile-write
Rong Xu [Fri, 17 Mar 2017 18:41:33 +0000 (18:41 +0000)]
Resubmit r295469 [PGO] Suspend SIGKILL for PR_SET_PDEATHSIG in profile-write

And also r295364 [PGO] remove unintended debug trace. NFC
I removed the test case: it's hard to write synchronized test b/w processes
in this framework. I will revisit the test-case later.

llvm-svn: 298113

7 years agoexecutables should be validated before spawning subprocesses
Tim Hammerquist [Fri, 17 Mar 2017 18:10:58 +0000 (18:10 +0000)]
executables should be validated before spawning subprocesses

dotest.py script doesn't validate executables passed on the command line
before spawning dozens of subprocesses, all of which fail silently,
leaving an empty results file.

We should validate the lldb and compiler executables on
configuration, aborting when given invalid paths, to prevent numerous,
cryptic, and spurious failures.

<rdar://problem/31117272>

llvm-svn: 298111

7 years ago[PGO] Value profile for size of memory intrinsic calls
Rong Xu [Fri, 17 Mar 2017 18:07:26 +0000 (18:07 +0000)]
[PGO] Value profile for size of memory intrinsic calls

This patch annotates the valuesites profile to memory intrinsics.

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

llvm-svn: 298110

7 years ago[Bitcode] Add compatibility test for the 4.0 release
Vedant Kumar [Fri, 17 Mar 2017 17:53:26 +0000 (17:53 +0000)]
[Bitcode] Add compatibility test for the 4.0 release

Fork off compatibility.ll for the 4.0 release. The *.bc file in this
commit was produced using a Release build of the release_40 branch.

llvm-svn: 298109

7 years ago[SelectionDAG] Add SelectionDAG.computeKnownBits test support for ISD::ABS
Simon Pilgrim [Fri, 17 Mar 2017 17:45:36 +0000 (17:45 +0000)]
[SelectionDAG] Add SelectionDAG.computeKnownBits test support for ISD::ABS

llvm-svn: 298108

7 years ago[x86] avoid adc/sbb assert when both sides of add are zexted (PR32316)
Sanjay Patel [Fri, 17 Mar 2017 17:27:31 +0000 (17:27 +0000)]
[x86] avoid adc/sbb assert when both sides of add are zexted (PR32316)

As noted in the comment, we might want to account for this case,
but I didn't look at what that would mean for the asm.

I'm also not sure why this only reproduces with avx512, but I'm
putting a conservative fix in for now to avoid the crash.

Also, if both sides of an add are zexted, shouldn't we shrink that add?

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

llvm-svn: 298107

7 years agoFix wasm build after arg_begin iterator type change
Reid Kleckner [Fri, 17 Mar 2017 17:24:03 +0000 (17:24 +0000)]
Fix wasm build after arg_begin iterator type change

llvm-svn: 298106

7 years agoStore Arguments in a flat array instead of an iplist
Reid Kleckner [Fri, 17 Mar 2017 17:16:39 +0000 (17:16 +0000)]
Store Arguments in a flat array instead of an iplist

This saves two pointers from Argument and eliminates some extra
allocations.

Arguments cannot be inserted or removed from a Function because that
would require changing its Type, which LLVM does not allow. Instead,
passes that change prototypes, like DeadArgElim, create a new Function
and copy over argument names and attributes. The primary benefit of
iplist is O(1) random insertion and removal. We just don't need that for
arguments, so don't use it.

Reviewed By: chandlerc

Subscribers: dlj, inglorion, llvm-commits

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

llvm-svn: 298105

7 years agoOnly unswitch loops with uniform conditions
Stanislav Mekhanoshin [Fri, 17 Mar 2017 17:13:41 +0000 (17:13 +0000)]
Only unswitch loops with uniform conditions

Loop unswitching can be extremely harmful for a SIMT target. In case
if hoisted condition is not uniform a SIMT machine will execute both
clones of a loop sequentially. Therefor LoopUnswitch checks if the
condition is non-divergent.

Since DivergenceAnalysis adds an expensive PostDominatorTree analysis
not needed for non-SIMT targets a new option is added to avoid unneded
analysis initialization. The method getAnalysisUsage is called when
TargetTransformInfo is not yet available and we cannot use it here.
For that reason a new field DivergentTarget is added to PassManagerBuilder
to control the behavior and set this field from a target.

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

llvm-svn: 298104

7 years ago[X86] Add SelectionDAG.computeKnownBits test showing inability to handle ISD::ABS
Simon Pilgrim [Fri, 17 Mar 2017 16:58:15 +0000 (16:58 +0000)]
[X86] Add SelectionDAG.computeKnownBits test showing inability to handle ISD::ABS

We have to be careful as abs(INT_MIN) == INT_MIN.

llvm-svn: 298103

7 years ago[ELF] - Move template instantiations to the end of file. NFC.
George Rimar [Fri, 17 Mar 2017 16:50:07 +0000 (16:50 +0000)]
[ELF] - Move template instantiations to the end of file. NFC.

To be consistent with other code, addresses post
commit review comments.

llvm-svn: 298102

7 years ago[Clang-tidy] Fix for misc-noexcept-move-constructor false triggers on defaulted decla...
Alexander Kornienko [Fri, 17 Mar 2017 16:40:34 +0000 (16:40 +0000)]
[Clang-tidy] Fix for misc-noexcept-move-constructor false triggers on defaulted declarations

Summary:
There is no need for triggering warning when noexcept specifier in move constructor or move-assignment operator is neither evaluated nor uninstantiated.

This fixes bug reported here: bugs.llvm.org/show_bug.cgi?id=24712

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JonasToth, JDevlieghere, cfe-commits

Tags: #clang-tools-extra

Patch by Marek Jenda!

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

llvm-svn: 298101

7 years agoCMake requires normalized paths when appending.
Zachary Turner [Fri, 17 Mar 2017 16:33:37 +0000 (16:33 +0000)]
CMake requires normalized paths when appending.

Patch by Hugh Bellamy
Differential Revision: https://reviews.llvm.org/D30927

llvm-svn: 298100

7 years agoFix some signed/unsigned comparison warnings.
Zachary Turner [Fri, 17 Mar 2017 16:32:43 +0000 (16:32 +0000)]
Fix some signed/unsigned comparison warnings.

Patch by Hugh Bellamy
Differential Revision: https://reviews.llvm.org/D30926

llvm-svn: 298099

7 years ago[clang-cl] Fix cross-compilation with MSVC 2017.
Zachary Turner [Fri, 17 Mar 2017 16:24:34 +0000 (16:24 +0000)]
[clang-cl] Fix cross-compilation with MSVC 2017.

clang-cl works best when the user runs vcvarsall to set up
an environment before running, but even this is not enough
on VC 2017 when cross compiling (e.g. using an x64 toolchain
to target x86, or vice versa).

The reason is that although clang-cl itself will have a
valid environment, it will shell out to other tools (such
as link.exe) which may not.  Generally we solve this through
adding the appropriate linker flags, but this is not enough
in VC 2017.

The cross-linker and the regular linker both link against
some common DLLs, but these DLLs live in the binary directory
of the native linker.  When setting up a cross-compilation
environment through vcvarsall, it will add *both* directories
to %PATH%, so that when cl shells out to any of the associated
tools, those tools will be able to find all of the dependencies
that it links against.  If you don't do this, link.exe will
fail to run because the loader won't be able to find all of
the required DLLs that it links against.

To solve this we teach the driver how to spawn a process with
an explicitly specified environment.  Then we modify the
PATH before shelling out to subtools and run with the modified
PATH.

Patch by Hamza Sood
Differential Revision: https://reviews.llvm.org/D30991

llvm-svn: 298098

7 years agoTest commit.
David Green [Fri, 17 Mar 2017 15:38:49 +0000 (15:38 +0000)]
Test commit.

llvm-svn: 298097

7 years agoHandle & and | of non abs values.
Rafael Espindola [Fri, 17 Mar 2017 14:55:36 +0000 (14:55 +0000)]
Handle & and | of non abs values.

Handling & in particular is probably important because of its use in
aligning addresses.

llvm-svn: 298096

7 years ago[ScheduleOptimiser] fix typos in top comment [NFC]
Siddharth Bhat [Fri, 17 Mar 2017 14:52:19 +0000 (14:52 +0000)]
[ScheduleOptimiser] fix typos in top comment [NFC]

coice -> choice
Transations -> Transactions

llvm-svn: 298095

7 years agoRefuse to add two non absolute symbols.
Rafael Espindola [Fri, 17 Mar 2017 14:51:07 +0000 (14:51 +0000)]
Refuse to add two non absolute symbols.

Since there is no way to produce the correct answer at runtime, it is
probably better to just err.

llvm-svn: 298094

7 years ago[ELF][MIPS] Always collect .reginfo, .MIPS.options, and .MIPS.abiflags input sections
Simon Atanasyan [Fri, 17 Mar 2017 14:27:55 +0000 (14:27 +0000)]
[ELF][MIPS] Always collect .reginfo, .MIPS.options, and .MIPS.abiflags input sections

Do not take in account the `Live` flag while collecting .reginfo, .MIPS.options,
and .MIPS.abiflags input sections to produce corresponding output sections.
These sections have information purpose and should be always produced per
ABI requirements.

llvm-svn: 298093

7 years ago[AArch64] Use alias analysis in the load/store optimization pass.
Chad Rosier [Fri, 17 Mar 2017 14:19:55 +0000 (14:19 +0000)]
[AArch64] Use alias analysis in the load/store optimization pass.

This allows the optimization to rearrange loads and stores more aggressively.

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

llvm-svn: 298092

7 years ago[ELF] - Detemplate SymbolBody::getGotOffset(). NFC.
George Rimar [Fri, 17 Mar 2017 14:12:51 +0000 (14:12 +0000)]
[ELF] - Detemplate SymbolBody::getGotOffset(). NFC.

llvm-svn: 298091

7 years ago[change-namespace] do not rename specialized template parameters.
Eric Liu [Fri, 17 Mar 2017 14:05:39 +0000 (14:05 +0000)]
[change-namespace] do not rename specialized template parameters.

Reviewers: hokein

Subscribers: cfe-commits

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

llvm-svn: 298090

7 years agoRevert "Remove references to AssumptionCache. NFC."
Michael Kruse [Fri, 17 Mar 2017 13:56:53 +0000 (13:56 +0000)]
Revert "Remove references to AssumptionCache. NFC."

The AssumptionCache removal of r289756 has been reverted in
r290086/r290087. A different solution has been implemented in r291671
which keeps the AssumptionCache. We can therefore use it again in Polly.

This reverts r289791.

llvm-svn: 298089

7 years agoSupport non abs values in the rhs of +.
Rafael Espindola [Fri, 17 Mar 2017 13:45:36 +0000 (13:45 +0000)]
Support non abs values in the rhs of +.

llvm-svn: 298088

7 years ago[ELF] - Detemplate findSection() global static method. NFC.
George Rimar [Fri, 17 Mar 2017 13:43:24 +0000 (13:43 +0000)]
[ELF] - Detemplate findSection() global static method. NFC.

llvm-svn: 298087

7 years ago[ELF] - Recommit r298078 "[ELF] - Simplify logic of creating "COMMON" section."
George Rimar [Fri, 17 Mar 2017 13:31:07 +0000 (13:31 +0000)]
[ELF] - Recommit r298078 "[ELF] - Simplify logic of creating "COMMON" section."

With fix of next warning:
Writer.cpp:361:3: warning: suggest parentheses around assignment used as truth value [-Wparentheses]

Original commit message:

Patch reuses BssSection section to simplify creation of
COMMON section.

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

llvm-svn: 298086

7 years ago[DependenceInfo] Remove idempotent union: must-writes with may-writes [NFC]
Siddharth Bhat [Fri, 17 Mar 2017 13:26:10 +0000 (13:26 +0000)]
[DependenceInfo] Remove idempotent union: must-writes with may-writes [NFC]

Since may-writes are always a superset of the must-writes, there is no
point in taking a union of one with the other.

llvm-svn: 298085

7 years ago[ELF] - Revert r298078 and 298082
George Rimar [Fri, 17 Mar 2017 13:21:22 +0000 (13:21 +0000)]
[ELF] - Revert r298078 and 298082

It segfaults.

llvm-svn: 298084

7 years agoAdd a test that now passes.
Rafael Espindola [Fri, 17 Mar 2017 13:19:15 +0000 (13:19 +0000)]
Add a test that now passes.

llvm-svn: 298083

7 years ago[ELF] - Fix warning.
George Rimar [Fri, 17 Mar 2017 13:15:35 +0000 (13:15 +0000)]
[ELF] - Fix warning.

Writer.cpp:361:3: warning: suggest parentheses around assignment used as truth value [-Wparentheses]

llvm-svn: 298082

7 years ago[ScopInfo/PruneUnprofitable] Move default profitability check.
Michael Kruse [Fri, 17 Mar 2017 13:10:05 +0000 (13:10 +0000)]
[ScopInfo/PruneUnprofitable] Move default profitability check.

In the previous default ScopInfo applied the profitability heuristic for
scalar accesses (-polly-unprofitable-scalar-accs=true) and the
-polly-prune-unprofitable was disabled by default
(-polly-enable-prune-unprofitable=false) as that pruning was already done.

This changes switches the defaults to -polly-unprofitable-scalar-accs=true
-polly-enable-prune-unprofitable=false such that the scalar access
heuristic check is done by the pass. This allows passes between ScopInfo
and PruneUnprofitable to optimize away scalar accesses.

Without enabling such intermediate passes, there is no change in
behaviour of profitability checks in a PassManagerBuilder built
pass chain, but it allows us to cover this configuration with the
buildbots.

Suggested-by: Tobias Grosser <tobias@grosser.es>
llvm-svn: 298081

7 years ago[PruneUnprofitable] Add -polly-prune-unprofitable pass.
Michael Kruse [Fri, 17 Mar 2017 13:09:52 +0000 (13:09 +0000)]
[PruneUnprofitable] Add -polly-prune-unprofitable pass.

ScopInfo's normal profitability heuristic considers SCoPs where all
statements have scalar writes as not profitably optimizable and
invalidate the SCoP in that case. However, -polly-delicm and
-polly-simplify may be able to remove some of the scalar writes such
that the flag -polly-unprofitable-scalar-accs=false allows disabling
that part of the heuristic.

In cases where DeLICM (or other passes after ScopInfo) are not
successful in removing scalar writes, the SCoP is still not profitably
optimizable. The schedule optimizer would again try computing another
schedule, resulting in slower compilation.

The -polly-prune-unprofitable pass applies the profitability heuristic
again before the schedule optimizer Polly can still bail out even with
-polly-unprofitable-scalar-accs=false.

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

llvm-svn: 298080

7 years agoChange our linker script expr representation.
Rafael Espindola [Fri, 17 Mar 2017 13:05:04 +0000 (13:05 +0000)]
Change our linker script expr representation.

This fixes pr32031 by representing the expressions results as a
SectionBase and offset. This allows us to use an input section
directly instead of getting lost trying to compute an offset in an
outputsection when not all the information is available yet.

This also creates a struct to represent the *value* of and expression,
allowing the expression itself to be a simple typedef. I think this is
easier to read and will make it easier to extend the expression
computation to handle more complicated cases.

llvm-svn: 298079

7 years ago[ELF] - Simplify logic of creating "COMMON" section.
George Rimar [Fri, 17 Mar 2017 13:04:06 +0000 (13:04 +0000)]
[ELF] - Simplify logic of creating "COMMON" section.

Patch reuses BssSection section to simplify creation of
COMMON section.

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

llvm-svn: 298078

7 years ago[ScopInfo] Add option to not add parameter bounds to context [NFC]
Tobias Grosser [Fri, 17 Mar 2017 13:00:53 +0000 (13:00 +0000)]
[ScopInfo] Add option to not add parameter bounds to context [NFC]

For experiments it is sometimes helpful to provide parameter bound information
to polly and to not use these parameter bounds for simplification.
Add a new option "-polly-ignore-parameter-bounds" which does precisely this.

llvm-svn: 298077

7 years agoRemove unnecessary (). NFC.
Rafael Espindola [Fri, 17 Mar 2017 13:00:45 +0000 (13:00 +0000)]
Remove unnecessary (). NFC.

llvm-svn: 298076

7 years ago[DependenceInfo] Replace use of deprecated isl_dim_n_out [NFC]
Siddharth Bhat [Fri, 17 Mar 2017 12:59:01 +0000 (12:59 +0000)]
[DependenceInfo] Replace use of deprecated isl_dim_n_out [NFC]

Change isl_dim_n_out to isl_map_dim(*, isl_dim_out)

llvm-svn: 298075

7 years ago[DependenceInfo] Track may-writes and build flow information in
Siddharth Bhat [Fri, 17 Mar 2017 12:31:28 +0000 (12:31 +0000)]
[DependenceInfo] Track may-writes and build flow information in
Dependences::calculateDependences.

This ensures that we handle may-writes correctly when building
dependence information. Also add a test case checking correctness of
may-write information. Not handling it before was an oversight.

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

llvm-svn: 298074

7 years ago[ScopInfo] Do not take inbounds assumptions [NFC]
Tobias Grosser [Fri, 17 Mar 2017 12:26:58 +0000 (12:26 +0000)]
[ScopInfo] Do not take inbounds assumptions [NFC]

For experiments it is sometimes helpful to not take any inbounds assumptions.
Add a new option "-polly-ignore-inbounds" which does precisely this.

llvm-svn: 298073

7 years ago[ELF] - Detemplate DynamicReloc class. NFC.
George Rimar [Fri, 17 Mar 2017 12:07:44 +0000 (12:07 +0000)]
[ELF] - Detemplate DynamicReloc class. NFC.

llvm-svn: 298072

7 years ago[ELF] - Detemplate SymbolBody::getVA and SymbolBody::getPltVA. NFC.
George Rimar [Fri, 17 Mar 2017 11:56:54 +0000 (11:56 +0000)]
[ELF] - Detemplate SymbolBody::getVA and SymbolBody::getPltVA. NFC.

llvm-svn: 298071

7 years ago[ELF] - Fix linux build bot.
George Rimar [Fri, 17 Mar 2017 11:41:56 +0000 (11:41 +0000)]
[ELF] - Fix linux build bot.

Error was:
Relocations.cpp:792:38: error: expected primary-expression before ‘>’ token
         In<ELFT>::Iplt->addEntry<ELFT>(Body);

llvm-svn: 298070

7 years agoFix FreeBSD build broken by r298066
Pavel Labath [Fri, 17 Mar 2017 11:33:57 +0000 (11:33 +0000)]
Fix FreeBSD build broken by r298066

llvm-svn: 298069

7 years ago[Asm] Don't list '@<type>' in diag when '@' is a comment
Oliver Stannard [Fri, 17 Mar 2017 11:10:17 +0000 (11:10 +0000)]
[Asm] Don't list '@<type>' in diag when '@' is a comment

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

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

llvm-svn: 298067

7 years agoMove GetAuxvData from Host to relevant process plugins
Pavel Labath [Fri, 17 Mar 2017 11:08:40 +0000 (11:08 +0000)]
Move GetAuxvData from Host to relevant process plugins

Summary:
GetAuxvData was causing dependencies from host to target and linux
process modules. It also does not fit netbsd use case, as there we can
only read the auxiliary vector with ptrace, which is better done in the
process plugin, with the other ptrace calls.

I resolve these issues by moving the freebsd and linux versions into the
relevant process plugins. In case of linux, this required adding an
interface in NativeProcessProtocol. The empty definitions on other
platforms can simply be removed.

To get the code compiling I had to add ProcessGdbRemote -> ProcessLinux
dependency, which was not caught before because we depended on it
transitively.

Reviewers: zturner, emaste

Subscribers: srhines, mgorny, lldb-commits

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

llvm-svn: 298066

7 years ago[ELF] - Detemplate PltSection. NFC.
George Rimar [Fri, 17 Mar 2017 11:01:57 +0000 (11:01 +0000)]
[ELF] - Detemplate PltSection. NFC.

Alternative approach can be remove templated method
either, like D31028 do.

llvm-svn: 298065

7 years ago[ELF] - Fixed cache.ll testcase.
George Rimar [Fri, 17 Mar 2017 10:32:10 +0000 (10:32 +0000)]
[ELF] - Fixed cache.ll testcase.

It failed for me under windows,
touch reported invalid date format.

Seems related to 12h/24h format, though
I don't understant why 197001010200 does not work,
but 197001010300 works, I see no logic here.

Changed to 197001011200.

llvm-svn: 298064

7 years agoOne more attempt to fix FreeBSD
Pavel Labath [Fri, 17 Mar 2017 10:30:42 +0000 (10:30 +0000)]
One more attempt to fix FreeBSD

It seems sysctl.h is not self-contained, as I get missing symbols in the
header itself now. I am going to include all files that the file I moved
this from included, and hope that is enough.

llvm-svn: 298063

7 years ago[ELF] - Recommit "[ELF] - Make Bss and BssRelRo sections to be synthetic (#3)."
George Rimar [Fri, 17 Mar 2017 10:14:53 +0000 (10:14 +0000)]
[ELF] - Recommit "[ELF] - Make Bss and BssRelRo sections to be synthetic (#3)."
Was fixed, details on review page.

Original commit message:

That removes CopyRelSection class completely, making
Bss/BssRelRo to be just regular synthetics.

This is splitted from D30541 and polished.
Difference from D30541 that all logic of SharedSymbol
converting to DefinedRegular was removed for now and
probably will be posted as separate patch.

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

llvm-svn: 298062

7 years agoSpeculative build fix for FreeBSD
Pavel Labath [Fri, 17 Mar 2017 10:09:56 +0000 (10:09 +0000)]
Speculative build fix for FreeBSD

broken by r298058.

llvm-svn: 298061

7 years ago[clang-tidy] Added a test with a different format.
Alexander Kornienko [Fri, 17 Mar 2017 10:05:49 +0000 (10:05 +0000)]
[clang-tidy] Added a test with a different format.

llvm-svn: 298060

7 years ago[clang-tidy] readability-misleading-indentation: fix chained if
Alexander Kornienko [Fri, 17 Mar 2017 09:58:30 +0000 (09:58 +0000)]
[clang-tidy] readability-misleading-indentation: fix chained if

Summary:
Fixed erroneously flagging of chained if statements when styled like this:

```
if (cond) {
}
else if (cond) {
}
else {
}
```

Reviewers: xazax.hun, alexfh

Reviewed By: xazax.hun, alexfh

Subscribers: JDevlieghere, cfe-commits

Patch by Florian Gross!

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

llvm-svn: 298059

7 years agoRemove HostThreadLinux/Free/NetBSD
Pavel Labath [Fri, 17 Mar 2017 09:51:23 +0000 (09:51 +0000)]
Remove HostThreadLinux/Free/NetBSD

Summary:
These classes existed only because of the GetName() static function,
which can be moved to a more natural place anyway. I move the linux
version to NativeProcessLinux (and get rid of ProcFileReader), the
freebsd version to ProcessFreeBSD (and fix a bug where it was using the
current process ID, instead of the inferior pid), and remove the NetBSD
version (which was probably incorrect anyway, as it assumes the current
process instead of the inferior.

I also add an llgs test to that verifies thread names are read
correctly.

Reviewers: zturner, krytarowski, emaste

Subscribers: lldb-commits, mgorny

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

llvm-svn: 298058

7 years ago[clang-tidy] Verify some conditions in a matcher instead of check(). NFC
Alexander Kornienko [Fri, 17 Mar 2017 09:47:05 +0000 (09:47 +0000)]
[clang-tidy] Verify some conditions in a matcher instead of check(). NFC

llvm-svn: 298057

7 years ago[ARM] Fix triple format in test branch disassemble test
Andre Vieira [Fri, 17 Mar 2017 09:37:10 +0000 (09:37 +0000)]
[ARM] Fix triple format in test branch disassemble test

Fixing triple format in the tests added for the branch label fix for Thumb
Targets. Also recommitting previously approved patch, see
https://reviews.llvm.org/D30943.

Reviewed by: samparker

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

llvm-svn: 298056

7 years ago[ARM] Change tests after fixing branch label for Thumb targets
Andre Vieira [Fri, 17 Mar 2017 09:37:02 +0000 (09:37 +0000)]
[ARM] Change tests after fixing branch label for Thumb targets

Patch to fix lld tests after my llvm-objdump patch to fix branch labels for
Thumb targets.

Reviewed by: emaste

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

llvm-svn: 298055

7 years ago[ScopInfo] Do not try to eliminate parameter dimensions that do not exist
Tobias Grosser [Fri, 17 Mar 2017 09:02:53 +0000 (09:02 +0000)]
[ScopInfo] Do not try to eliminate parameter dimensions that do not exist

In subsequent changes we will make Polly a little bit more lazy in adding
parameter dimensions to different sets. As a result, not all parameters will
always be part of the parameter space. This change ensures that we do not use
the '-1' returned when a parameter dimension cannot be found, but instead
just do not try to eliminate the anyhow non-existing dimension.

llvm-svn: 298054

7 years ago[ScopInfo] Do not expand getDomains() to full parameter space.
Tobias Grosser [Fri, 17 Mar 2017 09:02:50 +0000 (09:02 +0000)]
[ScopInfo] Do not expand getDomains() to full parameter space.

Since several years, isl can perform most operations on sets with differing
parameter spaces, by expanding the parameter space on demand relying using
named isl ids to distinguish different parameter dimensions.

By not always expanding to full dimensionality the set remain smaller and can
likely be operated on faster. This change by itself did not yet result in
measurable performance benefits, but it is a step into the right direction
needed to ensure that subsequent changes indeed can work with lower-dimensional
sets and these sets do not get blown up by accident when later intersected with
the domain context.

llvm-svn: 298053

7 years ago[clang-tidy] Ignore deleted members in google-explicit-constructor.
Alexander Kornienko [Fri, 17 Mar 2017 08:40:07 +0000 (08:40 +0000)]
[clang-tidy] Ignore deleted members in google-explicit-constructor.

This fixes http://llvm.org/PR32221.

llvm-svn: 298052

7 years ago[AVX-512] Make VEX encoded FMA instructions available when AVX512 is enabled regardle...
Craig Topper [Fri, 17 Mar 2017 07:37:31 +0000 (07:37 +0000)]
[AVX-512] Make VEX encoded FMA instructions available when AVX512 is enabled regardless of whether +fma was added on the command line.

We weren't able to handle isel of the 128/256-bit FMA instructions when AVX512F was enabled but VLX and FMA weren't.

I didn't mask FeatureAVX512 imply FeatureFMA as I wasn't sure I wanted disabling FMA to also disable AVX512. Instead we just can't prevent FMA instructions if AVX512 is enabled.

Another option would be to promote 128/256-bit to 512-bit, do the operation and extract it. But that requires a lot of extra isel patterns. Since no CPUs exist that support AVX512, but not FMA just using the VEX instructions seems better.

llvm-svn: 298051

7 years ago[X86] Remove unused predicate. NFC
Craig Topper [Fri, 17 Mar 2017 07:37:27 +0000 (07:37 +0000)]
[X86] Remove unused predicate. NFC

llvm-svn: 298050

7 years ago[SystemZ] New CodeGen tests for vector compare / select.
Jonas Paulsson [Fri, 17 Mar 2017 07:11:46 +0000 (07:11 +0000)]
[SystemZ]  New CodeGen tests for vector compare / select.

New SystemZ tests for the improved codegen of vector compare and select,
including cases with a logical combination of two compares.

Review: Ulrich Weigand.
https://reviews.llvm.org/D29489

llvm-svn: 298049

7 years agoAdd SystemZ to utils/update_llc_test_checks.py.
Jonas Paulsson [Fri, 17 Mar 2017 07:11:42 +0000 (07:11 +0000)]
Add SystemZ to utils/update_llc_test_checks.py.

Extend script for auto-generating CHECK lines so that it works for SystemZ.

This is a pre-commit for the new tests resulting from
https://reviews.llvm.org/D29489

llvm-svn: 298048

7 years ago[SystemZ] Add use of super-reg in splitMove()
Jonas Paulsson [Fri, 17 Mar 2017 06:47:08 +0000 (06:47 +0000)]
[SystemZ]  Add use of super-reg in splitMove()

If one of the subregs of the 128 bit reg is undefined when splitMove() splits
a store into two instructions, a use of an undefined physical register
results.

To remedy this, an implicit use of the super register is added onto both new
instructions, along with propagated kill and undef flags.

This was discovered with llvm-stress, and that test case is attached as
test/CodeGen/SystemZ/splitMove_undefReg_mverifier.ll

Thanks to Matthias Braun for helping with a nice explanation.

Review: Ulrich Weigand
llvm-svn: 298047

7 years ago[AVX-512] Give priority to EVEX encoded scalar FMA instructions when we have FMA...
Craig Topper [Fri, 17 Mar 2017 06:10:37 +0000 (06:10 +0000)]
[AVX-512] Give priority to EVEX encoded scalar FMA instructions when we have FMA, AVX512 and no VLX.

We were giving priority if VLX was enabled.

llvm-svn: 298046

7 years ago[X86] Use update_llc_test_checks.py to regenerate a test and add command lines to...
Craig Topper [Fri, 17 Mar 2017 06:00:01 +0000 (06:00 +0000)]
[X86] Use update_llc_test_checks.py to regenerate a test and add command lines to demonstrate that we don't pick EVEX encoded instruction when AVX512 and FMA3 are both enabled.

This bug only exists on the scalar llvm.fma instrinsics. Looks like we don't test the llvm.fma intrinsics very thoroughly. In fact I don't see any tests for the vector versions.

llvm-svn: 298045

7 years ago[X86] Use update_llc_test_checks.py to regenerate a test.
Craig Topper [Fri, 17 Mar 2017 05:59:57 +0000 (05:59 +0000)]
[X86] Use update_llc_test_checks.py to regenerate a test.

llvm-svn: 298044

7 years ago[X86] Cleanup the AddedComplexity values on move immediate instructions. NFC
Craig Topper [Fri, 17 Mar 2017 05:59:54 +0000 (05:59 +0000)]
[X86] Cleanup the AddedComplexity values on move immediate instructions. NFC

This makes the values a little more consistent between similar instruction and reduces the values some. This results in better grouping in the isel table saving a few bytes.

llvm-svn: 298043

7 years ago[AVX-512] Change the input type for some load intrinsics to take void type like the...
Craig Topper [Fri, 17 Mar 2017 05:59:25 +0000 (05:59 +0000)]
[AVX-512] Change the input type for some load intrinsics to take void type like the spec (and the test cases say).

llvm-svn: 298042

7 years ago[AVX-512] Fix test cases that were using the builtins directly without typecasts...
Craig Topper [Fri, 17 Mar 2017 05:59:22 +0000 (05:59 +0000)]
[AVX-512] Fix test cases that were using the builtins directly without typecasts instead of the intrinsic header.

llvm-svn: 298041

7 years ago[AVX-512] Add missing typecasts and parentheses to _mm512_mask_i64gather_ps. My macro...
Craig Topper [Fri, 17 Mar 2017 05:14:37 +0000 (05:14 +0000)]
[AVX-512] Add missing typecasts and parentheses to _mm512_mask_i64gather_ps. My macro cleanup script I used on the others last year must have missed it.

llvm-svn: 298040

7 years ago[XRay][compiler-rt] Add missing include to <string>
Dean Michael Berris [Fri, 17 Mar 2017 03:38:12 +0000 (03:38 +0000)]
[XRay][compiler-rt] Add missing include to <string>

Fixes a build break when using clang-3.9.1 (reported upstream,
post-commit review of D30850).

llvm-svn: 298039