platform/upstream/llvm.git
7 years ago[X86] Use SDValue::getConstantOperandVal helper. NFCI.
Simon Pilgrim [Fri, 5 May 2017 20:53:52 +0000 (20:53 +0000)]
[X86] Use SDValue::getConstantOperandVal helper. NFCI.

llvm-svn: 302286

7 years agoFix detection for [[fallthrough]] with GCC
Eric Fiselier [Fri, 5 May 2017 20:50:24 +0000 (20:50 +0000)]
Fix detection for [[fallthrough]] with GCC

llvm-svn: 302285

7 years ago[ODRHash] Fix typo, NFC
Richard Trieu [Fri, 5 May 2017 20:47:50 +0000 (20:47 +0000)]
[ODRHash] Fix typo, NFC

NestedNameSpecifer to NestedNameSpecifier.  This was not a problem before since
one of the included headers transitively brought in the definition of the class
and only manifested as a problem when using the typoed NestedNameSpecifer and
getting an incomplete type error instead of a typo correction.

llvm-svn: 302284

7 years agoFix remaining GCC 7 build warnings
Eric Fiselier [Fri, 5 May 2017 20:39:03 +0000 (20:39 +0000)]
Fix remaining GCC 7 build warnings

llvm-svn: 302283

7 years agoFix UDP Socket connections
Chris Bieneman [Fri, 5 May 2017 20:35:50 +0000 (20:35 +0000)]
Fix UDP Socket connections

Some of the refactoring in r301492 broke UDP socket connections. This is a partial revert of that refactoring. At some point I'll spend more time diagnosing where the refactoring went wrong and how to better clean up this code, but I don't have time to do that today.

llvm-svn: 302282

7 years ago[clang-tidy] Fix PR32896: detect initializer lists in modernize-use-empalce
Jakub Kuderski [Fri, 5 May 2017 20:35:30 +0000 (20:35 +0000)]
[clang-tidy] Fix PR32896: detect initializer lists in modernize-use-empalce

