platform/upstream/llvm.git
7 years agoAdd support for building modules from preprocessed source.
Richard Smith [Fri, 5 May 2017 22:18:51 +0000 (22:18 +0000)]
Add support for building modules from preprocessed source.

To support this, an optional marker "#pragma clang module contents" is
recognized in module map files, and the rest of the module map file from that
point onwards is treated as the source of the module. Preprocessing a module
map produces the input module followed by the marker and then the preprocessed
contents of the module.

Ignoring line markers, a preprocessed module might look like this:

  module A {
    header "a.h"
  }
  #pragma clang module contents
  #pragma clang module begin A
  // ... a.h ...
  #pragma clang module end

The preprocessed output generates line markers, which are not accepted by the
module map parser, so -x c++-module-map-cpp-output should be used to compile
such outputs.

A couple of major parts do not work yet:

1) The files that are listed in the module map must exist on disk, in order to
   build the on-disk header -> module lookup table in the PCM file. To fix
   this, we need the preprocessed output to track the file size and other stat
   information we might use to build the lookup table.

2) Declaration ownership semantics don't work properly yet, since mapping from
   a source location to a module relies on mapping from FileIDs to modules,
   which we can't do if module transitions can occur in the middle of a file.

llvm-svn: 302309

7 years agoOverride invalidate of ProfileSummaryInfo to return false.
Easwaran Raman [Fri, 5 May 2017 22:15:09 +0000 (22:15 +0000)]
Override invalidate of ProfileSummaryInfo to return false.

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

llvm-svn: 302308

7 years ago[Hexagon] Disable predicated calls by default
Krzysztof Parzyszek [Fri, 5 May 2017 22:13:57 +0000 (22:13 +0000)]
[Hexagon] Disable predicated calls by default

llvm-svn: 302307

7 years ago[Hexagon] Remove C6 and C7 as separate registers
Krzysztof Parzyszek [Fri, 5 May 2017 22:12:12 +0000 (22:12 +0000)]
[Hexagon] Remove C6 and C7 as separate registers

These are M0 and M1. Removing duplicated registers reduces the number
of explicit register aliasing.

llvm-svn: 302306

7 years ago[RDF] Remove covered parts of reached uses for phi and use in same block
Krzysztof Parzyszek [Fri, 5 May 2017 22:10:32 +0000 (22:10 +0000)]
[RDF] Remove covered parts of reached uses for phi and use in same block

llvm-svn: 302305

7 years agolld Fixups for TypeDatabase changes.
Zachary Turner [Fri, 5 May 2017 22:06:06 +0000 (22:06 +0000)]
lld Fixups for TypeDatabase changes.

llvm-svn: 302304

7 years agoARM: Compute MaxCallFrame size early
Matthias Braun [Fri, 5 May 2017 22:04:05 +0000 (22:04 +0000)]
ARM: Compute MaxCallFrame size early

This exposes a method in MachineFrameInfo that calculates
MaxCallFrameSize and calls it after instruction selection in the ARM
target.

This avoids
ARMBaseRegisterInfo::canRealignStack()/ARMFrameLowering::hasReservedCallFrame()
giving different answers in early/late phases of codegen.

The testcase shows a particular nasty example result of that where we
would fail to properly align an alloca.

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

llvm-svn: 302303

7 years ago[CodeView] Reserve TypeDatabase records up front.
Zachary Turner [Fri, 5 May 2017 22:02:37 +0000 (22:02 +0000)]
[CodeView] Reserve TypeDatabase records up front.

Most of the time we know exactly how many type records we
have in a list, and we want to use the visitor to deserialize
them into actual records in a database.  Previously we were
just using push_back() every time without reserving the space
up front in the vector.  This is obviously terrible from a
performance standpoint, and it's not uncommon to have PDB
files with half a million type records, where the performance
degredation was quite noticeable.

llvm-svn: 302302

7 years agoAdd missing target triple to test
Matthias Braun [Fri, 5 May 2017 21:50:26 +0000 (21:50 +0000)]
Add missing target triple to test

llvm-svn: 302301

7 years ago[scudo] Add Android support
Kostya Kortchinsky [Fri, 5 May 2017 21:38:22 +0000 (21:38 +0000)]
[scudo] Add Android support

Summary:
This change adds Android support to the allocator (but doesn't yet enable it in
the cmake config), and should be the last fragment of the rewritten change
D31947.

Android has more memory constraints than other platforms, so the idea of a
unique context per thread would not have worked. The alternative chosen is to
allocate a set of contexts based on the number of cores on the machine, and
share those contexts within the threads. Contexts can be dynamically reassigned
to threads to prevent contention, based on a scheme suggested by @dvyuokv in
the initial review.

Additionally, given that Android doesn't support ELF TLS (only emutls for now),
we use the TSan TLS slot to make things faster: Scudo is mutually exclusive
with other sanitizers so this shouldn't cause any problem.

An additional change made here, is replacing `thread_local` by `THREADLOCAL`
and using the initial-exec thread model in the non-Android version to prevent
extraneous weak definition and checks on the relevant variables.

