platform/upstream/llvm.git
8 years ago[PM] Add the IR unit type to the pass manager's logging and make all of
Chandler Carruth [Thu, 25 Feb 2016 10:27:39 +0000 (10:27 +0000)]
[PM] Add the IR unit type to the pass manager's logging and make all of
the testing more more explicit.

This will currently fail on platforms without support for getTypeName.
While an assert failure seems too harsh, I'm hoping we're OK with the
regression test failure, and I'd like to find out about what platforms
actually exist in this state if there are any so we can get
implementations in place for them.

But if we just can't fix all the host compilers to have a reasonably
portable variant of getTypeName and are worried about xfailing this test
on those platforms, I can add the horrible regular expression magic to
make the tests support "unknown" here as well.

llvm-svn: 261853

8 years ago[sanitizer] Disable recv and recvfrom interceptors on Windows.
Maxim Ostapenko [Thu, 25 Feb 2016 09:36:20 +0000 (09:36 +0000)]
[sanitizer] Disable recv and recvfrom interceptors on Windows.

Trying to fix sanitizer-windows buildbot by disabling new interceptors on Windows.

llvm-svn: 261844

8 years ago[X86][SSE3] Added combine support for MOVDDUP/MOVSHDUP/MOVSLDUP target shuffles
Simon Pilgrim [Thu, 25 Feb 2016 09:12:12 +0000 (09:12 +0000)]
[X86][SSE3] Added combine support for MOVDDUP/MOVSHDUP/MOVSLDUP target shuffles

Now that PerformShuffleCombine can handle unary shuffles.

llvm-svn: 261843

8 years agoRevert r260064, "Disable llvm/test/tools/llvm-profdata/value-prof.proftext on win32...
NAKAMURA Takumi [Thu, 25 Feb 2016 08:50:26 +0000 (08:50 +0000)]
Revert r260064, "Disable llvm/test/tools/llvm-profdata/value-prof.proftext on win32 for now. Investigating."

It seems unreproducible any more for me.

llvm-svn: 261842

8 years ago[sanitizer] Move recvmsg and recv interceptors to sanitizer_common.
Maxim Ostapenko [Thu, 25 Feb 2016 08:44:25 +0000 (08:44 +0000)]
[sanitizer] Move recvmsg and recv interceptors to sanitizer_common.

This patch moves recv and recvfrom interceptors from MSan and TSan to
sanitizer_common to enable them in ASan.

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

llvm-svn: 261841

8 years ago[ELF] - Referencing __start or __stop should keep the section from GC.
George Rimar [Thu, 25 Feb 2016 08:40:26 +0000 (08:40 +0000)]
[ELF] - Referencing __start or __stop should keep the section from GC.

This fixes the https://llvm.org/bugs/show_bug.cgi?id=22906 bug.

In GNU Binutils, a reference to start or stop is sufficient to
prevent the section from being garbage collected.
Patch implements the same behavior for lld.

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

llvm-svn: 261840

8 years agoRevert r261742, "[AMDGPU] Assembler: Simplify handling of optional operands"
NAKAMURA Takumi [Thu, 25 Feb 2016 08:35:27 +0000 (08:35 +0000)]
Revert r261742, "[AMDGPU] Assembler: Simplify handling of optional operands"

It brought undefined behavior.

llvm-svn: 261839

8 years ago[ELF2] - Basic implementation of -r/--relocatable
George Rimar [Thu, 25 Feb 2016 08:23:37 +0000 (08:23 +0000)]
[ELF2] - Basic implementation of -r/--relocatable

-r, -relocatable - Generate relocatable output

Currently does not have support for files containing
relocation sections with entries that refer to local
symbols (like rel[a].eh_frame which refer to sections
and not to symbols)

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

llvm-svn: 261838

8 years ago[Compiler-rt][MSan]Fix shmat testcase: Pass SHMLBA-alligned address to shmat
Mohit K. Bhakkad [Thu, 25 Feb 2016 08:07:44 +0000 (08:07 +0000)]
[Compiler-rt][MSan]Fix shmat testcase: Pass SHMLBA-alligned address to shmat

Reviewers: samsonov

Subscribers: jaydeep, sagar, llvm-commits

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

llvm-svn: 261837

8 years agoPM: Implement a basic loop pass manager
Justin Bogner [Thu, 25 Feb 2016 07:23:08 +0000 (07:23 +0000)]
PM: Implement a basic loop pass manager

This creates the new-style LoopPassManager and wires it up with dummy
and print passes.

This version doesn't support modifying the loop nest at all. It will
be far easier to discuss and evaluate the approaches to that with this
in place so that the boilerplate is out of the way.

llvm-svn: 261831

8 years ago[Sema] Remove assert in TreeTransform<Derived>::TransformObjCObjectType.
Akira Hatanaka [Thu, 25 Feb 2016 07:08:33 +0000 (07:08 +0000)]
[Sema] Remove assert in TreeTransform<Derived>::TransformObjCObjectType.

The assert isn't correct since TypeLoc::ObjCObjectTypeLoc doesn't
indicate whether the type is a dependent type. The function returns
false for a type like "<SomeProtocol>" which is a synonym for
"id<SomeProtocol>".

rdar://problem/23838912

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

llvm-svn: 261829

8 years agoOptimized loading (zextload) of i1 value from memory.
Elena Demikhovsky [Thu, 25 Feb 2016 07:05:12 +0000 (07:05 +0000)]
Optimized loading (zextload) of i1 value from memory.
This patch is a partial revert of https://llvm.org/svn/llvm-project/llvm/trunk@237793.
Extra "and" causes performance degradation.

We assume that i1 is stored in zero-extended form. And store operation is responsible for zeroing upper bits.

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

llvm-svn: 261828

8 years ago[Support] Don't check for ICC directly and rely on the __GNUC__ check
Chandler Carruth [Thu, 25 Feb 2016 06:13:01 +0000 (06:13 +0000)]
[Support] Don't check for ICC directly and rely on the __GNUC__ check
(which they emulate). This way we don't use that path when compiled with
ICC on Windows where it mimics MSVC's behavior and supports __FUNCSIG__.

Thanks for David Majnemer again for spotting this better pattern!

llvm-svn: 261827

8 years ago[OPENMP 4.5] Codegen for member decls in 'lastprivate' clause.
Alexey Bataev [Thu, 25 Feb 2016 05:25:57 +0000 (05:25 +0000)]
[OPENMP 4.5] Codegen for member decls in 'lastprivate' clause.

OpenMP 4.5 allows to privatize non-static member decls in non-static
member functions. Patch captures such decls by reference in general (for
bitfields, by value) and then operates with this capture. For bitfields,
at the end of codegen for lastprivates original bitfield is updated with the value of captured copy.

llvm-svn: 261824

8 years agoTwek fix for PR24473 (r261506) - Preserve the template arguments as written
Faisal Vali [Thu, 25 Feb 2016 05:09:30 +0000 (05:09 +0000)]
Twek fix for PR24473 (r261506) - Preserve the template arguments as written
(within the DeclRefExpr Node) when creating AST nodes that reference specializations of static data member templates.  While we pass the template args through for all non-instance members, they should only be relevant (i.e. non-null) for variable template ids (assertion added for that assumption)

Also preserve the FoundDecl that refers to the canonical Decl (the  primary VarTemplateDecl for a variable template specialization) that we are referencing in our DeclRefExpr. Not sure why this was not being done for non-variable template-ids.

No functionality change - so no tests added.

Thanks to Richard Smith for drawing my attention to this!

llvm-svn: 261823

8 years ago[ELF][MIPS] Enumerate absolute MIPS relocations in the isRelRelative
Simon Atanasyan [Thu, 25 Feb 2016 05:03:52 +0000 (05:03 +0000)]
[ELF][MIPS] Enumerate absolute MIPS relocations in the isRelRelative