Summary:
This patch fixes [[ https://bugs.llvm.org/show_bug.cgi?id=32896 | PR32896 ]].

The problem was that modernize-use-emplace incorrectly removed changed push_back into emplace_back, removing explicit constructor call with initializer list parameter, resulting in compiler error after applying fixits.
modernize-use-emplace used to check if matched constructor had InitListExpr, but didn't check against CXXStdInitializerListExpr.

Eg.

```
std::vector<std::vector<int>> v;
  v.push_back(std::vector<int>({1})); // --> v.emplace_back({1});
```

Reviewers: Prazek, alexfh, aaron.ballman

Reviewed By: Prazek, alexfh, aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 302281

7 years agoFix new warnings emitted by GCC 7
Eric Fiselier [Fri, 5 May 2017 20:32:26 +0000 (20:32 +0000)]
Fix new warnings emitted by GCC 7

llvm-svn: 302280

7 years agoRemove isTlsLocalDynamicRel and isTlsInitialExecRel.
Rafael Espindola [Fri, 5 May 2017 20:25:54 +0000 (20:25 +0000)]
Remove isTlsLocalDynamicRel and isTlsInitialExecRel.

This feels a bit hackish, but I think it is still an improvement.

The way a tls address is computed in the various architectures is not
that different. For example, for local dynamic we need the base of the
tls (R_TLSLD or R_TLSLD_PC), and the offset of that particular symbol
(R_ABS).

Given the similarity, we can just use the expressions instead of
having two additional target hooks.

llvm-svn: 302279

7 years agoTargetLibraryInfo: Introduce wcslen
Matthias Braun [Fri, 5 May 2017 20:25:50 +0000 (20:25 +0000)]
TargetLibraryInfo: Introduce wcslen

wcslen is part of the C99 and C++98 standards.

- This introduces the function to TargetLibraryInfo.
- Also set attributes for wcslen in llvm::inferLibFuncAttributes().

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

llvm-svn: 302278

7 years agoAMDGPU/AMDHSA: Set COMPUTE_PGM_RSRC2:LDS_SIZE to 0
Konstantin Zhuravlyov [Fri, 5 May 2017 20:13:55 +0000 (20:13 +0000)]
AMDGPU/AMDHSA: Set COMPUTE_PGM_RSRC2:LDS_SIZE to 0

This field is populated by the CP

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

llvm-svn: 302277

7 years ago[ScopBuilder] Move Scop::init to ScopBuilder. NFC.
Michael Kruse [Fri, 5 May 2017 20:09:08 +0000 (20:09 +0000)]
[ScopBuilder] Move Scop::init to ScopBuilder. NFC.

Scop::init is used only during SCoP construction. Therefore ScopBuilder
seems the more appropriate place for it. We integrate it onto its only
caller ScopBuilder::buildScop where some other construction steps
already took place.

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

llvm-svn: 302276

7 years agoDo not redefine the THREAD_ANNOTATION_ATTRIBUTE__ macro in the documentation.
Aaron Ballman [Fri, 5 May 2017 19:56:09 +0000 (19:56 +0000)]
Do not redefine the THREAD_ANNOTATION_ATTRIBUTE__ macro in the documentation.

Patch by Roman Lebedev.

llvm-svn: 302275

7 years ago[ARM] Limit the diagnose when an ISR calls a regular function
Weiming Zhao [Fri, 5 May 2017 19:25:29 +0000 (19:25 +0000)]
[ARM] Limit the diagnose when an ISR calls a regular function

Summary:
When the function is compiled with soft-float or on CPU with no FPU, we
don't need to diagnose for a call from an ISR to a regular function.

Reviewers: jroelofs, eli.friedman

Reviewed By: jroelofs

Subscribers: aemerson, rengolin, javed.absar, cfe-commits

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

llvm-svn: 302274

7 years agoRemove redundant `explicit`.
Rui Ueyama [Fri, 5 May 2017 19:24:58 +0000 (19:24 +0000)]
Remove redundant `explicit`.

llvm-svn: 302273

7 years agoCFI: Add a blacklist entry for std::_Sp_counted_ptr_inplace::_Sp_counted_ptr_inplace().
Peter Collingbourne [Fri, 5 May 2017 18:46:14 +0000 (18:46 +0000)]
CFI: Add a blacklist entry for std::_Sp_counted_ptr_inplace::_Sp_counted_ptr_inplace().

This ctor is used by std::make_shared and needs to cast to uninitialized T*
in order to call std::allocator_traits<T>::construct.

llvm-svn: 302272

7 years agoCodeGen: avoid use of @clang.arc.use intrinsic at O0
Saleem Abdulrasool [Fri, 5 May 2017 18:39:06 +0000 (18:39 +0000)]
CodeGen: avoid use of @clang.arc.use intrinsic at O0

The clang.arc.use intrinsic is removed via the ARC Contract Pass.  This
pass is only executed in optimized builds (>= opt level 1).  Prevent the
optimization implemented in SVN r301667 from triggering at optimization
level 0 like every other ARC use intrinsic usage.

llvm-svn: 302270

7 years agoSimplify dbg.value handling in SDISel with early returns
Reid Kleckner [Fri, 5 May 2017 18:30:34 +0000 (18:30 +0000)]
Simplify dbg.value handling in SDISel with early returns

No functional change other than improving dbgs logging accuracy on
constant dbg values. Previously we would add things like "i32 42" as
debug values, and then log that we were dropping the debug info, which
is silly.

Delete some dead code that was checking for static allocas. This
remained after r207165, but served no purpose. Currently, static alloca
dbg.values are always sent through the DanglingDebugInfoMap, and are
usually made valid the first time the alloca is used.

llvm-svn: 302267

7 years ago[WebAssembly] Add ObjectYAML support for wasm name section
Sam Clegg [Fri, 5 May 2017 18:12:34 +0000 (18:12 +0000)]
[WebAssembly] Add ObjectYAML support for wasm name section

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

llvm-svn: 302266

7 years ago[bpf] fix a bug which causes incorrect big endian reloc fixup
Alexei Starovoitov [Fri, 5 May 2017 18:05:00 +0000 (18:05 +0000)]
[bpf] fix a bug which causes incorrect big endian reloc fixup

  o Add bpfeb support in BPF dwarfdump unit test case

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@fb.com>
llvm-svn: 302265

7 years agoAdd NetBSD to the list of platforms supporting death tests. Two unit
Joerg Sonnenberger [Fri, 5 May 2017 17:57:45 +0000 (17:57 +0000)]
Add NetBSD to the list of platforms supporting death tests. Two unit
tests require this for compilation.

llvm-svn: 302264

7 years agoIf posix_fallocate returns EOPNOTSUPP, fallback to ftruncate.
Joerg Sonnenberger [Fri, 5 May 2017 17:55:58 +0000 (17:55 +0000)]
If posix_fallocate returns EOPNOTSUPP, fallback to ftruncate.
This can happen at least on NetBSD.

llvm-svn: 302263

7 years ago[KnownBits] Add wrapper methods for setting and clear all bits in the underlying...
Craig Topper [Fri, 5 May 2017 17:36:09 +0000 (17:36 +0000)]
[KnownBits] Add wrapper methods for setting and clear all bits in the underlying APInts in KnownBits.

This adds routines for reseting KnownBits to unknown, making the value all zeros or all ones. It also adds methods for querying if the value is zero, all ones or unknown.

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

llvm-svn: 302262

7 years ago[clang-tidy] Fix misc-move-const-arg for move-only types.
Alexander Kornienko [Fri, 5 May 2017 17:33:49 +0000 (17:33 +0000)]
[clang-tidy] Fix misc-move-const-arg for move-only types.

Summary: Fix misc-move-const-arg false positives on move-only types.

Reviewers: sbenza

Reviewed By: sbenza

Subscribers: xazax.hun, cfe-commits

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

llvm-svn: 302261

7 years agoAdd missing 'arch' key to valid qHostInfo keys
Francis Ricci [Fri, 5 May 2017 17:18:08 +0000 (17:18 +0000)]
Add missing 'arch' key to valid qHostInfo keys

Summary:
'arch' is a valid qHostInfo key, but the unit
test for qHostInfo did not include it in the set of possible keys.

Reviewers: tfiala, labath

Subscribers: lldb-commits

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

llvm-svn: 302260

7 years agoANSIfy more. Still no behavior change.
Nico Weber [Fri, 5 May 2017 17:16:58 +0000 (17:16 +0000)]
ANSIfy more. Still no behavior change.

llvm-svn: 302259

7 years agoANSIfy. No behavior change.
Nico Weber [Fri, 5 May 2017 17:15:08 +0000 (17:15 +0000)]
ANSIfy. No behavior change.

llvm-svn: 302258

7 years agoAllow operator-> to work from a FixedStreamArrayIterator.
Adrian McCarthy [Fri, 5 May 2017 17:14:00 +0000 (17:14 +0000)]
Allow operator-> to work from a FixedStreamArrayIterator.

This is similar to my recent fix for VarStreamArrayIterator, but the cause
(and thus the fix) is subtley different.  The FixedStreamArrayIterator
iterates over a const Array, so the iterator's value type must be const.

llvm-svn: 302257

7 years ago[Float2Int] Replace a ConstantRange copy with a move. Remove an extra call to MapVect...
Craig Topper [Fri, 5 May 2017 17:09:29 +0000 (17:09 +0000)]
[Float2Int] Replace a ConstantRange copy with a move. Remove an extra call to MapVector::find.

llvm-svn: 302256

7 years agoWarn that the [] spelling of uuid(...) is deprecated.
Nico Weber [Fri, 5 May 2017 17:05:56 +0000 (17:05 +0000)]
Warn that the [] spelling of uuid(...) is deprecated.

https://reviews.llvm.org/D32879

llvm-svn: 302255

7 years ago[ADT] Add BitVector::find_prev.
Zachary Turner [Fri, 5 May 2017 17:00:04 +0000 (17:00 +0000)]
[ADT] Add BitVector::find_prev.

This almost completes the matrix of all possible find
functions.

*EXISTING*
----------
find_first
find_first_unset
find_next
find_next_unset
find_last
find_last_unset

*NEW*
----
find_prev

*STILL MISSING*
---------------
find_prev_unset

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

llvm-svn: 302254

7 years agoAdd a fix-it for -Wunguarded-availability
Alex Lorenz [Fri, 5 May 2017 16:42:44 +0000 (16:42 +0000)]
Add a fix-it for -Wunguarded-availability

This patch adds a fix-it for the -Wunguarded-availability warning. This fix-it
is similar to the Swift one: it suggests that you wrap the statement in an
`if (@available)` check. The produced fixits are indented (just like the Swift
ones) to make them look nice in Xcode's fix-it preview.

rdar://31680358

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

llvm-svn: 302253

7 years agoAdd more variations of addcarry in the tests. NFC.
Amaury Sechet [Fri, 5 May 2017 16:27:55 +0000 (16:27 +0000)]
Add more variations of addcarry in the tests. NFC.

llvm-svn: 302252

7 years ago[InstSimplify] fix copy-paste mistake in test comments; NFC
Sanjay Patel [Fri, 5 May 2017 16:24:58 +0000 (16:24 +0000)]
[InstSimplify] fix copy-paste mistake in test comments; NFC

llvm-svn: 302251

7 years ago[ObjC] Don't disallow vector parameters/return values in methods
Alex Lorenz [Fri, 5 May 2017 16:15:17 +0000 (16:15 +0000)]
[ObjC] Don't disallow vector parameters/return values in methods
whose introduced version is lower than the allowed version.

We should just rely on the target version as this introduced version can lead
to false positives (e.g. deprecated declarations).

rdar://31964333

llvm-svn: 302250

7 years ago[llvm-dwarfdump] - Add comment for maybeDecompress(). NFC.
George Rimar [Fri, 5 May 2017 16:13:10 +0000 (16:13 +0000)]
[llvm-dwarfdump] - Add comment for maybeDecompress(). NFC.

Addresses post commit review comment.

llvm-svn: 302249

7 years ago[InstSimplify] add tests for (icmp X, C1 | icmp X, C2); NFC
Sanjay Patel [Fri, 5 May 2017 16:12:05 +0000 (16:12 +0000)]
[InstSimplify] add tests for (icmp X, C1 | icmp X, C2); NFC

These are the 'or' counterparts for the tests added with r300493.

llvm-svn: 302248

7 years agoIntroduce Wzero-as-null-pointer-constant.
Nico Weber [Fri, 5 May 2017 16:11:08 +0000 (16:11 +0000)]
Introduce Wzero-as-null-pointer-constant.

Add an opt-in warning that fires when 0 is used as a null pointer.
gcc has this warning, and there's some demand for it.

https://reviews.llvm.org/D32914

llvm-svn: 302247

7 years agofix build on Cygwin
Nuno Lopes [Fri, 5 May 2017 16:08:22 +0000 (16:08 +0000)]
fix build on Cygwin

llvm-svn: 302246

7 years ago[AArch64] Remove AArch64AddressTypePromotion pass
Jun Bum Lim [Fri, 5 May 2017 16:05:41 +0000 (16:05 +0000)]
[AArch64] Remove AArch64AddressTypePromotion pass

Summary:
Remove the AArch64AddressTypePromotion pass as we migrated all transformations
done in this pass into CGP in r299379.

Reviewers: qcolombet, jmolloy, javed.absar, mcrosier

Reviewed By: qcolombet

Subscribers: aemerson, rengolin, mgorny, llvm-commits

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

llvm-svn: 302245

7 years agoFix typo
Tobias Grosser [Fri, 5 May 2017 15:46:01 +0000 (15:46 +0000)]
Fix typo

llvm-svn: 302244

7 years ago[X86][SSE] Add 128/256/512 bit vector build vector from register tests
Simon Pilgrim [Fri, 5 May 2017 15:36:31 +0000 (15:36 +0000)]
[X86][SSE] Add 128/256/512 bit vector build vector from register tests

llvm-svn: 302243

7 years agoRemember OffsetInArchive in LazyObjectFile.
Rafael Espindola [Fri, 5 May 2017 15:17:07 +0000 (15:17 +0000)]
Remember OffsetInArchive in LazyObjectFile.

LazyObjectFile might turn out to be a BitcodeFile, so we need
OffsetInArchive.

llvm-svn: 302242

7 years agoUse the archive offset with --whole-archive.
Rafael Espindola [Fri, 5 May 2017 15:08:06 +0000 (15:08 +0000)]
Use the archive offset with --whole-archive.

The test ELF/lto/thin-archivecollision.ll was not testing what it
wanted to test. It needs two archive members with the same name, but
different offsets.

Without this we could remove all references of OffsetInArchive and all
tests would still pass.

Fixing the test showed that the --whole-archive case was broken, which
this patch fixes.

llvm-svn: 302241

7 years ago[Driver] Add a "-mmacos_version_min" option that's an alias for
Alex Lorenz [Fri, 5 May 2017 14:52:48 +0000 (14:52 +0000)]
[Driver] Add a "-mmacos_version_min" option that's an alias for
"-mmacosx_version_min"

The option -mmacosx_version_min will still be the canonical option for now, but
in the future we will switch over to -mmacos_version_min and make
-mmacosx_version_min an alias instead.

rdar://27043820

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

llvm-svn: 302240

7 years ago[ubsan]: temporarily disable print_stack_trace.cc test
Alexander Potapenko [Fri, 5 May 2017 14:51:16 +0000 (14:51 +0000)]
[ubsan]: temporarily disable print_stack_trace.cc test

Some problems with ARM stack unwinding led to inaccurate stack traces being
printed, which caused this test to fail on
http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15-full-sh

llvm-svn: 302239

7 years ago[LoopIdiom] check for safety while expanding
Aditya Kumar [Fri, 5 May 2017 14:49:45 +0000 (14:49 +0000)]
[LoopIdiom] check for safety while expanding

Loop Idiom recognition was generating memset in a case that
would result generating a division operation to an unsafe location.

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

llvm-svn: 302238

7 years ago[powerpc] Mark coverage-sample.cc as XFAIL on powerpc64le
Bill Seurer [Fri, 5 May 2017 14:20:11 +0000 (14:20 +0000)]
[powerpc] Mark coverage-sample.cc as XFAIL on powerpc64le

When run this test case causes a segementation fault on powerpc64le.
The xfail should be removed when the problem is fixed.

llvm-svn: 302237

7 years ago[Tooling] Remove redundant check, NFCi
Krasimir Georgiev [Fri, 5 May 2017 14:07:23 +0000 (14:07 +0000)]
[Tooling] Remove redundant check, NFCi

Summary: The Database check looks redundant.

Reviewers: bkramer

Subscribers: klimek, cfe-commits

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

llvm-svn: 302236

7 years agoRemember archive name when creating LazyObjectFile.
Rafael Espindola [Fri, 5 May 2017 13:55:51 +0000 (13:55 +0000)]
Remember archive name when creating LazyObjectFile.

It is needed for creating an unique identifier for ThinLTO.

This fixes pr32931.

llvm-svn: 302235

7 years ago[ScopBuilder] Do not verify unfeasible SCoPs.
Michael Kruse [Fri, 5 May 2017 13:38:35 +0000 (13:38 +0000)]
[ScopBuilder] Do not verify unfeasible SCoPs.

SCoPs with unfeasible runtime context are thrown away and therefore
do not need their uses verified.

The added test case requires a complexity limit to exceed.
Normally, error statements are removed from the SCoP and for that
reason are skipped during the verification. If there is a unfeasible
runtime context (here: because of the complexity limit being reached),
the removal of error statements and other SCoP construction steps are
skipped to not waste time. Error statements are not modeled in SCoPs
and therefore have no requirements on whether the scalars used in
them are available.

llvm-svn: 302234

7 years ago[X86][AVX512] Improve support and testing for CTLZ of 512-bit vectors without CDI
Simon Pilgrim [Fri, 5 May 2017 13:31:52 +0000 (13:31 +0000)]
[X86][AVX512] Improve support and testing for CTLZ of 512-bit vectors without CDI

llvm-svn: 302233

7 years agoFix handling of signWrappedSets in access relations
Tobias Grosser [Fri, 5 May 2017 13:20:47 +0000 (13:20 +0000)]
Fix handling of signWrappedSets in access relations

Since r294891, in MemoryAccess::computeBoundsOnAccessRelation(), we skip
manually bounding the access relation in case the parameter of the load
instruction is already a wrapped set. Later on we assume that the lower
bound on the set is always smaller or equal to the upper bound on the
set. Bug 32715 manages to construct a sign wrapped set, in which case
the assertion does not necessarily hold. Fix this by handling a sign
wrapped set similar to a normal wrapped set, that is skipping the
computation.

Contributed-by: Maximilian Falkenstein <falkensm@student.ethz.ch>
Reviewers: grosser

Subscribers: pollydev, llvm-commits

Tags: #Polly

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

llvm-svn: 302231

7 years ago[X86] Remove duplicate operation actions. NFCI.
Simon Pilgrim [Fri, 5 May 2017 12:34:55 +0000 (12:34 +0000)]
[X86] Remove duplicate operation actions. NFCI.

llvm-svn: 302230

7 years ago[X86][AVX512CDI] Move v2i64/v4i64 and v4i32/v8i32 VPLZCNT lowering to tablegen
Simon Pilgrim [Fri, 5 May 2017 12:20:34 +0000 (12:20 +0000)]
[X86][AVX512CDI] Move v2i64/v4i64 and v4i32/v8i32 VPLZCNT lowering to tablegen

Extend NoVLX targets to use the 512-bit versions

llvm-svn: 302229

7 years agoRemove stale live-ins in the branch folder
Krzysztof Parzyszek [Fri, 5 May 2017 12:20:07 +0000 (12:20 +0000)]
Remove stale live-ins in the branch folder

Hoisting common code can cause registers that live-in in the successor
blocks to no longer be live-in. The live-in information needs to be
updated to reflect this, or otherwise incorrect code can be generated
later on.

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

llvm-svn: 302228

7 years ago[ELF] - Accept --defsym foo=value form.
George Rimar [Fri, 5 May 2017 11:59:15 +0000 (11:59 +0000)]
[ELF] - Accept --defsym foo=value form.

Previously we accepted --defsym=foo=value only.

Reported by Sean Silva.

llvm-svn: 302227

7 years agoRemove unused variable
Simon Pilgrim [Fri, 5 May 2017 11:55:38 +0000 (11:55 +0000)]
Remove unused variable

llvm-svn: 302226

7 years agoFix segfault resulting from empty print prompt
Pavel Labath [Fri, 5 May 2017 11:51:21 +0000 (11:51 +0000)]
Fix segfault resulting from empty print prompt

Summary:
I have found a way to segfault lldb in 7 keystrokes! Steps to reproduce:
1) Launch lldb
2) Type `print` and hit enter. lldb will now prompt you to type a list of
    expressions, followed by an empty line.
