platform/upstream/llvm.git
8 years ago[libunwind][ARM] Improve unwinder stack usage - Make WMMX support optional
Asiri Rathnayake [Thu, 7 Jul 2016 10:55:39 +0000 (10:55 +0000)]
[libunwind][ARM] Improve unwinder stack usage - Make WMMX support optional

These registers are only available on a limited set of ARM targets (those
based on XScale). Other targets should not have to pay the cost of these.

This patch shaves off about ~300 bytes of stack usage and ~1KB of code-size.

Differential revision: http://reviews.llvm.org/D21991
Reviewers: bcraig, compnerd

Change-Id: I2d7a1911a193bd70b123e78747e1a7d1482463c7
llvm-svn: 274744

8 years agoTry to fix the OSX build with old SDK after r274725
Tamas Berghammer [Thu, 7 Jul 2016 10:38:05 +0000 (10:38 +0000)]
Try to fix the OSX build with old SDK after r274725

llvm-svn: 274743

8 years ago[ARM] Do not test for CPUs, use SubtargetFeatures. Also remove 1 flag
Diana Picus [Thu, 7 Jul 2016 09:11:39 +0000 (09:11 +0000)]
[ARM] Do not test for CPUs, use SubtargetFeatures. Also remove 1 flag

This is a follow-up for r273544.

The end goal is to get rid of the isSwift / isCortexXY / isWhatever methods.

This commit also removes a command line flag that isn't used in any of the tests:
check-vmlx-hazards. It can be replaced easily with the mattr mechanism, since
this is now a subtarget feature.

There is still some work left regarding FeatureExpandMLx. In the past MLx
expansion was enabled for subtargets with hasVFP2(), until r129775 [1] switched
from that to isCortexA9, without too much justification.

In spite of that, the code performing MLx expansion still contains calls to
isSwift/isLikeA9, although the results of those are pretty clear given that
we're only enabling it for the A9.

We should try to enable it for all targets that have FeatureHasVMLxHazards, as
it seems to be closely related to that behaviour, and if that is possible try to
clean up the MLx expansion pass from all calls to isWhatever. This will require
some performance testing, so it will be done in another patch.

[1] http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20110418/119725.html

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

llvm-svn: 274742

8 years agoImplement GetMemoryRegions() for Linux and Mac OSX core files.
Howard Hellyer [Thu, 7 Jul 2016 08:21:28 +0000 (08:21 +0000)]
Implement GetMemoryRegions() for Linux and Mac OSX core files.

Summary:
This patch fills in the implementation of GetMemoryRegions() on the Linux and Mac OS core file implementations of lldb_private::Process (ProcessElfCore::GetMemoryRegions and ProcessMachCore::GetMemoryRegions.) The GetMemoryRegions API was added under: http://reviews.llvm.org/D20565

The patch re-uses the m_core_range_infos list that was recently added to implement GetMemoryRegionInfo in both ProcessElfCore and ProcessMachCore to ensure the returned regions match the regions returned by Process::GetMemoryRegionInfo(addr_t load_addr, MemoryRegionInfo &region_info).

Reviewers: clayborg

Subscribers: labath, lldb-commits

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

llvm-svn: 274741

8 years ago[LCG] Hoist the definitions of the stream operator friends to be inline
Chandler Carruth [Thu, 7 Jul 2016 07:52:07 +0000 (07:52 +0000)]
[LCG] Hoist the definitions of the stream operator friends to be inline
friend definitions.

Based on the experiments Sean Silva and Reid did, this seems the safest
course of action and also will work around a questionable warning
provided by GCC6 on the old form of the code. Thanks for Davide pointing
out the issue and other suggesting ways to fix.

llvm-svn: 274740

8 years ago[ELF] - Fixed incorrect logic of version assignments when mixing wildcards with value...
George Rimar [Thu, 7 Jul 2016 07:45:27 +0000 (07:45 +0000)]
[ELF] - Fixed incorrect logic of version assignments when mixing wildcards with values matching.

Previously we had incorrect logic here. Imagine we would have the next script:

LIBSAMPLE_1.0
{
  global:
   a_2;
 local:
  *;
};

LIBSAMPLE_2.0
{
  global:
   a*;
};
According to previous logic it would assign version 1 to a_2 and then
would try to reassign it to version 2 because of applying wildcard a*.
And show a warning about that.

