OSDN Git Service

android-x86/external-llvm.git
8 years ago[CMake] Restrict libxar linkage to just llvm-objdump
Chris Bieneman [Thu, 26 May 2016 16:32:40 +0000 (16:32 +0000)]
[CMake] Restrict libxar linkage to just llvm-objdump

At some point we're going to need libObject to have this dependency, but as it is now this is causing too many headaches. This commit will reduce the linkage to just llvm-objdump where it is strictly needed, and we'll cross the libObject bridge later when we need it.

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

8 years agoUse new interface in Triple /NFC
Xinliang David Li [Thu, 26 May 2016 16:28:01 +0000 (16:28 +0000)]
Use new interface in Triple /NFC

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

8 years agoUndo a suboptimal clang-format decision. NFC
Adrian Prantl [Thu, 26 May 2016 16:06:04 +0000 (16:06 +0000)]
Undo a suboptimal clang-format decision. NFC

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

8 years agoSince some time clang itself figures out the default for ms-compatibility-version...
Ismail Donmez [Thu, 26 May 2016 15:52:23 +0000 (15:52 +0000)]
Since some time clang itself figures out the default for ms-compatibility-version  and uses it. Trying to figure it out during build is redundant and also will not work when the environment variable VSINSTALLDIR is not defined (which is not defined if you don't install whole Visual Studio but use Visual C++ Build Tools package).

Tested by bootstrapping clang with clang-cl.

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

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

8 years agoFix build warning introduced in r270552 "[AMDGPU][llvm-mc] Disassembler: support...
Artem Tamazov [Thu, 26 May 2016 15:52:16 +0000 (15:52 +0000)]
Fix build warning introduced in r270552 "[AMDGPU][llvm-mc] Disassembler: support for TTMP/TBA/TMA registers."

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

8 years ago[X86][SSE] When lowering a 256-bit shuffle as PMOVZX, reduce the input vector to...
Simon Pilgrim [Thu, 26 May 2016 15:40:36 +0000 (15:40 +0000)]
[X86][SSE] When lowering a 256-bit shuffle as PMOVZX, reduce the input vector to the lower 128-bit subvector.

Most often as not this is what it started out as, the extraction is zero-cost on AVX and the PMOVZX/PMOVSX folding logic is based around 128-bit loads.

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

8 years ago[Hexagon] Select the aggressive anti-dependency breaker
Krzysztof Parzyszek [Thu, 26 May 2016 15:38:50 +0000 (15:38 +0000)]
[Hexagon] Select the aggressive anti-dependency breaker

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

8 years ago[AMDGPU] Remove exit-on-error flag from test (PR27762)
Diana Picus [Thu, 26 May 2016 15:24:55 +0000 (15:24 +0000)]
[AMDGPU] Remove exit-on-error flag from test (PR27762)

Similar to r269948, but for argument lowering.

Fixes PR27762

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

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

8 years ago[BPF] Remove exit-on-error flag in test (PR27767)
Diana Picus [Thu, 26 May 2016 15:23:50 +0000 (15:23 +0000)]
[BPF] Remove exit-on-error flag in test (PR27767)

The exit-on-error flag is needed to avoid an assert where
llvm::SelectionDAGISel::LowerArguments doesn't create enough arguments. Fill up
with zeroes to reach the right number of args.

Fixes PR27767.

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

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

8 years ago[InstCombine] Catch more bswap cases missed due to zext and truncs.
Chad Rosier [Thu, 26 May 2016 14:58:51 +0000 (14:58 +0000)]
[InstCombine] Catch more bswap cases missed due to zext and truncs.

Fixes PR27824.
Differential Revision: http://reviews.llvm.org/D20591.

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

8 years ago[X86][SSE] Added load_zext_16i8_to_8i32 test
Simon Pilgrim [Thu, 26 May 2016 14:45:30 +0000 (14:45 +0000)]
[X86][SSE] Added load_zext_16i8_to_8i32 test

Odd issue with input vector not being folded into pmovzx on AVX2+ targets

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

8 years ago[ThinLTO] Resolve LinkOnceAny
Teresa Johnson [Thu, 26 May 2016 14:16:52 +0000 (14:16 +0000)]
[ThinLTO] Resolve LinkOnceAny

Summary:
Ensure we keep prevailing copy of LinkOnceAny by converting it to
WeakAny.

Rename odr_resolution test to the now more appropriate weak_resolution
(weak in the linker sense includes linkonce).

Reviewers: joker.eph

Subscribers: llvm-commits, joker.eph

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

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

8 years ago[AArch64] Generate a BFI/BFXIL from 'or (and X, MaskImm), OrImm'.
Chad Rosier [Thu, 26 May 2016 13:27:56 +0000 (13:27 +0000)]
[AArch64] Generate a BFI/BFXIL from 'or (and X, MaskImm), OrImm'.

If and only if the value being inserted sets only known zero bits.

This combine transforms things like

  and w8, w0, #0xfffffff0
  movz w9, #5
  orr w0, w8, w9

into

  movz w8, #5
  bfxil w0, w8, #0, #4

The combine is tuned to make sure we always reduce the number of instructions.
We avoid churning code for what is expected to be performance neutral changes
(e.g., converted AND+OR to OR+BFI).

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

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

8 years agoUse shouldAssumeDSOLocal on AArch64.
Rafael Espindola [Thu, 26 May 2016 12:42:55 +0000 (12:42 +0000)]
Use shouldAssumeDSOLocal on AArch64.

This reduces code duplication and now AArch64 also handles PIE.

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

8 years ago[AVX512] Fix intrinsic cmp{sd|ss} lowering.
Igor Breger [Thu, 26 May 2016 12:42:25 +0000 (12:42 +0000)]
[AVX512] Fix intrinsic cmp{sd|ss} lowering.

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

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

8 years agoAdd auto-exporting of symbols from tools so that plugins work on Windows
John Brawn [Thu, 26 May 2016 11:16:43 +0000 (11:16 +0000)]
Add auto-exporting of symbols from tools so that plugins work on Windows

The problem with plugins on Windows is that when building a plugin DLL it needs
to explicitly link against something (an exe or DLL) if it uses symbols from
that thing, and that thing must explicitly export those symbols. Also there's a
limit of 65535 symbols that can be exported. This means that currently plugins
only work on Windows when using BUILD_SHARED_LIBS, and that doesn't work with
MSVC.

This patch adds an LLVM_EXPORT_SYMBOLS_FOR_PLUGINS option, which when enabled
automatically exports from all LLVM tools the symbols that a plugin could want
to use so that a plugin can link against a tool directly. Plugins can specify
what tool they link against by using PLUGIN_TOOL argument to llvm_add_library.
The option can also be enabled on Linux, though there all it should do is
restrict the set of symbols that are exported as by default all symbols are
exported.

This option is currently OFF by default, as while I've verified that it works
with MSVC, linux gcc, and cygwin gcc, I haven't tried mingw gcc and I have no
idea what will happen on OSX. Also unfortunately we can't turn on
LLVM_ENABLE_PLUGINS when the option is ON as bugpoint-passes needs to be
loaded by both bugpoint.exe and opt.exe which is incompatible with this
approach. Also currently clang plugins don't work with this approach, which
will be fixed in future patches.

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

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

8 years ago[X86][F16C] Added F16C fast-isel tests to match clang/test/CodeGen/f16c-builtins.c
Simon Pilgrim [Thu, 26 May 2016 10:26:56 +0000 (10:26 +0000)]
[X86][F16C] Added F16C fast-isel tests to match clang/test/CodeGen/f16c-builtins.c

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

8 years ago[X86][AVX2] Added gather fast-isel tests to match clang/test/CodeGen/avx2-builtins.c
Simon Pilgrim [Thu, 26 May 2016 10:07:05 +0000 (10:07 +0000)]
[X86][AVX2] Added gather fast-isel tests to match clang/test/CodeGen/avx2-builtins.c

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

8 years ago[Sparc] Extend the assembler printing support for Sparc back-end.
Chris Dewhurst [Thu, 26 May 2016 07:28:31 +0000 (07:28 +0000)]
[Sparc] Extend the assembler printing support for Sparc back-end.

Allows display of floating-point registers and display of assembler meta-data output.

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

8 years ago[MergedLoadStoreMotion] Don't transform across may-throw calls
David Majnemer [Thu, 26 May 2016 07:11:09 +0000 (07:11 +0000)]
[MergedLoadStoreMotion] Don't transform across may-throw calls

It is unsafe to hoist a load before a function call which may throw, the
throw might prevent a pointer dereference.

Likewise, it is unsafe to sink a store after a call which may throw.
The caller might be able to observe the difference.

This fixes PR27858.

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

8 years ago[ConstantFold] NFC cleanup after previous change.
Adam Nemet [Thu, 26 May 2016 07:08:09 +0000 (07:08 +0000)]
[ConstantFold] NFC cleanup after previous change.

Merge two conditions.

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

8 years ago[ConstantFold] Fix incorrect index rewrites for GEPs
Adam Nemet [Thu, 26 May 2016 07:08:05 +0000 (07:08 +0000)]
[ConstantFold] Fix incorrect index rewrites for GEPs

Summary:
If an index for a vector or array type is out-of-range GEP constant
folding tries to factor it into preceding dimensions.  The code however
does not consider addressing of structure field padding which should not
qualify as out-of-range index.

As demonstrated by the testcase, this can occur if the indexing
performed on a vector type and the preceding index is an array type.

SROA generates GEPs for example involving padding bytes as it slices an
alloca.

My fix disables this folding if the element type is a vector type.  I
believe that this is the only way we can end up with padding.  (We have
no access to DataLayout so I am not sure if there is actual robust way
of actually checking the presence of padding.)

Reviewers: majnemer

Subscribers: llvm-commits, Gerolf

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

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

8 years ago[MergedLoadStoreMotion] Small cleanup
David Majnemer [Thu, 26 May 2016 05:43:12 +0000 (05:43 +0000)]
[MergedLoadStoreMotion] Small cleanup

No functional change is intended.

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

8 years agoMemorySSA: Revert r269678 and r268068; replace with special casing in MemorySSA.
Peter Collingbourne [Thu, 26 May 2016 04:58:46 +0000 (04:58 +0000)]
MemorySSA: Revert r269678 and r268068; replace with special casing in MemorySSA.

It turns out that too many passes are relying on alias analysis results
for control dependencies. Until we fix that by introducing a more accurate
modelling of control dependencies, special case assume in MemorySSA instead.

Also introduce tests to ensure we don't regress the FunctionAttrs or LICM
passes.

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

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

8 years agoRevert "[CMake] LINK_LIBS need to be public for Darwin dylib targets"
Steven Wu [Thu, 26 May 2016 04:35:35 +0000 (04:35 +0000)]
Revert "[CMake] LINK_LIBS need to be public for Darwin dylib targets"

This reverts r270723. This commit breaks greendragon.

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

8 years ago[X86] Add the AVX storeu intrinsics to InstCombine and LoopStrengthReduce in the...
Craig Topper [Thu, 26 May 2016 04:28:45 +0000 (04:28 +0000)]
[X86] Add the AVX storeu intrinsics to InstCombine and LoopStrengthReduce in the same places that the SSE/SSE2 storeu intrinsics appear.

I don't really know how to test this. Just seemed like we should be consistent.

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

8 years ago[IRCE] Use C++11 style initializers; NFC
Sanjoy Das [Thu, 26 May 2016 01:50:18 +0000 (01:50 +0000)]
[IRCE] Use C++11 style initializers; NFC

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

8 years ago[ThinLTO/gold] Handle bitcode archives
Teresa Johnson [Thu, 26 May 2016 01:46:41 +0000 (01:46 +0000)]
[ThinLTO/gold] Handle bitcode archives

Summary:
Several changes were required for ThinLTO links involving bitcode
archive static libraries. With this patch clang/llvm bootstraps with
ThinLTO and gold.

The first is that the gold callbacks get_input_file and
release_input_file can normally be used to get file information for
each constituent bitcode file within an archive. However, these
interfaces lock the underlying file and can't be for each archive
constituent for ThinLTO backends where we get all the input files up
front and don't release any until after the backend threads complete.
However, it is sufficient to only get and release once per file, and
then each consituent bitcode file can be accessed via get_view. This
required saving some information to identify which file handle is the
"leader" for each claimed file sharing the same file descriptor, and
other information so that get_input_file isn't necessary later when
processing the backends.

Second, the module paths in the index need to distinguish between
different constituent bitcode files within the same archive file,
otherwise they will all end up with the same archive file path.
Do this by appending the offset within the archive for the start of the
bitcode file, returned by get_input_file when we claim each bitcode file,
and saving that along with the file handle.

Third, rather than have the function importer try to load a file based
on the module path identifier (which now contains a suffix to
distinguish different bitcode files within an archive), use a custom
module loader. This is the same approach taken in libLTO, and I am using
the support refactored into the new LTO.h header in r270509. The module
loader parses the bitcode files out of the memory buffers returned from
gold via the get_view callback and saved in a map. This also means that
we call the function importer directly, rather than add it to the pass
pipeline (which was in the plan to do already for other reasons).

Reviewers: pcc, joker.eph

Subscribers: llvm-commits, joker.eph

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

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

8 years agollvm-objdump: support dumping AUX records for weak externals
Saleem Abdulrasool [Thu, 26 May 2016 01:45:12 +0000 (01:45 +0000)]
llvm-objdump: support dumping AUX records for weak externals

This is a support COFF feature.  Ensure that we can display the weak externals
auxiliary symbol.  It contains useful information (such as the default binding
and how to resolve the symbol).

This reapplies the previous patch with a modification which hopefully should fix
the endianness issues.  The variadic call would promote the ulittle32_t to a
uint32_t which would lose the byte-swapping behaviour desired.

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

8 years agoMemorySSA: Remove argument to createNewAccess function.
Peter Collingbourne [Thu, 26 May 2016 01:19:17 +0000 (01:19 +0000)]
MemorySSA: Remove argument to createNewAccess function.

There is only one caller of MemorySSA::createNewAccess, and it passes true
as the IgnoreNonMemory argument. Remove that argument and fold its behavior
into createNewAccess.

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

8 years agoMemorySSA: Fix example in header comment.
Peter Collingbourne [Thu, 26 May 2016 01:19:14 +0000 (01:19 +0000)]
MemorySSA: Fix example in header comment.

This fixes the example so that it matches the pass's behavior. I was a
little confused by the example until I tried running it and realized that
there was a mistake.

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

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

8 years ago[Kaleidoscope][BuildingAJIT] Add a stub Chapter 2 doc.
Lang Hames [Thu, 26 May 2016 00:38:04 +0000 (00:38 +0000)]
[Kaleidoscope][BuildingAJIT] Add a stub Chapter 2 doc.

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

8 years ago[Kaleidoscope][BuildingAJIT] Make the optimizeModule method for Chapter2
Lang Hames [Thu, 26 May 2016 00:24:18 +0000 (00:24 +0000)]
[Kaleidoscope][BuildingAJIT] Make the optimizeModule method for Chapter2
private.

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

8 years agoPR11740: Disable assembly debug info when assembly already contains line directives
David Blaikie [Thu, 26 May 2016 00:22:26 +0000 (00:22 +0000)]
PR11740: Disable assembly debug info when assembly already contains line directives

If there is already debug info in the assembly file, and user hope to
use -g option for compiling, we think we should not directly report an
error.

According to what GNU assembler did, it just reused the debug info in
the assembly file, and turned off the DEBUG_TYPE option so that there
will be no new debug info emitted by assembler. This fix is just as what
GNU assembler did.

The concern is the situation that there are two .text sections in the
assembly file, one with debug info and the other one without. Currently
with this fix, the assembler will no longer generate any debug info for
the second .text section. And this is what GNU assembler exactly did for
this situation. So I think this still make some sense.

Patch by Zhizhou Yang!

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

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

8 years ago[IRCE] Optimize conjunctions of range checks
Sanjoy Das [Thu, 26 May 2016 00:09:02 +0000 (00:09 +0000)]
[IRCE] Optimize conjunctions of range checks

After this change, we do the expected thing for cases like

```
Check0Passed = /* range check IRCE can optimize */
Check1Passed = /* range check IRCE can optimize */
if (!(Check0Passed && Check1Passed))
  throw_Exception();
```

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

8 years ago[IRCE] Refactor out a parseRangeCheckFromCond; NFC
Sanjoy Das [Thu, 26 May 2016 00:08:24 +0000 (00:08 +0000)]
[IRCE] Refactor out a parseRangeCheckFromCond; NFC

This will later hold more general logic to parse conjunctions of range
checks.

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

8 years ago[PM/PartiallyInlineLibCalls] Commit missing header.
Davide Italiano [Wed, 25 May 2016 23:44:01 +0000 (23:44 +0000)]
[PM/PartiallyInlineLibCalls] Commit missing header.

This should have been committed with the previous commit, but
I forgot to `git add`. Sorry.

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

8 years ago[KaleidoscopeJIT][BuildingAJIT] Remove some copy-pasta from Chapter 1.
Lang Hames [Wed, 25 May 2016 23:42:48 +0000 (23:42 +0000)]
[KaleidoscopeJIT][BuildingAJIT] Remove some copy-pasta from Chapter 1.

This text was accidentally left in when the original document was copied from
Chapter 7 of the Kaleidoscope language series.

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

8 years ago[PM] Port PartiallyInlineLibCalls to the new pass manager.
Davide Italiano [Wed, 25 May 2016 23:38:53 +0000 (23:38 +0000)]
[PM] Port PartiallyInlineLibCalls to the new pass manager.

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

8 years agollvm-dwp: Ensure uncompressed sections are not relocated during processing of later...
David Blaikie [Wed, 25 May 2016 23:37:06 +0000 (23:37 +0000)]
llvm-dwp: Ensure uncompressed sections are not relocated during processing of later inputs

Richard Smith identified this in post commit review of r270466. The
string sections in particular (in the future, possibly all sections - so
I'm not going to bother pulling out just the string sections for the
extra lifetime handling right now) need to remain valid during
processing of all inputs so that elements of the DWPStringPool can be
looked up repeatedly without having to make in-memory copies of string
contents in the noncompressed case (more common in dwp+dwp merge steps
where the memory is a bigger problem because the files are larger).

Using the SmallVector (or any vector) a reallocation on push_back could
cause any of the nested SmallStrings in small mode to move in memory and
invalid pointers to their contents. Using a deque the SmallStrings will
never move around since no elements are removed from the container.

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

8 years ago[Kaleidoscope][BuildingAJIT] Shorten the name of the BuildingAJIT tutorial
Lang Hames [Wed, 25 May 2016 23:34:19 +0000 (23:34 +0000)]
[Kaleidoscope][BuildingAJIT] Shorten the name of the BuildingAJIT tutorial
series.

The original name was pretty long, and likely to look awkward as more
chapters get added.

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

8 years agoRevert "[MC] Support symbolic expressions in assembly directives"
Reid Kleckner [Wed, 25 May 2016 23:29:08 +0000 (23:29 +0000)]
Revert "[MC] Support symbolic expressions in assembly directives"

This reverts commit r270786, it causes the directive_fill.s to fail.

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

8 years ago[Kaleidoscope][BuildingAJIT] Add code for the 2nd chapter of the BuildingAJIT
Lang Hames [Wed, 25 May 2016 23:25:23 +0000 (23:25 +0000)]
[Kaleidoscope][BuildingAJIT] Add code for the 2nd chapter of the BuildingAJIT
tutorial.

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

8 years ago[codeview] Use comdats for debug info describing comdat functions
Reid Kleckner [Wed, 25 May 2016 23:16:12 +0000 (23:16 +0000)]
[codeview] Use comdats for debug info describing comdat functions

Summary:
This allows the linker to discard unused symbol information for comdat
functions that were discarded during the link. Before this change,
searching for the name of an inline function in the debugger would
return multiple results, one per symbol subsection in the object file.
After this change, there is only one result, the result for the function
chosen by the linker.

Reviewers: zturner, majnemer

Subscribers: aaboud, amccarth, llvm-commits

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

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

8 years agoObjective-C Class Properties: Autoupgrade "Class Properties" module flag.
Manman Ren [Wed, 25 May 2016 23:14:48 +0000 (23:14 +0000)]
Objective-C Class Properties: Autoupgrade "Class Properties" module flag.

When we have "Image Info Version" module flag but don't have "Class Properties"
module flag, set "Class Properties" module flag to 0, so we can correctly emit
errors when one module has the flag set and another module does not.

rdar://26469641

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

8 years ago[NVPTX] Don't (incorrectly) say that the NVVMReflect pass preserves all analyses.
Justin Lebar [Wed, 25 May 2016 23:12:38 +0000 (23:12 +0000)]
[NVPTX] Don't (incorrectly) say that the NVVMReflect pass preserves all analyses.

Reviewers: tra

Subscribers: jholewinski, llvm-commits

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

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

8 years ago[CUDA] Add section to docs about controlling fp optimizations.
Justin Lebar [Wed, 25 May 2016 23:11:31 +0000 (23:11 +0000)]
[CUDA] Add section to docs about controlling fp optimizations.

Reviewers: rnk

Subscribers: llvm-commits, tra

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

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

8 years agoRemove unused header.
Eric Christopher [Wed, 25 May 2016 22:56:58 +0000 (22:56 +0000)]
Remove unused header.

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

8 years ago[Kaleidoscope][BuildingAJIT] Delete trailing whitespace.
Lang Hames [Wed, 25 May 2016 22:48:43 +0000 (22:48 +0000)]
[Kaleidoscope][BuildingAJIT] Delete trailing whitespace.

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

8 years ago[MC] Support symbolic expressions in assembly directives
Petr Hosek [Wed, 25 May 2016 22:47:51 +0000 (22:47 +0000)]
[MC] Support symbolic expressions in assembly directives

This matches the behavior of GNU assembler which supports symbolic
expressions in absolute expressions used in assembly directives.

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

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

8 years agoDon't repeat name in comment and git-clang-format.
Rafael Espindola [Wed, 25 May 2016 22:44:06 +0000 (22:44 +0000)]
Don't repeat name in comment and git-clang-format.

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

8 years agoWork around an MSVC compiler issue in r270776.
Adrian Prantl [Wed, 25 May 2016 22:37:29 +0000 (22:37 +0000)]
Work around an MSVC compiler issue in r270776.

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

8 years ago[Kaleidoscope][BuildingAJIT] Fix code-block indents.
Lang Hames [Wed, 25 May 2016 22:33:25 +0000 (22:33 +0000)]
[Kaleidoscope][BuildingAJIT] Fix code-block indents.

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

8 years ago[LazyValueInfo] Simplify `return after else`. NFCI.
Davide Italiano [Wed, 25 May 2016 22:29:34 +0000 (22:29 +0000)]
[LazyValueInfo] Simplify `return after else`. NFCI.

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

8 years ago[Kaleidoscope][BuildingAJIT] Add a description of the KaleidoscopeJIT addModule
Lang Hames [Wed, 25 May 2016 22:27:25 +0000 (22:27 +0000)]
[Kaleidoscope][BuildingAJIT] Add a description of the KaleidoscopeJIT addModule
method to Chapter1 of the BuildingAJIT tutorial.

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

8 years ago[BasicAA] Improve precision of alloca vs. inbounds GEP alias queries
Michael Kuperstein [Wed, 25 May 2016 22:23:08 +0000 (22:23 +0000)]
[BasicAA] Improve precision of alloca vs. inbounds GEP alias queries

If a we have (a) a GEP and (b) a pointer based on an alloca, and the
beginning of the object the GEP points would have a negative offset with
repsect to the alloca, then the GEP can not alias pointer (b).

For example, consider code like:

struct { int f0, int f1, ...} foo;
...
foo alloca;
foo *random = bar(alloca);
int *f0 = &alloca.f0
int *f1 = &random->f1;

Which is lowered, approximately, to:
%alloca = alloca %struct.foo
%random = call %struct.foo* @random(%struct.foo* %alloca)
%f0 = getelementptr inbounds %struct, %struct.foo* %alloca, i32 0, i32 0
%f1 = getelementptr inbounds %struct, %struct.foo* %random, i32 0, i32 1

Assume %f1 and %f0 alias. Then %f1 would point into the object allocated
by %alloca. Since the %f1 GEP is inbounds, that means %random must also
point into the same object. But since %f0 points to the beginning of %alloca,
the highest %f1 can be is (%alloca + 3). This means %random can not be higher
than (%alloca - 1), and so is not inbounds, a contradiction.

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

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

8 years agoPR26055: Speed up LiveDebugValues by replacing lists with bitvectors.
Adrian Prantl [Wed, 25 May 2016 22:21:12 +0000 (22:21 +0000)]
PR26055: Speed up LiveDebugValues by replacing lists with bitvectors.
This patch modifies the LiveDebugValues pass to use more efficient set
data structures as outlined in PR26055. Both VarLocSet and VarLocList are
now SparseBitVectors which allows us to perform much faster bitvector
arithmetic on them.

The speedup can be in the order of minutes especially on ASANified code.

The change is not NFC in the assembler output because the inserted
DBG_VALUEs are now sorted by variable and location.

Many thanks to Daniel Berlin for helping design the improved algorithm and
reviewing the patch.

https://llvm.org/bugs/show_bug.cgi?id=26055
http://reviews.llvm.org/D20178
rdar://problem/24091200

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

8 years ago[MBB] Early exit to reduce indentation, per coding guidelines. NFC.
Chad Rosier [Wed, 25 May 2016 21:53:46 +0000 (21:53 +0000)]
[MBB] Early exit to reduce indentation, per coding guidelines. NFC.

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

8 years agoLook for a loop's starting location in the llvm.loop metadata
Hal Finkel [Wed, 25 May 2016 21:42:37 +0000 (21:42 +0000)]
Look for a loop's starting location in the llvm.loop metadata

Getting accurate locations for loops is important, because those locations are
used by the frontend to generate optimization remarks. Currently, optimization
remarks for loops often appear on the wrong line, often the first line of the
loop body instead of the loop itself. This is confusing because that line might
itself be another loop, or might be somewhere else completely if the body was
inlined function call. This happens because of the way we find the loop's
starting location. First, we look for a preheader, and if we find one, and its
terminator has a debug location, then we use that. Otherwise, we look for a
location on an instruction in the loop header.

The fallback heuristic is not bad, but will almost always find the beginning of
the body, and not the loop statement itself. The preheader location search
often fails because there's often not a preheader, and even when there is a
preheader, depending on how it was formed, it sometimes carries the location of
some preceeding code.

I don't see any good theoretical way to fix this problem. On the other hand,
this seems like a straightforward solution: Put the debug location in the
loop's llvm.loop metadata. A companion Clang patch will cause Clang to insert
llvm.loop metadata with appropriate locations when generating debugging
information. With these changes, our loop remarks have much more accurate
locations.

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

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

8 years agoSort includes.
Rafael Espindola [Wed, 25 May 2016 21:37:29 +0000 (21:37 +0000)]
Sort includes.

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

8 years agoPort the strip-invalid-debuginfo logic to the legacy verifier pass, too.
Adrian Prantl [Wed, 25 May 2016 21:33:20 +0000 (21:33 +0000)]
Port the strip-invalid-debuginfo logic to the legacy verifier pass, too.

Since r268966 the modern Verifier pass defaults to stripping invalid debug info
in nonasserts builds.  This patch ports this behavior back to the legacy
Verifier pass as well.  The primary motivation is that the clang frontend
accepts bitcode files as input but is still using the legacy pass pipeline.

Background: The problem I'm trying to solve with this sequence of patches is
that historically we've done a really bad job at verifying debug info. We want
to be able to make the verifier stricter without having to worry about breaking
bitcode compatibility with existing producers. For example, we don't necessarily
want IR produced by an older version of clang to be rejected by an LTO link just
because of malformed debug info, and rather provide an option to strip it. Note
that merely outdated (but well-formed) debug info would continue to be
auto-upgraded in this scenario.

http://reviews.llvm.org/D20629
<rdar://problem/26448800>

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

8 years ago[X86][SSE41] Removed pblendw intrinsics tests - they are auto-upgraded
Simon Pilgrim [Wed, 25 May 2016 21:27:58 +0000 (21:27 +0000)]
[X86][SSE41] Removed pblendw intrinsics tests - they are auto-upgraded

Equivalent tests included in sse41-intrinsics-x86-upgrade.ll - the i8/i32 immediate diff doesn't matter anymore

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

8 years agoMove whole-program virtual call optimization pass after function attribute inference...
Peter Collingbourne [Wed, 25 May 2016 21:26:14 +0000 (21:26 +0000)]
Move whole-program virtual call optimization pass after function attribute inference in LTO pipeline.

As a result of D18634 we no longer infer certain attributes on linkonce_odr
functions at compile time, and may only infer them at LTO time. The readnone
attribute in particular is required for virtual constant propagation (part
of whole-program virtual call optimization) to work correctly.

This change moves the whole-program virtual call optimization pass after
the function attribute inference passes, and enables the attribute inference
passes at opt level 1, so that virtual constant propagation has a chance to
work correctly for linkonce_odr functions.

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

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

8 years ago[X86][SSE41] Regenerated intrinsics tests
Simon Pilgrim [Wed, 25 May 2016 21:21:51 +0000 (21:21 +0000)]
[X86][SSE41] Regenerated intrinsics tests

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

8 years ago[TLI] Also cover Linux 64 libfunc (stat64, ...) prototype checking.
Ahmed Bougacha [Wed, 25 May 2016 21:16:33 +0000 (21:16 +0000)]
[TLI] Also cover Linux 64 libfunc (stat64, ...) prototype checking.

My script missed those in r270750.

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

8 years ago[X86][SSE41] Removed blendpd/blendps intrinsics tests - they are auto-upgraded
Simon Pilgrim [Wed, 25 May 2016 21:06:36 +0000 (21:06 +0000)]
[X86][SSE41] Removed blendpd/blendps intrinsics tests - they are auto-upgraded

Equivalent tests included in sse41-intrinsics-x86-upgrade.ll

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

8 years agofix typo; NFC
Sanjay Patel [Wed, 25 May 2016 21:03:31 +0000 (21:03 +0000)]
fix typo; NFC

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

8 years agoValueMaterializer: rename materializeDeclFor() to materialize()
Mehdi Amini [Wed, 25 May 2016 21:03:21 +0000 (21:03 +0000)]
ValueMaterializer: rename materializeDeclFor() to materialize()

It may materialize a declaration, or a definition. The name could
be misleading. This is following a merge of materializeInitFor()
into materializeDeclFor().

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

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

8 years agoValueMaterializer: fuse materializeDeclFor and materializeInitFor (NFC)
Mehdi Amini [Wed, 25 May 2016 21:01:51 +0000 (21:01 +0000)]
ValueMaterializer: fuse materializeDeclFor and materializeInitFor (NFC)

They were originally separated to handle the co-recursion between
the ValueMapper and the ValueMaterializer. This recursion does not
exist anymore: the ValueMapper now uses a Worklist and the
ValueMaterializer is scheduling job on the Worklist.

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

From: Mehdi Amini <mehdi.amini@apple.com>

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

8 years agoIRLinker: fix double scheduling of mapping a global value because of an alias
Mehdi Amini [Wed, 25 May 2016 21:00:44 +0000 (21:00 +0000)]
IRLinker: fix double scheduling of mapping a global value because of an alias

This test was hitting an assertion in the value mapper because
the IRLinker was trying to map two times @A while materializing
the initializer for @C.

Fix http://llvm.org/PR27850

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

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

8 years ago[X86][AVX2] Regenerate avx2 vector shift tests
Simon Pilgrim [Wed, 25 May 2016 21:00:40 +0000 (21:00 +0000)]
[X86][AVX2] Regenerate avx2 vector shift tests

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

8 years ago[libfuzzer] replacing unittest for truncate_units with functional test.
Mike Aizatsky [Wed, 25 May 2016 21:00:17 +0000 (21:00 +0000)]
[libfuzzer] replacing unittest for truncate_units with functional test.

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

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

8 years agoSimplify std::all_of/any_of predicates by using llvm::all_of/any_of. NFCI.
Simon Pilgrim [Wed, 25 May 2016 20:41:11 +0000 (20:41 +0000)]
Simplify std::all_of/any_of predicates by using llvm::all_of/any_of. NFCI.

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

8 years ago[codeview] Move StreamInterface and StreamReader to libcodeview.
Zachary Turner [Wed, 25 May 2016 20:37:03 +0000 (20:37 +0000)]
[codeview] Move StreamInterface and StreamReader to libcodeview.

We have need to reuse this functionality, including making
additional generic stream types that are smarter about how and
when they copy memory versus referencing the original memory.
So all of these structures belong in the common library
rather than being pdb specific.

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

8 years ago[TLI] Fix NumParams==0 prototype checking typo.
Ahmed Bougacha [Wed, 25 May 2016 20:22:45 +0000 (20:22 +0000)]
[TLI] Fix NumParams==0 prototype checking typo.

There was a typo in r267758. It caused invalid accesses when
given something like "void @free(...)", as NumParams == 0, and
we then try to look at the 0th parameter.

Turns out, most of these were untested; add both attribute
and missing-prototype checks for all libc libfuncs.

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

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

8 years agoSimplify std::all_of predicate (to one line) by using llvm::all_of. NFCI.
Simon Pilgrim [Wed, 25 May 2016 20:17:39 +0000 (20:17 +0000)]
Simplify std::all_of predicate (to one line) by using llvm::all_of. NFCI.

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

8 years agoSimplify std::all_of predicate (to one line) by using llvm::all_of. NFCI.
Simon Pilgrim [Wed, 25 May 2016 20:13:39 +0000 (20:13 +0000)]
Simplify std::all_of predicate (to one line) by using llvm::all_of. NFCI.

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

8 years agoFix shouldAssumeDSOLocal for private linkage.
Rafael Espindola [Wed, 25 May 2016 19:55:16 +0000 (19:55 +0000)]
Fix shouldAssumeDSOLocal for private linkage.

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

8 years ago[libFuzzer] document the proposed FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
Kostya Serebryany [Wed, 25 May 2016 18:41:53 +0000 (18:41 +0000)]
[libFuzzer] document the proposed FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION

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

8 years ago[IR] Copy comdats in GlobalObject::copyAttributesFrom
Reid Kleckner [Wed, 25 May 2016 18:36:22 +0000 (18:36 +0000)]
[IR] Copy comdats in GlobalObject::copyAttributesFrom

This is probably correct for all uses except cross-module IR linking,
where we need to move the comdat from the source module to the
destination module.

Fixes PR27870.

Reviewers: majnemer

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

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

8 years ago[llvm-pdbdump] Dump raw stream contents as binary block.
Zachary Turner [Wed, 25 May 2016 18:32:07 +0000 (18:32 +0000)]
[llvm-pdbdump] Dump raw stream contents as binary block.

Dumping it as ASCII makes it fairly useless.

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

8 years agoTableGen: Use StringRef instead of std::string
Matt Arsenault [Wed, 25 May 2016 18:07:40 +0000 (18:07 +0000)]
TableGen: Use StringRef instead of std::string

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

8 years agoAMDGPU: Fix v2i64/v2f64 bitcasts
Matt Arsenault [Wed, 25 May 2016 18:07:36 +0000 (18:07 +0000)]
AMDGPU: Fix v2i64/v2f64 bitcasts

These operations tend to get promoted away to v4i32 so
this doesn't happen often.

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

8 years agoAMDGPU: Fix missing br_cc i1 test coverage
Matt Arsenault [Wed, 25 May 2016 17:58:27 +0000 (17:58 +0000)]
AMDGPU: Fix missing br_cc i1 test coverage

Also un xfail a test.

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

8 years ago[SelectionDAG] Add smarts for BSWAP in computeKnownBits.
Chad Rosier [Wed, 25 May 2016 17:52:38 +0000 (17:52 +0000)]
[SelectionDAG] Add smarts for BSWAP in computeKnownBits.

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

8 years agoAMDGPU: Make vectorization defeating test changes
Matt Arsenault [Wed, 25 May 2016 17:42:39 +0000 (17:42 +0000)]
AMDGPU: Make vectorization defeating test changes

Simplifies test updates in the future.

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

8 years ago[PM] CorrelatedValuePropagation: pass state to function. NFCI.
Davide Italiano [Wed, 25 May 2016 17:39:54 +0000 (17:39 +0000)]
[PM] CorrelatedValuePropagation: pass state to function. NFCI.

While here, convert the logic of the pass to use static function(s).
This is in preparation for porting this pass to the new PM.

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

8 years agoAMDGPU: Fix inconsistent lowering of select of vectors
Matt Arsenault [Wed, 25 May 2016 17:34:58 +0000 (17:34 +0000)]
AMDGPU: Fix inconsistent lowering of select of vectors

f32 vectors would use a sequence of BFI instructions instead
of unrolled cmp + select. This was better in the case of a VALU
select with SGPR inputs, but we don't have a way of dealing with that
in the DAG.

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

8 years ago[x86] avoid code explosion from LoopVectorizer for gather loop (PR27826)
Sanjay Patel [Wed, 25 May 2016 17:27:54 +0000 (17:27 +0000)]
[x86] avoid code explosion from LoopVectorizer for gather loop (PR27826)

By making pointer extraction from a vector more expensive in the cost model,
we avoid the vectorization of a loop that is very likely to be memory-bound:
https://llvm.org/bugs/show_bug.cgi?id=27826

There are still bugs related to this, so we may need a more general solution
to avoid vectorizing obviously memory-bound loops when we don't have HW gather
support.

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

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

8 years agoUse new triple API to check if comdat is supported
Xinliang David Li [Wed, 25 May 2016 17:17:51 +0000 (17:17 +0000)]
Use new triple API to check if comdat is supported

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

8 years agoAdd a new helper API in triple /NFC
Xinliang David Li [Wed, 25 May 2016 17:11:31 +0000 (17:11 +0000)]
Add a new helper API in triple /NFC

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

8 years ago[obj2yaml] [yaml2obj] MachO support for rebase opcodes
Chris Bieneman [Wed, 25 May 2016 17:09:07 +0000 (17:09 +0000)]
[obj2yaml] [yaml2obj] MachO support for rebase opcodes

This is the first bit of support for MachO __LINKEDIT segment data.

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

8 years ago[CMake] LINK_LIBS need to be public for Darwin dylib targets
Chris Bieneman [Wed, 25 May 2016 17:08:43 +0000 (17:08 +0000)]
[CMake] LINK_LIBS need to be public for Darwin dylib targets

This should actually address PR27855. This results in adding references to the system libs inside generated dylibs so that they get correctly pulled in when linking against the dylib.

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

8 years agoMove and add comments to the top for tailcall-string-rvo.ll
Tim Shen [Wed, 25 May 2016 17:01:09 +0000 (17:01 +0000)]
Move and add comments to the top for tailcall-string-rvo.ll

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

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

8 years ago[SDAG] Add a fallback multiplication expansion
Hal Finkel [Wed, 25 May 2016 16:50:22 +0000 (16:50 +0000)]
[SDAG] Add a fallback multiplication expansion

LegalizeIntegerTypes does not have a way to expand multiplications for large
integer types (i.e. larger than twice the native bit width). There's no
standard runtime call to use in that case, and so we'd just assert.

Unfortunately, as it turns out, it is possible to hit this case from
standard-ish C code in rare cases. A particular case a user ran into yesterday
involved an __int128 induction variable and a loop with a quadratic (not
linear) recurrence which triggered some backend logic using SCEVExpander. In
this case, the BinomialCoefficient code in SCEV generates some i129 variables,
which get widened to i256. At a high level, this is not actually good (i.e. the
underlying optimization, PPCLoopPreIncPrep, should not be transforming the loop
in question for performance reasons), but regardless, the backend shouldn't
crash because of cost-modeling issues in the optimizer.

This is a straightforward implementation of the multiplication expansion, based
on the algorithm in Hacker's Delight. I validated it against the code for the
mul256b function from http://locklessinc.com/articles/256bit_arithmetic/ using
random inputs. There should be no functional change for previously-working code
(the new expansion code only replaces an assert).

Fixes PR19797.

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

8 years ago[ThinLTO] Fix test check prefix so that intended prefix tested
Teresa Johnson [Wed, 25 May 2016 16:45:08 +0000 (16:45 +0000)]
[ThinLTO] Fix test check prefix so that intended prefix tested

There aren't any checks with prefix PROMOTE, should be PROMOTE_MOD1
which wasn't being tested (but works as expected).

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

8 years ago[x86, AVX] allow explicit calls to VZERO* to modify state in VZeroUpperInserter pass...
Sanjay Patel [Wed, 25 May 2016 16:39:47 +0000 (16:39 +0000)]
[x86, AVX] allow explicit calls to VZERO* to modify state in VZeroUpperInserter pass (PR27823)

As noted in the review, there are still problems, so this doesn't the bug completely.

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

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

8 years ago[RuntimeDyld] Call the SymbolResolver::findSymbolInLogicalDylib method when
Lang Hames [Wed, 25 May 2016 16:23:59 +0000 (16:23 +0000)]
[RuntimeDyld] Call the SymbolResolver::findSymbolInLogicalDylib method when
searching for external symbols, and fall back to the SymbolResolver::findSymbol
method if the former returns null.

This makes RuntimeDyld behave more like a static linker: Symbol definitions
from within the current module's "logical dylib" will be preferred to
external definitions. We can build on this behavior in the future to properly
support weak symbol handling.

Custom symbol resolvers that override the findSymbolInLogicalDylib method may
notice changes due to this patch. Clients who have not overridden this method
should generally be unaffected, however users of the OrcMCJITReplacement class
may notice changes.

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

8 years agoClarify that we match BSwap in InstCombine and BitReverse in CGP. NFC.
Chad Rosier [Wed, 25 May 2016 16:22:14 +0000 (16:22 +0000)]
Clarify that we match BSwap in InstCombine and BitReverse in CGP. NFC.

Also, rename recognizeBitReverseOrBSwapIdiom to recognizeBSwapOrBitReverseIdiom,
so the ordering of the MatchBSwaps and MatchBitReversals arguments are
consistent with the function name.

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

8 years ago[X86][AVX] Sync with clang/test/CodeGen/avx2-builtins.c
Simon Pilgrim [Wed, 25 May 2016 15:30:08 +0000 (15:30 +0000)]
[X86][AVX] Sync with clang/test/CodeGen/avx2-builtins.c

Only tests for the gather intrinsic are still to be added

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