3) Hit enter, indicating the end of your input.
4) Segfault!

After some investigation, I've found the issue in Host/common/Editline.cpp.
Editline::MoveCursor() relies on m_input_lines not being empty when the `to`
argument is CursorPosition::BlockEnd. This scenario, as far as I can tell,
occurs in one specific instance: In Editline::EndOrAddLineCommand() when the
list of lines being processed contains exactly one string (""). Meeting this
condition is fairly simple, I have posted steps to reproduce above.

Reviewers: krytarowski, zturner, labath

Reviewed By: labath

Subscribers: scott.smith, lldb-commits

Differential Revision: https://reviews.llvm.org/D32421
Patch by Alex Langford.

llvm-svn: 302225

7 years ago[ARM] Add support for ORR and ORN instruction substitutions
John Brawn [Fri, 5 May 2017 11:31:25 +0000 (11:31 +0000)]
[ARM] Add support for ORR and ORN instruction substitutions

Recently support was added for substituting one intruction for another by
negating or inverting the immediate, but ORR and ORN were missed so this patch
adds them.

This one is slightly different to the others in that ORN only exists in thumb,
so we only do the substitution in thumb.

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

llvm-svn: 302224

7 years agoAdd TaskMap for iterating a function over a set of integers
Pavel Labath [Fri, 5 May 2017 11:16:59 +0000 (11:16 +0000)]
Add TaskMap for iterating a function over a set of integers

