platform/upstream/llvm.git
8 years agoFix warning about unused variable.
Rafael Espindola [Wed, 13 Apr 2016 19:09:48 +0000 (19:09 +0000)]
Fix warning about unused variable.

llvm-svn: 266232

8 years agogit-clang-format. NFC.
Rafael Espindola [Wed, 13 Apr 2016 19:07:40 +0000 (19:07 +0000)]
git-clang-format. NFC.

llvm-svn: 266231

8 years agoDon't set MustBeInDynSym for hidden symbols.
Rafael Espindola [Wed, 13 Apr 2016 19:03:34 +0000 (19:03 +0000)]
Don't set MustBeInDynSym for hidden symbols.

llvm-svn: 266230

8 years ago[PGO] Remove redundant VP instrumentation
Betul Buyukkurt [Wed, 13 Apr 2016 18:52:19 +0000 (18:52 +0000)]
[PGO] Remove redundant VP instrumentation

LLVM optimization passes may reduce a profiled target expression
to a constant. Removing runtime calls at such instrumentation points
would help speedup the runtime of the instrumented program.

llvm-svn: 266229

8 years ago[PowerPC] Basic support for P9 byte comparison and count trailing zero insns
Nemanja Ivanovic [Wed, 13 Apr 2016 18:51:18 +0000 (18:51 +0000)]
[PowerPC] Basic support for P9 byte comparison and count trailing zero insns

This patch corresponds to review:
http://reviews.llvm.org/D17850

This patch implements the following instructions:
cmprb, cmpeqb, cnttzw, cnttzw., cnttzd, cnttzd.

llvm-svn: 266228

8 years agoELF: Implement --dynamic-list
Adhemerval Zanella [Wed, 13 Apr 2016 18:51:11 +0000 (18:51 +0000)]
ELF: Implement --dynamic-list

This patch implements the --dynamic-list option, which adds a list of
global symbol that either should not be bounded by default definition
when creating shared libraries, or add in dynamic symbol table in the
case of creating executables.

The patch modifies the ScriptParserBase class to use a list of Token
instead of StringRef, which contains information if the token is a
quoted or unquoted strings. It is used to use a faster search for
exact match symbol name.

The input file follow a similar format of linker script with some
simplifications (it does not have scope or node names). It leads
to a simplified parser define in DynamicList.{cpp,h}.

Different from ld/gold neither glob pattern nor mangled names
(extern 'C++') are currently supported.

llvm-svn: 266227

8 years agoRemove redundant null-check; NFC
Hubert Tong [Wed, 13 Apr 2016 18:41:03 +0000 (18:41 +0000)]
Remove redundant null-check; NFC

llvm-svn: 266226

8 years agollvm-dwp: Add assert text
David Blaikie [Wed, 13 Apr 2016 18:38:33 +0000 (18:38 +0000)]
llvm-dwp: Add assert text

Post-commit feedback from Eric Christopher on r265452.

llvm-svn: 266225

8 years agolibclang: Use early-return to reduce indentation.
David Blaikie [Wed, 13 Apr 2016 18:36:19 +0000 (18:36 +0000)]
libclang: Use early-return to reduce indentation.

& since I'll get blamed for all the lines anyway, remove some
else-after-return and otherwise tidy things up.

llvm-svn: 266224

8 years ago[AArch64] Disable LDP/STP for quads
Evandro Menezes [Wed, 13 Apr 2016 18:31:45 +0000 (18:31 +0000)]
[AArch64] Disable LDP/STP for quads

Disable LDP/STP for quads on Exynos M1 as they are not as efficient as pairs
of regular LDR/STR.

Patch by Abderrazek Zaafrani <a.zaafrani@samsung.com>.

llvm-svn: 266223

8 years agoSimplify memory management of CXEvalResultKind/ExprEvalResult using unique_ptr and...
David Blaikie [Wed, 13 Apr 2016 18:23:33 +0000 (18:23 +0000)]
Simplify memory management of CXEvalResultKind/ExprEvalResult using unique_ptr and a dtor

This doesn't seem to need to be a C type, C only handles a void*, so use
new/delete as usual to simplify allocation and cleanup.

Follow-up to r265994

llvm-svn: 266222

8 years agoRevert "[IR/Verifier] Each DISubprogram with isDefinition: true must belong to a...
Davide Italiano [Wed, 13 Apr 2016 18:08:07 +0000 (18:08 +0000)]
Revert "[IR/Verifier] Each DISubprogram with isDefinition: true must belong to a CU."

This reverts commit r266102. The O(N^2) verifier check causes timeouts
in LTO test suite.

llvm-svn: 266221

8 years ago[ELF] - Change -t implementation to print which archive members are used.
George Rimar [Wed, 13 Apr 2016 18:07:57 +0000 (18:07 +0000)]
[ELF] - Change -t implementation to print which archive members are used.

Previously each archive file was reported no matter were it's member used or not,
like:
lib/libLLVMSupport.a

Now lld prints line for each used internal file, like:
lib/libLLVMSupport.a(lib/Support/CMakeFiles/LLVMSupport.dir/StringSaver.cpp.o)
lib/libLLVMSupport.a(lib/Support/CMakeFiles/LLVMSupport.dir/Host.cpp.o)
lib/libLLVMSupport.a(lib/Support/CMakeFiles/LLVMSupport.dir/ConvertUTF.c.o)

That should be consistent with what gold do.