Reviewers: kcc, dvyukov, alekseyshl

Reviewed By: alekseyshl

Subscribers: srhines, mgorny, llvm-commits

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

llvm-svn: 302300

7 years agoDelete LinkerScript::getSectionIndex.
Rafael Espindola [Fri, 5 May 2017 21:34:26 +0000 (21:34 +0000)]
Delete LinkerScript::getSectionIndex.

We can set SectionIndex tentatively as we process the linker script
instead of looking it repeatedly.

In general we should try to have as few name lookups as possible.

llvm-svn: 302299

7 years agoMark test using <sys/time.h> as UNSUPPORTED on Windows
Eric Fiselier [Fri, 5 May 2017 21:32:37 +0000 (21:32 +0000)]
Mark test using <sys/time.h> as UNSUPPORTED on Windows

llvm-svn: 302298

7 years agoFix condition_variable::wait_until and wait_for on Windows.
Eric Fiselier [Fri, 5 May 2017 21:31:22 +0000 (21:31 +0000)]
Fix condition_variable::wait_until and wait_for on Windows.

The ERROR_TIMEDOUT returned by the Windows API does not
have the same value as ETIMEDOUT. This caused condition_variable
to return timeouts as unknown errors.

llvm-svn: 302297

7 years agoMultilib: add dump methods
Jonathan Roelofs [Fri, 5 May 2017 21:30:13 +0000 (21:30 +0000)]
Multilib: add dump methods

llvm-svn: 302296

7 years agoFix build breakage on Linux.
Rui Ueyama [Fri, 5 May 2017 21:27:30 +0000 (21:27 +0000)]
Fix build breakage on Linux.

llvm-svn: 302295

7 years agoFix -Wreorder warning.
Zachary Turner [Fri, 5 May 2017 21:25:31 +0000 (21:25 +0000)]
Fix -Wreorder warning.

llvm-svn: 302294

7 years agoFix another incorrectly cased header include.
Zachary Turner [Fri, 5 May 2017 21:18:26 +0000 (21:18 +0000)]
Fix another incorrectly cased header include.

llvm-svn: 302293

7 years ago[StreamArray] Pipe the Offset through the constructor.
Zachary Turner [Fri, 5 May 2017 21:15:31 +0000 (21:15 +0000)]
[StreamArray] Pipe the Offset through the constructor.

When randomly accessing an element by offset, we weren't passing
the offset through so if you called .offset() it would return a
value of 0.

llvm-svn: 302292

7 years agoFix #include case sensitivity problem.
Zachary Turner [Fri, 5 May 2017 21:14:55 +0000 (21:14 +0000)]
Fix #include case sensitivity problem.

llvm-svn: 302291

7 years ago[AMDGPU] In the new waitcnt insertion pass, use getHeader
Kannan Narayanan [Fri, 5 May 2017 21:10:17 +0000 (21:10 +0000)]
[AMDGPU] In the new waitcnt insertion pass, use getHeader
         instead of getTopBlock to find the loop header.

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

llvm-svn: 302290

7 years agoMIParser/MIRPrinter: Compute block successors if not explicitely specified
Matthias Braun [Fri, 5 May 2017 21:09:30 +0000 (21:09 +0000)]
MIParser/MIRPrinter: Compute block successors if not explicitely specified

- MIParser: If the successor list is not specified successors will be
  added based on basic block operands in the block and possible
  fallthrough.

- MIRPrinter: Adds a new `simplify-mir` option, with that option set:
  Skip printing of block successor lists in cases where the
  parser is guaranteed to reconstruct it. This means we still print the
  list if some successor cannot be determined (happens for example for
  jump tables), if the successor order changes or branch probabilities
  being unequal.

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

llvm-svn: 302289

7 years agoSplit up Parallel and LLVM'ize naming conventions.
Zachary Turner [Fri, 5 May 2017 21:09:26 +0000 (21:09 +0000)]
Split up Parallel and LLVM'ize naming conventions.

This is one step in preparation of raising this up to
LLVM.  This hides all of the Executor stuff in a private
implementation file, leaving only the core algorithms and
the TaskGroup class exposed.  In doing so, fix up all the
variable names to conform to LLVM style.

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

llvm-svn: 302288

7 years agoAdd cxxStdInitializerListExpr AST matcher
Jakub Kuderski [Fri, 5 May 2017 21:01:12 +0000 (21:01 +0000)]
Add cxxStdInitializerListExpr AST matcher

Summary:
This adds a new ASTMatcher for CXXStdInitializerListExprs that matches C++ initializer list expressions.

The primary motivation is to use it to fix [[ https://bugs.llvm.org/show_bug.cgi?id=32896 | PR32896 ]] (review here [[ https://reviews.llvm.org/D32767 | D32767 ]]).

Reviewers: alexfh, Prazek, aaron.ballman

Reviewed By: alexfh, aaron.ballman

Subscribers: malcolm.parsons, cfe-commits, klimek

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

llvm-svn: 302287

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