Summary:
Many parallel tasks just want to iterate over all the possible numbers from 0 to N-1.  Rather than enqueue N work items, instead just "map" the function across the requested integer space.

Reviewers: clayborg, labath, tberghammer, zturner

Reviewed By: clayborg, zturner

Subscribers: zturner, lldb-commits

Differential Revision: https://reviews.llvm.org/D32757
Patch by Scott Smith <scott.smith@purestorage.com>.

llvm-svn: 302223

7 years ago[X86][AVX] Add LowerIntUnary helpers to split unary vector ops in half. NFCI.
Simon Pilgrim [Fri, 5 May 2017 10:59:24 +0000 (10:59 +0000)]
[X86][AVX] Add LowerIntUnary helpers to split unary vector ops in half. NFCI.

Same as LowerIntArith helpers but for unary ops instead of binary.

llvm-svn: 302222

7 years ago[llvm-dwarfdump] - Print an error message if section decompression failed.
George Rimar [Fri, 5 May 2017 10:52:39 +0000 (10:52 +0000)]
[llvm-dwarfdump] - Print an error message if section decompression failed.

llvm-dwarfdump currently prints no message if decompression fails
for some reason. I noticed that during work on one of LLD patches
where LLD produced an broken output. It was a bit confusing to see
no output for section dumped and no any error message at all.