This commit does two related thing. At first, it enumerates supported
absolute MIPS relocations in the `MipsTargetInfo<ELFT>::isRelRelative`
method. In that case the code is shorter and the case switch does not
tend to grow. At second, it prevents R_MIPS_COPY and PLT creation for
relative relocations. For almost all relative MIPS relocations like
R_MIPS_PC19_S2, R_MIPS_PCHI16 etc it does not have a sence. The only
exception is R_MIPS_PC32. GNU linker creates a copy relocation or PLT
entry for it. But I could not find any real test case uses R_MIPS_PC32
with DSO defined symbol as a target. So for now I prefer to skip this
case to simplify the LLD code.

llvm-svn: 261822

8 years agobuiltins: adjust the clobbers list for android __clear_cache
Saleem Abdulrasool [Thu, 25 Feb 2016 04:04:37 +0000 (04:04 +0000)]
builtins: adjust the clobbers list for android __clear_cache

Adjust the clobbers list.  This use to work with older versions of gcc, but now
will error on newer versions (tested against 5.3) (as well as clang).

Patch by Tee Hao Wei!

llvm-svn: 261821

8 years ago[OPENMP 4.5] Support fielddecls in 'shared' clause.
Alexey Bataev [Thu, 25 Feb 2016 03:59:29 +0000 (03:59 +0000)]
[OPENMP 4.5] Support fielddecls in 'shared' clause.

OpenMP 4.5 allows to use non-static data members of current class in
non-static member functions in different kind of clauses. Patch adds
support for data members in 'shared' clause.

llvm-svn: 261820

8 years ago[Support] Add a fancy helper function to get a static name for a type.
Chandler Carruth [Thu, 25 Feb 2016 03:58:21 +0000 (03:58 +0000)]
[Support] Add a fancy helper function to get a static name for a type.

This extracts the type name from __PRETTY_FUNCTION__ for compilers that
support it (I've opted Clang, GCC, and ICC into this as I've tested that
they work) and from __FUNCSIG__ which is very similar on MSVC. The
routine falls back gracefully on a stub "UNKNOWN_TYPE" string with
compilers or formats it doesn't understand.

This should be enough for a lot of common cases in LLVM where the real
goal is just to log or print a type name as a debugging aid, and save
a ton of boilerplate in the process. Notably, I'm planning to use this
to remove all the getName() boiler plate from the new pass manager.

The design and implementation is based on a bunch of advice and
discussion with Richard Smith and experimenting with most versions of
Clang and GCC. David Majnemer also provided excellent advice on how best
to do this with MSVC. Richard also checked that ICC does something
reasonable and I'll watch the build bots for other compilers. It'd be
great if someone could contribute logic for xlC and/or other toolchains.

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

llvm-svn: 261819

8 years ago[OpenCL] Add Sema checks for types
Xiuli Pan [Thu, 25 Feb 2016 03:34:20 +0000 (03:34 +0000)]
[OpenCL] Add Sema checks for types

Summary:
Add Sema checks for opencl type: image, pipe....
This patch is partitioned from http://reviews.llvm.org/D16047

Reviewers: Anastasia, yaxunl

Subscribers: pekka.jaaskelainen, cfe-commits

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

llvm-svn: 261818

8 years agoFix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in source...
Eugene Zelenko [Thu, 25 Feb 2016 02:08:17 +0000 (02:08 +0000)]
Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in source/Commands/CommandObjectType.cpp; other minor fixes.

llvm-svn: 261817

8 years agocheck-clang-tools: Introduce the feature "target-headers".
NAKAMURA Takumi [Thu, 25 Feb 2016 01:12:57 +0000 (01:12 +0000)]
check-clang-tools: Introduce the feature "target-headers".

For now, it just detects that host is non-Windows and target is msvc.

FIXME: It should be probable for cross compilations. Detect whether target's headers would be available.
llvm-svn: 261814

8 years agoIR: Make the X / undef -> undef fold match the comment
Justin Bogner [Thu, 25 Feb 2016 01:02:18 +0000 (01:02 +0000)]
IR: Make the X / undef -> undef fold match the comment

The constant folding for sdiv and udiv has a big discrepancy between the
comments and the code, which looks like a typo. Currently, we're folding
X / undef pretty inconsistently:

  0 / undef -> undef
  C / undef -> 0
  undef / undef -> 0

Whereas the comments state we do X / undef -> undef. The logic that
returns zero is actually commented as doing undef / X -> 0, despite that
the LHS isn't undef in many of the cases that hit it.

llvm-svn: 261813

8 years agoFix "target modules add -s <filename>" to work if the file doesn't exist locally...
Greg Clayton [Thu, 25 Feb 2016 00:56:47 +0000 (00:56 +0000)]
Fix "target modules add -s <filename>" to work if the file doesn't exist locally on the current machine.

<rdar://problem/24807382>

llvm-svn: 261812

8 years ago[clang-tidy] Another attempt to fix MSVC build
Alexander Kornienko [Thu, 25 Feb 2016 00:39:11 +0000 (00:39 +0000)]
[clang-tidy] Another attempt to fix MSVC build

llvm-svn: 261811

8 years agoXFail TestInlines.py on Windows with clang.
Adrian McCarthy [Thu, 25 Feb 2016 00:24:07 +0000 (00:24 +0000)]
XFail TestInlines.py on Windows with clang.

Test expects the breakpoint to resolve to three locations, but clang on windows yields only 2.

llvm.org/pr26710

llvm-svn: 261810

8 years ago[CodeGenPrepare] Remove load-based heuristic
Junmo Park [Thu, 25 Feb 2016 00:23:27 +0000 (00:23 +0000)]
[CodeGenPrepare] Remove load-based heuristic

Summary:
Both the hardware and LLVM have changed since 2012.
Now, load-based heuristic don't show big differences any more on OoO cores.

There is no notable regressons and improvements on spec2000/2006. (Cortex-A57, Core i5).

Reviewers: spatel, zansari

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

llvm-svn: 261809

8 years agoGet register context for the 32-bit process in a WoW64 process minidump
Adrian McCarthy [Thu, 25 Feb 2016 00:23:27 +0000 (00:23 +0000)]
Get register context for the 32-bit process in a WoW64 process minidump

32-bit processes on 64-bit Windows run in a layer called WoW64 (Windows-on-Windows64). If you capture a mini dump of such a process from a 32-bit debugger, you end up with a register context for the 64-bit WoW64 process rather than the 32-bit one you probably care about.

This detects WoW64 by looking to see if there's a module named wow64.dll loaded. For such processes, it then looks in the 64-bit Thread Environment Block (TEB) to locate a copy of the 32-bit CONTEXT record that the plugin needs for the register context.

Added some rudimentary tests.  I'd like to improve these later once we figure out how to get the exception information from these mini dumps.

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

llvm-svn: 261808

8 years agoMove test/CodeGen/Generic/pr26652.ll to test/CodeGen/X86/pr26652.ll and test it only...
Cong Hou [Thu, 25 Feb 2016 00:12:18 +0000 (00:12 +0000)]
Move test/CodeGen/Generic/pr26652.ll to test/CodeGen/X86/pr26652.ll and test it only on X86.

llvm-svn: 261807

8 years agoTrying to fix MSVC build
Alexander Kornienko [Wed, 24 Feb 2016 23:48:24 +0000 (23:48 +0000)]
Trying to fix MSVC build

llvm-svn: 261806

8 years agofix typo
Sanjay Patel [Wed, 24 Feb 2016 23:44:19 +0000 (23:44 +0000)]
fix typo

llvm-svn: 261805

8 years agoDetecte vector reduction operations just before instruction selection.
Cong Hou [Wed, 24 Feb 2016 23:40:36 +0000 (23:40 +0000)]
Detecte vector reduction operations just before instruction selection.

(This is the second attemp to commit this patch, after fixing pr26652 & pr26653).