Generally Ian Lance Tailor wrote about next rules that should be applied:
(http://www.airs.com/blog/archives/300)

Here are the current rules for gold:

"If there is an exact match for the mangled name, we use it. If there is more than one exact match, we give a warning, and we use the first tag in the script which matches. If a symbol has an exact match as both global and local for the same version tag, we give an error.
Otherwise, we look for an extern C++ or an extern Java exact match. If we find an exact match, we use it. If there is more than one exact match, we give a warning, and we use the first tag in the script which matches. If a symbol has an exact match as both global and local for the same version tag, we give an error.
Otherwise, we look through the wildcard patterns, ignoring “*” patterns. We look through the version tags in reverse order. For each version tag, we look through the global patterns and then the local patterns. We use the first match we find (i.e., the last matching version tag in the file).
Otherwise, we use the “*” pattern if there is one. We give a warning if there are multiple “*” patterns."

Patch makes wildcard matching to be in revered order and to follow after the regular naming matching.

Differential revision: http://reviews.llvm.org/D21894

llvm-svn: 274739

8 years ago[LoopAccessAnalysis] Fix an integer overflow
David Majnemer [Thu, 7 Jul 2016 06:24:36 +0000 (06:24 +0000)]
[LoopAccessAnalysis] Fix an integer overflow

We were inappropriately using 32-bit types to account for quantities
that can be far larger.

Fixed in PR28443.

llvm-svn: 274737

8 years ago[AVX512] Zero extend the result of vpcmpeq/vpcmpgt and similar intrinsics in the...
Craig Topper [Thu, 7 Jul 2016 06:11:07 +0000 (06:11 +0000)]
[AVX512] Zero extend the result of vpcmpeq/vpcmpgt and similar intrinsics in the autoupgrade code. This currently results in worse codegen but is needed for correctness.

llvm-svn: 274736

8 years agoFixed a bug in vectorizing GEP before gather/scatter intrinsic.
Elena Demikhovsky [Thu, 7 Jul 2016 06:06:46 +0000 (06:06 +0000)]
Fixed a bug in vectorizing GEP before gather/scatter intrinsic.

Vectorizing GEP was incorrect and broke SSA in some cases.

The patch fixes PR27997 https://llvm.org/bugs/show_bug.cgi?id=27997.

Differential revision: http://reviews.llvm.org/D22035

llvm-svn: 274735

8 years ago[CodeView] Implement support for thread-local variables
David Majnemer [Thu, 7 Jul 2016 05:14:21 +0000 (05:14 +0000)]
[CodeView] Implement support for thread-local variables

llvm-svn: 274734

8 years ago[AST] Tighten up the bitfield in TemplateSpecializationType
David Majnemer [Thu, 7 Jul 2016 04:43:11 +0000 (04:43 +0000)]
[AST] Tighten up the bitfield in TemplateSpecializationType

Optimize the bitfield types to conserve space for the MSVC ABI.

llvm-svn: 274733

8 years ago[AST] Use ArrayRef in more interfaces
David Majnemer [Thu, 7 Jul 2016 04:43:07 +0000 (04:43 +0000)]
[AST] Use ArrayRef in more interfaces

ArrayRef is a little better than passing around a pointer/length
pair.

No functional change is intended.

llvm-svn: 274732

8 years ago[clang-tidy] Enhance redundant-expression check
Etienne Bergeron [Thu, 7 Jul 2016 04:03:05 +0000 (04:03 +0000)]
[clang-tidy] Enhance redundant-expression check

Summary: This patch is adding support to recognize more complex redundant expressions.

Reviewers: alexfh

Subscribers: aaron.ballman, cfe-commits, chrisha

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

llvm-svn: 274731

8 years agoCorrectly define "zlib" feature.
Rui Ueyama [Thu, 7 Jul 2016 03:55:57 +0000 (03:55 +0000)]
Correctly define "zlib" feature.

We have "REQUIRES: zlib" in our test, but zlib was not defined,
so the test did not run on any platform.

llvm-svn: 274730

8 years agoFix endianness issue.
Rui Ueyama [Thu, 7 Jul 2016 03:55:55 +0000 (03:55 +0000)]
Fix endianness issue.

Previously, ch_size was read in host byte order, so if a host and
a target are different in byte order, we would produce a corrupted
output.

llvm-svn: 274729

8 years agoDefine endianness-aware type for Elf_Chdr.
Rui Ueyama [Thu, 7 Jul 2016 03:53:00 +0000 (03:53 +0000)]
Define endianness-aware type for Elf_Chdr.

llvm-svn: 274728

8 years ago[esan|cfrag] Handle binaries built with -esan-aux-field-info=false
Qin Zhao [Thu, 7 Jul 2016 03:20:24 +0000 (03:20 +0000)]
[esan|cfrag] Handle binaries built with -esan-aux-field-info=false

Summary:
Handles binaries built with -esan-aux-field-info=false and print less
information.

Updates test struct-simple.cpp.

Reviewers: aizatsky

Subscribers: llvm-commits, bruening, eugenis, kcc, zhaoqin, kubabrecka, vitalybuka

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

llvm-svn: 274727

8 years ago[esan:cfrag] Add option -esan-aux-field-info
Qin Zhao [Thu, 7 Jul 2016 03:20:16 +0000 (03:20 +0000)]
[esan:cfrag] Add option -esan-aux-field-info

Summary:
Adds option -esan-aux-field-info to control generating binary with
auxiliary struct field information.

Extracts code for creating auxiliary information from
createCacheFragInfoGV into createCacheFragAuxGV.

Adds test struct_field_small.ll for -esan-aux-field-info test.

Reviewers: aizatsky

Subscribers: llvm-commits, bruening, eugenis, kcc, zhaoqin, vitalybuka

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

llvm-svn: 274726

8 years agodebugserver will now report the minimum version load command
Jason Molenda [Thu, 7 Jul 2016 03:12:01 +0000 (03:12 +0000)]
debugserver will now report the minimum version load command
os name and version # from the mach-o binary as it scans the
header/load commands from memory and sends the details back
in the jGetLoadedDynamicLibrariesInfos response.  lldb isn't
using these fields yet but I have a suspicion I'm going to
need them soon.

<rdar://problem/25251243>

llvm-svn: 274725

8 years agoFix formatting.
Rui Ueyama [Thu, 7 Jul 2016 02:46:30 +0000 (02:46 +0000)]
Fix formatting.

llvm-svn: 274724

8 years agoDo not call warning() from ELFOptTable::parse().
Rui Ueyama [Thu, 7 Jul 2016 01:58:04 +0000 (01:58 +0000)]
Do not call warning() from ELFOptTable::parse().

warning() depends on Config->FatalWarnings, so we don't want to call
that function before we initialize that member.

llvm-svn: 274723

8 years agoThinLTO: Remove check for multiple modules before applying weak resolutions.
Peter Collingbourne [Thu, 7 Jul 2016 01:51:11 +0000 (01:51 +0000)]
ThinLTO: Remove check for multiple modules before applying weak resolutions.

This check is not only unnecessary, it can produce the wrong result. If we
are linking a single module and it has an exported linkonce symbol, we need
to promote to weak in order to avoid PR19901-style problems.

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

llvm-svn: 274722

8 years agoUse the class version of getPointerTy rather than getting back to
Eric Christopher [Thu, 7 Jul 2016 01:49:59 +0000 (01:49 +0000)]
Use the class version of getPointerTy rather than getting back to
ourselves via a call through the DAG.

llvm-svn: 274721

8 years agoUse the class definition for useSoftFloat.
Eric Christopher [Thu, 7 Jul 2016 01:49:57 +0000 (01:49 +0000)]
Use the class definition for useSoftFloat.

llvm-svn: 274720

8 years agoFix indentation.
Rui Ueyama [Thu, 7 Jul 2016 01:21:14 +0000 (01:21 +0000)]
Fix indentation.

llvm-svn: 274719

8 years agoAdd support to debugserver for some new ways to interact with dyld
Jason Molenda [Thu, 7 Jul 2016 01:09:23 +0000 (01:09 +0000)]
Add support to debugserver for some new ways to interact with dyld
to find the solibs loaded in a process.  Support two new ways of
sending the jGetLoadedDynamicLibrariesInfos packet to debugserver
and add a new jGetSharedCacheInfo packet.  Update the documentation
for these packets as well.  The changes to lldb to use these will
be a separate commit.

<rdar://problem/25251243>

llvm-svn: 274718

8 years agoRename argument for consistency.
Eric Christopher [Thu, 7 Jul 2016 01:08:23 +0000 (01:08 +0000)]
Rename argument for consistency.

llvm-svn: 274717

8 years agoRemove the plumbing for isDarwinABI from EmitTailCallLoadFPAndRetAddr.
Eric Christopher [Thu, 7 Jul 2016 01:08:21 +0000 (01:08 +0000)]
Remove the plumbing for isDarwinABI from EmitTailCallLoadFPAndRetAddr.

llvm-svn: 274716

8 years agoUse the MachineFunction that we've already queried for in the function.
Eric Christopher [Thu, 7 Jul 2016 01:08:19 +0000 (01:08 +0000)]
Use the MachineFunction that we've already queried for in the function.

llvm-svn: 274715

8 years agoRemove the plumbing for isDarwinABI from the PrepareTailCall hierarchy.
Eric Christopher [Thu, 7 Jul 2016 01:08:17 +0000 (01:08 +0000)]
Remove the plumbing for isDarwinABI from the PrepareTailCall hierarchy.

llvm-svn: 274714

8 years ago[CUDA] Fix "control reaches end of non-void function" warnings in Cuda.cpp.
Justin Lebar [Thu, 7 Jul 2016 01:06:59 +0000 (01:06 +0000)]
[CUDA] Fix "control reaches end of non-void function" warnings in Cuda.cpp.

Some compilers are too dumb to realize that the switch statement covers
all cases.

(Don't use a "default" label, because we explicitly want to get a warning
if our switch doesn't cover all the cases.)

llvm-svn: 274713

8 years ago[PM] Avoid getResult on a higher level in LoopAccessAnalysis
Sean Silva [Thu, 7 Jul 2016 01:01:53 +0000 (01:01 +0000)]
[PM] Avoid getResult on a higher level in LoopAccessAnalysis

Note that require<domtree> and require<loops> aren't needed because they
come in implicitly via the loop pass manager.

llvm-svn: 274712

8 years agoRemove the plumbing of 64-bitness from PrepareTailCall and functions
Eric Christopher [Thu, 7 Jul 2016 00:39:32 +0000 (00:39 +0000)]
Remove the plumbing of 64-bitness from PrepareTailCall and functions
called by it.

llvm-svn: 274711

8 years agoSink call to get the MachineFunction into EmitTailCallStoreFPAndRetAddr
Eric Christopher [Thu, 7 Jul 2016 00:39:30 +0000 (00:39 +0000)]
Sink call to get the MachineFunction into EmitTailCallStoreFPAndRetAddr
and remove the argument.

llvm-svn: 274710

8 years agoRemove unnecessary subtarget parameters in PPCTargetLowering.
Eric Christopher [Thu, 7 Jul 2016 00:39:27 +0000 (00:39 +0000)]
Remove unnecessary subtarget parameters in PPCTargetLowering.

llvm-svn: 274709

8 years ago[PM] Port TailCallElim
Sean Silva [Wed, 6 Jul 2016 23:48:41 +0000 (23:48 +0000)]
[PM] Port TailCallElim

llvm-svn: 274708

8 years agoFix missing member initializers
Matt Arsenault [Wed, 6 Jul 2016 23:30:54 +0000 (23:30 +0000)]
Fix missing member initializers

This fixes the -Werror build with some combination of
warning flags.

llvm-svn: 274707

8 years agoRevert "Retry "Include debug info for nested structs and classes""
Adrian McCarthy [Wed, 6 Jul 2016 23:28:34 +0000 (23:28 +0000)]
Revert "Retry "Include debug info for nested structs and classes""

Reverting because it causes a test failure on build bots (Modules/ModuleDebugInfo.cpp).  Failure does not reproduce locally.

svn revision: rL274698

This reverts commit 3c5ed6599b086720aab5b8bd6941149d066806a6.

llvm-svn: 274706

8 years ago[PM] Port CorrelatedValuePropagation
Sean Silva [Wed, 6 Jul 2016 23:26:29 +0000 (23:26 +0000)]
[PM] Port CorrelatedValuePropagation

llvm-svn: 274705

8 years agofix documentation comment. NFC.
Junmo Park [Wed, 6 Jul 2016 23:18:58 +0000 (23:18 +0000)]
fix documentation comment. NFC.

llvm-svn: 274704

8 years ago"frame variable" and "target variable" shouldn't allow us to get the address of bitfi...
Greg Clayton [Wed, 6 Jul 2016 23:16:24 +0000 (23:16 +0000)]
"frame variable" and "target variable" shouldn't allow us to get the address of bitfields.

"frame variable" and "target variable" are trying to emulate the expression parser when doing things like:

(lldb) frame variable &my_struct.my_bitfield

And since the expression parser doesn't allow this, we shouldn't allow "frame variable" or "target variable" to succeed.

<rdar://problem/27208607>

llvm-svn: 274703

8 years agoMinor code cleanup. NFC.
Junmo Park [Wed, 6 Jul 2016 23:15:18 +0000 (23:15 +0000)]
Minor code cleanup. NFC.

llvm-svn: 274702

8 years agoLLDB reads incorrect memory ranges when displaying bitfields when reading bits from...
Greg Clayton [Wed, 6 Jul 2016 23:11:13 +0000 (23:11 +0000)]
LLDB reads incorrect memory ranges when displaying bitfields when reading bits from file memory.

Bitfields were not correctly describing their offsets within the integer that they are contained within. If we had a bitfield like:

struct MyStruct {
  uint32_t a:8;
  uint32_t b:8;
};

ClangASTContext::GetChildCompilerTypeAtIndex would say that child a and b had the following values in their respective ValueObjectChild objects:

name byte-size bit-size bit-offset byte-offset-from-parent
==== ========= ======== ========== =======================
"a"  4         8        0          0
"b"  4         8        0          1

So if we had a "MyStruct" at address 0x1000, we would end up reading 4 bytes from 0x1000 for "a", and 4 bytes from 0x1001 for "b". The fix for this is to fix the "child_byte_offset" and "child_bitfield_bit_offset" values returned by ClangASTContext::GetChildCompilerTypeAtIndex() so that now the table looks like:

name byte-size bit-size bit-offset byte-offset-from-parent
==== ========= ======== ========== =======================
"a"  4         8        0          0
"b"  4         8        8          0

Then we don't run into a problem when reading data from a file's section info using "target variable" before running. It will also stop us from not being able to display a bitfield values if the bitfield is in the last bit of memory before an unmapped region. (Like if address 0x1004 was unmapped and unreadable in the example above, if we tried to read 4 bytes from 0x1001, the memory read would fail and we wouldn't be able to display "b").

<rdar://problem/27208225>

llvm-svn: 274701

8 years agoEnhance FuncUnwinders::GetUnwindPlanAtNonCallSite to detect when we
Jason Molenda [Wed, 6 Jul 2016 23:06:19 +0000 (23:06 +0000)]
Enhance FuncUnwinders::GetUnwindPlanAtNonCallSite to detect when we
may be in a function that is non-ABI conformant, and the eh_frame
instructions correctly describe how to unwind out of this function,
but the assembly parsing / arch default unwind plans would be
incorrect.

This is to address a problem that Ravitheja Addepally reported in
http://reviews.llvm.org/D21221 - I wanted to try handling the problem
with this approach which I think may be more generally helpful,
Ravitheja tested it and said it solves the problem on Linux/FreeBSD.
Ravi has a test case in http://reviews.llvm.org/D21221 that will
be committed separately.

Thanks for all the help on this one, Ravi.

llvm-svn: 274700

8 years agoThinLTO: Add test cases for promote+internalize.
Peter Collingbourne [Wed, 6 Jul 2016 22:53:02 +0000 (22:53 +0000)]
ThinLTO: Add test cases for promote+internalize.

This tests the effect of both promotion and internalization on a module,
and helps show that D21883 is NFC wrt promotion+internalization.

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

llvm-svn: 274699

8 years agoRetry "Include debug info for nested structs and classes"
Adrian McCarthy [Wed, 6 Jul 2016 22:39:15 +0000 (22:39 +0000)]
Retry "Include debug info for nested structs and classes"

This should work now that the LLVM-side of the change has landed successfully.

Original Differential Revision: http://reviews.llvm.org/D21705

This reverts commit a30322e861c387e1088f47065d0438c6bb019879.

llvm-svn: 274698

8 years agoFix the installation of the vector<bool> data formatters in order to restore function...
Enrico Granata [Wed, 6 Jul 2016 22:35:34 +0000 (22:35 +0000)]
Fix the installation of the vector<bool> data formatters in order to restore functionality

llvm-svn: 274697

8 years ago[InstCombine] enhance (select X, C1, C2 --> ext X) to handle vectors
Sanjay Patel [Wed, 6 Jul 2016 22:23:01 +0000 (22:23 +0000)]
[InstCombine] enhance (select X, C1, C2 --> ext X) to handle vectors

By replacing dyn_cast of ConstantInt with m_Zero/m_One/m_AllOnes, we
allow these transforms for splat vectors.

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

llvm-svn: 274696

8 years agoEnsuring the bit-fields have the same type; MSVC will place the fields in different...
Aaron Ballman [Wed, 6 Jul 2016 22:06:19 +0000 (22:06 +0000)]
Ensuring the bit-fields have the same type; MSVC will place the fields in different allocation units otherwise.

llvm-svn: 274695

8 years agoMinor formatting change, NFC
Vedant Kumar [Wed, 6 Jul 2016 22:02:55 +0000 (22:02 +0000)]
Minor formatting change, NFC

The rest of llvm-cov does not use LLVM_ATTRIBUTE_UNUSED. Leave unused
params unnamed to be consistent.

llvm-svn: 274694

8 years agoAdd testing coverage for r274582.
Manman Ren [Wed, 6 Jul 2016 22:01:28 +0000 (22:01 +0000)]
Add testing coverage for r274582.

llvm-svn: 274693

8 years ago[X86] Transform setcc + movzbl into xorl + setcc
Michael Kuperstein [Wed, 6 Jul 2016 21:56:18 +0000 (21:56 +0000)]
[X86] Transform setcc + movzbl into xorl + setcc

xorl + setcc is generally the preferred sequence due to the partial register
stall setcc + movzbl suffers from. As a bonus, it also encodes one byte smaller.

This fixes PR28146.

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

llvm-svn: 274692

8 years ago[analyzer] Suppress false positives in std::shared_ptr
Devin Coughlin [Wed, 6 Jul 2016 21:52:55 +0000 (21:52 +0000)]
[analyzer] Suppress false positives in std::shared_ptr

The analyzer does not model C++ temporary destructors completely and so
reports false alarms about leaks of memory allocated by the internals of
shared_ptr:

  std::shared_ptr<int> p(new int(1));
  p = nullptr; // 'Potential leak of memory pointed to by field __cntrl_'

This patch suppresses all diagnostics where the end of the path is inside
a method in std::shared_ptr.

It also reorganizes the tests for suppressions in the C++ standard library
to use a separate simulated header for library functions with bugs
that were deliberately inserted to test suppression. This will prevent
other tests from using these as models.

rdar://problem/23652766

llvm-svn: 274691

8 years agoRead the implicit addend of R_386_GOT32X.
Rafael Espindola [Wed, 6 Jul 2016 21:48:50 +0000 (21:48 +0000)]
Read the implicit addend of R_386_GOT32X.

llvm-svn: 274690

8 years ago[CUDA] Add missing namespace qualification on CudaArch in Action.cpp.
Justin Lebar [Wed, 6 Jul 2016 21:45:44 +0000 (21:45 +0000)]
[CUDA] Add missing namespace qualification on CudaArch in Action.cpp.

Fix build breakage with MSVC.

llvm-svn: 274689

8 years ago[llvm-cov] Add support for creating html reports
Vedant Kumar [Wed, 6 Jul 2016 21:44:05 +0000 (21:44 +0000)]
[llvm-cov] Add support for creating html reports

Based on a patch by Harlan Haskins!

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

llvm-svn: 274688

8 years agoRecognize R_386_GOT32X.
Rafael Espindola [Wed, 6 Jul 2016 21:41:39 +0000 (21:41 +0000)]
Recognize R_386_GOT32X.

We don't relax it, but we at least recognize it.

llvm-svn: 274687

8 years agoAArch64: Change modeling of zero cycle zeroing.
Matthias Braun [Wed, 6 Jul 2016 21:39:33 +0000 (21:39 +0000)]
AArch64: Change modeling of zero cycle zeroing.

On CPUs with the zero cycle zeroing feature enabled "movi v.2d" should
be used to zero a vector register. This was previously done at
instruction selection time, however the register coalescer sometimes
widened multiple vregs to the Q width because of that leading to extra
spills. This patch leaves the decision on how to zero a register to the
AsmPrinter phase where it doesn't affect register allocation anymore.

This patch also sets isAsCheapAsAMove=1 on FMOVS0, FMOVD0.

This fixes http://llvm.org/PR27454, rdar://25866262

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

llvm-svn: 274686

8 years agoAArch64: Replace a RegScavenger instance with LivePhysRegs
Matthias Braun [Wed, 6 Jul 2016 21:31:27 +0000 (21:31 +0000)]
AArch64: Replace a RegScavenger instance with LivePhysRegs

findScratchNonCalleeSaveRegister() just needs a simple liveness
analysis, use LivePhysRegs for that as it is simpler and does not depend
on the kill flags.

This commit adds a convenience function available() to LivePhysRegs:
This function returns true if the given register is not reserved and
neither the register nor any of its aliases are alive.

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

llvm-svn: 274685

8 years ago[ELF] Introduce a flag to parse response files according to windows rules.
Davide Italiano [Wed, 6 Jul 2016 21:24:34 +0000 (21:24 +0000)]
[ELF] Introduce a flag to parse response files according to windows rules.

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

llvm-svn: 274684

8 years agoBecause of our lifetime rules w.r.t. ValueObjects and ClusterManagers, synthetic...
Enrico Granata [Wed, 6 Jul 2016 21:24:28 +0000 (21:24 +0000)]
Because of our lifetime rules w.r.t. ValueObjects and ClusterManagers, synthetic children caching is a tricky area:
- if a synthetic child comes from the same hierarchy as its parent object, then it can't be cached by SharedPointer inside the synthetic provider, or it will cause a reference loop;
- but, if a synthetic child is made from whole cloth (e.g. from an expression, a memory region, ...), then it better be cached by SharedPointer, or it will be cleared out and cause an assert() to fail if used at a later point

For most cases of self-rooted synthetic children, we have a flag we set "IsSyntheticChildrenGenerated", but we were not using it to track caching. So, what ended up happening is each provider would set up its own cache, and if it got it wrong, a hard to diagnose crash would ensue

This patch fixes that by centralizing caching in ValueObjectSynthetic - if a provider returns a self-rooted child (as per the flag), then it gets cached centrally by the ValueObject itself
This cache is used only for lifetime management and not later retrieval of child values - a different cache handles that (because we might have a mix of self-rooted and properly nested child values for the same parent, we can't trivially use this lifetime cache for retrieval)

Fixes rdar://26480007

llvm-svn: 274683

8 years ago[CUDA] Rename member variables in CudaInstallationDetector.
Justin Lebar [Wed, 6 Jul 2016 21:21:43 +0000 (21:21 +0000)]
[CUDA] Rename member variables in CudaInstallationDetector.

Summary:
Remove the "Cuda" prefix from these variables -- it's clear that they
related to CUDA given their containing type.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 274682

8 years ago[CUDA] Add utility functions for dealing with CUDA versions / architectures.
Justin Lebar [Wed, 6 Jul 2016 21:21:39 +0000 (21:21 +0000)]
[CUDA] Add utility functions for dealing with CUDA versions / architectures.

Summary:
Currently our handling of CUDA architectures is scattered all around
clang.  This patch centralizes it.

A key advantage of this centralization is that you can now write a C++
switch on e.g. CudaArch and get a compile error if you don't handle one
of the enum values.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 274681

8 years ago[CUDA] Add support for CUDA 8 and sm_60-62.
Justin Lebar [Wed, 6 Jul 2016 21:21:14 +0000 (21:21 +0000)]
[CUDA] Add support for CUDA 8 and sm_60-62.

Summary: Also add sm_32, which was missing.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 274680

8 years ago[MemorySSA] Reinstate the legacy printer and verifier.
Chad Rosier [Wed, 6 Jul 2016 21:20:47 +0000 (21:20 +0000)]
[MemorySSA] Reinstate the legacy printer and verifier.

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

llvm-svn: 274679

8 years agoAdd initial support for R_386_GOT32X.
Rafael Espindola [Wed, 6 Jul 2016 21:19:11 +0000 (21:19 +0000)]
Add initial support for R_386_GOT32X.

This adds it only for movl mov@GOT(%reg), %reg.

llvm-svn: 274678

8 years ago[CodeGen, DebugInfo] Use hasLocalLinkage instead of hasInternalLinkage
David Majnemer [Wed, 6 Jul 2016 21:07:53 +0000 (21:07 +0000)]
[CodeGen, DebugInfo] Use hasLocalLinkage instead of hasInternalLinkage

For the purpose of emitting debug info, entities with private linkage
should be treated the same as internal linkage.  While this doesn't
change anything in practice, it makes the code a little less confusing.

llvm-svn: 274677

8 years ago[CodeView] Emit an appropriate symbol kind for globals
David Majnemer [Wed, 6 Jul 2016 21:07:47 +0000 (21:07 +0000)]
[CodeView] Emit an appropriate symbol kind for globals

We emitted debug info for globals/functions as if they all had external
linkage.  Instead, emit local symbol records when appropriate.

llvm-svn: 274676

8 years ago[CodeView] Unions are always sealed
David Majnemer [Wed, 6 Jul 2016 21:07:42 +0000 (21:07 +0000)]
[CodeView] Unions are always sealed

It is impossible to inherit from a union.  We are missing a way to
represent this in IR for classes/structs...

llvm-svn: 274675

8 years ago[NVPTX] Add sm_60, sm_61, sm_62 targets to LLVM.
Justin Lebar [Wed, 6 Jul 2016 21:06:10 +0000 (21:06 +0000)]
[NVPTX] Add sm_60, sm_61, sm_62 targets to LLVM.

Reviewers: tra

Subscribers: jholewinski, llvm-commits

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

llvm-svn: 274674

8 years ago[LIR] Fix mis-compilation with unwinding.
Haicheng Wu [Wed, 6 Jul 2016 21:05:40 +0000 (21:05 +0000)]
[LIR] Fix mis-compilation with unwinding.

To fix PR27859, bail out if there is an instruction may throw.

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

llvm-svn: 274673

8 years ago[esan|wset] Ensure SIGSEGV is not blocked
Derek Bruening [Wed, 6 Jul 2016 21:04:48 +0000 (21:04 +0000)]
[esan|wset] Ensure SIGSEGV is not blocked

Summary:
Adds interception of sigprocmask and pthread_sigmask to esan so that the
working set tool can prevent SIGSEGV from being blocked.  A blocked SIGSEGV
results in crashes due to our lazy shadow page allocation scheme.

Adds new sanitizer helper functions internal_sigemptyset and
internal_sigismember.

Adds a test to workingset-signal-posix.cpp.

Reviewers: aizatsky

Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka

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

llvm-svn: 274672

8 years agoFix cmake generation on Apple for interception unittests
Etienne Bergeron [Wed, 6 Jul 2016 21:02:32 +0000 (21:02 +0000)]
Fix cmake generation on Apple for interception unittests

llvm-svn: 274671

8 years ago[InstCombine] use more specific pattern matchers; NFCI
Sanjay Patel [Wed, 6 Jul 2016 21:01:26 +0000 (21:01 +0000)]
[InstCombine] use more specific pattern matchers; NFCI

Follow-up from r274465: we don't need to capture the value in these cases,
so just match the constant that we're looking for. m_One/m_Zero work with
vector splats as well as scalars.

llvm-svn: 274670

8 years ago[esan|wset] Further reduce flakiness of sampling test
Derek Bruening [Wed, 6 Jul 2016 20:27:44 +0000 (20:27 +0000)]
[esan|wset] Further reduce flakiness of sampling test

Enhances the sampling test to try and reduce flakiness further by
increasing the workload to ensure a few samples are gathered.

llvm-svn: 274669

8 years agoAdd 'thinlto_src_module' metadata to imported function
Piotr Padlewski [Wed, 6 Jul 2016 20:26:25 +0000 (20:26 +0000)]
Add 'thinlto_src_module' metadata to imported function

Added metadata to be able to make statistics on how many functions
that have been imported have been removed. Also module name might
be helpfull when debugging.

Reviewers: tejohnson, eraman

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 274668

8 years ago[compiler-rt] Disable interception tests on Apple
Etienne Bergeron [Wed, 6 Jul 2016 20:15:50 +0000 (20:15 +0000)]
[compiler-rt] Disable interception tests on Apple

Summary:
The CMake generation is not working on Apple.

This patch is disabling the generation until it's fixed.

Reviewers: rnk

Subscribers: tberghammer, chrisha, danalbert, llvm-commits, srhines

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

llvm-svn: 274667

8 years ago[esan|wset] Fix incorrect memory size assert
Derek Bruening [Wed, 6 Jul 2016 20:13:53 +0000 (20:13 +0000)]
[esan|wset] Fix incorrect memory size assert

Summary:
Fixes an incorrect assert that fails on 128-bit-sized loads or stores.
Augments the wset tests to include this case.

Reviewers: aizatsky

Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits

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

llvm-svn: 274666

8 years ago[sanitizer] Handle null in internal_sigaction_syscall
Derek Bruening [Wed, 6 Jul 2016 20:13:40 +0000 (20:13 +0000)]
[sanitizer] Handle null in internal_sigaction_syscall

Summary:
Adds support for nullptr as the action parameter to
internal_sigaction_syscall().

Reviewers: aizatsky

Subscribers: kubabrecka, vitalybuka, zhaoqin, kcc, eugenis, llvm-commits

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

llvm-svn: 274665

8 years agoNVPTX: Replace uses of cuda.syncthreads with nvvm.barrier0
Justin Bogner [Wed, 6 Jul 2016 20:02:45 +0000 (20:02 +0000)]
NVPTX: Replace uses of cuda.syncthreads with nvvm.barrier0

Everywhere where cuda.syncthreads or __syncthreads is used, use the
properly namespaced nvvm.barrier0 instead.

llvm-svn: 274664

8 years agoNVPTX: Rename __builtin_ptx_shfl -> __nvvm_shfl
Justin Bogner [Wed, 6 Jul 2016 19:52:32 +0000 (19:52 +0000)]
NVPTX: Rename __builtin_ptx_shfl -> __nvvm_shfl

To match "NVPTX: Make the llvm.nvvm.shfl intrinsics and builtin names
consistent" in LLVM.

llvm-svn: 274663

8 years agoNVPTX: Make the llvm.nvvm.shfl intrinsics and builtin names consistent
Justin Bogner [Wed, 6 Jul 2016 19:52:27 +0000 (19:52 +0000)]
NVPTX: Make the llvm.nvvm.shfl intrinsics and builtin names consistent

The intrinsics here use nvvm, but the builtins and tablegen variable
names were using ptx. Stick to the modern names here.

llvm-svn: 274662

8 years agoRetry: "Emit CodeView type records for nested classes."
Adrian McCarthy [Wed, 6 Jul 2016 19:49:51 +0000 (19:49 +0000)]
Retry: "Emit CodeView type records for nested classes."

Now with a corrected test to account for a recently supported properties bit in the debug info of a struct.

Original review: http://reviews.llvm.org/D21939

This reverts commit 970c3fd497a28d25dd69526eb52594a696c37968.

llvm-svn: 274661

8 years ago[DSE] Avoid iterator invalidation bugs.
Chad Rosier [Wed, 6 Jul 2016 19:48:52 +0000 (19:48 +0000)]
[DSE] Avoid iterator invalidation bugs.

The dse_with_dbg_value.ll test committed with r273141 is removed because this
we no longer performs any type of back tracking, which is what was causing the
codegen differences with and without debug information.

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

llvm-svn: 274660

8 years ago[Conduct] Refine what "rare cases" means wrt violations outside our spaces.
Paul Robinson [Wed, 6 Jul 2016 19:32:41 +0000 (19:32 +0000)]
[Conduct] Refine what "rare cases" means wrt violations outside our spaces.
Text suggested by Daniel Berlin. While it is likely to be exactly what
the advisory committee would do anyway, codifying it does no harm and
helps reassure people that rare does not mean arbitrary.

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

llvm-svn: 274659

8 years ago[x86] fix cost of SINT_TO_FP for i32 --> float (PR21356, PR28434)
Sanjay Patel [Wed, 6 Jul 2016 19:15:54 +0000 (19:15 +0000)]
[x86] fix cost of SINT_TO_FP for i32 --> float (PR21356, PR28434)

This is "cvtdq2ps" which does not appear to be particularly slow on any CPU
according to Agner's tables. Choosing "5" as a cost here as suggested in:
https://llvm.org/bugs/show_bug.cgi?id=21356
...but it seems very conservative given that the instruction is fully pipelined,
and I think these costs are supposed to model throughput.

Note that related costs are also most likely too high, but this fixes PR21356
and partly fixes PR28434.

llvm-svn: 274658

8 years ago[compilter-rt] Add unittests for interception library
Etienne Bergeron [Wed, 6 Jul 2016 19:15:11 +0000 (19:15 +0000)]
[compilter-rt] Add unittests for interception library

Summary:
This patch is adding unittests for the interception library.

Reviewers: rnk

Subscribers: majnemer, llvm-commits, wang0109, chrisha, tberghammer, danalbert, srhines

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

llvm-svn: 274657

8 years agoWork around PR28400 a bit harder.
Sean Silva [Wed, 6 Jul 2016 19:05:41 +0000 (19:05 +0000)]
Work around PR28400 a bit harder.

We were still crashing in the "no change" case because LVI was not
getting invalidated.

See the thread "Should analyses be able to hold AssertingVH to IR?
(related to PR28400)" for more discussion.

llvm-svn: 274656

8 years agoTailDuplicator: Remove live-in updating logic
Matthias Braun [Wed, 6 Jul 2016 18:55:10 +0000 (18:55 +0000)]
TailDuplicator: Remove live-in updating logic

This logic was introduced in r157663 and does not make any sense to me.
The motivating example in rdar://11538365 looks like this:

This is the tail:
BB#16: derived from LLVM BB %if.end68
    Live Ins: %R0 %R4 %R5
    Predecessors according to CFG: BB#15 BB#5
        tBLXi pred:14, pred:%noreg, <ga:@CFRelease>, %R0<kill>, <regmask>, %LR<imp-def,dead>, %SP<imp-use>, %SP<imp-def>
        t2B <BB#20>, pred:14, pred:%noreg
    Successors according to CFG: BB#20

This is the predBB:
BB#5:
    Live Ins: %R5
    Predecessors according to CFG: BB#4
        %R4<def> = t2MOVi 0, pred:14, pred:%noreg, opt:%noreg
        t2B <BB#16>, pred:14, pred:%noreg
    Successors according to CFG: BB#16

However this is invalid machine code to begin with, if %R0 is live-in to
BB#16 then it must be live-in to BB#5 as well if BB#5 does not define
it.  We should not need logic to retroactively fix broken machine code
and in fact the example from r157663 passes cleanly with the code
removed and I do not see any (newly) failing tests with the machine
verifier enabled.

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

llvm-svn: 274655

8 years agoEnsuring the bit-fields have the same type; MSVC will place the fields in different...
Aaron Ballman [Wed, 6 Jul 2016 18:33:01 +0000 (18:33 +0000)]
Ensuring the bit-fields have the same type; MSVC will place the fields in different allocation units otherwise.

llvm-svn: 274654

8 years ago[X86] Sort cast cost tables. NFC.
Michael Kuperstein [Wed, 6 Jul 2016 18:26:48 +0000 (18:26 +0000)]
[X86] Sort cast cost tables. NFC.

Cast cost tables are now sorted, for each cast type, lexicographically on
[source base type, source vector width, dest base type, base vector width].

llvm-svn: 274653

8 years agoAdd AST matchers for handling bit-fields and narrowing based on their width.
Aaron Ballman [Wed, 6 Jul 2016 18:25:16 +0000 (18:25 +0000)]
Add AST matchers for handling bit-fields and narrowing based on their width.

llvm-svn: 274652

8 years agoRevert r274605 due to bot failure: http://lab.llvm.org:8080/green/job/clang-stage1...
Manman Ren [Wed, 6 Jul 2016 18:24:53 +0000 (18:24 +0000)]
Revert r274605 due to bot failure: lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/244/

llvm-svn: 274651

8 years ago[SystemZ] Remove AND mask of bottom 6 bits when result is used for shift/rotate
Elliot Colp [Wed, 6 Jul 2016 18:13:11 +0000 (18:13 +0000)]
[SystemZ] Remove AND mask of bottom 6 bits when result is used for shift/rotate

On SystemZ, shift and rotate instructions only use the bottom 6 bits of the shift/rotate amount.
Therefore, if the amount is ANDed with an immediate mask that has all of the bottom 6 bits set, we
can remove the AND operation entirely.

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

llvm-svn: 274650

8 years agoNFC changed names in FunctionImport
Piotr Padlewski [Wed, 6 Jul 2016 18:12:23 +0000 (18:12 +0000)]
NFC changed names in FunctionImport

llvm-svn: 274649

8 years ago[X86][SSE] Fixed typo in insertps lowering.
Simon Pilgrim [Wed, 6 Jul 2016 18:09:08 +0000 (18:09 +0000)]
[X86][SSE] Fixed typo in insertps lowering.

We were checking for 2 insertions (which is caught earlier in the pattern matching loop) instead of the case where we have no insertions.

Turns out this code never fires as we always try to lower to insertps after trying to lower to blendps, which would catch these cases - I'm about to make some changes to support combining to insertps which could cause this to fire so I don't want to remove it.

llvm-svn: 274648

8 years ago[pdb] Round trip the PDB stream between YAML and binary PDB.
Zachary Turner [Wed, 6 Jul 2016 18:05:57 +0000 (18:05 +0000)]
[pdb] Round trip the PDB stream between YAML and binary PDB.

This gets writing of the PDB stream working.

llvm-svn: 274647

8 years ago[SemaExpr] Support assignments from vector to scalars with same size
Bruno Cardoso Lopes [Wed, 6 Jul 2016 18:05:23 +0000 (18:05 +0000)]
[SemaExpr] Support assignments from vector to scalars with same size

Before r266366, clang used to support constructs like:

  typedef __attribute__((vector_size(8))) double float64x1_t;
  typedef __attribute__((vector_size(16))) double float64x2_t;
  float64x1_t vget_low_f64(float64x2_t __p0);

  double y = 3.0 + vget_low_f64(v);

But it would reject:

  double y = vget_low_f64(v) + 3.0;

It also always rejected assignments:

  double y = vget_low_f64(v);

This patch: (a) revivies the behavior of `3.0 + vget_low_f64(v)` prior to
r266366, (b) add support for `vget_low_f64(v) + 3.0` and (c) add support for
assignments.

These vector semantics have never really been tied up but it seems
odd that we used to support some binop froms but do not support
assignment. If we did support scalar for the purposes of arithmetic, we
should probably be able to reinterpret as scalar for the purposes of
assignment too.

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

rdar://problem/26093791

llvm-svn: 274646

8 years agoEnsure all uses of permute instructions feed vector stores
Kit Barton [Wed, 6 Jul 2016 18:03:52 +0000 (18:03 +0000)]
Ensure all uses of permute instructions feed vector stores

There is a problem in VSXSwapRemoval where it is incorrectly removing permute instructions.
In this case, the permute is feeding both a vector store and also a non-store instruction. In this case, the permute cannot be removed.

The fix is to simply look at all the uses of the vector register defined by the permute and ensure that all the uses are vector store instructions.

This problem was reported in PR 27735 (https://llvm.org/bugs/show_bug.cgi?id=27735).

Test case based on the original problem reported.

Phabricator Review: http://reviews.llvm.org/D21802

llvm-svn: 274645

8 years ago[DAGCombiner] Fix visitSTORE to continue processing current SDNode, if findBetterNeig...
Tim Shen [Wed, 6 Jul 2016 17:44:03 +0000 (17:44 +0000)]
[DAGCombiner] Fix visitSTORE to continue processing current SDNode, if findBetterNeighborChains doesn't actually CombineTo it.

Summary:
findBetterNeighborChains may or may not find a better chain for each node it finds, which include the node ("St") that visitSTORE is currently processing. If no better chain is found for St, visitSTORE should continue instead of return SDValue(St, 0), as if it's CombinedTo'ed.

This fixes bug 28130. There might be other ways to make the test pass (see D21409). I think both of the patches are fixing actual bugs revealed by the same testcase.

Reviewers: echristo, wschmidt, hfinkel, kbarton, amehsan, arsenm, nemanjai, bogner

Subscribers: mehdi_amini, nemanjai, llvm-commits

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

llvm-svn: 274644