Patch adds error message for such cases.

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

llvm-svn: 302221

7 years agoABISysV_arm64: compute return value for large vectors correctly
Pavel Labath [Fri, 5 May 2017 10:50:02 +0000 (10:50 +0000)]
ABISysV_arm64: compute return value for large vectors correctly

Summary:
Arm64 Procedure Call Standard specifies than only vectors up to 16 bytes
are stored in v0 (which makes sense, as that's the size of the
register). 32-byte vector types are passed as regular structs via x8
pointer. Treat them as such.

This fixes TestReturnValue for arm64-clang. I also split the test case
into two so I can avoid the if(gcc) line, and annotate each test
instead. (It seems the vector type tests fail with gcc only when
targetting x86 arches).

Reviewers: tberghammer, eugene

Subscribers: aemerson, omjavaid, rengolin, srhines, lldb-commits

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

llvm-svn: 302220

7 years ago[X86] Remove unused code from X86 optimize LEAs. NFC.
Andrew Ng [Fri, 5 May 2017 09:21:35 +0000 (09:21 +0000)]
[X86] Remove unused code from X86 optimize LEAs. NFC.

This patch removes unused code which is no longer required because of changes
to the DIExpression::prepend function.

llvm-svn: 302219

7 years ago[ubsan] Implement __sanitizer_print_stack_trace for standalone UBSan runtime.
Alexander Potapenko [Fri, 5 May 2017 09:02:28 +0000 (09:02 +0000)]
[ubsan] Implement __sanitizer_print_stack_trace for standalone UBSan runtime.

Patch by Max Moroz, reviewed at https://reviews.llvm.org/D32542