This patch detects vector reductions before instruction selection. Vector
reductions are vectorized reduction operations, and for such operations we have
freedom to reorganize the elements of the result as long as the reduction of them
stay unchanged. This will enable some reduction pattern recognition during
instruction combine such as SAD/dot-product on X86. A flag is added to
SDNodeFlags to mark those vector reduction nodes to be checked during instruction
combine.

To detect those vector reductions, we search def-use chains starting from the
given instruction, and check if all uses fall into two categories:

1. Reduction with another vector.
2. Reduction on all elements.

in which 2 is detected by recognizing the pattern that the loop vectorizer
generates to reduce all elements in the vector outside of the loop, which
includes several ShuffleVector and one ExtractElement instructions.

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

llvm-svn: 261804

8 years agoFix assertion failure on MaybeODRUseExprs.
Manman Ren [Wed, 24 Feb 2016 23:05:43 +0000 (23:05 +0000)]
Fix assertion failure on MaybeODRUseExprs.

In VisitNonTypeTemplateParamDecl, before SubstExpr with the default argument,
we should create a ConstantEvaluated ExpressionEvaluationContext. Without this,
it is possible to use a PotentiallyEvaluated ExpressionEvaluationContext; and
MaybeODRUseExprs will not be cleared when popping the context, causing
assertion failure.

This is similar to how we handle the context before SubstExpr with the
default argument, in SubstDefaultTemplateArgument.

Part of PR13986.
rdar://24480205

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

llvm-svn: 261803

8 years agoMake test more portable.
Rafael Espindola [Wed, 24 Feb 2016 22:47:41 +0000 (22:47 +0000)]
Make test more portable.

We just need to show that an error is printed, so no need to check for a
system dependent message.

llvm-svn: 261802

8 years ago[CMake] Fix a really simple, silly bug from r261797
Chris Bieneman [Wed, 24 Feb 2016 22:42:47 +0000 (22:42 +0000)]
[CMake] Fix a really simple, silly bug from r261797

This should fix bots with CMake older than 2.8.12.

llvm-svn: 261801

8 years agoxfail case sensitivity test on Linux.
Zachary Turner [Wed, 24 Feb 2016 22:41:04 +0000 (22:41 +0000)]
xfail case sensitivity test on Linux.

There are two tests in this file.  One which only runs on Windows
and tests that you can set a breakpoint with mismatched case.  And
another that only runs on non-Windows and tests that you cannot set
a breakpoint with mismatched case.  This latter test is failing on
non Windows platforms for some reason.  It could be that the test
is just written incorrectly, as I think the actual functionality
actually works correctly on non-Windows platforms.

llvm-svn: 261800

8 years agoadd tests to show missing bitcasted logic transform
Sanjay Patel [Wed, 24 Feb 2016 22:31:18 +0000 (22:31 +0000)]
add tests to show missing bitcasted logic transform

llvm-svn: 261799

8 years agoMinor cleanup of Sema::CheckEnableIf. NFC.
George Burgess IV [Wed, 24 Feb 2016 22:31:14 +0000 (22:31 +0000)]
Minor cleanup of Sema::CheckEnableIf. NFC.

llvm-svn: 261798

8 years ago[CMake] Default CMAKE_MACOSX_RPATH to On, this is the default with CMP0042
Chris Bieneman [Wed, 24 Feb 2016 22:29:42 +0000 (22:29 +0000)]
[CMake] Default CMAKE_MACOSX_RPATH to On, this is the default with CMP0042

Summary: Building the sanitizer libraries without rpaths causes all sorts of problems when you try to use them. This simple fix should make it all work.

Reviewers: samsonov, zaks.anna

Subscribers: llvm-commits

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

llvm-svn: 261797

8 years agoAdd capability to push/pop DFI in MCStreamer. NFC
Amaury Sechet [Wed, 24 Feb 2016 22:25:18 +0000 (22:25 +0000)]
Add capability to push/pop DFI in MCStreamer. NFC

Summary: This is extracted from D17555

Reviewers: davidxl, reames, sanjoy, MatzeB, pete

Subscribers: llvm-commits

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

llvm-svn: 261796

8 years agoUpdate the website with lots of new info about building / testing.
Zachary Turner [Wed, 24 Feb 2016 22:19:23 +0000 (22:19 +0000)]
Update the website with lots of new info about building / testing.

llvm-svn: 261795

8 years ago[asan] Do not instrument globals in the special "LLVM" sections
Anna Zaks [Wed, 24 Feb 2016 22:12:18 +0000 (22:12 +0000)]
[asan] Do not instrument globals in the special "LLVM" sections

llvm-svn: 261794

8 years agoIntroduce ScopStmt::getRegionNode(). NFC.
Michael Kruse [Wed, 24 Feb 2016 22:08:28 +0000 (22:08 +0000)]
Introduce ScopStmt::getRegionNode(). NFC.

Replace an inline ternary operator pattern.

llvm-svn: 261793

8 years agoIntroduce ScopStmt::getEntryBlock(). NFC.
Michael Kruse [Wed, 24 Feb 2016 22:08:24 +0000 (22:08 +0000)]
Introduce ScopStmt::getEntryBlock(). NFC.

This replaces an ungly inline ternary operator pattern.

llvm-svn: 261792

8 years agoIntroduce Scop::getStmtFor. NFC.
Michael Kruse [Wed, 24 Feb 2016 22:08:19 +0000 (22:08 +0000)]
Introduce Scop::getStmtFor. NFC.

Replace Scop::getStmtForBasicBlock and Scop::getStmtForRegionNode, and
add overloads for llvm::Instruction and llvm::RegionNode.

getStmtFor and overloads become the common interface to get the Stmt
that contains something. Named after LoopInfo::getLoopFor and
RegionInfo::getRegionFor.

llvm-svn: 261791

8 years agoAdd assertions checking def dominates use. NFC.
Michael Kruse [Wed, 24 Feb 2016 22:08:14 +0000 (22:08 +0000)]
Add assertions checking def dominates use. NFC.

This is also be caught by the function verifier, but disconnected from
the place that produced it. Catch it already at creation to be able to
reason more directly about the cause.

llvm-svn: 261790

8 years agoAdd assertion to MemoryAccess::addIncoming. NFC.
Michael Kruse [Wed, 24 Feb 2016 22:08:11 +0000 (22:08 +0000)]
Add assertion to MemoryAccess::addIncoming. NFC.

MemoryAccess::addIncoming exists to remember which values come from that
statement in PHI writes, relevant for subregions that have multiple
exiting edges to an exit block. The exit block can be separated from the
exiting block by regions simplifications. It should not be called for
any read accesses.

llvm-svn: 261789

8 years agoUse inline variable declaration. NFC.
Michael Kruse [Wed, 24 Feb 2016 22:08:08 +0000 (22:08 +0000)]
Use inline variable declaration. NFC.

llvm-svn: 261788

8 years agoReplace std::auto_ptr with std::unique_ptr. NFC.
Michael Kruse [Wed, 24 Feb 2016 22:08:05 +0000 (22:08 +0000)]
Replace std::auto_ptr with std::unique_ptr. NFC.

std::auto_ptr has been deprecated in C++11, which some compilers warn
about.

llvm-svn: 261787

8 years agoTidy test case. NFC.
Michael Kruse [Wed, 24 Feb 2016 22:08:02 +0000 (22:08 +0000)]
Tidy test case. NFC.

The test style guide defines that opt should get its input from stdin.
(instead by file argument to avoid that the file name appears in its
output)

CHECK-FORCED is not recognized by FileCheck; remove it.

llvm-svn: 261786

8 years agoProofreading comments in DependenceInfo.h. NFC.
Michael Kruse [Wed, 24 Feb 2016 22:07:57 +0000 (22:07 +0000)]
Proofreading comments in DependenceInfo.h. NFC.