This fixes PR27243.

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

llvm-svn: 266220

8 years ago[analyzer] Nullability: Suppress diagnostic on bind with cast.
Devin Coughlin [Wed, 13 Apr 2016 17:59:24 +0000 (17:59 +0000)]
[analyzer] Nullability: Suppress diagnostic on bind with cast.

Update the nullability checker to allow an explicit cast to nonnull to
suppress a warning on an assignment of nil to a nonnull:

id _Nonnull x = (id _Nonnull)nil; // no-warning

This suppression as already possible for diagnostics on returns and
function/method arguments.

rdar://problem/25381178

llvm-svn: 266219

8 years ago[IR/DebugInfoMetadata] Simplify array length calculation by using array_lengthof...
David Blaikie [Wed, 13 Apr 2016 17:42:56 +0000 (17:42 +0000)]
[IR/DebugInfoMetadata] Simplify array length calculation by using array_lengthof instead of ArrayRef::size

llvm-svn: 266218

8 years agoCleanup Store Merging in UseAA case
Nirav Dave [Wed, 13 Apr 2016 17:27:26 +0000 (17:27 +0000)]
Cleanup Store Merging in UseAA case

This patch fixes a bug (PR26827) when using anti-aliasing in store
merging. This sets the chain users of the component stores to point to
the new store instead of the component stores chain parent.

Reviewers: jyknight

Subscribers: llvm-commits

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

llvm-svn: 266217

8 years agoSanity check `opt` options compatibility: can't have module-summary or module-hash...
Mehdi Amini [Wed, 13 Apr 2016 17:20:10 +0000 (17:20 +0000)]
Sanity check `opt` options compatibility: can't have module-summary or module-hash when emitting textual IR

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266216

8 years agoRevert "Make aliases explicit in the summary"
Mehdi Amini [Wed, 13 Apr 2016 17:20:07 +0000 (17:20 +0000)]
Revert "Make aliases explicit in the summary"

Inadvertently commited...

This reverts commit e618ec93786d99df2ddf280ad2d5e02f5516cecf.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266215

8 years agoMake aliases explicit in the summary
Mehdi Amini [Wed, 13 Apr 2016 17:18:42 +0000 (17:18 +0000)]
Make aliases explicit in the summary

Summary:
To be able to work accurately on the reference graph when taking decision
about internalizing, promoting, renaming, etc. We need to have the alias
information explicit.

Reviewers: tejohnson

Subscribers: llvm-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266214

8 years ago[OrderFiles] Don't allow lit to run dtrace multithreaded
Chris Bieneman [Wed, 13 Apr 2016 17:12:56 +0000 (17:12 +0000)]
[OrderFiles] Don't allow lit to run dtrace multithreaded

Dtrace is implemented to try and minimize performance impact on the process being traced. This results in dtrace dropping samples if it is taking too many CPU resources. Multi-threading dtrace increases the sample drop rate dramatically.

llvm-svn: 266213

8 years agoAArch64: allow 64-bit access to sysregs.
Tim Northover [Wed, 13 Apr 2016 17:08:55 +0000 (17:08 +0000)]
AArch64: allow 64-bit access to sysregs.

Although all the registers are actually 32-bits, I think we have to assume the
high 32-bits could be RES0 (the ARM ARM is unclear). If so, reading as a 32-bit
register can require extra zero extension operations.

llvm-svn: 266212

8 years agoARM: make Darwin's "-arch armv7em" default to hard-float.
Tim Northover [Wed, 13 Apr 2016 17:08:51 +0000 (17:08 +0000)]
ARM: make Darwin's "-arch armv7em" default to hard-float.

We've already paid the price for separate "armv7m" and "armv7em" slices
(support in other tools), it's silly to make them identical other than the
default CPU.

rdar://23055688

llvm-svn: 266211

8 years agoRevert inadvertently modified comment in r266131
Mehdi Amini [Wed, 13 Apr 2016 17:06:49 +0000 (17:06 +0000)]
Revert inadvertently modified comment in r266131

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266210

8 years agoQualify calls to addressof to avoid getting ADL. Fixes PR#27254.
Marshall Clow [Wed, 13 Apr 2016 17:02:23 +0000 (17:02 +0000)]
Qualify calls to addressof to avoid getting ADL. Fixes PR#27254.

llvm-svn: 266209

8 years agoELF: Use hidden visibility for all DefinedSynthetic symbols.
Peter Collingbourne [Wed, 13 Apr 2016 16:57:28 +0000 (16:57 +0000)]
ELF: Use hidden visibility for all DefinedSynthetic symbols.

This simplifies the code by allowing us to remove the visibility argument
to functions that create synthetic symbols.

The only functional change is that the visibility of the MIPS "_gp" symbol
is now hidden. Because this symbol is defined in every executable or DSO, it
would be difficult to observe a visibility change here.

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

llvm-svn: 266208

8 years agoTest dynamic relocations pointing to __stop_ symbols.
Rafael Espindola [Wed, 13 Apr 2016 16:33:02 +0000 (16:33 +0000)]
Test dynamic relocations pointing to __stop_ symbols.

llvm-svn: 266207

8 years agoAArch64: don't create instructions that write to xzr/wzr twice.
Tim Northover [Wed, 13 Apr 2016 16:25:39 +0000 (16:25 +0000)]
AArch64: don't create instructions that write to xzr/wzr twice.