llvm-svn: 302218

7 years agoRevert "[Polly] Added OpenCL Runtime to GPURuntime Library for GPGPU CodeGen"
Siddharth Bhat [Fri, 5 May 2017 09:02:08 +0000 (09:02 +0000)]
Revert "[Polly] Added OpenCL Runtime to GPURuntime Library for GPGPU CodeGen"

This reverts commit 17a84e414adb51ee375d14836d4c2a817b191933.

Patches should have been submitted in the order of:

1. D32852
2. D32854
3. D32431

I mistakenly pushed D32431(3) first. Reverting to push in the correct
order.

llvm-svn: 302217

7 years ago[ArgPromotion] Add a testcase for PR32917
Martin Storsjo [Fri, 5 May 2017 08:40:24 +0000 (08:40 +0000)]
[ArgPromotion] Add a testcase for PR32917

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

llvm-svn: 302216

7 years ago[Polly] Added OpenCL Runtime to GPURuntime Library for GPGPU CodeGen
Siddharth Bhat [Fri, 5 May 2017 07:54:49 +0000 (07:54 +0000)]
[Polly] Added OpenCL Runtime to GPURuntime Library for GPGPU CodeGen

Summary:
When compiling for GPU, one can now choose to compile for OpenCL or CUDA,
with the corresponding polly-gpu-runtime flag (libopencl / libcudart). The
GPURuntime library (GPUJIT) has been extended with the OpenCL Runtime library
for that purpose, correctly choosing the corresponding library calls to the
option chosen when compiling (via different initialization calls).

Additionally, a specific GPU Target architecture can now be chosen with -polly-gpu-arch (only nvptx64 implemented thus far).

Reviewers: grosser, bollu, Meinersbur, etherzhhb, singam-sanjay

Reviewed By: grosser, Meinersbur

Subscribers: singam-sanjay, llvm-commits, pollydev, nemanjai, mgorny, yaxunl, Anastasia

Tags: #polly

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

llvm-svn: 302215

7 years agoInitialize new member X86Operand::FrontendSize in all codepaths.
Daniel Jasper [Fri, 5 May 2017 07:31:40 +0000 (07:31 +0000)]
Initialize new member X86Operand::FrontendSize in all codepaths.

This fixes MSAN-builds after r302179.

llvm-svn: 302214

7 years agoDocument XFAIL's with the relevent bug number
Eric Fiselier [Fri, 5 May 2017 05:19:21 +0000 (05:19 +0000)]
Document XFAIL's with the relevent bug number

llvm-svn: 302213

7 years ago[XRay][compiler-rt] Remove dependency on FileCheck from function id utilities tests
Dean Michael Berris [Fri, 5 May 2017 01:55:13 +0000 (01:55 +0000)]
[XRay][compiler-rt] Remove dependency on FileCheck from function id utilities tests

Follow-up on D32846 to simplify testing and not rely on FileCheck to
test boundary conditions, and instead do all the testing in code
instead.

llvm-svn: 302212

7 years ago[ubsan] Fix error summary message for ObjC BOOL invalid loads
Vedant Kumar [Fri, 5 May 2017 01:35:42 +0000 (01:35 +0000)]
[ubsan] Fix error summary message for ObjC BOOL invalid loads

llvm-svn: 302211

7 years ago[XRay][compiler-rt] Add function id utilities for XRay
Dean Michael Berris [Fri, 5 May 2017 01:27:11 +0000 (01:27 +0000)]
[XRay][compiler-rt] Add function id utilities for XRay

Summary:
This change allows us to provide users and implementers of XRay handlers
a means of converting XRay function id's to addresses. This, in
combination with the facilities provided in D32695, allows users to find
out:

  - How many function id's there are defined in the current binary.
  - Get the address of the function associated with this function id.
  - Patch only specific functions according to their requirements.

While we don't directly provide symbolization support in XRay, having
the function's address lets users determine this information easily
either during runtime, or offline with tools like 'addr2line'.

Reviewers: dblaikie, echristo, pelikan

Subscribers: kpw, llvm-commits

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

llvm-svn: 302210

7 years agoUpdate VP prof metadata during inlining.
Dehao Chen [Fri, 5 May 2017 00:47:34 +0000 (00:47 +0000)]
Update VP prof metadata during inlining.

Summary: r298270 added profile update logic for branch_weights. This patch implements profile update logic for VP prof metadata too.

Reviewers: eraman, tejohnson, davidxl

Reviewed By: eraman

Subscribers: llvm-commits

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

llvm-svn: 302209

7 years ago[ADT] A few minor improvements to BitVector
Zachary Turner [Fri, 5 May 2017 00:19:57 +0000 (00:19 +0000)]
[ADT] A few minor improvements to BitVector

Fixes some spelling mistakes, uses a helper function, and
adds an additional test case.

llvm-svn: 302208

7 years agoDocument that Multilib flags must be actual flags
Jonathan Roelofs [Fri, 5 May 2017 00:18:27 +0000 (00:18 +0000)]
Document that Multilib flags must be actual flags

This is because -print-multi-lib depends on them being flags for correctness.

Fixes a case of this in the arm-android multilib selection logic.

llvm-svn: 302207

7 years ago[pdb] Don't verify TPI hash values up front.
Zachary Turner [Thu, 4 May 2017 23:53:54 +0000 (23:53 +0000)]
[pdb] Don't verify TPI hash values up front.

Verifying the hash values as we are currently doing
results in iterating every type record before the user
even tries to access the first one, and the API user
has no control over, or ability to hook into this
process.

