platform/upstream/llvm.git
7 years agoRevert r302781 and subsequent attempts to disable part of it.
Daniel Jasper [Thu, 18 May 2017 09:31:37 +0000 (09:31 +0000)]
Revert r302781 and subsequent attempts to disable part of it.

The Msan unit tests are still broken and by this point, I think we
should start over.

llvm-svn: 303339

7 years agoFixup r303324 - temporary disable stndup interceptor, due to r302781 being buggy
Diana Picus [Thu, 18 May 2017 09:12:27 +0000 (09:12 +0000)]
Fixup r303324 - temporary disable stndup interceptor, due to r302781 being buggy

r303324 missed one of the tests added by r302781. This commit applies
the same fix as r303324 to the missed test (strndup.cc).

llvm-svn: 303338

7 years ago[ELF] Support R_ARM_SBREL32 Relocation
Peter Smith [Thu, 18 May 2017 09:12:21 +0000 (09:12 +0000)]
[ELF] Support R_ARM_SBREL32 Relocation

This change adds support for the R_ARM_SBREL32 relocation. The relocation
is a base relative relocation that is produced by clang/llvm when -frwpi
is used. The use case for the -frwpi option is position independent data
for embedded systems that do not have a GOT. With -frwpi all data is
accessed via an offset from a base register (usually r9), where r9 is set
at run time to where the data has been loaded. The base of the data is
known as the static base.

The ARM ABI defines the static base as:
B(S) is the addressing origin of the output segment defining the symbol S.
The origin is not required to be the base address of the segment. For
simplicity we choose to use the base address of the segment.

The ARM procedure call standard only defines a read write variant using
R_ARM_SBREL32 relocations. The read-only data is accessed via pc-relative
offsets from the code, this is implemented in clang as -fropi.

Fixes PR32924

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

llvm-svn: 303337

7 years ago[SCEV][NFC] Remove duplication of isLoopInvariant code
Max Kazantsev [Thu, 18 May 2017 08:26:41 +0000 (08:26 +0000)]
[SCEV][NFC] Remove duplication of isLoopInvariant code

Replace two places that duplicate the code of isLoopInvariant method with
the invocation of this method.

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

llvm-svn: 303336

7 years ago[DWARF] - Simplify RelocVisitor implementation.
George Rimar [Thu, 18 May 2017 08:25:11 +0000 (08:25 +0000)]
[DWARF] - Simplify RelocVisitor implementation.

We do not need to store relocation width field.
Patch removes relative code, that simplifies implementation.

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

llvm-svn: 303335

7 years ago[lib/Object] - Fix build bot after r303331 "[lib/Object] - Minor API update for llvm...
George Rimar [Thu, 18 May 2017 08:14:43 +0000 (08:14 +0000)]
[lib/Object] - Fix build bot after r303331 "[lib/Object] - Minor API update for llvm::Decompressor".