Typos, commas and other minor changes
(e.g. "dependences struct" -> "Dependences struct", because it is the
struct's name)

llvm-svn: 261785

8 years agoRevert "Don't convert a char to a const char *"
David Majnemer [Wed, 24 Feb 2016 22:07:26 +0000 (22:07 +0000)]
Revert "Don't convert a char to a const char *"

This reverts commit r261780.  It turns out the original code was just
fine.  An overload for ltrim which takes char was added but the Doxygen
docs haven't seemed to pick it up.

llvm-svn: 261784

8 years agoMark R_AARCH64_CALL26 as relative.
Rafael Espindola [Wed, 24 Feb 2016 22:07:12 +0000 (22:07 +0000)]
Mark R_AARCH64_CALL26 as relative.

llvm-svn: 261783

8 years agoFix build by using hasFlag instead of hasArg.
Peter Collingbourne [Wed, 24 Feb 2016 22:03:06 +0000 (22:03 +0000)]
Fix build by using hasFlag instead of hasArg.

llvm-svn: 261782

8 years agoPR26237: Fix iterator invalidation bug that occurs if serializing
Richard Smith [Wed, 24 Feb 2016 21:59:10 +0000 (21:59 +0000)]
PR26237: Fix iterator invalidation bug that occurs if serializing
specializations of a template manages to trigger deserialization of more
specializations of the same template.

No test case provided: this is hard to reliably test due to standard library
differences.

Patch by Vassil Vassilev!

llvm-svn: 261781

8 years agoDon't convert a char to a const char *
David Majnemer [Wed, 24 Feb 2016 21:55:58 +0000 (21:55 +0000)]
Don't convert a char to a const char *

This fixes PR26728.

llvm-svn: 261780

8 years ago[CUDA] Mark all CUDA device-side function defs, decls, and calls as convergent.
Justin Lebar [Wed, 24 Feb 2016 21:55:11 +0000 (21:55 +0000)]
[CUDA] Mark all CUDA device-side function defs, decls, and calls as convergent.

Summary:
This is important for e.g. the following case:

  void sync() { __syncthreads(); }
  void foo() {
    do_something();
    sync();
    do_something_else():
  }

Without this change, if the optimizer does not inline sync() (which it
won't because __syncthreads is also marked as noduplicate, for now
anyway), it is free to perform optimizations on sync() that it would not
be able to perform on __syncthreads(), because sync() is not marked as
convergent.

Similarly, we need a notion of convergent calls, since in the case when
we can't statically determine a call's target(s), we need to know
whether it's safe to perform optimizations around the call.

This change is conservative; the optimizer will remove these attrs where
it can, see r260318, r260319.

Reviewers: majnemer

Subscribers: cfe-commits, jhen, echristo, tra

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

llvm-svn: 261779

8 years ago[CUDA] do not allow attribute-based overloading for __global__ functions.
Artem Belevich [Wed, 24 Feb 2016 21:54:45 +0000 (21:54 +0000)]
[CUDA] do not allow attribute-based overloading for __global__ functions.

__global__ functions are present on both host and device side,
so providing __host__ or __device__ overloads is not going to
do anything useful.

llvm-svn: 261778

8 years ago[CUDA] Add conversion operators for threadIdx, blockIdx, gridDim, and blockDim to...
Justin Lebar [Wed, 24 Feb 2016 21:49:33 +0000 (21:49 +0000)]
[CUDA] Add conversion operators for threadIdx, blockIdx, gridDim, and blockDim to uint3 and dim3.

Summary:
This lets you write, e.g.

  uint3 a = threadIdx;
  uint3 b = blockIdx;
  dim3 c = gridDim;
  dim3 d = blockDim;

which is legal in nvcc, but was not legal in clang.

The fact that e.g. the type of threadIdx is not actually uint3 is still
observable, but now you have to try to observe it.

Reviewers: tra

Subscribers: echristo, cfe-commits

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

llvm-svn: 261777

8 years ago[CUDA] Add hack so code which includes "curand.h" doesn't break.
Justin Lebar [Wed, 24 Feb 2016 21:49:31 +0000 (21:49 +0000)]
[CUDA] Add hack so code which includes "curand.h" doesn't break.

Summary:
curand.h includes curand_mtgp32_kernel.h.  In host mode, this header
redefines threadIdx and blockDim, giving them their "proper" types of
uint3 and dim3, respectively.

clang has its own plan for these variables -- their types are magic
builtin classes.  So these redefinitions are incompatible.

As a hack, we force-include the offending CUDA header and use #defines
to get the right types for threadIdx and blockDim.

Reviewers: tra

Subscribers: echristo, cfe-commits

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

llvm-svn: 261776

8 years ago[CUDA] Don't specify exact line numbers in cuda-builtin-vars.cu.
Justin Lebar [Wed, 24 Feb 2016 21:49:30 +0000 (21:49 +0000)]
[CUDA] Don't specify exact line numbers in cuda-builtin-vars.cu.

This makes the test less fragile to changes to cuda_builtin_vars.h.

Test-only change.

llvm-svn: 261775

8 years agoBail on compilation as soon as a job fails.
Justin Lebar [Wed, 24 Feb 2016 21:49:28 +0000 (21:49 +0000)]
Bail on compilation as soon as a job fails.

Summary:
(Re-land of r260448, which was reverted in r260522 due to a test failure
in Driver/output-file-cleanup.c that only showed up in fresh builds.)

Previously we attempted to be smart; if one job failed, we'd run all
jobs that didn't depend on the failing job.

Problem is, this doesn't work well for e.g. CUDA compilation without
-save-temps.  In this case, the device-side and host-side Assemble
actions (which actually are responsible for preprocess, compile,
backend, and assemble, since we're not saving temps) are necessarily
distinct.  So our clever heuristic doesn't help us, and we repeat every
error message once for host and once for each device arch.

The main effect of this change, other than fixing CUDA, is that if you
pass multiple cc files to one instance of clang and you get a compile
error, we'll stop when the first cc1 job fails.

Reviewers: echristo

Subscribers: cfe-commits, jhen, echristo, tra, rafael

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

llvm-svn: 261774

8 years agoMake test/Driver/output-file-cleanup.c hermetic.
Justin Lebar [Wed, 24 Feb 2016 21:49:26 +0000 (21:49 +0000)]
Make test/Driver/output-file-cleanup.c hermetic.

Summary:
It checks that certain files do and exist, so make sure that they don't
exist at the beginning of the test.

This hid a failure in r260448; to see the failure, you had to run the test with
a clean-ish objdir.

Subscribers: cfe-commits

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

llvm-svn: 261773

8 years agoMark R_AARCH64_ADD_ABS_LO12_NC as relative.
Rafael Espindola [Wed, 24 Feb 2016 21:48:06 +0000 (21:48 +0000)]
Mark R_AARCH64_ADD_ABS_LO12_NC as relative.

llvm-svn: 261772

8 years agoSome fixes for case insensitive paths on Windows.
Zachary Turner [Wed, 24 Feb 2016 21:26:47 +0000 (21:26 +0000)]
Some fixes for case insensitive paths on Windows.

Paths on Windows are not case-sensitive.  Because of this, if a file
is called main.cpp, you should be able to set a breakpoint on it
by using the name Main.cpp.  In an ideal world, you could just
tell people to match the case, but in practice this can be a real
problem as it requires you to know whether the person who compiled
the program ran "clang++ main.cpp" or "clang++ Main.cpp", both of
which would work, regardless of what the file was actually called.

This fixes http://llvm.org/pr22667

Patch by Petr Hons

Differential Revision: http://reviews.llvm.org/D17492
Reviewed by: zturner

llvm-svn: 261771

8 years agoFix rejects-valid caused by r261297.
Nico Weber [Wed, 24 Feb 2016 20:58:14 +0000 (20:58 +0000)]
Fix rejects-valid caused by r261297.

r261297 called hasUserProvidedDefaultConstructor() to check if defining a
const object is ok.  This is incorrect for this example:

  struct X { template<typename ...T> X(T...); int n; };
  const X x; // formerly OK, now bogus error

Instead, track if a class has a defaulted default constructor, and disallow
a const object for classes that either have defaulted default constructors or
if they need an implicit constructor.

Bug report and fix approach by Richard Smith, thanks!

llvm-svn: 261770

8 years agoMark R_AARCH64_LDST64_ABS_LO12_NC as relative.
Rafael Espindola [Wed, 24 Feb 2016 20:52:58 +0000 (20:52 +0000)]
Mark R_AARCH64_LDST64_ABS_LO12_NC as relative.

llvm-svn: 261769

8 years agoRemoved unused functions.
Greg Clayton [Wed, 24 Feb 2016 20:47:13 +0000 (20:47 +0000)]
Removed unused functions.

llvm-svn: 261768

8 years agoAdd whole-program vtable optimization feature to Clang.
Peter Collingbourne [Wed, 24 Feb 2016 20:46:36 +0000 (20:46 +0000)]
Add whole-program vtable optimization feature to Clang.

This patch introduces the -fwhole-program-vtables flag, which enables the
whole-program vtable optimization feature (D16795) in Clang.

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

llvm-svn: 261767

8 years agoMark R_AARCH64_LDST32_ABS_LO12_NC as relative.
Rafael Espindola [Wed, 24 Feb 2016 20:18:06 +0000 (20:18 +0000)]
Mark R_AARCH64_LDST32_ABS_LO12_NC as relative.

llvm-svn: 261766

8 years agoR_AARCH64_LDST8_ABS_LO12_NC is effectivelly relative.
Rafael Espindola [Wed, 24 Feb 2016 19:58:50 +0000 (19:58 +0000)]
R_AARCH64_LDST8_ABS_LO12_NC is effectivelly relative.

It only sets the low bits and given the page alignment of PT_LOAD the
dynamic linker can only change the high ones.

llvm-svn: 261765

8 years agoR_AARCH64_ADR_PREL_PG_HI21 is relative.
Rafael Espindola [Wed, 24 Feb 2016 19:36:30 +0000 (19:36 +0000)]
R_AARCH64_ADR_PREL_PG_HI21 is relative.

llvm-svn: 261764

8 years agoMachineInstr: Respect register aliases in clearRegiserKills()
Matthias Braun [Wed, 24 Feb 2016 19:21:48 +0000 (19:21 +0000)]
MachineInstr: Respect register aliases in clearRegiserKills()

This fixes bugs in copy elimination code in llvm. It slightly changes the
semantics of clearRegisterKills(). This is appropriate because:
- Users in lib/CodeGen/MachineCopyPropagation.cpp and
  lib/Target/AArch64RedundantCopyElimination.cpp and
  lib/Target/SystemZ/SystemZElimCompare.cpp are incorrect without it
  (see included testcase).
- All other users in llvm are unaffected (they pass TRI==nullptr)
- (Kill flags are optional anyway so removing too many shouldn't hurt.)

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

llvm-svn: 261763

8 years agoFix typo in test/CodeGen/object-size.c CHECK line.
Bob Wilson [Wed, 24 Feb 2016 18:38:35 +0000 (18:38 +0000)]
Fix typo in test/CodeGen/object-size.c CHECK line.

llvm-svn: 261762

8 years agoELF: Do not instantiate InputSectionBase::Discarded.
Rui Ueyama [Wed, 24 Feb 2016 18:33:35 +0000 (18:33 +0000)]
ELF: Do not instantiate InputSectionBase::Discarded.

"Discarded" section is a marker for discarded sections, and we do not
use the instance except for checking its identity. In that sense, it
is just another type of a "null" pointer for InputSectionBase. So,
it doesn't have to be a real instance of InputSectionBase class.

In this patch, we no longer instantiate Discarded section but instead
use -1 as a pointer value. This eliminates a global variable which
needed initialization at startup.

llvm-svn: 261761

8 years agoMove target independent code out of x86_64 only path.
Rafael Espindola [Wed, 24 Feb 2016 18:24:23 +0000 (18:24 +0000)]
Move target independent code out of x86_64 only path.

The logic for deciding if an undefined symbol should have the value of a
got entry is not target specific.

llvm-svn: 261760

8 years agoAArch64: remove CRC feature from Cyclone.
Tim Northover [Wed, 24 Feb 2016 18:10:17 +0000 (18:10 +0000)]
AArch64: remove CRC feature from Cyclone.

Turns out we don't actually support those instructions.

llvm-svn: 261759

8 years agoAArch64: fix Cyclone CPU features list.
Tim Northover [Wed, 24 Feb 2016 17:57:48 +0000 (17:57 +0000)]
AArch64: fix Cyclone CPU features list.

It turns out we don't have CRC after all. Who knew?

llvm-svn: 261758

8 years ago[ThinLTO] Add missing breaks when parsing summaries (NFC)
Teresa Johnson [Wed, 24 Feb 2016 17:57:28 +0000 (17:57 +0000)]
[ThinLTO] Add missing breaks when parsing summaries (NFC)

This wasn't causing a correctness issue, but was causing extra duplicate
entries to be added to the SummaryMap.

llvm-svn: 261757

8 years agoObjective-C: Add a size field to non-fragile category metadata.
Manman Ren [Wed, 24 Feb 2016 17:49:50 +0000 (17:49 +0000)]
Objective-C: Add a size field to non-fragile category metadata.

This is mainly for extensibility. Note that fragile category metadata,
metadata for classes and protocols all have a size field.

Initial patch was provided by Greg Parker.

rdar://problem/24804226

llvm-svn: 261756

8 years ago[CLANG] [AVX512] [BUILTIN] Adding PSHUF{L|H}W{128|256|512} builtin to clang .
Michael Zuckerman [Wed, 24 Feb 2016 17:39:35 +0000 (17:39 +0000)]
[CLANG] [AVX512] [BUILTIN] Adding PSHUF{L|H}W{128|256|512} builtin to clang .

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

llvm-svn: 261755

8 years ago[SimplifyCFG] Use a more elegant solution than r261731
David Majnemer [Wed, 24 Feb 2016 17:30:48 +0000 (17:30 +0000)]
[SimplifyCFG] Use a more elegant solution than r261731

The cleanupret instruction has an invariant that it's 'from' operand be
a cleanuppad.  This invariant was violated when we removed a dead block
which removed a cleanuppad leaving behind a cleanupret with an undef
'from' operand.

This was solved in r261731 by staving off the removal of the dead block
to a later pass.

However, it occured to me that we do not need to do this.
Instead, we can simply avoid processing the cleanupret if it has an
undef 'from' operand because we know that it will be removed soon.

llvm-svn: 261754

8 years ago[X86][SSSE3] Added target shuffle combine tests for SSE3/SSSE3 specific shuffles.
Simon Pilgrim [Wed, 24 Feb 2016 17:08:59 +0000 (17:08 +0000)]
[X86][SSSE3] Added target shuffle combine tests for SSE3/SSSE3 specific shuffles.

Allows us to test SSSE3 PSHUFB intrinsic.

llvm-svn: 261753

8 years agoremove fixme comment that was fixed with r261750
Sanjay Patel [Wed, 24 Feb 2016 17:08:29 +0000 (17:08 +0000)]
remove fixme comment that was fixed with r261750

llvm-svn: 261752

8 years ago[WinEH] Make sure terminate handlers have funclet operands
David Majnemer [Wed, 24 Feb 2016 17:02:45 +0000 (17:02 +0000)]
[WinEH] Make sure terminate handlers have funclet operands

Calls to the terminate handler must be annotated within the exception
region they are within.

llvm-svn: 261751

8 years ago[InstCombine] enable optimization of casted vector xor instructions
Sanjay Patel [Wed, 24 Feb 2016 17:00:34 +0000 (17:00 +0000)]
[InstCombine] enable optimization of casted vector xor instructions

This is part of the payoff for the refactoring in:
http://reviews.llvm.org/rL261649
http://reviews.llvm.org/rL261707

In addition to removing a pile of duplicated code, the xor case was
missing the optimization for vector types because it checked
"SrcTy->isIntegerTy()" rather than "SrcTy->isIntOrIntVectorTy()"
like 'and' and 'or' were already doing.

This solves part of:
https://llvm.org/bugs/show_bug.cgi?id=26702

llvm-svn: 261750

8 years agoCreate implicit plt entries for R_X86_64_32S.
Rafael Espindola [Wed, 24 Feb 2016 16:37:47 +0000 (16:37 +0000)]
Create implicit plt entries for R_X86_64_32S.

llvm-svn: 261749

8 years agoadd test to show missing bitcasted vector xor fold
Sanjay Patel [Wed, 24 Feb 2016 16:34:29 +0000 (16:34 +0000)]
add test to show missing bitcasted vector xor fold

llvm-svn: 261748

8 years agoMark R_AARCH64_PREL32 as relative.
Rafael Espindola [Wed, 24 Feb 2016 16:15:13 +0000 (16:15 +0000)]
Mark R_AARCH64_PREL32 as relative.

llvm-svn: 261747

8 years ago`MSP430InstrInfo::loadRegFromStackSlot` forgets to set register def.
Anton Korobeynikov [Wed, 24 Feb 2016 15:15:02 +0000 (15:15 +0000)]
`MSP430InstrInfo::loadRegFromStackSlot` forgets to set register def.

Summary:
For instance, compiling the below results in a panic:

```
llc: ../lib/CodeGen/InlineSpiller.cpp:1140: bool (anonymous namespace)::InlineSpiller::foldMemoryOperand(ArrayRef<std::pair<MachineInstr *, unsigned int> >, llvm::MachineInstr *): Assertion `MO->isDead() && "Cannot fold physreg def"' failed.
#0 0x00007f50fbcf353e llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/h/3rd/llvm/build/../lib/Support/Unix/Signals.inc:321:15
#1 0x00007f50fbcf3929 PrintStackTraceSignalHandler(void*) /home/h/3rd/llvm/build/../lib/Support/Unix/Signals.inc:380:1
#2 0x00007f50fbcf22a3 llvm::sys::RunSignalHandlers() /home/h/3rd/llvm/build/../lib/Support/Signals.cpp:45:5
#3 0x00007f50fbcf3bb4 SignalHandler(int) /home/h/3rd/llvm/build/../lib/Support/Unix/Signals.inc:210:1
#4 0x00007f50fa87a180 (/lib/x86_64-linux-gnu/libc.so.6+0x35180)
#5 0x00007f50fa87a107 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x35107)
#6 0x00007f50fa87b4e8 abort (/lib/x86_64-linux-gnu/libc.so.6+0x364e8)
#7 0x00007f50fa873226 (/lib/x86_64-linux-gnu/libc.so.6+0x2e226)
#8 0x00007f50fa8732d2 (/lib/x86_64-linux-gnu/libc.so.6+0x2e2d2)
#9 0x00007f50fddd9287 (anonymous namespace)::InlineSpiller::foldMemoryOperand(llvm::ArrayRef<std::pair<llvm::MachineInstr*, unsigned int> >, llvm::MachineInstr*) /home/h/3rd/llvm/build/../lib/CodeGen/InlineSpiller.cpp:1141:21
#10 0x00007f50fddd9ee9 (anonymous namespace)::InlineSpiller::spillAroundUses(unsigned int) /home/h/3rd/llvm/build/../lib/CodeGen/InlineSpiller.cpp:1286:9
#11 0x00007f50fddd388b (anonymous namespace)::InlineSpiller::spillAll() /home/h/3rd/llvm/build/../lib/CodeGen/InlineSpiller.cpp:1338:21
#12 0x00007f50fddd221d (anonymous namespace)::InlineSpiller::spill(llvm::LiveRangeEdit&) /home/h/3rd/llvm/build/../lib/CodeGen/InlineSpiller.cpp:1391:3
#13 0x00007f50fdfd921b (anonymous namespace)::RAGreedy::selectOrSplitImpl(llvm::LiveInterval&, llvm::SmallVectorImpl<unsigned int>&, llvm::SmallSet<unsigned int, 16u, std::less<unsigned int> >&, unsigned int) /home/h/3rd/llvm/build/../lib/CodeGen/RegAllocGreedy.cpp:2555:5
#14 0x00007f50fdfd647b (anonymous namespace)::RAGreedy::selectOrSplit(llvm::LiveInterval&, llvm::SmallVectorImpl<unsigned int>&) /home/h/3rd/llvm/build/../lib/CodeGen/RegAllocGreedy.cpp:2221:12
#15 0x00007f50fdfc89f9 llvm::RegAllocBase::allocatePhysRegs() /home/h/3rd/llvm/build/../lib/CodeGen/RegAllocBase.cpp:110:14
#16 0x00007f50fdfd6337 (anonymous namespace)::RAGreedy::runOnMachineFunction(llvm::MachineFunction&) /home/h/3rd/llvm/build/../lib/CodeGen/RegAllocGreedy.cpp:2611:3
#17 0x00007f50fded33ee llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/h/3rd/llvm/build/../lib/CodeGen/MachineFunctionPass.cpp:43:3
#18 0x00007f50fd6cdc6f llvm::FPPassManager::runOnFunction(llvm::Function&) /home/h/3rd/llvm/build/../lib/IR/LegacyPassManager.cpp:1550:23
#19 0x00007f50fd6cdf85 llvm::FPPassManager::runOnModule(llvm::Module&) /home/h/3rd/llvm/build/../lib/IR/LegacyPassManager.cpp:1571:16
#20 0x00007f50fd6ce71a (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/h/3rd/llvm/build/../lib/IR/LegacyPassManager.cpp:1627:23
#21 0x00007f50fd6ce246 llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/h/3rd/llvm/build/../lib/IR/LegacyPassManager.cpp:1730:16
#22 0x00007f50fd6cec31 llvm::legacy::PassManager::run(llvm::Module&) /home/h/3rd/llvm/build/../lib/IR/LegacyPassManager.cpp:1761:3
#23 0x0000000000415bdc compileModule(char**, llvm::LLVMContext&) /home/h/3rd/llvm/build/../tools/llc/llc.cpp:405:5
#24 0x0000000000414571 main /home/h/3rd/llvm/build/../tools/llc/llc.cpp:211:13
#25 0x00007f50fa866b45 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b45)
#26 0x0000000000414296 _start (/home/h/3rd/llvm/build/bin/llc+0x414296)
Stack dump:
0. Program arguments: ./bin/llc -mtriple msp430 loadstore.ll
1. Running pass 'Function Pass Manager' on module 'loadstore.ll'.
2. Running pass 'Greedy Register Allocator' on function '@inc'
```

Original IR:

```llvm
%struct.VeryLarge = type { i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }

; Function Attrs: norecurse nounwind
define void @inc(%struct.VeryLarge* noalias nocapture sret %agg.result, %struct.VeryLarge* byval align 1 %s) #0 {
entry:
  %p0 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 0
  %0 = load i8, i8* %p0, align 1, !tbaa !1
  %p1 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 1
  %1 = load i32, i32* %p1, align 1, !tbaa !6
  %p2 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 2
  %2 = load i32, i32* %p2, align 1, !tbaa !7
  %p3 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 3
  %3 = load i32, i32* %p3, align 1, !tbaa !8
  %p4 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 4
  %4 = load i32, i32* %p4, align 1, !tbaa !9
  %p5 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 5
  %5 = load i32, i32* %p5, align 1, !tbaa !10
  %p6 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 6
  %6 = load i32, i32* %p6, align 1, !tbaa !11
  %p7 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 7
  %7 = load i32, i32* %p7, align 1, !tbaa !12
  %p8 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 8
  %8 = load i32, i32* %p8, align 1, !tbaa !13
  %p9 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 9
  %9 = load i32, i32* %p9, align 1, !tbaa !14
  %p10 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 10
  %10 = load i32, i32* %p10, align 1, !tbaa !15
  %p11 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 11
  %11 = load i32, i32* %p11, align 1, !tbaa !16
  %p12 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 12
  %12 = load i32, i32* %p12, align 1, !tbaa !17
  %p13 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 13
  %13 = load i32, i32* %p13, align 1, !tbaa !18
  %p14 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 14
  %14 = load i32, i32* %p14, align 1, !tbaa !19
  %p15 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 15
  %15 = load i32, i32* %p15, align 1, !tbaa !20
  %p16 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 16
  %16 = load i32, i32* %p16, align 1, !tbaa !21
  %p17 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 17
  %17 = load i32, i32* %p17, align 1, !tbaa !22
  %p18 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 18
  %18 = load i32, i32* %p18, align 1, !tbaa !23
  %p19 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 19
  %19 = load i32, i32* %p19, align 1, !tbaa !24
  %p20 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 20
  %20 = load i32, i32* %p20, align 1, !tbaa !25
  %p21 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 21
  %21 = load i32, i32* %p21, align 1, !tbaa !26
  %p22 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 22
  %22 = load i32, i32* %p22, align 1, !tbaa !27
  %p23 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 23
  %23 = load i32, i32* %p23, align 1, !tbaa !28
  %p24 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 24
  %24 = load i32, i32* %p24, align 1, !tbaa !29
  %p25 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 25
  %25 = load i32, i32* %p25, align 1, !tbaa !30
  %p26 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 26
  %26 = load i32, i32* %p26, align 1, !tbaa !31
  %p27 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 27
  %27 = load i32, i32* %p27, align 1, !tbaa !32
  %p28 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 28
  %28 = load i32, i32* %p28, align 1, !tbaa !33
  %p29 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 29
  %29 = load i32, i32* %p29, align 1, !tbaa !34
  %p30 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 30
  %30 = load i32, i32* %p30, align 1, !tbaa !35
  %p31 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 31
  %31 = load i32, i32* %p31, align 1, !tbaa !36
  %p32 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 32
  %32 = load i32, i32* %p32, align 1, !tbaa !37
  %add = add i8 %0, 1
  store i8 %add, i8* %p0, align 1, !tbaa !1
  %add2 = add i32 %1, 2
  store i32 %add2, i32* %p1, align 1, !tbaa !6
  %add3 = add i32 %2, 3
  store i32 %add3, i32* %p2, align 1, !tbaa !7
  %add4 = add i32 %3, 4
  store i32 %add4, i32* %p3, align 1, !tbaa !8
  %add5 = add i32 %4, 5
  store i32 %add5, i32* %p4, align 1, !tbaa !9
  %add6 = add i32 %5, 6
  store i32 %add6, i32* %p5, align 1, !tbaa !10
  %add7 = add i32 %6, 7
  store i32 %add7, i32* %p6, align 1, !tbaa !11
  %add8 = add i32 %7, 8
  store i32 %add8, i32* %p7, align 1, !tbaa !12
  %add9 = add i32 %8, 9
  store i32 %add9, i32* %p8, align 1, !tbaa !13
  %add10 = add i32 %9, 10
  store i32 %add10, i32* %p9, align 1, !tbaa !14
  %add11 = add i32 %10, 11
  store i32 %add11, i32* %p10, align 1, !tbaa !15
  %add12 = add i32 %11, 12
  store i32 %add12, i32* %p11, align 1, !tbaa !16
  %add13 = add i32 %12, 13
  store i32 %add13, i32* %p12, align 1, !tbaa !17
  %add14 = add i32 %13, 14
  store i32 %add14, i32* %p13, align 1, !tbaa !18
  %add15 = add i32 %14, 15
  store i32 %add15, i32* %p14, align 1, !tbaa !19
  %add16 = add i32 %15, 16
  store i32 %add16, i32* %p15, align 1, !tbaa !20
  %add17 = add i32 %16, 17
  store i32 %add17, i32* %p16, align 1, !tbaa !21
  %add18 = add i32 %17, 18
  store i32 %add18, i32* %p17, align 1, !tbaa !22
  %add19 = add i32 %18, 19
  store i32 %add19, i32* %p18, align 1, !tbaa !23
  %add20 = add i32 %19, 20
  store i32 %add20, i32* %p19, align 1, !tbaa !24
  %add21 = add i32 %20, 21
  store i32 %add21, i32* %p20, align 1, !tbaa !25
  %add22 = add i32 %21, 22
  store i32 %add22, i32* %p21, align 1, !tbaa !26
  %add23 = add i32 %22, 23
  store i32 %add23, i32* %p22, align 1, !tbaa !27
  %add24 = add i32 %23, 24
  store i32 %add24, i32* %p23, align 1, !tbaa !28
  %add25 = add i32 %24, 25
  store i32 %add25, i32* %p24, align 1, !tbaa !29
  %add26 = add i32 %25, 26
  store i32 %add26, i32* %p25, align 1, !tbaa !30
  %add27 = add i32 %26, 27
  store i32 %add27, i32* %p26, align 1, !tbaa !31
  %add28 = add i32 %27, 28
  store i32 %add28, i32* %p27, align 1, !tbaa !32
  %add29 = add i32 %28, 29
  store i32 %add29, i32* %p28, align 1, !tbaa !33
  %add30 = add i32 %29, 30
  store i32 %add30, i32* %p29, align 1, !tbaa !34
  %add31 = add i32 %30, 31
  store i32 %add31, i32* %p30, align 1, !tbaa !35
  %add32 = add i32 %31, 32
  store i32 %add32, i32* %p31, align 1, !tbaa !36
  %add33 = add i32 %32, 33
  store i32 %add33, i32* %p32, align 1, !tbaa !37
  %33 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %agg.result, i32 0, i32 0
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %33, i8* %p0, i32 129, i32 1, i1 false), !tbaa.struct !38
  ret void
}

; Function Attrs: argmemonly nounwind
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i32, i1) #1