As a result, when the user wants to iterate over types
to print them or index them, this results in a second
iteration over the same list of types.  When there's
upwards of 1,000,000 type records, this is obviously
quite undesirable.

This patch raises the verification outside of TpiStream
, and llvm-pdbdump hooks a hash verification visitor
into the normal dumping process.  So we still verify
the hash records, but we can do it while not requiring
a second iteration over the type stream.

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

llvm-svn: 302206

7 years ago[PDB] Don't build the entire source file list up front.
Zachary Turner [Thu, 4 May 2017 23:53:29 +0000 (23:53 +0000)]
[PDB] Don't build the entire source file list up front.

I tried to run llvm-pdbdump on a very large (~1.5GB) PDB to
try and identify show-stopping performance problems.  This
patch addresses the first such problem.

When loading the DBI stream, before anyone has even tried to
access a single record, we build an in memory map of every
source file for every module.  In the particular PDB I was
using, this was over 85 million files.  Specifically, the
complexity is O(m*n) where m is the number of modules and
n is the average number of source files (including headers)
per module.

The whole reason for doing this was so that we could have
constant time access to any module and any of its source
file lists.  However, we can still get O(1) access to the
source file list for a given module with a simple O(m)
precomputation, and access to the list of modules is
already O(1) anyway.

So this patches reduces the O(m*n) up-front precomputation
to an O(m) one, where n is ~6,500 and n*m is about 85 million
in my pathological test case.

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

llvm-svn: 302205

7 years ago[llvm-pdbdump] Only build the TypeDatabase if necessary.
Zachary Turner [Thu, 4 May 2017 23:53:01 +0000 (23:53 +0000)]
[llvm-pdbdump] Only build the TypeDatabase if necessary.

Building the type database is expensive, and can take multiple
minutes for large PDBs.  But we only need it in certain cases
depending on what command line options are specified.  So only
build it when we know we're about to need it.

llvm-svn: 302204

7 years agoRemap metadata attached to global variables.
Evgeniy Stepanov [Thu, 4 May 2017 23:29:39 +0000 (23:29 +0000)]
Remap metadata attached to global variables.

Fix for PR32577.
Global variables may have !associated metadata, which includes a reference to another global. It needs remapping.

llvm-svn: 302203

7 years ago[RegisterBankInfo] Fix 80-col introduced in r293506.
Quentin Colombet [Thu, 4 May 2017 22:43:08 +0000 (22:43 +0000)]
[RegisterBankInfo] Fix 80-col introduced in r293506.

NFC.

llvm-svn: 302202

7 years ago[GlobalISel] Add missing doxygen keyword for doxygen groups.
Quentin Colombet [Thu, 4 May 2017 22:43:04 +0000 (22:43 +0000)]
[GlobalISel] Add missing doxygen keyword for doxygen groups.

NFC

llvm-svn: 302201

7 years agoAMDGPU: GFX9 GS and HS shaders always have the scratch wave offset in SGPR5
Marek Olsak [Thu, 4 May 2017 22:25:20 +0000 (22:25 +0000)]
AMDGPU: GFX9 GS and HS shaders always have the scratch wave offset in SGPR5

Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 302200

7 years ago[GISel]:Skip legalizing Intermediate inst(with generic types)
Aditya Nandakumar [Thu, 4 May 2017 22:00:42 +0000 (22:00 +0000)]
[GISel]:Skip legalizing Intermediate inst(with generic types)

During legalization, targets can create Pseudo Instructions with
generic types. We shouldn't try to legalize them.

Reviewed by Quentin, dsanders
https://reviews.llvm.org/D32575

llvm-svn: 302199

7 years ago[JumpThreading] When processing compares, explicitly check that the result type is...
Craig Topper [Thu, 4 May 2017 21:45:49 +0000 (21:45 +0000)]
[JumpThreading] When processing compares, explicitly check that the result type is not a vector rather than check for it being an integer.

Compares always return a scalar integer or vector of integers. isIntegerTy returns false for vectors, but that's not completely obvious. So using isVectorTy is less confusing.

llvm-svn: 302198

7 years ago[JumpThreading] Change a dyn_cast that is already protected by an isa check to a...
Craig Topper [Thu, 4 May 2017 21:45:45 +0000 (21:45 +0000)]
[JumpThreading] Change a dyn_cast that is already protected by an isa check to a static cast. Combine the with another static cast. NFC

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

llvm-svn: 302197

7 years ago[GISel]: Add support to translate ConstantVectors
Aditya Nandakumar [Thu, 4 May 2017 21:43:12 +0000 (21:43 +0000)]
[GISel]: Add support to translate ConstantVectors

Reviewed by Quentin
https://reviews.llvm.org/D32814

llvm-svn: 302196

7 years agoFix whitespace before token-paste of an argument.
James Y Knight [Thu, 4 May 2017 21:31:17 +0000 (21:31 +0000)]
Fix whitespace before token-paste of an argument.

The whitespace should come from the argument name in the macro
expansion, rather than from the token passed to the macro (same as it
does when not pasting).

Added a new test case for the change in behavior to stringize_space.c.

FileCheck'ized macro_paste_commaext.c, tweaked the test case, and
added a comment; no behavioral change to this test.

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

llvm-svn: 302195

7 years ago[ConstantRange] Add LLVM_NODISCARD to ConstantRange since a large number of its metho...
Craig Topper [Thu, 4 May 2017 21:29:50 +0000 (21:29 +0000)]
[ConstantRange] Add LLVM_NODISCARD to ConstantRange since a large number of its methods construct new ConstantRange objects.