Error was:
Decompressor.h:33:28: error: extra qualification ‘llvm::object::Decompressor::’ on member ‘resizeAndDecompress’ [-fpermissive]
   template <class T> Error Decompressor::resizeAndDecompress(T &Out) {

llvm-svn: 303334

7 years ago[X86] Replace slow LEA instructions in X86
Lama Saba [Thu, 18 May 2017 08:11:50 +0000 (08:11 +0000)]
[X86] Replace slow LEA instructions in X86

  According to Intel's Optimization Reference Manual for SNB+:
  " For LEA instructions with three source operands and some specific situations, instruction latency has increased to 3 cycles, and must
    dispatch via port 1:
  - LEA that has all three source operands: base, index, and offset
  - LEA that uses base and index registers where the base is EBP, RBP,or R13
  - LEA that uses RIP relative addressing mode
  - LEA that uses 16-bit addressing mode "
  This patch currently handles the first 2 cases only.

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

llvm-svn: 303333

7 years ago[clang-format] Make NoLineBreakFormatter respect MustBreakBefore
Krasimir Georgiev [Thu, 18 May 2017 08:07:52 +0000 (08:07 +0000)]
[clang-format] Make NoLineBreakFormatter respect MustBreakBefore

Summary:
This patch makes NoLineBreakFormatter to insert a break before tokens where
MustBreakBefore is true.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 303332

7 years ago[lib/Object] - Minor API update for llvm::Decompressor.
George Rimar [Thu, 18 May 2017 08:00:01 +0000 (08:00 +0000)]
[lib/Object] - Minor API update for llvm::Decompressor.

I revisited Decompressor API (issue with it was triggered during D32865 review)
and found it is probably provides more then we really need.

Issue was about next method's signature:

Error decompress(SmallString<32> &Out);
It is too strict. At first I wanted to change it to decompress(SmallVectorImpl<char> &Out),
but then found it is still not flexible because sticks to SmallVector.

During reviews was suggested to use templating to simplify code. Patch do that.

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

llvm-svn: 303331

7 years agoclang-format: fix prefix for doxygen comments after member
Krasimir Georgiev [Thu, 18 May 2017 07:36:21 +0000 (07:36 +0000)]
clang-format: fix prefix for doxygen comments after member

Summary:
Doxygen supports putting documentation blocks after member, by adding
an additional < marker in the comment block. This patch makes sure
this marker is used in lines which are introduced by breaking the
comment.

  int foo; ///< Some very long comment.

becomes:

  int foo; ///< Some very long
           ///< comment.

Contributed by @Typz!

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: djasper, klimek, cfe-commits

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

llvm-svn: 303330

7 years agoFix buildbot failure after rL303327: [BPI] Reduce the probability of unreachable...
Serguei Katkov [Thu, 18 May 2017 07:20:52 +0000 (07:20 +0000)]
Fix buildbot failure after rL303327: [BPI] Reduce the probability of unreachable edge to minimal value greater than 0.

One more test is updated to meet new branch probability for unreachable branches.

llvm-svn: 303329

7 years ago[X86] Adding tests for scalar bitcasts from vsetcc. NFC.
Zvi Rackover [Thu, 18 May 2017 07:04:48 +0000 (07:04 +0000)]
[X86] Adding tests for scalar bitcasts from vsetcc. NFC.

llvm-svn: 303328

7 years ago[BPI] Reduce the probability of unreachable edge to minimal value greater than 0
Serguei Katkov [Thu, 18 May 2017 06:11:56 +0000 (06:11 +0000)]
[BPI] Reduce the probability of unreachable edge to minimal value greater than 0

The probability of edge coming to unreachable block should be as low as possible.
The change reduces the probability to minimal value greater than zero.

The bug https://bugs.llvm.org/show_bug.cgi?id=32214 show the example when
the probability of edge coming to unreachable block is greater than for edge
coming to out of the loop and it causes incorrect loop rotation.

Please note that with this change the behavior of unreachable heuristic is a bit different
than others. Specifically, before this change the sum of probabilities
coming to unreachable blocks have the same weight for all branches
(it was just split over all edges of this block coming to unreachable blocks).
With this change it might be slightly different but not to much due to probability of
taken branch to unreachable block is really small.

Reviewers: chandlerc, sanjoy, vsk, congh, junbuml, davidxl, dexonsmith
Reviewed By: chandlerc, dexonsmith
Subscribers: reames, llvm-commits
Differential Revision: https://reviews.llvm.org/D30633

llvm-svn: 303327

7 years ago[ThinLTO] Do not assert when adding a module with a different but
Akira Hatanaka [Thu, 18 May 2017 03:52:29 +0000 (03:52 +0000)]
[ThinLTO] Do not assert when adding a module with a different but
compatible target triple

Currently, an assertion fails in ThinLTOCodeGenerator::addModule when
the target triple of the module being added doesn't match that of the
one stored in TMBuilder. This patch relaxes the constraint and makes
changes to allow target triples that only differ in their version
numbers on Apple platforms, similarly to what r228999 did.

rdar://problem/30133904

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

llvm-svn: 303326

7 years agoFix an assertion failure in FormatASTNodeDiagnosticArgument.
Alexander Kornienko [Thu, 18 May 2017 03:02:15 +0000 (03:02 +0000)]
Fix an assertion failure in FormatASTNodeDiagnosticArgument.

Summary:
The test being added in this patch used to cause an assertion failure:

/build/./bin/clang -cc1 -internal-isystem /build/lib/clang/5.0.0/include -nostdsysteminc -verify -fsyntax-only -std=c++11 -Wshadow-all /src/tools/clang/test/SemaCXX/warn-shadow.cpp
--
Exit Code: 134

Command Output (stderr):
--
clang: /src/tools/clang/lib/AST/ASTDiagnostic.cpp:424: void clang::FormatASTNodeDiagnosticArgument(DiagnosticsEngine::ArgumentKind, intptr_t, llvm::StringRef, llvm::StringRef, ArrayRef<DiagnosticsEngine::ArgumentValue>, SmallVectorImpl<char> &, void *, ArrayRef<intptr_t>): Assertion `isa<NamedDecl>(DC) && "Expected a NamedDecl"' failed.
#0 0x0000000001c7a1b4 PrintStackTraceSignalHandler(void*) (/build/./bin/clang+0x1c7a1b4)
#1 0x0000000001c7a4e6 SignalHandler(int) (/build/./bin/clang+0x1c7a4e6)
#2 0x00007f30880078d0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0xf8d0)
#3 0x00007f3087054067 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x35067)
#4 0x00007f3087055448 abort (/lib/x86_64-linux-gnu/libc.so.6+0x36448)
#5 0x00007f308704d266 (/lib/x86_64-linux-gnu/libc.so.6+0x2e266)
#6 0x00007f308704d312 (/lib/x86_64-linux-gnu/libc.so.6+0x2e312)
#7 0x00000000035b7f22 clang::FormatASTNodeDiagnosticArgument(clang::DiagnosticsEngine::ArgumentKind, long, llvm::StringRef, llvm::StringRef, llvm::ArrayRef<std::pair<clang::DiagnosticsEngine::ArgumentKind, long> >, llvm::SmallVectorImpl<char>&, void*, llvm::ArrayRef<long>) (/build/
./bin/clang+0x35b7f22)
#8 0x0000000001ddbae4 clang::Diagnostic::FormatDiagnostic(char const*, char const*, llvm::SmallVectorImpl<char>&) const (/build/./bin/clang+0x1ddbae4)
#9 0x0000000001ddb323 clang::Diagnostic::FormatDiagnostic(char const*, char const*, llvm::SmallVectorImpl<char>&) const (/build/./bin/clang+0x1ddb323)
#10 0x00000000022878a4 clang::TextDiagnosticBuffer::HandleDiagnostic(clang::DiagnosticsEngine::Level, clang::Diagnostic const&) (/build/./bin/clang+0x22878a4)
#11 0x0000000001ddf387 clang::DiagnosticIDs::ProcessDiag(clang::DiagnosticsEngine&) const (/build/./bin/clang+0x1ddf387)
#12 0x0000000001dd9dea clang::DiagnosticsEngine::EmitCurrentDiagnostic(bool) (/build/./bin/clang+0x1dd9dea)
#13 0x0000000002cad00c clang::Sema::EmitCurrentDiagnostic(unsigned int) (/build/./bin/clang+0x2cad00c)
#14 0x0000000002d91cd2 clang::Sema::CheckShadow(clang::NamedDecl*, clang::NamedDecl*, clang::LookupResult const&) (/build/./bin/clang+0x2d91cd2)

Stack dump:
0.      Program arguments: /build/./bin/clang -cc1 -internal-isystem /build/lib/clang/5.0.0/include -nostdsysteminc -verify -fsyntax-only -std=c++11 -Wshadow-all /src/tools/clang/test/SemaCXX/warn-shadow.cpp
1.      /src/tools/clang/test/SemaCXX/warn-shadow.cpp:214:23: current parser token ';'
2.      /src/tools/clang/test/SemaCXX/warn-shadow.cpp:213:26: parsing function body 'handleLinkageSpec'
3.      /src/tools/clang/test/SemaCXX/warn-shadow.cpp:213:26: in compound statement ('{}')
/build/tools/clang/test/SemaCXX/Output/warn-shadow.cpp.script: line 1: 15595 Aborted                 (core dumped) /build/./bin/clang -cc1 -internal-isystem /build/lib/clang/5.0.0/include -nostdsysteminc -verify -fsyntax-only -std=c++11 -Wshadow-all /src/tools/clang/test/SemaCXX/warn-shadow.cpp

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: krytarowski, cfe-commits

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

llvm-svn: 303325

7 years agotemporary disable stndup interceptor, due to r302781 being buggy
Kostya Serebryany [Thu, 18 May 2017 03:00:07 +0000 (03:00 +0000)]
temporary disable stndup interceptor, due to r302781 being buggy

llvm-svn: 303324

7 years ago[Target/X86] Remove unneeded return. NFCI.
Davide Italiano [Thu, 18 May 2017 02:36:42 +0000 (02:36 +0000)]
[Target/X86] Remove unneeded return. NFCI.

llvm-svn: 303323

7 years ago[modules] Switch from inferring owning modules based on source location to
Richard Smith [Thu, 18 May 2017 02:29:20 +0000 (02:29 +0000)]
[modules] Switch from inferring owning modules based on source location to
inferring based on the current module at the point of creation.

This should result in no functional change except when building a preprocessed
module (or more generally when using #pragma clang module begin/end to switch
module in the middle of a file), in which case it allows us to correctly track
the owning module for declarations. We can't map from FileID to module in the
preprocessed module case, since all modules would have the same FileID.

There are still a couple of remaining places that try to infer a module from a
source location; I'll clean those up in follow-up changes.

llvm-svn: 303322

7 years ago[clang-tidy] Optimize GlobList::contains
Alexander Kornienko [Thu, 18 May 2017 01:13:51 +0000 (01:13 +0000)]
[clang-tidy] Optimize GlobList::contains

With large lists of checks and large number of warnings GlobList::contains
starts being ridiculously CPU hungry, since it runs regexp match per glob.
Caching results of glob matching in a StringMap significantly speeds up check
filtering even for small GlobLists.

/tmp/q.cc:

void f() {
  int I;
  {int I;}
  {int I;}
  {int I;}
  ... // 200k times
}

Before the patch:

GlobList with 2 entries:
  $ time clang-tidy-old -checks=-*,modernize-use-override /tmp/q.cc -- -Wshadow
  200000 warnings generated.
  Suppressed 200000 warnings (200000 with check filters).

  real    0m3.826s
  user    0m3.176s
  sys     0m0.504s

GlobList with 28 entries:
  $ time clang-tidy-old -checks=-*,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,modernize-use-override /tmp/q.cc -- -Wshadow
  200000 warnings generated.
  Suppressed 200000 warnings (200000 with check filters).

  real    0m5.000s
  user    0m4.744s
  sys     0m0.060s

GlobList with 158 entries:
  $ time clang-tidy-old -checks=-*,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,modernize-use-override /tmp/q.cc -- -Wshadow
  200000 warnings generated.
  Suppressed 200000 warnings (200000 with check filters).

  real    0m13.920s
  user    0m13.636s
  sys     0m0.104s

With the patch runtime is practically independent from the length of the GlobList:
  $ time clang-tidy-new -checks=-*,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,modernize-use-override /tmp/q.cc -- -Wshadow
  200000 warnings generated.
  Suppressed 200000 warnings (200000 with check filters).

  real    0m2.300s
  user    0m2.104s
  sys     0m0.044s

llvm-svn: 303321

7 years ago[Statistics] Use the new Statistic::updateMax to atomically calculate a maximum value...
Craig Topper [Thu, 18 May 2017 01:11:52 +0000 (01:11 +0000)]
[Statistics] Use the new Statistic::updateMax to atomically calculate a maximum value statistic.

llvm-svn: 303320

7 years agoUpdate three tests I missed in r302979 and r302990
Justin Bogner [Thu, 18 May 2017 00:58:06 +0000 (00:58 +0000)]
Update three tests I missed in r302979 and r302990

llvm-svn: 303319

7 years ago[Statistics] Add a method to atomically update a statistic that contains a maximum
Craig Topper [Thu, 18 May 2017 00:51:39 +0000 (00:51 +0000)]
[Statistics] Add a method to atomically update a statistic that contains a maximum

Summary:
There are several places in the codebase that try to calculate a maximum value in a Statistic object. We currently do this in one of two ways:

  MaxNumFoo = std::max(MaxNumFoo, NumFoo);

or

  MaxNumFoo = (MaxNumFoo > NumFoo) ? MaxNumFoo : NumFoo;

The first version reads from MaxNumFoo one time and uncontionally rwrites to it. The second version possibly reads it twice depending on the result of the first compare.  But we have no way of knowing if the value was changed by another thread between the reads and the writes.

This patch adds a method to the Statistic object that can ensure that we only store if our value is the max and the previous max didn't change after we read it. If it changed we'll recheck if our value should still be the max or not and try again.

This spawned from an audit I'm trying to do of all places we uses the implicit conversion to unsigned on the Statistics objects. See my previous thread on llvm-dev https://groups.google.com/forum/#!topic/llvm-dev/yfvxiorKrDQ

Reviewers: dberlin, chandlerc, hfinkel, dblaikie

Reviewed By: chandlerc

Subscribers: llvm-commits, sanjoy

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

llvm-svn: 303318

7 years agoThe constant expression evaluator should examine function arguments for non-constexpr...
Nick Lewycky [Wed, 17 May 2017 23:56:54 +0000 (23:56 +0000)]
The constant expression evaluator should examine function arguments for non-constexpr function calls unless the EvalInfo says to stop.

llvm-svn: 303317

7 years agoCodeGen: BlockPlacement: Add Message strings to asserts. NFC
Kyle Butt [Wed, 17 May 2017 23:44:41 +0000 (23:44 +0000)]
CodeGen: BlockPlacement: Add Message strings to asserts. NFC

Add message strings to all the unlabeled asserts in the file.

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

llvm-svn: 303316

7 years ago[InstCombine] add test for xor-of-icmps; NFC
Sanjay Patel [Wed, 17 May 2017 23:22:52 +0000 (23:22 +0000)]
[InstCombine] add test for xor-of-icmps; NFC

This is another form of the problem discussed in D32143.

llvm-svn: 303315

7 years ago[Statistics] Use Statistic::operator+= instead of adding and assigning separately.
Craig Topper [Wed, 17 May 2017 23:22:10 +0000 (23:22 +0000)]
[Statistics] Use Statistic::operator+= instead of adding and assigning separately.

I believe this technically fixes a multithreaded race condition in this code. But my primary concern was as part of looking at removing the ability to treat Statistics like a plain unsigned. There are many weird operations on Statistics in the codebase.

llvm-svn: 303314

7 years agoRevert "[globalisel][tablegen] Import rules containing intrinsic_wo_chain."
Quentin Colombet [Wed, 17 May 2017 23:17:29 +0000 (23:17 +0000)]
Revert "[globalisel][tablegen] Import rules containing intrinsic_wo_chain."

This reverts commit r303259.

This breaks the GISel bot:
http://lab.llvm.org:8080/green/job/Compiler_Verifiers_GlobalISEL/5163/consoleFull#-134276167849ba4694-19c4-4d7e-bec5-911270d8a58c

llvm-svn: 303313

7 years ago[InstCombine] handle icmp i1 X, C early to avoid creating an unknown pattern
Sanjay Patel [Wed, 17 May 2017 22:29:40 +0000 (22:29 +0000)]
[InstCombine] handle icmp i1 X, C early to avoid creating an unknown pattern

The missing optimization for xor-of-icmps still needs to be added, but by
being more efficient (not generating unnecessary logic ops with constants)
we avoid the bug.

See discussion in post-commit comments:
https://reviews.llvm.org/D32143

llvm-svn: 303312

7 years agoAttempt to pacify ASan and UBSan reports in CrashRecovery tests
Reid Kleckner [Wed, 17 May 2017 22:23:20 +0000 (22:23 +0000)]
Attempt to pacify ASan and UBSan reports in CrashRecovery tests

llvm-svn: 303311

7 years ago[InstCombine] add test for missing icmp bool fold; NFC
Sanjay Patel [Wed, 17 May 2017 22:20:02 +0000 (22:20 +0000)]
[InstCombine] add test for missing icmp bool fold; NFC

llvm-svn: 303310

7 years ago[InstCombine] move icmp bool canonicalizations to helper; NFC
Sanjay Patel [Wed, 17 May 2017 22:15:07 +0000 (22:15 +0000)]
[InstCombine] move icmp bool canonicalizations to helper; NFC

As noted in the post-commit comments in D32143, we should be
catching the constant operand cases sooner to be more efficient
and less likely to expose a missing fold.

llvm-svn: 303309

7 years agoAMDGPU: Start defining a calling convention
Matt Arsenault [Wed, 17 May 2017 21:56:25 +0000 (21:56 +0000)]
AMDGPU: Start defining a calling convention

Partially implement callee-side for arguments and return values.
byval doesn't work properly, and most likely sret or other on-stack
return values most as well.

llvm-svn: 303308

7 years agoCodeGen: Power: Add lowering for shifts of v1i128.
Kyle Butt [Wed, 17 May 2017 21:54:41 +0000 (21:54 +0000)]
CodeGen: Power: Add lowering for shifts of v1i128.

When legalizing vector operations on vNi128, they will be split to v1i128
because that is a legal type on ppc64, but then the compiler will crash in
selection dag because it fails to select for these operations. This patch fixes
shift operations. Logical shift right and left shift can be performed in the
vector unit, but algebraic shift right requires being split.

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

llvm-svn: 303307

7 years agoFix PR33028
Michael Liao [Wed, 17 May 2017 21:48:00 +0000 (21:48 +0000)]
Fix PR33028

- '-verify-mahcineinstrs' starts to complain allocatable live-in physical
  registers on non-entry or non-landing-pad basic blocks.
- Refactor the XBEGIN translation to define EAX on a dedicated fallback code
  path due to XABORT. Add a pseudo instruction to define EAX explicitly to
  avoid add physical register live-in.

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

llvm-svn: 303306

7 years agoAMDGPU: Remove old intrinsic uses
Matt Arsenault [Wed, 17 May 2017 21:38:21 +0000 (21:38 +0000)]
AMDGPU: Remove old intrinsic uses

llvm-svn: 303305

7 years agoRe-submit r303225: Garbage collect dllimported symbols.
Rui Ueyama [Wed, 17 May 2017 21:36:08 +0000 (21:36 +0000)]
Re-submit r303225: Garbage collect dllimported symbols.

This reverts re-submits r303225 which was reverted in r303270 because it
broke the sanitizer-windows bot.

The reason of the failure is that we were writing dead symbols to the
symbol table. I fixed the issue.

llvm-svn: 303304

7 years agoAMDGPU: Expand frame indexes to be relative to scratch wave offset
Matt Arsenault [Wed, 17 May 2017 21:23:14 +0000 (21:23 +0000)]
AMDGPU: Expand frame indexes to be relative to scratch wave offset

In order for an arbitrary callee to access an object
in a caller's stack frame, the 32-bit offset used as
the private pointer needs to be relative to the kernel's
scratch wave offset register.

Convert to this by finding the difference from the current
stack frame and scaling by the wavefront size.

llvm-svn: 303303

7 years ago[XRay] Fix __xray_function_address on PPC reguarding local entry points.
Tim Shen [Wed, 17 May 2017 21:20:00 +0000 (21:20 +0000)]
[XRay] Fix __xray_function_address on PPC reguarding local entry points.

Reviewers: echristo, dberris

Subscribers: llvm-commits

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

llvm-svn: 303302

7 years agoAMDGPU: Change mubuf soffset register when SP relative
Matt Arsenault [Wed, 17 May 2017 21:02:58 +0000 (21:02 +0000)]
AMDGPU: Change mubuf soffset register when SP relative

Check the MachinePointerInfo for whether the access is
supposed to be relative to the stack pointer.

No tests because this is used in later commits implementing
calls.

llvm-svn: 303301

7 years ago[X86][AVX512] Add 512-bit vector ctlz costs + tests
Simon Pilgrim [Wed, 17 May 2017 21:02:18 +0000 (21:02 +0000)]
[X86][AVX512] Add 512-bit vector ctlz costs + tests

llvm-svn: 303300

7 years ago[llvm-pdbdump] in yaml2pdb, generate default output filename if none given
Bob Haarman [Wed, 17 May 2017 20:46:48 +0000 (20:46 +0000)]
[llvm-pdbdump] in yaml2pdb, generate default output filename if none given

Summary:
llvm-pdbdump yaml2pdb used to fail with a misleading error
message ("An I/O error occurred on the file system") if no output file
was specified. This change adds an assert to PDBFileBuilder to check
that an output file name is specified, and makes llvm-pdbdump generate
an output file name based on the input file name if no output file
name is explicitly specified.

Reviewers: amccarth, zturner

Reviewed By: zturner

Subscribers: fhahn, llvm-commits

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

llvm-svn: 303299

7 years agoupdate the test that should have been updated in r303292. (NFC)
Dehao Chen [Wed, 17 May 2017 20:44:08 +0000 (20:44 +0000)]
update the test that should have been updated in r303292. (NFC)

llvm-svn: 303298

7 years agoAdd some helpers for manipulating BinaryStreamRefs.
Zachary Turner [Wed, 17 May 2017 20:42:52 +0000 (20:42 +0000)]
Add some helpers for manipulating BinaryStreamRefs.

llvm-svn: 303297

7 years agoAMDGPU: Make better use of op_sel with high components
Matt Arsenault [Wed, 17 May 2017 20:30:58 +0000 (20:30 +0000)]
AMDGPU: Make better use of op_sel with high components

Handle more general swizzles.

llvm-svn: 303296

7 years ago[InstSimplify] handle all icmp i1 X, C in one place; NFCI
Sanjay Patel [Wed, 17 May 2017 20:27:55 +0000 (20:27 +0000)]
[InstSimplify] handle all icmp i1 X, C in one place; NFCI

We already handled all of the new tests identically, but several
of those went through a lot of unnecessary processing before
getting folded.

Another motivation for grouping these cases together is that
InstCombine needs a similar fold. Currently, it handles the
'not' cases inefficiently which can lead to bugs as described
in the post-commit comments of:
https://reviews.llvm.org/D32143

llvm-svn: 303295

7 years ago[BinaryStream] Reduce the amount of boiler plate needed to use.
Zachary Turner [Wed, 17 May 2017 20:23:31 +0000 (20:23 +0000)]
[BinaryStream] Reduce the amount of boiler plate needed to use.

Often you have an array and you just want to use it.  With the current
design, you have to first construct a `BinaryByteStream`, and then create
a `BinaryStreamRef` from it.  Worse, the `BinaryStreamRef` holds a pointer
to the `BinaryByteStream`, so you can't just create a temporary one to
appease the compiler, you have to actually hold onto both the `ArrayRef`
as well as the `BinaryByteStream` *AND* the `BinaryStreamReader` on top of
that.  This makes for very cumbersome code, often requiring one to store a
`BinaryByteStream` in a class just to circumvent this.

At the cost of some added complexity (not exposed to users, but internal
to the library), we can do better than this.  This patch allows us to
construct `BinaryStreamReaders` and `BinaryStreamWriters` directly from
source data (e.g. `StringRef`, `MutableArrayRef<uint8_t>`, etc).  Not only
does this reduce the amount of code you have to type and make it more
obvious how to use it, but it solves real lifetime issues when it's
inconvenient to hold onto a `BinaryByteStream` for a long time.

The additional complexity is in the form of an added layer of indirection.
Whereas before we simply stored a `BinaryStream*` in the ref, we now store
both a `BinaryStream*` **and** a `std::shared_ptr<BinaryStream>`.  When
the user wants to construct a `BinaryStreamRef` directly from an
`ArrayRef` etc, we allocate an internal object that holds ownership over a
`BinaryByteStream` and forwards all calls, and store this in the
`shared_ptr<>`.  This also maintains the ref semantics, as you can copy it
by value and references refer to the same underlying stream -- the one
being held in the object stored in the `shared_ptr`.

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

llvm-svn: 303294

7 years ago[X86][AVX512] Add 512-bit vector cttz costs + tests
Simon Pilgrim [Wed, 17 May 2017 20:22:54 +0000 (20:22 +0000)]
[X86][AVX512] Add 512-bit vector cttz costs + tests

llvm-svn: 303293

7 years agoOnly enable LiveRangeShrink for x86.
Dehao Chen [Wed, 17 May 2017 20:18:13 +0000 (20:18 +0000)]
Only enable LiveRangeShrink for x86.

Summary: Moving LiveRangeShrink to x86 as this pass is mostly useful for archtectures with great register pressure.

Reviewers: MatzeB, qcolombet

Reviewed By: qcolombet

Subscribers: jholewinski, jyknight, javed.absar, llvm-commits

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

llvm-svn: 303292

7 years agoAMDGPU: Try to use op_sel when selecting packed instructions
Matt Arsenault [Wed, 17 May 2017 20:00:00 +0000 (20:00 +0000)]
AMDGPU: Try to use op_sel when selecting packed instructions

Avoids instructions to pack a vector when the source is really
a scalar being broadcast.

Also be smarter and look for per-component fneg.

Doesn't yet handle scalar from upper half of register
or other swizzles.

llvm-svn: 303291

7 years ago[X86] Split ctpop/ctlz/cttz cost tests
Simon Pilgrim [Wed, 17 May 2017 19:57:20 +0000 (19:57 +0000)]
[X86] Split ctpop/ctlz/cttz cost tests

This will make things a lot easier to test all the permutations of avx512

llvm-svn: 303290

7 years agoReapply part of rL303015, fixing just the DynamicLibaryTest. Add
Dimitry Andric [Wed, 17 May 2017 19:46:49 +0000 (19:46 +0000)]
Reapply part of rL303015, fixing just the DynamicLibaryTest.  Add
retrieval of the original argv[0] from the GoogleTest framework, so it
is more likely the correct main executable path is found.

llvm-svn: 303289

7 years ago[WebAssembly][NFC] Update expected testsuite failures for newly passing tests
Jacob Gravelle [Wed, 17 May 2017 19:45:22 +0000 (19:45 +0000)]
[WebAssembly][NFC] Update expected testsuite failures for newly passing tests

Summary: r303050 fixes crashes when calling scalarizeMaskedMemIntrin pass from WebAssembly backend. This updates expected test failures for that.

Reviewers: sbc100

Subscribers: jfb, llvm-commits, dschuff

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

llvm-svn: 303288

7 years agoAMDGPU: Use appropriate soffset for spilling
Matt Arsenault [Wed, 17 May 2017 19:37:57 +0000 (19:37 +0000)]
AMDGPU: Use appropriate soffset for spilling

This needs to be the frame offset register, and not the global
scratch wave offset register. For kernels, these are the same.

llvm-svn: 303287

7 years ago[Ubsan]Remove unused link libraries.
Leo Li [Wed, 17 May 2017 19:37:27 +0000 (19:37 +0000)]
[Ubsan]Remove unused link libraries.

Summary: Remove unused link libraries metioned in D33216.

Reviewers: llvm-commits, vsk

Reviewed By: vsk

Subscribers: vsk, kubamracek, mgorny, filcab

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

llvm-svn: 303286

7 years agoRevert r303015, because it has the unintended side effect of breaking
Dimitry Andric [Wed, 17 May 2017 19:33:10 +0000 (19:33 +0000)]
Revert r303015, because it has the unintended side effect of breaking
driver-mode recognition in clang (this is because the sysctl method
always returns one and only one executable path, even for an executable
with multiple links):

Fix DynamicLibraryTest.cpp on FreeBSD and NetBSD

Summary:

After rL301562, on FreeBSD the DynamicLibrary unittests fail, because
the test uses getMainExecutable("DynamicLibraryTests", Ptr), and since
the path does not contain any slashes, retrieving the main executable
will not work.

Reimplement getMainExecutable() for FreeBSD and NetBSD using sysctl(3),
which is more reliable than fiddling with relative or absolute paths.

Also add retrieval of the original argv[] from the GoogleTest framework,
to use as a fallback for other OSes.

Reviewers: emaste, marsupial, hans, krytarowski

Reviewed By: krytarowski

Subscribers: krytarowski, llvm-commits

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

llvm-svn: 303285

7 years agoAMDGPU: Fix min3/max3 combines for f16/i16
Matt Arsenault [Wed, 17 May 2017 19:25:06 +0000 (19:25 +0000)]
AMDGPU: Fix min3/max3 combines for f16/i16

Fix missing instruction definitions for min3/max3.

llvm-svn: 303284

7 years ago[X86][AVX512] Add 512-bit vector bitreverse costs + tests
Simon Pilgrim [Wed, 17 May 2017 19:20:20 +0000 (19:20 +0000)]
[X86][AVX512] Add 512-bit vector bitreverse costs + tests

llvm-svn: 303283

7 years agoAdd back a dummy --use-processes.
Rafael Espindola [Wed, 17 May 2017 18:55:01 +0000 (18:55 +0000)]
Add back a dummy --use-processes.

Some bots are using it.

llvm-svn: 303282

7 years agoMake next/prev/advance/distance operations on iterators be constexpr. I missed this...
Marshall Clow [Wed, 17 May 2017 18:51:36 +0000 (18:51 +0000)]
Make next/prev/advance/distance operations on iterators be constexpr. I missed this when I implemented the rest of P0031R0

llvm-svn: 303281

7 years agoAlways use the multiprocess module.
Rafael Espindola [Wed, 17 May 2017 18:20:01 +0000 (18:20 +0000)]
Always use the multiprocess module.

This seems to work on freebsd and openbsd these days.

llvm-svn: 303280

7 years agoRe-land r303274: "[CrashRecovery] Use SEH __try instead of VEH when available"
Reid Kleckner [Wed, 17 May 2017 18:16:17 +0000 (18:16 +0000)]
Re-land r303274: "[CrashRecovery] Use SEH __try instead of VEH when available"

We have to check gCrashRecoveryEnabled before using __try.

In other words, SEH works too well and we ended up recovering from
crashes in implicit module builds that we weren't supposed to. Only
libclang is supposed to enable CrashRecoveryContext to allow implicit
module builds to crash.

llvm-svn: 303279

7 years agoFix error string set in AddName to take a StringRef.
Ted Woodward [Wed, 17 May 2017 17:48:55 +0000 (17:48 +0000)]
Fix error string set in AddName to take a StringRef.

llvm-svn: 303278

7 years ago[GISel]: Fix undefined behavior in IRTranslator
Aditya Nandakumar [Wed, 17 May 2017 17:41:55 +0000 (17:41 +0000)]
[GISel]: Fix undefined behavior in IRTranslator

Make sure IRTranslator->MachineIRBuilder->DebugLoc doesn't
outlive the DILocation. Clear it at the end of
IRTranslator::runOnMachineFunction

llvm-svn: 303277

7 years agoGenerate ubsan shared libraries.
Leo Li [Wed, 17 May 2017 17:17:41 +0000 (17:17 +0000)]
Generate ubsan shared libraries.

Summary: Those libraries are required by aosp (https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/master/Android.mk). Currenly the shared libraries are generated by aosp Makefile system. We are looking forward to using cmake to generate them.

Reviewers: llvm-commits, vsk

Reviewed By: vsk

Subscribers: filcab, vsk, srhines, kubamracek, mgorny, krytarowski

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

llvm-svn: 303276

7 years agoRevert "[CrashRecovery] Use SEH __try instead of VEH when available"
Reid Kleckner [Wed, 17 May 2017 17:15:00 +0000 (17:15 +0000)]
Revert "[CrashRecovery] Use SEH __try instead of VEH when available"

This reverts commit r303274, it appears to break some clang tests.

llvm-svn: 303275

7 years ago[CrashRecovery] Use SEH __try instead of VEH when available
Reid Kleckner [Wed, 17 May 2017 17:02:16 +0000 (17:02 +0000)]
[CrashRecovery] Use SEH __try instead of VEH when available

Summary:
It avoids problems when other libraries raise exceptions. In particular,
OutputDebugString raises an exception that the debugger is supposed to
catch and suppress. VEH kicks in first right now, and that is entirely
incorrect.

Unfortunately, GCC does not support SEH, so I've kept the old buggy VEH
codepath around. We could fix it with SetUnhandledExceptionFilter, but
that is not per-thread, so a well-behaved library shouldn't set it.

Reviewers: zturner

Subscribers: llvm-commits, mgorny

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

llvm-svn: 303274

7 years agoInclude setjmp.h unconditionally in asan_test_utils.h
Hans Wennborg [Wed, 17 May 2017 16:44:08 +0000 (16:44 +0000)]
Include setjmp.h unconditionally in asan_test_utils.h

It's used in asan_test.cc also on Windows, and my build was failing
with:

C:/src/llvm/projects/compiler-rt/lib/asan/tests/asan_test.cc:549:28: error: unknown type name 'jmp_buf'
NOINLINE void LongJmpFunc1(jmp_buf buf) {
                           ^
C:/src/llvm/projects/compiler-rt/lib/asan/tests/asan_test.cc:569:10: error: unknown type name 'jmp_buf'
  static jmp_buf buf;
         ^

I couldn't find what changed to make this not work anymore, but this should fix
it.

llvm-svn: 303273

7 years agoWorkaround for incorrect Win32 header on GCC.
Zachary Turner [Wed, 17 May 2017 16:39:33 +0000 (16:39 +0000)]
Workaround for incorrect Win32 header on GCC.

llvm-svn: 303272

7 years ago[CodeView] Simplify the use of visiting type records & streams.
Zachary Turner [Wed, 17 May 2017 16:39:06 +0000 (16:39 +0000)]
[CodeView] Simplify the use of visiting type records & streams.

There is often a lot of boilerplate code required to visit a type
record or type stream.  The #1 use case is that you have a sequence
of bytes that represent one or more records, and you want to
deserialize each one, switch on it, and call a callback with the
deserialized record that the user can examine.  Currently this
requires at least 6 lines of code:

  codeview::TypeVisitorCallbackPipeline Pipeline;
  Pipeline.addCallbackToPipeline(Deserializer);
  Pipeline.addCallbackToPipeline(MyCallbacks);

  codeview::CVTypeVisitor Visitor(Pipeline);
  consumeError(Visitor.visitTypeRecord(Record));

With this patch, it becomes one line of code:

  consumeError(codeview::visitTypeRecord(Record, MyCallbacks));

This is done by having the deserialization happen internally inside
of the visitTypeRecord function.  Since this is occasionally not
desirable, the function provides a 3rd parameter that can be used
to change this behavior.

Hopefully this can significantly reduce the barrier to entry
to using the visitation infrastructure.

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

llvm-svn: 303271

7 years agoRevert r303225 "Garbage collect dllimported symbols."
Hans Wennborg [Wed, 17 May 2017 16:22:03 +0000 (16:22 +0000)]
Revert r303225 "Garbage collect dllimported symbols."

and follow-up r303226 "Fix Windows buildbots."

This broke the sanitizer-windows buildbot.

> Previously, the garbage collector (enabled by default or by explicitly
> passing /opt:ref) did not kill dllimported symbols. As a result,
> dllimported symbols could be added to resulting executables' dllimport
> list even if no one was actually using them.
>
> This patch implements dllexported symbol garbage collection. Just like
> COMDAT sections, dllimported symbols now have Live bits to manage their
> liveness, and MarkLive marks reachable dllimported symbols.
>
> Fixes https://bugs.llvm.org/show_bug.cgi?id=32950
>
> Reviewers: pcc
>
> Subscribers: llvm-commits
>
> Differential Revision: https://reviews.llvm.org/D33264

llvm-svn: 303270

7 years ago[BitVector] Add find_[first,last]_[set,unset]_in.
Zachary Turner [Wed, 17 May 2017 15:49:45 +0000 (15:49 +0000)]
[BitVector] Add find_[first,last]_[set,unset]_in.

A lot of code is duplicated between the first_last and the
next / prev methods.  All of this code can be shared if they
are implemented in terms of find_first_in(Begin, End) etc,
in which case find_first = find_first_in(0, Size) and find_next
is find_first_in(Prev+1, Size), with similar reductions for
the other methods.

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

llvm-svn: 303269

7 years agoMark the copy constructor and move
Marshall Clow [Wed, 17 May 2017 15:30:01 +0000 (15:30 +0000)]
Mark the copy constructor and move
constructor to be constexpr. This only works when the contained type has a constexpr copy/move ctor.

llvm-svn: 303268

7 years agoclang-cl: Fix path-based MSVC version detection
Hans Wennborg [Wed, 17 May 2017 15:27:44 +0000 (15:27 +0000)]
clang-cl: Fix path-based MSVC version detection

The code wasn't taking the architecture-specific subdirectory into
account.

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

llvm-svn: 303267

7 years agoRevert "Implement tls scanning for darwin LSan"
Francis Ricci [Wed, 17 May 2017 15:25:41 +0000 (15:25 +0000)]
Revert "Implement tls scanning for darwin LSan"

This reverts r303262, due to TSan buildbot breakages.

llvm-svn: 303266

7 years ago[Frontend] Remove unused TemporaryFiles
Krasimir Georgiev [Wed, 17 May 2017 14:51:44 +0000 (14:51 +0000)]
[Frontend] Remove unused TemporaryFiles

Summary:
OnDiskData.TemporaryFiles is filled only by ASTUnit::addTemporaryFile, which is
dead. Also these files are used nowhere in the frontend nor in libclang.

Reviewers: bkramer, ilya-biryukov

Reviewed By: bkramer, ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 303265

7 years agoChange getChecksFilter() interface to hide implementation details.
Alexander Kornienko [Wed, 17 May 2017 14:39:47 +0000 (14:39 +0000)]
Change getChecksFilter() interface to hide implementation details.

llvm-svn: 303264

7 years ago[clang-tidy] Replace matchesName with hasName where no regex is needed
Alexander Kornienko [Wed, 17 May 2017 14:39:39 +0000 (14:39 +0000)]
[clang-tidy] Replace matchesName with hasName where no regex is needed

llvm-svn: 303263

7 years agoImplement tls scanning for darwin LSan
Francis Ricci [Wed, 17 May 2017 14:35:17 +0000 (14:35 +0000)]
Implement tls scanning for darwin LSan

Summary:
This required for any users who call exit() after creating
thread-specific data, as tls destructors are only called when
pthread_exit() or pthread_cancel() are used. This should also
match tls behavior on linux.

Getting the base address of the tls section is straightforward,
as it's stored as a section offset in %gs. The size is a bit trickier
to work out, as there doesn't appear to be any official documentation
or source code referring to it. The size used in this patch was determined
by taking the difference between the base address and the address of the
subsequent memory region returned by vm_region_recurse_64, which was
1024 * sizeof(uptr) on all threads except the main thread, where it was
larger. Since the section must be the same size on all of the threads,
1024 * sizeof(uptr) seemed to be a reasonable size to use, barring
a more programtic way to get the size.

1024 seems like a reasonable number, given that PTHREAD_KEYS_MAX
is 512 on darwin, so pthread keys will fit inside the region while
leaving space for other tls data. A larger size would overflow the
memory region returned by vm_region_recurse_64, and a smaller size
wouldn't leave room for all the pthread keys. In addition, the
stress test added here passes, which means that we are scanning at
least the full set of possible pthread keys, and probably
the full tls section.

Reviewers: alekseyshl, kubamracek

Subscribers: krytarowski, llvm-commits

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

llvm-svn: 303262

7 years ago[InstCombine] add isCanonicalPredicate() helper function and use it; NFCI
Sanjay Patel [Wed, 17 May 2017 14:21:19 +0000 (14:21 +0000)]
[InstCombine] add isCanonicalPredicate() helper function and use it; NFCI

There should be a slight efficiency improvement from handling icmp/fcmp with one matcher and reducing duplicated code.

The larger motivation is that there are questions about how predicate canonicalization is handled, and the refactoring
should make it easier if we want to change any of that behavior.

1. As noted in the code comment, we've chosen 3 of the 16 FCMP preds as not canonical. Why those 3? It goes back to
   rL32751 from what I can tell, but I'm not sure if there's a justification for that rule.
2. We currently do not canonicalize integer select conditions. Should we use the same rule that applies to branches
   for selects?
3. We currently do canonicalize some FP select conditions, and those rules would conflict with the rule shown here.
   Should one or both be changed?

No-functional-change-intended, but adding tests anyway because there's no coverage for most of the predicates.

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

llvm-svn: 303261

7 years agoRecommit "[include-fixer] Don't throw exception when parsing unknown ar… …guments...
Haojian Wu [Wed, 17 May 2017 14:13:59 +0000 (14:13 +0000)]
Recommit "[include-fixer] Don't throw exception when parsing unknown ar… …guments in vim script."

Summary: To make it work in neovim.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits

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

llvm-svn: 303260

7 years ago[globalisel][tablegen] Import rules containing intrinsic_wo_chain.
Daniel Sanders [Wed, 17 May 2017 13:39:49 +0000 (13:39 +0000)]
[globalisel][tablegen] Import rules containing intrinsic_wo_chain.

Summary:
As of this patch, 1018 out of 3938 rules are currently imported.

Depends on D32275

Reviewers: qcolombet, kristof.beyls, rovka, t.p.northover, ab, aditya_nandakumar

Reviewed By: qcolombet

Subscribers: dberris, igorb, llvm-commits

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

llvm-svn: 303259

7 years ago[x86] Update tests in psubus.ll; NFC
Sanjay Patel [Wed, 17 May 2017 13:39:16 +0000 (13:39 +0000)]
[x86] Update tests in psubus.ll; NFC

Remove unnecessary memops to minimize tests.

Patch by Yulia Koval!

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

llvm-svn: 303258

7 years ago[PPC] Properly update register save area offsets
Krzysztof Parzyszek [Wed, 17 May 2017 13:25:09 +0000 (13:25 +0000)]
[PPC] Properly update register save area offsets

The variables MinGPR/MinG8R were not updated properly when resetting the
offsets, which in the included testcase lead to saving the CR register
in the same location as R30.

This fixes another issue reported in PR26519.

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

llvm-svn: 303257

7 years ago[clang-tidy] A bit of refactoring of modernize-replace-auto-ptr. NFC
Alexander Kornienko [Wed, 17 May 2017 12:57:06 +0000 (12:57 +0000)]
[clang-tidy] A bit of refactoring of modernize-replace-auto-ptr. NFC

llvm-svn: 303256

7 years ago[GlobalISel][X86] Support add i64 in IA32.
Igor Breger [Wed, 17 May 2017 12:48:08 +0000 (12:48 +0000)]
[GlobalISel][X86] Support add i64 in IA32.

Summary: support G_UADDE instruction selection.

Reviewers: zvi, guyblank

Reviewed By: guyblank

Subscribers: rovka, kristof.beyls, llvm-commits

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

llvm-svn: 303255

7 years ago[SystemZ] Modelling of costs of divisions with a constant power of 2.
Jonas Paulsson [Wed, 17 May 2017 12:46:26 +0000 (12:46 +0000)]
[SystemZ]  Modelling of costs of divisions with a constant power of 2.

Such divisions will eventually be implemented with shifts which should
be reflected in the cost function.

Review: Ulrich Weigand
llvm-svn: 303254

7 years ago[globalisel][tablegen] Require that all registers between instructions of a match...
Daniel Sanders [Wed, 17 May 2017 12:43:30 +0000 (12:43 +0000)]
[globalisel][tablegen] Require that all registers between instructions of a match are virtual.

Summary:
Without this, it's possible to encounter multiple defs for a register.

This is triggered by the current version of D32868 when applied to trunk.

Reviewers: qcolombet, ab, t.p.northover, rovka, kristof.beyls

Reviewed By: qcolombet

Subscribers: llvm-commits, igorb

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

llvm-svn: 303253

7 years agoReland r303247: [ARM] GlobalISel: Remove dead instruction selection code
Diana Picus [Wed, 17 May 2017 12:42:52 +0000 (12:42 +0000)]
Reland r303247: [ARM] GlobalISel: Remove dead instruction selection code

It only failed on llvm-clang-x86_64-expensive-checks-win, probably
because the TableGen stuff hasn't been regenerated.
Requires a clean build.

llvm-svn: 303252

7 years ago[DWARF] - Cleanup relocations proccessing.
George Rimar [Wed, 17 May 2017 12:10:51 +0000 (12:10 +0000)]
[DWARF] - Cleanup relocations proccessing.

RelocAddrMap was a pair of <width, address>, where width is relocation size (4/8/x, x < 8),
and width field was never used in code.

Relocations proccessing loop had checks for width field. Does not look like DWARF parser
should do that. There is probably no much sense to validate relocations during proccessing
them in parser.

Patch removes relocation's width relative code from DWARFContext.

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

llvm-svn: 303251

7 years agoConstify.
Vassil Vassilev [Wed, 17 May 2017 12:09:11 +0000 (12:09 +0000)]
Constify.

llvm-svn: 303250

7 years agoRevert "[ARM] GlobalISel: Remove dead instruction selection code"
Diana Picus [Wed, 17 May 2017 11:56:07 +0000 (11:56 +0000)]
Revert "[ARM] GlobalISel: Remove dead instruction selection code"

This reverts commit r303247 because the tests are failing on some bots.
Sorry!

llvm-svn: 303249

7 years agoMake TestConflictingSymbol run on non-darwin targets
Pavel Labath [Wed, 17 May 2017 11:47:44 +0000 (11:47 +0000)]
Make TestConflictingSymbol run on non-darwin targets

For remote targets we need to call registerSharedLibrariesWithTarget to
make sure they are installed alongside main executable. This also
required a small fixup in the the mentioned function as in this case
"One" was both a directory name and a library name template. I fixed it
to make sure it checks that the string refers to a file before it
assumed it was a full library path.

llvm-svn: 303248

7 years ago[ARM] GlobalISel: Remove dead instruction selection code
Diana Picus [Wed, 17 May 2017 11:39:26 +0000 (11:39 +0000)]
[ARM] GlobalISel: Remove dead instruction selection code

We can now generate code for selecting G_ADD, G_SUB and G_MUL. Remove
the hand-written versions.

llvm-svn: 303247

7 years ago[Lexer] Ensure that the token is not an annotation token when
Alex Lorenz [Wed, 17 May 2017 11:08:36 +0000 (11:08 +0000)]
[Lexer] Ensure that the token is not an annotation token when
retrieving the identifer info for an Objective-C keyword

This commit fixes an assertion that's triggered in getIdentifier when the token
is an annotation token.

rdar://32225463

llvm-svn: 303246

7 years ago[Sparc] Remove execute permissions from non-executable text files
Daniel Cederman [Wed, 17 May 2017 11:05:20 +0000 (11:05 +0000)]
[Sparc] Remove execute permissions from non-executable text files

Reviewers: jyknight, lero_chris, venkatra

Reviewed By: jyknight

Subscribers: llvm-commits

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

llvm-svn: 303245

7 years agoFixup r303240: Use llvm::to_string instead of std::to_string
Diana Picus [Wed, 17 May 2017 09:25:08 +0000 (09:25 +0000)]
Fixup r303240: Use llvm::to_string instead of std::to_string

It turns out some of the buildbots don't have std::to_string around,
even in this day and age...

llvm-svn: 303243

7 years agoRevert "[include-fixer] Don't throw exception when parsing unknown arguments in vim...
Benjamin Kramer [Wed, 17 May 2017 09:24:28 +0000 (09:24 +0000)]
Revert "[include-fixer] Don't throw exception when parsing unknown arguments in vim script."

This reverts commit r302934. It's wrong, edits the wrong file and was
committed without review.

llvm-svn: 303242

7 years ago[DebugInfo/DWARF] - Make comments to be in doxygen style. NFCi.
George Rimar [Wed, 17 May 2017 09:00:10 +0000 (09:00 +0000)]
[DebugInfo/DWARF] - Make comments to be in doxygen style. NFCi.

This changes "//" to "///" in llvm/DebugInfo/DWARF folder where appropriate
and also removes few trailing whitespaces.

llvm-svn: 303241

7 years ago[GlobalISel][TableGen] Fix handling of default operands
Diana Picus [Wed, 17 May 2017 08:57:28 +0000 (08:57 +0000)]
[GlobalISel][TableGen] Fix handling of default operands

When looping through a destination pattern's operands to decide how many
default operands we need to introduce, we used to count the "expanded"
number of operands. So if one default operand would be rendered as 2
values, we'd count it as 2 operands, when in fact it needs to count as
only 1 operand regardless of how many values it expands to.

This turns out to be a problem only in some very specific cases, e.g.
when we have one operand with multiple default values followed by more
operands with default values (see the new test). In such a situation
we'd stop looping before looking at all the operands, and then error out
assuming that we don't have enough default operands to make up the
shortfall.

At the moment this only affects ARM.

The patch removes the loop counting default operands entirely and
assumes that we'll have to introduce values for any default operand that
we find (i.e. we're assuming it cannot be given as a child at all). It
also extracts the code for adding renderers for default operands into a
helper method.

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

llvm-svn: 303240

7 years ago[RuntimeDyld] Fix debug section relocation (pr20457)
Pavel Labath [Wed, 17 May 2017 08:47:28 +0000 (08:47 +0000)]
[RuntimeDyld] Fix debug section relocation (pr20457)

Summary:
Debug info sections, (or non-SHF_ALLOC sections in general) should be
linked as if their load address was zero to emulate the behavior of the
static linker.

This bug was discovered because it was breaking lldb expression evaluation on
linux.

Reviewers: lhames

Subscribers: aprantl, eugene, clayborg, lldb-commits, llvm-commits

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

llvm-svn: 303239