These are unpredictable even on AArch64.

Patch by Yichao Yu.

llvm-svn: 266206

8 years ago[AMDGPU][llvm-mc] Support of Trap Handler registers (TTMP0..11 and TBA/TMA)git status
Artem Tamazov [Wed, 13 Apr 2016 16:18:41 +0000 (16:18 +0000)]
[AMDGPU][llvm-mc] Support of Trap Handler registers (TTMP0..11 and TBA/TMA)git status

Tests added along with implemented feature.
Note that there is a small leftover of unecessary MI sheduling issue
(more info in the review). CodeGen/AMDGPU/salu-to-valu.ll updated to fix
the false regression.

TODO: Support for TTMP quads, comma-separated syntax in "[]" and more.

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

llvm-svn: 266205

8 years ago[mips] Fix emitAtomicCmpSwapPartword to handle 64 bit pointers correctly
Zoran Jovanovic [Wed, 13 Apr 2016 16:02:25 +0000 (16:02 +0000)]
[mips] Fix emitAtomicCmpSwapPartword to handle 64 bit pointers correctly

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

llvm-svn: 266204

8 years ago[mips] Sign-extend i32 values truncated from previously zero-extended i32 values.
Vasileios Kalintiris [Wed, 13 Apr 2016 15:07:45 +0000 (15:07 +0000)]
[mips] Sign-extend i32 values truncated from previously zero-extended i32 values.

Summary:
This is a special case for MIPS64 because the architecture requires
properly 32-bit sign-extended values in the register containers.

Additionaly, we merge consecutive trunc + AssertZExt nodes in order
to avoid unnecessary sign-extensions when the extension comes from a
type smaller than i32.

Reviewers: dsanders

Subscribers: dsanders, sdardis, llvm-commits

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

llvm-svn: 266203