llvm-svn: 302194

7 years ago[Float2Int] Remove return of ConstantRange from seen method. Nothing uses it so it...
Craig Topper [Thu, 4 May 2017 21:29:45 +0000 (21:29 +0000)]
[Float2Int] Remove return of ConstantRange from seen method. Nothing uses it so it just creates and discards a ConstantRange object for no reason.

llvm-svn: 302193

7 years agoStrip trailing whitespace. NFCI.
Simon Pilgrim [Thu, 4 May 2017 20:55:16 +0000 (20:55 +0000)]
Strip trailing whitespace. NFCI.

llvm-svn: 302192

7 years ago[clangd] Add documentation page
Marc-Andre Laperle [Thu, 4 May 2017 19:57:53 +0000 (19:57 +0000)]
[clangd] Add documentation page

Summary:
Add a simple documentation page for Clangd.
This will be useful for interested users and contributors to get basic information about how
to get started and the progress of Clangd.

Reviewers: krasimir, bkramer

Reviewed By: krasimir

Subscribers: Prazek, jbcoe, JDevlieghere, mgehre, JonasToth, kromanenkov, xazax.hun, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 302191

7 years agoTurn on -Wmicrosoft-enum-forward-reference by default.
Nico Weber [Thu, 4 May 2017 19:54:50 +0000 (19:54 +0000)]
Turn on -Wmicrosoft-enum-forward-reference by default.

clang-cl already errs or warns on everything that cl
warns on in /permissive- mode, except for enum foward
declarations (and ATL attributes).
So warn on enum forward declarations by default.

llvm-svn: 302190

7 years ago[InstSimplify] add folds for or-of-casted-icmps
Sanjay Patel [Thu, 4 May 2017 19:51:34 +0000 (19:51 +0000)]
[InstSimplify] add folds for or-of-casted-icmps

The sibling folds for 'and' with casts were added with https://reviews.llvm.org/rL273200.
This is a preliminary step for adding the 'or' variants for the folds added with https://reviews.llvm.org/rL301260.

The reason for the strange form with constant LHS in the 1st test is because there's another missing fold in that
case for the inverted predicate. That should be fixed when we add the ConstantRange functionality for 'or-of-icmps'
that already exists for 'and-of-icmps'.

I'm hoping to share more code for the and/or cases, so we won't have these differences. This will allow us to remove
code from InstCombine. It's also possible that we can remove some code here in InstSimplify. I think we have some
duplicated folds because patterns are not matched in a general way.

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

llvm-svn: 302189

7 years agoFix bugs checking va_start in lambdas and erroneous contexts
Reid Kleckner [Thu, 4 May 2017 19:51:05 +0000 (19:51 +0000)]
Fix bugs checking va_start in lambdas and erroneous contexts

Summary:
First, getCurFunction looks through blocks and lambdas, which is wrong.
Inside a lambda, va_start should refer to the lambda call operator
prototype. This fixes PR32737.

Second, we shouldn't use any of the getCur* methods, because they look
through contexts that we don't want to look through (EnumDecl,
CapturedStmtDecl). We can use CurContext directly as the calling
context.

Finally, this code assumed that CallExprs would never appear outside of
code contexts (block, function, obj-c method), which is wrong. Struct
member initializers are an easy way to create and parse exprs in a
non-code context.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 302188

7 years agoTurn -Wmicrosoft-enum-value off by default.
Nico Weber [Thu, 4 May 2017 19:36:26 +0000 (19:36 +0000)]
Turn -Wmicrosoft-enum-value off by default.

The warning is currently way too noisy to be useful. The plan is
to make it warn when an MS enum that's negative is compared to
something, but until that's done the warning shouldn't default
to on.

llvm-svn: 302187

7 years agoSimplify the header allocation.
Rafael Espindola [Thu, 4 May 2017 19:34:17 +0000 (19:34 +0000)]
Simplify the header allocation.

In the non linker script case we would try very early to find out if
we could allocate the headers. Failing to do that would add extra
alignment to the first ro section, since we would set PageAlign
thinking it was the first section in the PT_LOAD.

In the linker script case the header allocation must be done in the
end, causing some duplication.

We now tentatively add the headers to the first PT_LOAD and if it
turns out they don't fit, remove them. With this we only need to
allocate the headers in one place in the code.

llvm-svn: 302186

7 years ago[WebAssembly] Add wasm symbol table support to llvm-objdump
Sam Clegg [Thu, 4 May 2017 19:32:43 +0000 (19:32 +0000)]
[WebAssembly] Add wasm symbol table support to llvm-objdump

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

llvm-svn: 302185

7 years agoDriver: only inject libstdc++ paths when needed on CrossWindows
Saleem Abdulrasool [Thu, 4 May 2017 19:18:21 +0000 (19:18 +0000)]
Driver: only inject libstdc++ paths when needed on CrossWindows

When building with libc++ don't bother with injecting the libstdc++
search paths into the linker search path.  This will make it easier to
switch between ld and lld.

llvm-svn: 302184

7 years ago[PPC] When restoring R30 (PIC base pointer), mark it as <def>
Krzysztof Parzyszek [Thu, 4 May 2017 19:14:54 +0000 (19:14 +0000)]
[PPC] When restoring R30 (PIC base pointer), mark it as <def>

This happened on the PPC32/SVR4 path and was discovered when building
FreeBSD on PPC32. It was a typo-class error in the frame lowering code.

This fixes PR26519.

llvm-svn: 302183