attributes #0 = { norecurse nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { argmemonly nounwind }

!llvm.ident = !{!0}

!0 = !{!"clang version 3.8.0 (git://github.com/llvm-mirror/clang 40ef2b7531472c41212c4719a9294aeb7bddebbc) (git://github.com/llvm-mirror/llvm c601eaf55606dfb9ad372b514b77aa00d1409be1)"}
!1 = !{!2, !3, i64 0}
!2 = !{!"", !3, i64 0, !5, i64 1, !5, i64 5, !5, i64 9, !5, i64 13, !5, i64 17, !5, i64 21, !5, i64 25, !5, i64 29, !5, i64 33, !5, i64 37, !5, i64 41, !5, i64 45, !5, i64 49, !5, i64 53, !5, i64 57, !5, i64 61, !5, i64 65, !5, i64 69, !5, i64 73, !5, i64 77, !5, i64 81, !5, i64 85, !5, i64 89, !5, i64 93, !5, i64 97, !5, i64 101, !5, i64 105, !5, i64 109, !5, i64 113, !5, i64 117, !5, i64 121, !5, i64 125}
!3 = !{!"omnipotent char", !4, i64 0}
!4 = !{!"Simple C/C++ TBAA"}
!5 = !{!"int", !3, i64 0}
!6 = !{!2, !5, i64 1}
!7 = !{!2, !5, i64 5}
!8 = !{!2, !5, i64 9}
!9 = !{!2, !5, i64 13}
!10 = !{!2, !5, i64 17}
!11 = !{!2, !5, i64 21}
!12 = !{!2, !5, i64 25}
!13 = !{!2, !5, i64 29}
!14 = !{!2, !5, i64 33}
!15 = !{!2, !5, i64 37}
!16 = !{!2, !5, i64 41}
!17 = !{!2, !5, i64 45}
!18 = !{!2, !5, i64 49}
!19 = !{!2, !5, i64 53}
!20 = !{!2, !5, i64 57}
!21 = !{!2, !5, i64 61}
!22 = !{!2, !5, i64 65}
!23 = !{!2, !5, i64 69}
!24 = !{!2, !5, i64 73}
!25 = !{!2, !5, i64 77}
!26 = !{!2, !5, i64 81}
!27 = !{!2, !5, i64 85}
!28 = !{!2, !5, i64 89}
!29 = !{!2, !5, i64 93}
!30 = !{!2, !5, i64 97}
!31 = !{!2, !5, i64 101}
!32 = !{!2, !5, i64 105}
!33 = !{!2, !5, i64 109}
!34 = !{!2, !5, i64 113}
!35 = !{!2, !5, i64 117}
!36 = !{!2, !5, i64 121}
!37 = !{!2, !5, i64 125}
!38 = !{i64 0, i64 1, !39, i64 1, i64 4, !40, i64 5, i64 4, !40, i64 9, i64 4, !40, i64 13, i64 4, !40, i64 17, i64 4, !40, i64 21, i64 4, !40, i64 25, i64 4, !40, i64 29, i64 4, !40, i64 33, i64 4, !40, i64 37, i64 4, !40, i64 41, i64 4, !40, i64 45, i64 4, !40, i64 49, i64 4, !40, i64 53, i64 4, !40, i64 57, i64 4, !40, i64 61, i64 4, !40, i64 65, i64 4, !40, i64 69, i64 4, !40, i64 73, i64 4, !40, i64 77, i64 4, !40, i64 81, i64 4, !40, i64 85, i64 4, !40, i64 89, i64 4, !40, i64 93, i64 4, !40, i64 97, i64 4, !40, i64 101, i64 4, !40, i64 105, i64 4, !40, i64 109, i64 4, !40, i64 113, i64 4, !40, i64 117, i64 4, !40, i64 121, i64 4, !40, i64 125, i64 4, !40}
!39 = !{!3, !3, i64 0}
!40 = !{!5, !5, i64 0}
```

Reviewers: asl

Subscribers: qcolombet

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

llvm-svn: 261746

8 years ago[X86][SSE41] Combine vector blends with zero
Simon Pilgrim [Wed, 24 Feb 2016 15:14:21 +0000 (15:14 +0000)]
[X86][SSE41] Combine vector blends with zero

Part 2 of 2
This patch add support for combining target shuffles into blends-with-zero.

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

llvm-svn: 261745

8 years ago[docs] Change non-c++ code blocks to 'text' format to fix a sphinx warning.
Alexander Kornienko [Wed, 24 Feb 2016 15:07:48 +0000 (15:07 +0000)]
[docs] Change non-c++ code blocks to 'text' format to fix a sphinx warning.

llvm-svn: 261744

8 years ago[X86][SSE41] Combine insertion of zero scalars into vector blends with zero
Simon Pilgrim [Wed, 24 Feb 2016 14:53:27 +0000 (14:53 +0000)]
[X86][SSE41] Combine insertion of zero scalars into vector blends with zero

Part 1 of 2
This patch attempts to replace the insertion of zero scalars with a vector blend with zero, avoiding the use of the integer insertion instructions (which are particularly slow on many targets).
(Part 2 will add support for combining multiple blends-with-zero).

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

llvm-svn: 261743

8 years ago[AMDGPU] Assembler: Simplify handling of optional operands
Nikolay Haustov [Wed, 24 Feb 2016 14:22:47 +0000 (14:22 +0000)]
[AMDGPU] Assembler: Simplify handling of optional operands

Prepare to support DPP encodings.

For DPP encodings, we want row_mask/bank_mask/bound_ctrl to be optional operands. However this means that when parsing instruction which has no mnemonic prefix, we cannot add both default values for VOP3 and for DPP optional operands to OperandVector - neither instructions would match. So add default values for optional operands to MCInst during conversion instead.

Mark more operands as IsOptional = 1 in .td files.
Do not add default values for optional operands to OperandVector in AMDGPUAsmParser.
Add default values for optional operands during conversion using new helper addOptionalImmOperand.
Change to cvtVOP3_2_mod to check instruction flag instead of presence of modifiers. In the future, cvtVOP3* functions can be combined into one.
Separate cvtFlat and cvtFlatAtomic.
Fix CNDMASK_B32 definition to have no modifiers.

Review: http://reviews.llvm.org/D17445

Reviewers: tstellarAMD
llvm-svn: 261742

8 years ago[Renderscript] Change expression strings to use portable format specifiers.
Aidan Dodds [Wed, 24 Feb 2016 14:17:33 +0000 (14:17 +0000)]
[Renderscript] Change expression strings to use portable format specifiers.

Mips64 tests were failing on windows because the sscanf implementation differs between clang/gcc/msvc such that on windows %lx specifies a 32bits parameter and %llx is for 64bits. For us this meant that 64bit pointers were being truncated to 32bits on their way into a JIT'd expression.

llvm-svn: 261741

8 years ago[MSAN] Fix memcmp_test on MIPS
Sagar Thakur [Wed, 24 Feb 2016 13:48:14 +0000 (13:48 +0000)]
[MSAN] Fix memcmp_test on MIPS

Summary: As per the test the 4th element of both arrays are not initialized and hence will contain garbage values. Memcmp returns the difference between the garbage values of the 4th element which will be different on every run of the test. And since the return value of memcmp is returned from main, we are getting random exit code every time.

Reviewers: kcc, eugenis
Subscribers: mohit.bhakkad, jaydeep, llvm-commits
Differential: http://reviews.llvm.org/D17534
llvm-svn: 261739

8 years ago[clang-tidy] introduce modernize-deprecated-headers check
Alexander Kornienko [Wed, 24 Feb 2016 13:36:34 +0000 (13:36 +0000)]
[clang-tidy] introduce modernize-deprecated-headers check

Summary:
This patch introduces the modernize-deprecated-headers check, which is supposed to replace deprecated C library headers with the C++ STL-ones.

For information see documentation; for exmaples see the test cases.

Reviewers: Eugene.Zelenko, LegalizeAdulthood, alexfh

Subscribers: cfe-commits

Patch by Kirill Bobyrev!

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

llvm-svn: 261738

8 years ago[clang-tidy] Added a check for forward declaration in the potentially wrong namespace
Alexander Kornienko [Wed, 24 Feb 2016 13:35:32 +0000 (13:35 +0000)]
[clang-tidy] Added a check for forward declaration in the potentially wrong namespace

Adds a new check "misc-forward-declaration-namespace".
In check, A forward declaration is considerred in a potentially wrong namespace
if there is any definition/declaration with the same name exists in a different
namespace.

Reviewers: akuegel, hokein, alexfh

Patch by Eric Liu!

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

llvm-svn: 261737

8 years agoNFC. Move isDereferenceable to Loads.h/cpp
Artur Pilipenko [Wed, 24 Feb 2016 12:49:04 +0000 (12:49 +0000)]
NFC. Move isDereferenceable to Loads.h/cpp

This is a part of the refactoring to unify isSafeToLoadUnconditionally and isDereferenceablePointer functions. In subsequent change I'm going to eliminate isDerferenceableAndAlignedPointer from Loads API, leaving isSafeToLoadSpecualtively the only function to check is load instruction can be speculated.

Reviewed By: hfinkel

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

llvm-svn: 261736

8 years agoNFC. Move getAlignment helper function from ValueTracking to Value class.
Artur Pilipenko [Wed, 24 Feb 2016 12:25:10 +0000 (12:25 +0000)]
NFC. Move getAlignment helper function from ValueTracking to Value class.

Reviewed By: reames, hfinkel

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

llvm-svn: 261735