8 years ago[Clang][AVX512][Builtin] Adding support to intrinsics of pmovs{d|q}{b|w|d}{128|256...
Michael Zuckerman [Wed, 13 Apr 2016 15:02:04 +0000 (15:02 +0000)]
[Clang][AVX512][Builtin] Adding support to intrinsics of pmovs{d|q}{b|w|d}{128|256|512} instruction set

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

llvm-svn: 266202

8 years agoReverting r266199; it causes build bot failures.
Aaron Ballman [Wed, 13 Apr 2016 14:53:52 +0000 (14:53 +0000)]
Reverting r266199; it causes build bot failures.

http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/3255
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/3517

llvm-svn: 266201

8 years agoSimplify strlen to a subtraction for certain cases.
David L Kreitzer [Wed, 13 Apr 2016 14:31:06 +0000 (14:31 +0000)]
Simplify strlen to a subtraction for certain cases.

Patch by Li Huang (li1.huang@intel.com)

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

llvm-svn: 266200

8 years agoAdd functions declared in ctype.h to builtin function database. All functions are...
Aaron Ballman [Wed, 13 Apr 2016 13:55:58 +0000 (13:55 +0000)]
Add functions declared in ctype.h to builtin function database. All functions are annotated with nothrow and pure attribute, which enables better optimization.

Patch by Taewook Oh.

llvm-svn: 266199

8 years ago[OPENMP 4.0] Fixed DSA analysis for taskloop directives.
Alexey Bataev [Wed, 13 Apr 2016 13:36:48 +0000 (13:36 +0000)]
[OPENMP 4.0] Fixed DSA analysis for taskloop directives.

Patch make clang to perform analysis for task-based directives also for
taskloop-based directives.

llvm-svn: 266198

8 years agoMatch types in for loop to fix signedness comparison warning
Ed Maste [Wed, 13 Apr 2016 13:32:06 +0000 (13:32 +0000)]
Match types in for loop to fix signedness comparison warning

llvm-svn: 266197

8 years agoRemove obsolete comments
Pavel Labath [Wed, 13 Apr 2016 13:26:45 +0000 (13:26 +0000)]
Remove obsolete comments

llvm-svn: 266196

8 years ago[Clang][AVX512][Builtin] Adding support for VBROADCAST and VPBROADCASTB/W/D/Q instruc...
Michael Zuckerman [Wed, 13 Apr 2016 12:58:01 +0000 (12:58 +0000)]
[Clang][AVX512][Builtin] Adding support for VBROADCAST and VPBROADCASTB/W/D/Q instruction set

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

llvm-svn: 266195

8 years ago[X86][SSE] Regenerated vector integer absolute tests
Simon Pilgrim [Wed, 13 Apr 2016 12:40:22 +0000 (12:40 +0000)]
[X86][SSE] Regenerated vector integer absolute tests

llvm-svn: 266194

8 years agoCalculate __builtin_object_size when pointer depends on a condition
Petar Jovanovic [Wed, 13 Apr 2016 12:25:25 +0000 (12:25 +0000)]
Calculate __builtin_object_size when pointer depends on a condition

This patch fixes calculating of builtin_object_size if it depends on a
condition. Before this patch compiler did not know how to calculate the
object size when it finds a condition that cannot be eliminated.
This patch enables calculating of builtin_object_size even in case when
condition cannot be eliminated by choosing minimum or maximum value as a
result from condition. Choosing minimum or maximum value from condition
is based on the second argument of __builtin_object_size function.

Patch by Strahinja Petrovic.

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

llvm-svn: 266193

8 years agoFix test rerun logic
Pavel Labath [Wed, 13 Apr 2016 12:05:48 +0000 (12:05 +0000)]
Fix test rerun logic

result_formatter used inspect.getfile() to get the python file name, which returned "*.pyc" if
the bytecode file was present. This resulted in files being displayed with the wrong extension,
and more critically, would confuse the rerun logic because it would try to rerun the pyc file
(which resulted in an empty rerun list as unittest refused to run those).

Fix: use inspect.getsourcefile() instead.

I am not sure why does was not an issue before. I can only assume that some system update
tricked python into producing bytecode files more aggressively.

llvm-svn: 266192

8 years agoComplete support for C++ Core Guidelines Type.6: Always initialize a member variable.
Alexander Kornienko [Wed, 13 Apr 2016 11:35:47 +0000 (11:35 +0000)]
Complete support for C++ Core Guidelines Type.6: Always initialize a member variable.

Summary: Added the remaining features needed to satisfy C++ Core Guideline Type.6: Always initialize a member variable to cppcoreguidelines-pro-type-member-init. The check now flags all default-constructed uses of record types without user-provided default constructors that would leave their memory in an undefined state. The check suggests value initializing them instead.

Reviewers: flx, alexfh, aaron.ballman

Subscribers: klimek, aaron.ballman, LegalizeAdulthood, cfe-commits

Patch by Michael Miller!

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

llvm-svn: 266191

8 years ago[clang-tidy] Add a readability-deleted-default clang-tidy check.
Alexander Kornienko [Wed, 13 Apr 2016 11:33:40 +0000 (11:33 +0000)]
[clang-tidy] Add a readability-deleted-default clang-tidy check.

Checks if constructors and assignment operators that are marked '= default' are
actually deleted by the compiler.

Patch by Alex Pilkiewicz!

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

llvm-svn: 266190

8 years agoAdd AST Matchers for CXXConstructorDecl::isDelegatingConstructor and CXXMethodDecl...
Alexander Kornienko [Wed, 13 Apr 2016 11:13:08 +0000 (11:13 +0000)]
Add AST Matchers for CXXConstructorDecl::isDelegatingConstructor and CXXMethodDecl::isUserProvided.

Summary: Added two AST matchers: isDelegatingConstructor for CXXConstructorDecl::IsDelegatingConstructor; and isUserProvided corresponding to CXXMethodDecl::isUserProvided.

Reviewers: aaron.ballman, alexfh

Subscribers: klimek, cfe-commits

Patch by Michael Miller!

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

llvm-svn: 266189

8 years ago[Clang][AVX512][Builtin] Adding supporting to intrinsics of cvt{b|d|q}2mask{128|256...
Michael Zuckerman [Wed, 13 Apr 2016 10:49:37 +0000 (10:49 +0000)]
[Clang][AVX512][Builtin] Adding supporting to intrinsics of cvt{b|d|q}2mask{128|256|512} and cvtmask2{b|d|q}{128|256|512} instruction set.

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

llvm-svn: 266188

8 years ago[modules] Add OpenCLImageTypes.def to module map to fix the modules build.
Alexey Bader [Wed, 13 Apr 2016 09:54:47 +0000 (09:54 +0000)]
[modules] Add OpenCLImageTypes.def to module map to fix the modules build.

llvm-svn: 266187

8 years agoEnable support for __float128 in Clang
Nemanja Ivanovic [Wed, 13 Apr 2016 09:49:45 +0000 (09:49 +0000)]
Enable support for __float128 in Clang

This patch corresponds to review:
http://reviews.llvm.org/D15120

It adds support for the __float128 keyword, literals and a target feature to
enable it. This support is disabled by default on all targets and any target
that has support for this type is free to add it.

Based on feedback that I've received from target maintainers, this appears to
be the right thing for most targets. I have not heard from the maintainers of
X86 which I believe supports this type. I will subsequently investigate the
impact of enabling this on X86.

llvm-svn: 266186

8 years agoAdded missing autogeneration note
Simon Pilgrim [Wed, 13 Apr 2016 09:28:44 +0000 (09:28 +0000)]
Added missing autogeneration note

llvm-svn: 266185

8 years agoTry to use readability-identifier-naming check on Clang.
Alexander Kornienko [Wed, 13 Apr 2016 08:59:49 +0000 (08:59 +0000)]
Try to use readability-identifier-naming check on Clang.

llvm-svn: 266184

8 years agoDon't use misc-unused-parameters check on LLVM.
Alexander Kornienko [Wed, 13 Apr 2016 08:58:52 +0000 (08:58 +0000)]
Don't use misc-unused-parameters check on LLVM.

llvm-svn: 266183

8 years ago[clang-tidy] Disable misc-unused-parameters for clang.
Alexander Kornienko [Wed, 13 Apr 2016 08:47:42 +0000 (08:47 +0000)]
[clang-tidy] Disable misc-unused-parameters for clang.

llvm-svn: 266182

8 years ago[clang-tidy] add_new_check.py should fail if check name starts with the module name
Alexander Kornienko [Wed, 13 Apr 2016 08:46:32 +0000 (08:46 +0000)]
[clang-tidy] add_new_check.py should fail if check name starts with the module name

+ updated formatting

llvm-svn: 266181

8 years ago[OpenCL] Move OpenCLImageTypes.def from clangAST to clangBasic library.
Alexey Bader [Wed, 13 Apr 2016 08:33:41 +0000 (08:33 +0000)]
[OpenCL] Move OpenCLImageTypes.def from clangAST to clangBasic library.

Putting OpenCLImageTypes.def to clangAST library violates layering requirement: "It's not OK for a Basic/ header to include an AST/ header".
This fixes the modules build.

Differential revision: http://reviews.llvm.org/D18954
Reviewers: Richard Smith, Vassil Vassilev.

llvm-svn: 266180

8 years ago[mips][microMIPS] Add CodeGen support for DIV, MOD, DIVU, MODU, DDIV, DMOD, DDIVU...
Zlatko Buljan [Wed, 13 Apr 2016 08:02:26 +0000 (08:02 +0000)]
[mips][microMIPS] Add CodeGen support for DIV, MOD, DIVU, MODU, DDIV, DMOD, DDIVU and DMODU instructions
Differential Revision: http://reviews.llvm.org/D17137

This patch was reverted after the revertion of dependant patch http://reviews.llvm.org/D17068.
There was the problem with test-suite failure.
The problem is hopefully solved with dependant patch so this patch is commited again.

llvm-svn: 266179

8 years agoconstexpr -> const to appease MSVC bots.
Richard Smith [Wed, 13 Apr 2016 07:47:38 +0000 (07:47 +0000)]
constexpr -> const to appease MSVC bots.

llvm-svn: 266178

8 years agoASTWriterDecl.cpp: Prune a couple of \param(s), corresponding to r266160. [-Wdocument...
NAKAMURA Takumi [Wed, 13 Apr 2016 07:45:10 +0000 (07:45 +0000)]
ASTWriterDecl.cpp: Prune a couple of \param(s), corresponding to r266160. [-Wdocumentation]

llvm-svn: 266177

8 years ago[modules] Add some missing blockinfo records. No functionality change except to llvm...
Richard Smith [Wed, 13 Apr 2016 07:41:35 +0000 (07:41 +0000)]
[modules] Add some missing blockinfo records. No functionality change except to llvm-bcanalyzer output.

llvm-svn: 266176

8 years ago[InstCombine] We folded an fcmp to an i1 instead of a vector of i1
David Majnemer [Wed, 13 Apr 2016 06:55:52 +0000 (06:55 +0000)]
[InstCombine] We folded an fcmp to an i1 instead of a vector of i1

Remove an ad-hoc transform in InstCombine and replace it with more
general machinery (ValueTracking, InstructionSimplify and VectorUtils).

This fixes PR27332.

llvm-svn: 266175

8 years agoSimplify LTOInternalize into UpdateLLVMCompilerUsed
Mehdi Amini [Wed, 13 Apr 2016 06:32:46 +0000 (06:32 +0000)]
Simplify LTOInternalize into UpdateLLVMCompilerUsed

It is now only doing the update to the llvm.compiler_used global.
The client has to call separately the internalization stage.
Hopefully the code is simpler to understand this way.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266174

8 years agoMinor cleanup in Internalize, hide helper class using anonymous namespace (NFC)
Mehdi Amini [Wed, 13 Apr 2016 06:32:29 +0000 (06:32 +0000)]
Minor cleanup in Internalize, hide helper class using anonymous namespace (NFC)

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266173

8 years agoLTOInternalize: Use a StringSet instead of a sorted vector and a binary search query...
Mehdi Amini [Wed, 13 Apr 2016 06:32:04 +0000 (06:32 +0000)]
LTOInternalize: Use a StringSet instead of a sorted vector and a binary search query for each function

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266172

8 years ago[mips][microMIPS] Fix for "Cannot copy registers" assertion
Hrvoje Varga [Wed, 13 Apr 2016 06:17:21 +0000 (06:17 +0000)]
[mips][microMIPS] Fix for "Cannot copy registers" assertion
Differential Revision: http://reviews.llvm.org/D17068

This changes contains fix for failing test-suite. So, this patch should hopefully work now.

llvm-svn: 266171

8 years agoMove "ExternalSymbols" out of LTOInternalize (NFC)
Mehdi Amini [Wed, 13 Apr 2016 05:36:06 +0000 (05:36 +0000)]
Move "ExternalSymbols" out of LTOInternalize (NFC)

This is not really related to internalization per se.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266170

8 years agoReally return whether Internalize did change the Module or not.
Mehdi Amini [Wed, 13 Apr 2016 05:25:16 +0000 (05:25 +0000)]
Really return whether Internalize did change the Module or not.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266169

8 years agoModernize Internalizer with for-range loop (NFC)
Mehdi Amini [Wed, 13 Apr 2016 05:25:12 +0000 (05:25 +0000)]
Modernize Internalizer with for-range loop (NFC)

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266168

8 years agoRefactor the InternalizePass into a helper class, and expose it through a public...
Mehdi Amini [Wed, 13 Apr 2016 05:25:08 +0000 (05:25 +0000)]
Refactor the InternalizePass into a helper class, and expose it through a public free function (NFC)

There is really no reason to require to instanciate a pass manager to
internalize.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266167

8 years ago[PPC64][VSX] Add a couple of new data types for vec_vsx_ld and vec_vsx_st intrinsics...
Chuang-Yu Cheng [Wed, 13 Apr 2016 05:16:31 +0000 (05:16 +0000)]
[PPC64][VSX] Add a couple of new data types for vec_vsx_ld and vec_vsx_st intrinsics and fix incorrect testcases with minor refactoring

New added data types:
  vector double vec_vsx_ld (int, const double *);
  vector float vec_vsx_ld (int, const float *);
  vector bool short vec_vsx_ld (int, const vector bool short *);
  vector bool int vec_vsx_ld (int, const vector bool int *);
  vector signed int vec_vsx_ld (int, const signed int *);
  vector unsigned int vec_vsx_ld (int, const unsigned int *);

  void vec_vsx_st (vector double, int, double *);
  void vec_vsx_st (vector float, int, float *);
  void vec_vsx_st (vector bool short, int, vector bool short *);
  void vec_vsx_st (vector bool short, int, signed short *);
  void vec_vsx_st (vector bool short, int, unsigned short *);
  void vec_vsx_st (vector bool int, int, vector bool int *);
  void vec_vsx_st (vector bool int, int, signed int *);
  void vec_vsx_st (vector bool int, int, unsigned int *);

Also fix testcases which use non-vector argument version of vec_vsx_ld or
vec_vsx_st, but pass incorrect parameter.

llvm-svn: 266166

8 years agoUpdate Symtab::InitAddressIndexes so that computed symbol sizes
Jason Molenda [Wed, 13 Apr 2016 04:32:49 +0000 (04:32 +0000)]
Update Symtab::InitAddressIndexes so that computed symbol sizes
will not exceed the bounds of their Section.  This is addressing a
problem where a file had a large space between two sections that
were not used by this module - the last symbol in the text section
had an enormous size because the distance between that and the first
symbol in the data section were used to compute the size.

http://reviews.llvm.org/D19004
<rdar://problem/25227945>

llvm-svn: 266165

8 years agoAttempt to fix TestCPPBreakpointLocations on Linux/Android.
Oleksiy Vyalov [Wed, 13 Apr 2016 04:21:05 +0000 (04:21 +0000)]
Attempt to fix TestCPPBreakpointLocations on Linux/Android.

llvm-svn: 266164

8 years agoRefactor Internalization pass to use as a callback instead of a StringSet (NFC)
Mehdi Amini [Wed, 13 Apr 2016 04:20:32 +0000 (04:20 +0000)]
Refactor Internalization pass to use as a callback instead of a StringSet (NFC)

This will save a bunch of copies / initialization of intermediate
datastructure, and (hopefully) simplify the code.

This also abstract the symbol preservation mechanism outside of the
Internalization pass into the client code, which is not forced
to keep a map of strings for instance (ThinLTO will prefere hashes).

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266163

8 years agoRecommit r265547, and r265610,r265639,r265657 on top of it, plus
Wei Mi [Wed, 13 Apr 2016 03:08:27 +0000 (03:08 +0000)]
Recommit r265547, and r265610,r265639,r265657 on top of it, plus
two fixes with one about error verify-regalloc reported, and
another about live range update of phi after rematerialization.

r265547:
Replace analyzeSiblingValues with new algorithm to fix its compile
time issue. The patch is to solve PR17409 and its duplicates.

analyzeSiblingValues is a N x N complexity algorithm where N is
the number of siblings generated by reg splitting. Although it
causes siginificant compile time issue when N is large, it is also
important for performance since it removes redundent spills and
enables rematerialization.

To solve the compile time issue, the patch removes analyzeSiblingValues
and replaces it with lower cost alternatives containing two parts. The
first part creates a new spill hoisting method in postOptimization of
register allocation. It does spill hoisting at once after all the spills
are generated instead of inside every instance of selectOrSplit. The
second part queries the define expr of the original register for
rematerializaiton and keep it always available during register allocation
even if it is already dead. It deletes those dead instructions only in
postOptimization. With the two parts in the patch, it can remove
analyzeSiblingValues without sacrificing performance.

Patches on top of r265547:
r265610 "Fix the compare-clang diff error introduced by r265547."
r265639 "Fix the sanitizer bootstrap error in r265547."
r265657 "InlineSpiller.cpp: Escap \@ in r265547. [-Wdocumentation]"

Differential Revision: http://reviews.llvm.org/D15302
Differential Revision: http://reviews.llvm.org/D18934
Differential Revision: http://reviews.llvm.org/D18935
Differential Revision: http://reviews.llvm.org/D18936

llvm-svn: 266162

8 years agoELF: Do not create relative relocations for undefined symbols.
Peter Collingbourne [Wed, 13 Apr 2016 02:24:48 +0000 (02:24 +0000)]
ELF: Do not create relative relocations for undefined symbols.

We need to ensure that the address of an undefined weak symbol evaluates to
zero. We were getting this right for non-PIC executables (where the symbol
can be evaluated directly) and for DSOs (where we emit a symbolic relocation
for these symbols, as they are preemptible). But we weren't getting it right
for PIEs. Probably the simplest way to ensure that these symbols evaluate
to zero is by not creating a relocation in .got for them.

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

llvm-svn: 266161

8 years ago[modules] Refactor handling of cases where we write an offset to a prior record into...
Richard Smith [Wed, 13 Apr 2016 02:12:03 +0000 (02:12 +0000)]
[modules] Refactor handling of cases where we write an offset to a prior record into the bitstream and simplify a little, in preparation for doing this in more cases.

llvm-svn: 266160

8 years agoFix FunctionImport export list computation: need to take a reference to a map entry...
Mehdi Amini [Wed, 13 Apr 2016 01:52:32 +0000 (01:52 +0000)]
Fix FunctionImport export list computation: need to take a reference to a map entry to actually modify it

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266159

8 years agoChange how we apply relocations.
Rafael Espindola [Wed, 13 Apr 2016 01:40:19 +0000 (01:40 +0000)]
Change how we apply relocations.

With this patch we use the first scan over the relocations to remember
the information we found about them: will them be relaxed, will a plt be
used, etc.

With that the actual relocation application becomes much simpler. That
is particularly true for the interfaces in Target.h.

This unfortunately means that we now do two passes over relocations for
non SHF_ALLOC sections. I think this can be solved by factoring out the
code that scans a single relocation. It can then be used both as a scan
that record info and for a dedicated direct relocation of non SHF_ALLOC
sections.

I also think it is possible to reduce the number of enum values by
representing a target with just an OutputSection and an offset (which
can be from the start or end).

This should unblock adding features like relocation optimizations.

llvm-svn: 266158

8 years ago[analyzer] Nullability: Treat nil _Nonnull ivar as invariant violation.
Devin Coughlin [Wed, 13 Apr 2016 00:41:54 +0000 (00:41 +0000)]
[analyzer] Nullability: Treat nil _Nonnull ivar as invariant violation.

Treat a _Nonnull ivar that is nil as an invariant violation in a similar
fashion to how a nil _Nonnull parameter is treated as a precondition violation.

This avoids warning on defensive returns of nil on defensive internal
checks, such as the following common idiom:

@class InternalImplementation
@interface PublicClass {
  InternalImplementation * _Nonnull _internal;
}
-(id _Nonnull)foo;
@end

@implementation PublicClass
-(id _Nonnull)foo {
  if (!_internal)
    return nil; // no-warning

  return [_internal foo];
}
@end

rdar://problem/24485171

llvm-svn: 266157

8 years agoAMDGPU: Add test for m0 initialization in basic loop
Matt Arsenault [Wed, 13 Apr 2016 00:39:52 +0000 (00:39 +0000)]
AMDGPU: Add test for m0 initialization in basic loop

Initialization of m0 is emitted for each LDS operation, so
every block with LDS usage ends up with one. MachineLICM
used to fail to hoist this out of the loop, so every loop
iteration with LDS usage in it would re-initialize it.

This seems to be fixed now, so add a test to make sure that
it stays this way.

llvm-svn: 266156

8 years agoAMDGPU: Remove leftover ShaderType attributes in tests
Matt Arsenault [Wed, 13 Apr 2016 00:39:48 +0000 (00:39 +0000)]
AMDGPU: Remove leftover ShaderType attributes in tests

llvm-svn: 266155

8 years agoclang/test/Driver/cl-options.c: Fix an expression to recognize dos r'\\'.
NAKAMURA Takumi [Wed, 13 Apr 2016 00:22:25 +0000 (00:22 +0000)]
clang/test/Driver/cl-options.c: Fix an expression to recognize dos r'\\'.

llvm-svn: 266154

8 years agoLTOInternalize: Fix member type, should be a reference and not a copy
Mehdi Amini [Tue, 12 Apr 2016 23:58:30 +0000 (23:58 +0000)]
LTOInternalize: Fix member type, should be a reference and not a copy

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266153

8 years agoAMDGPU/SI: Fix spilling of 96-bit registers
Tom Stellard [Tue, 12 Apr 2016 23:57:30 +0000 (23:57 +0000)]
AMDGPU/SI: Fix spilling of 96-bit registers

Summary:
It seems like this was broken in r252327.  I thought we had test cases
for this, but it's really hard to tirgger spills of this exact register
size since they aren't used very much.

Reviewers: arsenm, nhaehnle

Subscribers: nhaehnle, arsenm, llvm-commits

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

llvm-svn: 266152

8 years agoFix mismatch on returned type between header and implementation for createNameAnonFun...
Mehdi Amini [Tue, 12 Apr 2016 23:25:11 +0000 (23:25 +0000)]
Fix mismatch on returned type between header and implementation for createNameAnonFunctionPass()

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266151

8 years agoCodeGen: Clear the MFI's save and restore point after PrologEpilogInserter
Justin Bogner [Tue, 12 Apr 2016 23:21:53 +0000 (23:21 +0000)]
CodeGen: Clear the MFI's save and restore point after PrologEpilogInserter

This state is no longer useful and not guaranteed to be valid in later
codegen passes. For example, see the added test, which would print a
savepoint of %bb.-1 without this change, and crashes with a
use-after-free error under ASan if you apply the recycling allocator
patch from llvm.org/PR26808.

llvm-svn: 266150

8 years agoAdd space between words in verify-scev-maps option help message
Jeroen Ketema [Tue, 12 Apr 2016 23:21:46 +0000 (23:21 +0000)]
Add space between words in verify-scev-maps option help message

llvm-svn: 266149

8 years ago[x86, InstCombine] fix masked load pass-through operand to be a zero vector
Sanjay Patel [Tue, 12 Apr 2016 23:16:23 +0000 (23:16 +0000)]
[x86, InstCombine] fix masked load pass-through operand to be a zero vector

This bug was introduced with:
http://reviews.llvm.org/rL262269

AVX masked loads are specified to set vector lanes to zero when the high bit of the mask
element for that lane is zero:
"If the mask is 0, the corresponding data element is set to zero in the load form of these
instructions, and unmodified in the store form." --Intel manual

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

llvm-svn: 266148

8 years ago[ObjC] Pop all cleanups created in EmitObjCForCollectionStmt before
Akira Hatanaka [Tue, 12 Apr 2016 23:10:58 +0000 (23:10 +0000)]
[ObjC] Pop all cleanups created in EmitObjCForCollectionStmt before
exiting the for-in loop.

This commit fixes a bug where EmitObjCForCollectionStmt didn't pop
cleanups for captures.

For example, in the following for-in loop, a block which captures self
is passed to foo1:

for (id x in [self foo1:^{ use(self); }]) {
  use(x);
  break;
}

Previously, the code in EmitObjCForCollectionStmt wouldn't pop the
cleanup for the captured self before exiting the loop, which caused
code-gen to generate an IR in which objc_release was called twice on
the captured self.

This commit fixes the bug by entering a RunCleanupsScope before the
loop condition is evaluated and forcing its cleanup before exiting the
loop.

rdar://problem/16865751

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

llvm-svn: 266147

8 years agoObjC class properties: add diagnostics for unimplemented class properties.
Manman Ren [Tue, 12 Apr 2016 23:01:55 +0000 (23:01 +0000)]
ObjC class properties: add diagnostics for unimplemented class properties.

rdar://24711047

llvm-svn: 266146

8 years agoFix breakpoint_set_restart test for Windows
Adrian McCarthy [Tue, 12 Apr 2016 22:45:03 +0000 (22:45 +0000)]
Fix breakpoint_set_restart test for Windows

When run with the multiprocess test runner, the getchar() trick doesn't work, so ninja check-lldb would fail on this test, but running the test directly worked fine.

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

llvm-svn: 266145

8 years ago[AArch64] Fuse AES{D,E}/AESMC for Exynos M1. (NFC)
Evandro Menezes [Tue, 12 Apr 2016 22:42:36 +0000 (22:42 +0000)]
[AArch64] Fuse AES{D,E}/AESMC for Exynos M1. (NFC)

llvm-svn: 266144

8 years agoAdd test for the interaction of copy relocations and non alloc sections.
Rafael Espindola [Tue, 12 Apr 2016 22:36:05 +0000 (22:36 +0000)]
Add test for the interaction of copy relocations and non alloc sections.

llvm-svn: 266143

8 years agoPre-fill LibcallRoutineNames with nullptr.
James Y Knight [Tue, 12 Apr 2016 22:32:47 +0000 (22:32 +0000)]
Pre-fill LibcallRoutineNames with nullptr.

And rearrange InitLibcallNames slightly.

llvm-svn: 266142

8 years agoAdd a few more cases to this test.
Rafael Espindola [Tue, 12 Apr 2016 22:08:23 +0000 (22:08 +0000)]
Add a few more cases to this test.

It now documents how we currently handle relocations for
alloc/non-alloc.

llvm-svn: 266141

8 years ago[COFF] Simplify the code leveraging implicit conversion.
Davide Italiano [Tue, 12 Apr 2016 22:05:38 +0000 (22:05 +0000)]
[COFF] Simplify the code leveraging implicit conversion.

Suggested by: David Blaikie!

llvm-svn: 266140

8 years agoFixed being able to set breakpoints on destructors when we don't fully specify the...
Greg Clayton [Tue, 12 Apr 2016 22:02:37 +0000 (22:02 +0000)]
Fixed being able to set breakpoints on destructors when we don't fully specify the demangled name. So all of the following now work:

(lldb) b ~Foo
(lldb) b Foo::~Foo
(lldb) b Bar::Foo::~Foo

Improved out C++ breakpoint locations tests as well to cover this issue.

<rdar://problem/25577252>

llvm-svn: 266139

8 years agoUse the FormatEntity work for great good - parse summary strings before accepting...
Enrico Granata [Tue, 12 Apr 2016 21:57:11 +0000 (21:57 +0000)]
Use the FormatEntity work for great good - parse summary strings before accepting them, and fail to add any strings that fail parsing

llvm-svn: 266138

8 years agoUpdate psabi link for x86-64. Add link to linux gabi supplement.
James Y Knight [Tue, 12 Apr 2016 21:54:57 +0000 (21:54 +0000)]
Update psabi link for x86-64. Add link to linux gabi supplement.

llvm-svn: 266137

8 years ago[MC/ELFObjectWriter] Fix indentation of class body.
David Blaikie [Tue, 12 Apr 2016 21:45:53 +0000 (21:45 +0000)]
[MC/ELFObjectWriter] Fix indentation of class body.

llvm-svn: 266136

8 years agoFixed a few typos and formatting problems. NFCI.
David L Kreitzer [Tue, 12 Apr 2016 21:45:09 +0000 (21:45 +0000)]
Fixed a few typos and formatting problems. NFCI.

llvm-svn: 266135

8 years ago[DebugInfo] Add error message to test.
Davide Italiano [Tue, 12 Apr 2016 21:44:16 +0000 (21:44 +0000)]
[DebugInfo] Add error message to test.

Suggested by Rafael as post-commit review (r266102).

llvm-svn: 266134

8 years ago[AMDGPU] Add debugger related target options
Konstantin Zhuravlyov [Tue, 12 Apr 2016 21:42:15 +0000 (21:42 +0000)]
[AMDGPU] Add debugger related target options

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

llvm-svn: 266133