platform/upstream/llvm.git
5 years ago[Driver] Default Android toolchains to libc++.
Dan Albert [Thu, 11 Oct 2018 20:58:43 +0000 (20:58 +0000)]
[Driver] Default Android toolchains to libc++.

Reviewers: srhines, pirama, EricWF

Reviewed By: srhines

Subscribers: cfe-commits

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

llvm-svn: 344296

5 years ago[Driver] Default to `-z now` and `-z relro` on Android.
Dan Albert [Thu, 11 Oct 2018 20:57:54 +0000 (20:57 +0000)]
[Driver] Default to `-z now` and `-z relro` on Android.

Summary:
RTLD_LAZY is not supported on Android (though failing to use `-z now`
will work since it is assumed by the loader).

RelRO is required.

Reviewers: srhines, pirama

Reviewed By: srhines

Subscribers: cfe-commits

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

llvm-svn: 344295

5 years agoRename SymbolTable::addRegular -> SymbolTable::addDefined.
Rui Ueyama [Thu, 11 Oct 2018 20:43:01 +0000 (20:43 +0000)]
Rename SymbolTable::addRegular -> SymbolTable::addDefined.

We have addAbsolute, addBitcode, addCommon, etc. addRegular looked a
bit inconsistent.

llvm-svn: 344294

5 years ago[Driver] Fix --hash-style choice for Android.
Dan Albert [Thu, 11 Oct 2018 20:39:32 +0000 (20:39 +0000)]
[Driver] Fix --hash-style choice for Android.

Summary:
Android supports GNU style hashes as of Marshmallow, so we should be
generating both styles for pre-M targets and GNU hashes for newer
targets.

Reviewers: srhines, pirama

Reviewed By: srhines

Subscribers: cfe-commits

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

llvm-svn: 344293

5 years agoRemove unused default arguments.
Rui Ueyama [Thu, 11 Oct 2018 20:38:34 +0000 (20:38 +0000)]
Remove unused default arguments.

llvm-svn: 344292

5 years ago[X86] Type legalize v2f32 loads by using an f64 load and a scalar_to_vector.
Craig Topper [Thu, 11 Oct 2018 20:36:06 +0000 (20:36 +0000)]
[X86] Type legalize v2f32 loads by using an f64 load and a scalar_to_vector.

On 64-bit targets the generic legalize will use an i64 load and a scalar_to_vector for us. But on 32-bit targets i64 isn't legal and the generic legalizer will end up emitting two 32-bit loads. We have DAG combines that try to put those two loads back together with pretty good success.

This patch instead uses f64 to avoid the splitting entirely. I've made it do the same for 64-bit mode for consistency and to keep the load in the fp domain.

There are a few things in here that look like regressions in 32-bit mode, but I believe they bring us closer to the 64-bit mode codegen. And that the 64-bit mode code could be better. I think those issues should be looked at separately.

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

llvm-svn: 344291

5 years agoRemove SymbolTable::addUndefined<ELF32LE>(StringRef).
Rui Ueyama [Thu, 11 Oct 2018 20:34:29 +0000 (20:34 +0000)]
Remove SymbolTable::addUndefined<ELF32LE>(StringRef).

Because we can implement the function as a non-member function.

llvm-svn: 344290

5 years ago[hwasan] relax a test
Kostya Serebryany [Thu, 11 Oct 2018 20:29:00 +0000 (20:29 +0000)]
[hwasan] relax a test

llvm-svn: 344289

5 years ago[python] [tests] Fix calling tests on Windows
Michal Gorny [Thu, 11 Oct 2018 20:26:55 +0000 (20:26 +0000)]
[python] [tests] Fix calling tests on Windows

Fix passing arguments to the Python test command to use 'env' builtin
CMake command, in order to fix compatibility with Windows.

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

llvm-svn: 344288

5 years ago[WebAssembly][NFC] Remove repetition of Defs = [ARGUMENTS] (fixed)
Thomas Lively [Thu, 11 Oct 2018 20:21:22 +0000 (20:21 +0000)]
[WebAssembly][NFC] Remove repetition of Defs = [ARGUMENTS] (fixed)

llvm-svn: 344287

5 years agoUpdate test of r344198 to work with release builds.
Warren Ristow [Thu, 11 Oct 2018 20:19:25 +0000 (20:19 +0000)]
Update test of r344198 to work with release builds.

llvm-svn: 344286

5 years ago[HIP] Remove unused irif bitcode from test
Aaron Enye Shi [Thu, 11 Oct 2018 19:52:32 +0000 (19:52 +0000)]
[HIP] Remove unused irif bitcode from test

This is part of previous commit [HIP] Replace irif library with hip.amdgcn.bc

Reviewers: yaxunl

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

llvm-svn: 344285

5 years ago[Hexagon] Restrict compound instructions with constant value.
Sumanth Gundapaneni [Thu, 11 Oct 2018 19:48:15 +0000 (19:48 +0000)]
[Hexagon] Restrict compound instructions with constant value.

Having a constant value operand in the compound instruction
is not always profitable. This patch improves coremark by ~4% on
Hexagon.

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

llvm-svn: 344284

5 years ago[Pipeliner] Use the Index from Topo instead of relying on NodeNum. (NFC)
Sumanth Gundapaneni [Thu, 11 Oct 2018 19:45:07 +0000 (19:45 +0000)]
[Pipeliner] Use the Index from Topo instead of relying on NodeNum. (NFC)

In future, if we may add any new DAG mutations other than artificial dependencies,
the NodeNum may not be valid. Instead the index from topological schedule DAG can be
used as long as we update it with the DAG change.

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

llvm-svn: 344283

5 years ago[Pipeliner] Fix the Schedule DAG topoligical order.
Sumanth Gundapaneni [Thu, 11 Oct 2018 19:42:46 +0000 (19:42 +0000)]
[Pipeliner] Fix the Schedule DAG topoligical order.

This patch updates the DAG change to reflect in the topological ordering
of the nodes.

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

llvm-svn: 344282

5 years ago[HIP] Replace irif library with hip.amdgcn.bc
Aaron Enye Shi [Thu, 11 Oct 2018 19:41:54 +0000 (19:41 +0000)]
[HIP] Replace irif library with hip.amdgcn.bc

No longer use irif amdgcn library, instead we will use the previous fence functions from new hip.amdgcn.bc bitcode library. Update hip-device-libs.hip test as well.

llvm-svn: 344281

5 years ago[WebAssembly] Revert rL344180, which was breaking expensive checks
Thomas Lively [Thu, 11 Oct 2018 18:45:48 +0000 (18:45 +0000)]
[WebAssembly] Revert rL344180, which was breaking expensive checks

llvm-svn: 344280

5 years agoRevert SymbolFileNativePDB plugin.
Zachary Turner [Thu, 11 Oct 2018 18:45:44 +0000 (18:45 +0000)]
Revert SymbolFileNativePDB plugin.

This was originally causing some test failures on non-Windows
platforms, which required fixes in the compiler and linker.  After
those fixes, however, other tests started failing.  Reverting
temporarily until I can address everything.

llvm-svn: 344279

5 years agoRevert r344197 "[MC][ELF] compute entity size for explicit sections"
Artem Dergachev [Thu, 11 Oct 2018 18:43:08 +0000 (18:43 +0000)]
Revert r344197 "[MC][ELF] compute entity size for explicit sections"

Revert r344206 "[MC][ELF] Fix section_mergeable_size.ll"

They were causing failures on too many important buildbots for too long.
Please revert eagerly if your fix takes more than a couple of hours to land!

llvm-svn: 344278

5 years agoFix this comment so it is consistent with all the others.
Jason Molenda [Thu, 11 Oct 2018 18:41:34 +0000 (18:41 +0000)]
Fix this comment so it is consistent with all the others.

llvm-svn: 344277

5 years agoRevert "clang-cl: Add /showFilenames option (PR31957)"
Sean Fertile [Thu, 11 Oct 2018 18:40:35 +0000 (18:40 +0000)]
Revert "clang-cl: Add /showFilenames option (PR31957)"

This reverts https://reviews.llvm.org/rL344234 which is causing failures on
several bots due to invalid llvm.linker.options.

llvm-svn: 344276

5 years agoDon't mark an LC_BUILD_VERSION as giving us a
Jason Molenda [Thu, 11 Oct 2018 18:37:53 +0000 (18:37 +0000)]
Don't mark an LC_BUILD_VERSION as giving us a
correct version if it has a major verison 0.

llvm-svn: 344275

5 years ago[PassManager/Sanitizer] Port of AddresSanitizer pass from legacy to new PassManager
Leonard Chan [Thu, 11 Oct 2018 18:31:51 +0000 (18:31 +0000)]
[PassManager/Sanitizer] Port of AddresSanitizer pass from legacy to new PassManager

This patch ports the legacy pass manager to the new one to take advantage of
the benefits of the new PM. This involved moving a lot of the declarations for
`AddressSantizer` to a header so that it can be publicly used via
PassRegistry.def which I believe contains all the passes managed by the new PM.

This patch essentially decouples the instrumentation from the legacy PM such
hat it can be used by both legacy and new PM infrastructure.

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

llvm-svn: 344274

5 years ago[OPENMP][NVPTX]Reduce memory use for globalized vars in
Alexey Bataev [Thu, 11 Oct 2018 18:30:31 +0000 (18:30 +0000)]
[OPENMP][NVPTX]Reduce memory use for globalized vars in
target/teams/distribute regions.

Previously introduced globalization scheme that uses memory coalescing
scheme may increase memory usage fr the variables that are devlared in
target/teams/distribute contexts. We don't need 32 copies of such
variables, just 1. Patch reduces memory use in this case.

llvm-svn: 344273

5 years ago[DAG] Fix Big Endian in Load-Store forwarding
Nirav Dave [Thu, 11 Oct 2018 18:28:59 +0000 (18:28 +0000)]
[DAG] Fix Big Endian in Load-Store forwarding

Summary:
Correct offset calculation in load-store forwarding for big-endian
targets.

Reviewers: rnk, RKSimon, waltl

Subscribers: sdardis, nemanjai, hiraditya, jrtc27, atanasyan, jsji, llvm-commits

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

llvm-svn: 344272

5 years ago[Hexagon] Eliminate potential sources of non-determinism in HCE
Krzysztof Parzyszek [Thu, 11 Oct 2018 18:26:02 +0000 (18:26 +0000)]
[Hexagon] Eliminate potential sources of non-determinism in HCE

Also, avoid comparing GUIDs when ordering global addresses, because
source file location can cause different GUID to be calculated. As a
result, a pair of symbols can compare "less" in one directory, but
"greater" in another.

llvm-svn: 344271

5 years ago[X86] Restore X86ISelDAGToDAG::matchBEXTRFromAnd. Teach address matching to create...
Craig Topper [Thu, 11 Oct 2018 18:06:07 +0000 (18:06 +0000)]
[X86] Restore X86ISelDAGToDAG::matchBEXTRFromAnd. Teach address matching to create a BEXTR pattern from a (shl (and X, mask >> C1) if C1 can be folded into addressing mode.

This is an alternative to D53080 since I think using a BEXTR for a shifted mask is definitely an improvement when the shl can be absorbed into addressing mode. The other cases I'm less sure about.

We already have several tricks for handling an and of a shift in address matching. This adds a new case for BEXTR.

I've moved the BEXTR matching code back to X86ISelDAGToDAG to allow it to match. I suppose alternatively we could directly emit a X86ISD::BEXTR node that isel could pattern match. But I'm trying to view BEXTR matching as an isel concern so DAG combine can see 'and' and 'shift' operations that are well understood. We did lose a couple cases from tbm_patterns.ll, but I think there are ways to recover that.

I've also put back the manual load folding code in matchBEXTRFromAnd that I removed a few months ago in r324939. This gives us some more freedom to make decisions based on the ability to fold a load. I haven't done anything with that yet.

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

llvm-svn: 344270

5 years agoBetter support for POSIX paths in PDBs.
Zachary Turner [Thu, 11 Oct 2018 18:01:55 +0000 (18:01 +0000)]
Better support for POSIX paths in PDBs.

While it doesn't make a *ton* of sense for POSIX paths to be
in PDBs, it's possible to occur in real scenarios involving
cross compilation.

The tools need to be able to handle this, because certain types
of debugging scenarios are possible without a running process
and so don't necessarily require you to be on a Windows system.
These include post-mortem debugging and binary forensics (e.g.
using a debugger to disassemble functions and examine symbols
without running the process).

There's changes in clang, LLD, and lldb in this patch.  After
this the cross-platform disassembly and source-list tests pass
on Linux.

Furthermore, the behavior of LLD can now be summarized by a much
simpler rule than before: Unless you specify /pdbsourcepath and
/pdbaltpath, the PDB ends up with paths that are valid within
the context of the machine that the link is performed on.

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

llvm-svn: 344269

5 years ago[llvm-nm] Fix crash when running with --print-armap on corrupt archives.
Jordan Rupprecht [Thu, 11 Oct 2018 17:55:11 +0000 (17:55 +0000)]
[llvm-nm] Fix crash when running with --print-armap on corrupt archives.

error() in llvm-nm intentionally does not return so that the callee can move on to future files/slices. When printing the archive map, this is not currently handled (the caller assumes that error() returns), so processing continues despite there being an error.

Also, change one return to a break, so that symbols can be printed even if the archive map is corrupt.

llvm-svn: 344268

5 years agoRevert "[Lex] TokenConcatenation now takes const Preprocessor"
Eric Liu [Thu, 11 Oct 2018 17:50:04 +0000 (17:50 +0000)]
Revert "[Lex] TokenConcatenation now takes const Preprocessor"

This reverts commit r344262. This was an unintentional commit.

llvm-svn: 344267

5 years agoclang-cl: set output of lit-test to a tmp file after r344234
Eric Liu [Thu, 11 Oct 2018 17:49:20 +0000 (17:49 +0000)]
clang-cl: set output of lit-test to a tmp file after r344234

Some test frameworks do not allow output file in CWD.

llvm-svn: 344266

5 years ago[COFF] Add and use a Wordsize field in Config. NFCI.
Martin Storsjo [Thu, 11 Oct 2018 17:45:58 +0000 (17:45 +0000)]
[COFF] Add and use a Wordsize field in Config. NFCI.

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

llvm-svn: 344265

5 years ago[COFF] Set proper pointer size alignment for LocalImportChunk
Martin Storsjo [Thu, 11 Oct 2018 17:45:51 +0000 (17:45 +0000)]
[COFF] Set proper pointer size alignment for LocalImportChunk

When these are accessed with load/store instructions on ARM64,
it becomes strictly necessary to have them properly aligned.

This fixes PR39228.

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

llvm-svn: 344264

5 years ago[python] [tests] Retab CMakeLists.txt for consistency (NFC)
Michal Gorny [Thu, 11 Oct 2018 17:45:35 +0000 (17:45 +0000)]
[python] [tests] Retab CMakeLists.txt for consistency (NFC)

llvm-svn: 344263

5 years ago[Lex] TokenConcatenation now takes const Preprocessor
Eric Liu [Thu, 11 Oct 2018 17:35:29 +0000 (17:35 +0000)]
[Lex] TokenConcatenation now takes const Preprocessor

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

llvm-svn: 344262

5 years agoRevert commit r344254; does not work with C++03
Marshall Clow [Thu, 11 Oct 2018 17:28:57 +0000 (17:28 +0000)]
Revert commit r344254; does not work with C++03

llvm-svn: 344261

5 years ago[tests] Remove Python tests from check-all due to breakage
Michal Gorny [Thu, 11 Oct 2018 17:25:05 +0000 (17:25 +0000)]
[tests] Remove Python tests from check-all due to breakage

Remove the Python tests from default target in order to fix two
kinds of breakage uncovered by enabling them: one failing test on Linux,
and problem with the test command on Windows.  Both to be addressed
in followup revisions.

llvm-svn: 344260

5 years agoImprove -Wshadow warnings with enumerators.
Aaron Ballman [Thu, 11 Oct 2018 16:40:18 +0000 (16:40 +0000)]
Improve -Wshadow warnings with enumerators.

Addresses PR24718 by checking for enumerators that shadow other enumerators. Catches issues like:

enum E1{e1};
void f(void) {
  enum E2{e1};
}

llvm-svn: 344259

5 years ago[tests] Include Python binding tests in CMake rules
Michal Gorny [Thu, 11 Oct 2018 16:32:54 +0000 (16:32 +0000)]
[tests] Include Python binding tests in CMake rules

Add a new CMake rule check-clang-python to run the Python bindings'
test suite, and include it in check-all.

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

llvm-svn: 344258

5 years agoSome improvements to the OpenBSD driver.
Brad Smith [Thu, 11 Oct 2018 16:13:44 +0000 (16:13 +0000)]
Some improvements to the OpenBSD driver.

- OpenBSD has switched to compiler_rt / libcxx
- Fix sysroot and lib path handling
- Some cleaning up

llvm-svn: 344257

5 years ago[clang-move] Remove clang:: qualifier
Fangrui Song [Thu, 11 Oct 2018 16:09:26 +0000 (16:09 +0000)]
[clang-move] Remove clang:: qualifier

Summary:
The use sites are enclosed by `namespace clang`, so clang:: is not
necessary. Many unqualified names have already been used, e.g. SourceManager SourceLocation LangOptions. This change makes the code terser and more consistent.

Reviewers: hokein

Reviewed By: hokein

Subscribers: ioeric, cfe-commits

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

llvm-svn: 344256

5 years ago[DAGCombiner] move comment closer to the corresponding code; NFC
Sanjay Patel [Thu, 11 Oct 2018 16:07:25 +0000 (16:07 +0000)]
[DAGCombiner] move comment closer to the corresponding code; NFC

llvm-svn: 344255

5 years agoPrefer to use the __is_XXX compiler intrinsics to the (old, busted) __has_XXX intrins...
Marshall Clow [Thu, 11 Oct 2018 15:38:07 +0000 (15:38 +0000)]
Prefer to use the __is_XXX compiler intrinsics to the (old, busted) __has_XXX intrinsics when implementing type traits. Thanks to Richard Smith for the patch.

llvm-svn: 344254

5 years ago[llvm-mca][BtVer2] Add tests for optimizable GPR register moves. NFC
Andrea Di Biagio [Thu, 11 Oct 2018 14:54:54 +0000 (14:54 +0000)]
[llvm-mca][BtVer2] Add tests for optimizable GPR register moves. NFC

llvm-svn: 344253

5 years ago[lldb] Surpress copy-elison warning.
Eric Liu [Thu, 11 Oct 2018 14:52:33 +0000 (14:52 +0000)]
[lldb] Surpress copy-elison warning.

llvm-svn: 344252

5 years ago[InstCombine] Fix SimplifyLibCalls erasing an instruction while IC still had referenc...
Amara Emerson [Thu, 11 Oct 2018 14:51:11 +0000 (14:51 +0000)]
[InstCombine] Fix SimplifyLibCalls erasing an instruction while IC still had references to it.

InstCombine keeps a worklist and assumes that optimizations don't
eraseFromParent() the instruction, which SimplifyLibCalls violates. This change
adds a new callback to SimplifyLibCalls to let clients specify their own hander
for erasing actions.

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

llvm-svn: 344251

5 years ago[lldb] rename MinOS::minor to MinOS::minor_version etc. NFC
Eric Liu [Thu, 11 Oct 2018 14:44:12 +0000 (14:44 +0000)]
[lldb] rename MinOS::minor to MinOS::minor_version etc. NFC

The constructor initializer minor(...)/major(...) can be confused with system
macros `#define minor(...)` on some platforms.

llvm-svn: 344250

5 years agoAdd support for 'dynamic_allocators' clause on 'requires' directive. Differential...
Patrick Lyster [Thu, 11 Oct 2018 14:41:10 +0000 (14:41 +0000)]
Add support for 'dynamic_allocators' clause on 'requires' directive. Differential Revision: https://reviews.llvm.org/D53079

llvm-svn: 344249

5 years ago[AARCH64][FIX] Emit data symbol for constant pool data
Diogo N. Sampaio [Thu, 11 Oct 2018 14:10:32 +0000 (14:10 +0000)]
[AARCH64][FIX] Emit data symbol for constant pool data

The ARM64 elf emitter would omit printing data
symbol for zero filled constant data. This patch
overrides the emitFill method as to enforce that
the symbol is correctly printed.

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

llvm-svn: 344248

5 years ago[Tooling] Move CompilationDatabasePlugin to the Registry header, where it's useful...
Sam McCall [Thu, 11 Oct 2018 13:42:53 +0000 (13:42 +0000)]
[Tooling] Move CompilationDatabasePlugin to the Registry header, where it's useful. NFC

llvm-svn: 344247

5 years ago[Sema][OpenCL] Improve diagnostics for not viable overloadable function candidates
Andrew Savonichev [Thu, 11 Oct 2018 13:35:34 +0000 (13:35 +0000)]
[Sema][OpenCL] Improve diagnostics for not viable overloadable function candidates

Summary:
Allowed extension name (that ought to be disabled) printing in the note message.

This diagnostic was proposed here: https://reviews.llvm.org/D51341

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia

Subscribers: cfe-commits, asavonic, bader

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

llvm-svn: 344246

5 years ago[clangd] Remove no-op crash handler, we never set a crash context.
Sam McCall [Thu, 11 Oct 2018 13:06:10 +0000 (13:06 +0000)]
[clangd] Remove no-op crash handler, we never set a crash context.

Summary:
I think this was just copied from somewhere with the belief that it actually
did some crash handling.

Of course the question arises: *should* we set one? I don't think so:
 - clangd used to crash a lot, now it's pretty stable, because we found and
   fixed the crashes. I think the long-term effects of crashing hard are good.
 - the implementation can't do any magic, it just uses longjmp to return without
   running any destructors by default. This is unsafe in general (e.g. mutexes
   won't unlock) and will certainly end up leaking memory. Whatever UB caused
   the crash may still stomp all over global state, etc.

I think there's an argument for isolating the background indexer (autoindex)
because it's not directly under the user's control, the crash surface is larger,
and it doesn't particularly need to interact with the rest of clangd.
But there, fork() and communicate through the FS is safer.

Reviewers: ioeric, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 344245

5 years agoRevert r344241 as it broke multiple bots.
Aaron Ballman [Thu, 11 Oct 2018 12:57:29 +0000 (12:57 +0000)]
Revert r344241 as it broke multiple bots.

http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/10814
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/20613

llvm-svn: 344244

5 years agoGeneralize an IR verifier check to work with non-zero program address spaces
Dylan McKay [Thu, 11 Oct 2018 12:49:50 +0000 (12:49 +0000)]
Generalize an IR verifier check to work with non-zero program address spaces

This commit modifies an existing IR verifier check that
assumes all functions will be located in the default address
space 0.

Rather than using the default paramater value getPointerTo(AddrSpace=0),
explicitly specify the program memory address space from the data layout.

This only affects targets that specify a nonzero address space
in their data layouts. The only in-tree target that does this
is AVR.

llvm-svn: 344243

5 years ago[analyzer][UninitializedObjectChecker] Reports Loc fields pointing to themselves
Kristof Umann [Thu, 11 Oct 2018 11:58:53 +0000 (11:58 +0000)]
[analyzer][UninitializedObjectChecker] Reports Loc fields pointing to themselves

I've added a new functionality, the checker is now able to
detect and report fields pointing to themselves. I figured
this would fit well into the checker as there's no reason
for a pointer to point to itself instead of being nullptr.

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

llvm-svn: 344242

5 years ago[tests] Include Python binding tests in CMake rules
Michal Gorny [Thu, 11 Oct 2018 11:58:14 +0000 (11:58 +0000)]
[tests] Include Python binding tests in CMake rules

Add a new CMake rule check-clang-python to run the Python bindings'
test suite, and include it in check-all.

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

llvm-svn: 344241

5 years ago[python] [tests] Support overriding library path via environment
Michal Gorny [Thu, 11 Oct 2018 11:58:07 +0000 (11:58 +0000)]
[python] [tests] Support overriding library path via environment

Support a new CLANG_LIBRARY_PATH environment variable for the Python
binding tests.  This variable can be used to force the bindings to load
libclang.* from a specific directory.

I plan to use this when integrating Python binding tests with the CMake
build system.  Currently, those tests load libclang.so from default
search paths, so I would have to rely on platform-specific mechanics
such as LD_LIBRARY_PATH.  Instead of copying the whole logic necessary
to handle platform differences into yet another place, it's easier to
just add a dedicated variable for this purpose.

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

llvm-svn: 344240

5 years ago[InstCombine] Demand bits of UMin
David Green [Thu, 11 Oct 2018 11:28:27 +0000 (11:28 +0000)]
[InstCombine] Demand bits of UMin

This is the umin alternative to the umax code from rL344237. We use
DeMorgans law on the umax case to bring us to the same thing on umin,
but using countLeadingOnes, not countLeadingZeros.

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

llvm-svn: 344239

5 years ago[RISCV] Re-generate test/CodeGen/RISCV/vararg.ll after r344142
Alex Bradbury [Thu, 11 Oct 2018 11:11:58 +0000 (11:11 +0000)]
[RISCV] Re-generate test/CodeGen/RISCV/vararg.ll after r344142

The improved load-store forwarding committed in r344142 broke this test.

llvm-svn: 344238

5 years ago[InstCombine] Demand bits of UMax
David Green [Thu, 11 Oct 2018 11:04:09 +0000 (11:04 +0000)]
[InstCombine] Demand bits of UMax

Use the demanded bits of umax(A,C) to prove we can just use A so long as the
lowest non-zero bit of DemandMask is higher than the highest non-zero bit of C

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

llvm-svn: 344237

5 years ago[InstCombine] Add tests for demand bits of min/max. NFC.
David Green [Thu, 11 Oct 2018 10:46:12 +0000 (10:46 +0000)]
[InstCombine] Add tests for demand bits of min/max. NFC.

llvm-svn: 344236

5 years ago[tblgen][CodeGenSchedule] Add a check for invalid RegisterFile definitions with zero...
Andrea Di Biagio [Thu, 11 Oct 2018 10:39:03 +0000 (10:39 +0000)]
[tblgen][CodeGenSchedule] Add a check for invalid RegisterFile definitions with zero physical registers.

llvm-svn: 344235

5 years agoclang-cl: Add /showFilenames option (PR31957)
Hans Wennborg [Thu, 11 Oct 2018 10:04:15 +0000 (10:04 +0000)]
clang-cl: Add /showFilenames option (PR31957)

Add a /showFilenames option for users who want clang to echo the
currently compiled filename. MSVC does this echoing by default, and it's
useful for showing progress in build systems that doesn't otherwise
provide any progress report, such as MSBuild.

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

llvm-svn: 344234

5 years ago[LV] Use SmallVector instead of DenseMap in calculateRegisterUsage (NFC).
Florian Hahn [Thu, 11 Oct 2018 09:46:25 +0000 (09:46 +0000)]
[LV] Use SmallVector instead of DenseMap in calculateRegisterUsage (NFC).

We assign indices sequentially for seen instructions, so we can just use
a vector and push back the seen instructions. No need for using a
DenseMap.

Reviewers: hsaito, rengolin, nadav, dcaballe

Reviewed By: rengolin

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

llvm-svn: 344233

5 years ago[LV] Ignore more debug info.
Florian Hahn [Thu, 11 Oct 2018 09:27:24 +0000 (09:27 +0000)]
[LV] Ignore more debug info.

We can avoid doing some unnecessary work by skipping debug instructions
in a few loops. It also helps to ensure debug instructions do not
prevent vectorization, although I do not have any concrete test cases
for that.

Reviewers: rengolin, hsaito, dcaballe, aprantl, vsk

Reviewed By: rengolin, dcaballe

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

llvm-svn: 344232

5 years ago[compiler-rt][ubsan] Split Implicit Integer Truncation Sanitizer into unsigned and...
Roman Lebedev [Thu, 11 Oct 2018 09:09:52 +0000 (09:09 +0000)]
[compiler-rt][ubsan] Split Implicit Integer Truncation Sanitizer into unsigned and signed checks

Summary:
This is compiler-rt part.
clang part is D50901.

Reviewers: rsmith, vsk, filcab, Sanitizers

Reviewed by: filcab

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

llvm-svn: 344231

5 years ago[clang][ubsan] Split Implicit Integer Truncation Sanitizer into unsigned and signed...
Roman Lebedev [Thu, 11 Oct 2018 09:09:50 +0000 (09:09 +0000)]
[clang][ubsan] Split Implicit Integer Truncation Sanitizer into unsigned and signed checks

Summary:
As per IRC disscussion, it seems we really want to have more fine-grained `-fsanitize=implicit-integer-truncation`:
* A check when both of the types are unsigned.
* Another check for the other cases (either one of the types is signed, or both of the types is signed).

This is clang part.
Compiler-rt part is D50902.

Reviewers: rsmith, vsk, Sanitizers

Reviewed by: rsmith

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

llvm-svn: 344230

5 years ago[profile] Fix the gcov tests after the patch in D49853 landed.
Calixte Denizet [Thu, 11 Oct 2018 08:53:55 +0000 (08:53 +0000)]
[profile] Fix the gcov tests after the patch in D49853 landed.

Summary:
The goal of the patch in D49853 is to display counter on the line of function definition.
So some tests need to be fixed.

Reviewers: marco-c, davidxl

Reviewed By: marco-c

Subscribers: sylvestre.ledru, delcypher, llvm-commits, #sanitizers

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

llvm-svn: 344229

5 years ago[gcov] Display the hit counter for the line of a function definition
Calixte Denizet [Thu, 11 Oct 2018 08:53:43 +0000 (08:53 +0000)]
[gcov] Display the hit counter for the line of a function definition

Summary:
Right now there is no hit counter on the line of function.
So the idea is add the line of the function to all the lines covered by the entry block.
Tests in compiler-rt/profile will be fixed in another patch: https://reviews.llvm.org/D49854

Reviewers: marco-c, davidxl

Reviewed By: marco-c

Subscribers: sylvestre.ledru, llvm-commits

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

llvm-svn: 344228

5 years ago[NFC] Factor out getOrCreateAddRecExpr method
Max Kazantsev [Thu, 11 Oct 2018 08:46:39 +0000 (08:46 +0000)]
[NFC] Factor out getOrCreateAddRecExpr method

llvm-svn: 344227

5 years ago[ELF] - Set sh_info and sh_link for .rela.plt sections.
George Rimar [Thu, 11 Oct 2018 08:25:35 +0000 (08:25 +0000)]
[ELF] - Set sh_info and sh_link for .rela.plt sections.

This is https://bugs.llvm.org/show_bug.cgi?id=37538,

Currently, LLD may set both sh_link and sh_info for
.rela.plt section to zero when we have only .rela.iplt section part used.

ELF spec (https://docs.oracle.com/cd/E19683-01/816-1386/chapter6-94076/index.html)
says that for SHT_REL and SHT_RELA, sh_link references the associated symbol table
and sh_info the "section to which the relocation applies."

When we set the sh_link field, for the regular case we use the .dynsym index.
For .rela.iplt sections, it is unclear what is the associated symbol table,
because R_*_RELATIVE relocations do not use symbol names and we might have no
.dynsym section at all so this patch uses .symtab section index.

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

llvm-svn: 344226

5 years agoFix the qualification of `IntrusiveRefCntPtr` to use `llvm::`.
Chandler Carruth [Thu, 11 Oct 2018 08:05:10 +0000 (08:05 +0000)]
Fix the qualification of `IntrusiveRefCntPtr` to use `llvm::`.

Without this, the code only compiled if the header was included after
something introduced the alias from `clang::` to `llvm::` for this type.
Any modules build would fail here.

llvm-svn: 344225

5 years ago[X86][BMI1]: X86DAGToDAGISel: select BEXTR from x & ~(-1 << nbits) pattern
Roman Lebedev [Thu, 11 Oct 2018 07:51:13 +0000 (07:51 +0000)]
[X86][BMI1]: X86DAGToDAGISel: select BEXTR from x & ~(-1 << nbits) pattern

Summary:
As discussed in D48491, we can't really do this in the TableGen,
since we need to produce *two* instructions. This only implements
one single pattern. The other 3 patterns will be in follow-ups.

I'm not sure yet if we want to also fuse shift into here
(i.e `(x >> start) & ...`)

Reviewers: RKSimon, craig.topper, spatel

Reviewed By: craig.topper

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

llvm-svn: 344224

5 years ago[IndVars] Drop "exact" flag from lshr and udiv when substituting their args
Max Kazantsev [Thu, 11 Oct 2018 07:22:26 +0000 (07:22 +0000)]
[IndVars] Drop "exact" flag from lshr and udiv when substituting their args

There is a transform that may replace `lshr (x+1), 1` with `lshr x, 1` in case
if it can prove that the result will be the same. However the initial instruction
might have an `exact` flag set, and it now should be dropped unless we prove
that it may hold. Incorrectly set `exact` attribute may then produce poison.

Differential Revision: https://reviews.llvm.org/D53061
Reviewed By: sanjoy

llvm-svn: 344223

5 years ago[llvm-nm] Include the text "@FILE" in the output of --help
Martin Storsjo [Thu, 11 Oct 2018 06:53:38 +0000 (06:53 +0000)]
[llvm-nm] Include the text "@FILE" in the output of --help

libtool requires this text to be present, in order to conclude that
the tool supports response files. Also add an explicit test of using
response files with llvm-nm.

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

llvm-svn: 344222

5 years agoAdd a test that shows what happens with throwing destructors. NFC.
Marshall Clow [Thu, 11 Oct 2018 04:07:20 +0000 (04:07 +0000)]
Add a test that shows what happens with throwing destructors. NFC.

llvm-svn: 344220

5 years ago[CMake] Temporarily remove the LLVM_ENABLE_IDE option
Chris Bieneman [Thu, 11 Oct 2018 04:06:14 +0000 (04:06 +0000)]
[CMake] Temporarily remove the LLVM_ENABLE_IDE option

All uses of this option have been removed, and the intent is to change the purpose and default value of this option. To prevent it from having impacts on users, this patch temporarily removes the option and purges it from CMake caches. In a few days, once this has propagated to contributors I will re-introduce the option with the new default value.

llvm-svn: 344219

5 years ago[CMake] Unconditionally add .h and .td files to target sources
Chris Bieneman [Thu, 11 Oct 2018 04:02:53 +0000 (04:02 +0000)]
[CMake] Unconditionally add .h and .td files to target sources

Previously adding header and table gen files was conditional on using an IDE. Since these files have the `HEADER_FILE_ONLY` attribute applied they are ignored as sources by all non-IDE generators, so there is really no reason not to include them.

Additionally having the CMake always include these files allows the CMake-server to include them in the sources list for targets, which is valuable to anyone using CMake-server integrated tools.

llvm-svn: 344218

5 years ago[Coverage] Apply filtered paths to summary
Chris Bieneman [Thu, 11 Oct 2018 04:00:51 +0000 (04:00 +0000)]
[Coverage] Apply filtered paths to summary

Summary:
The script to generate code coverage reports supports passing filter paths to llvm-cov when generating the HTML reports, but doesn't pass those paths to the summary generation as well. This results in a summary report that doesn't match the HTML report.

This patch addresses the problem by also passing the filter paths to the summary report generation.

Reviewers: vsk

Subscribers: llvm-commits

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

llvm-svn: 344217

5 years agoUse fully qualified namespace name.
Zachary Turner [Thu, 11 Oct 2018 03:42:17 +0000 (03:42 +0000)]
Use fully qualified namespace name.

llvm::detail is not the only namespace named detail.  So if
someone has done a `using namespace llvm::support`, for example,
this will fail with an ambiguous namespace name.  Granted
people generally shouldn't be using large namespaces like that,
but it's common at local function scopes.

llvm-svn: 344216

5 years agoUse C++03 friendly version of alignof
Eric Fiselier [Thu, 11 Oct 2018 03:01:14 +0000 (03:01 +0000)]
Use C++03 friendly version of alignof

llvm-svn: 344215

5 years agoFix use of removed _LIBCPP_HAS_NO_BUILTIN_ALIGNED_OPERATOR_NEW_DELETE
Eric Fiselier [Thu, 11 Oct 2018 01:48:00 +0000 (01:48 +0000)]
Fix use of removed _LIBCPP_HAS_NO_BUILTIN_ALIGNED_OPERATOR_NEW_DELETE

It was replaced with the better named
_LIBCPP_HAS_NO_BUILTIN_OVERLOADED_OPERATOR_NEW_DELETE.

llvm-svn: 344214

5 years ago[hwasan] extend the stack-uar test
Kostya Serebryany [Thu, 11 Oct 2018 01:05:18 +0000 (01:05 +0000)]
[hwasan] extend the stack-uar test

llvm-svn: 344213

5 years agoEliminate dependency to formatv(). NFC.
Fangrui Song [Thu, 11 Oct 2018 00:58:00 +0000 (00:58 +0000)]
Eliminate dependency to formatv(). NFC.

llvm-svn: 344212

5 years ago[WebAssembly][NFC] Use intrinsic dag nodes directly
Thomas Lively [Thu, 11 Oct 2018 00:49:24 +0000 (00:49 +0000)]
[WebAssembly][NFC] Use intrinsic dag nodes directly

Summary: Instead of custom lowering to WebAssemblyISD nodes first.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 344211

5 years ago[hwasan] more compact printing for 'Previosly allocated frames'
Kostya Serebryany [Thu, 11 Oct 2018 00:34:20 +0000 (00:34 +0000)]
[hwasan] more compact printing for 'Previosly allocated frames'

llvm-svn: 344210

5 years agoUpstreaming the BridgeOS device support and the
Jason Molenda [Thu, 11 Oct 2018 00:28:35 +0000 (00:28 +0000)]
Upstreaming the BridgeOS device support and the
LC_BUILD_VERSION load command handling - this
commit is a combination of patches by Adrian
Prantl and myself.  llvm::Triple::BridgeOS
isn't defined yet, so all references to that
are currently commented out.

Also update Xcode project file to build the
NativePDB etc plugins.

<rdar://problem/43353615>

llvm-svn: 344209

5 years agoUpdate libc++abi's detection of aligned allocation after r344207.
Eric Fiselier [Thu, 11 Oct 2018 00:18:54 +0000 (00:18 +0000)]
Update libc++abi's detection of aligned allocation after r344207.

llvm-svn: 344208

5 years agoDistinguish between library and language support for aligned allocation.
Eric Fiselier [Thu, 11 Oct 2018 00:17:24 +0000 (00:17 +0000)]
Distinguish between library and language support for aligned allocation.

There are two cases:
1. The library has all it needs to provide align_val_t and the
new/delete overloads needed to support aligned allocation.
2. The compiler has actually turned the language feature on.

There are times where libc++ needs to distinguish between the two.

This patch adds the additional macro
_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION which denotes when case (1)
does not hold. _LIBCPP_HAS_NO_ALIGNED_ALLOCATION is defined whenever
_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION is defined, or when the
compiler has not enabled the language feature.

Additionally this patch cleans up a number of other macros related
to detection of aligned allocation machinery.

llvm-svn: 344207

5 years ago[MC][ELF] Fix section_mergeable_size.ll
Fangrui Song [Thu, 11 Oct 2018 00:08:59 +0000 (00:08 +0000)]
[MC][ELF] Fix section_mergeable_size.ll

Some targets use %progbits instead of @progbits.

Updating that check with a {{[@%]}}progbits regex to make those bots happy.

llvm-svn: 344206

5 years ago[WebAssembly] Saturating float-to-int builtins
Thomas Lively [Thu, 11 Oct 2018 00:07:55 +0000 (00:07 +0000)]
[WebAssembly] Saturating float-to-int builtins

Summary: Depends on D53007 and D53004.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits

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

llvm-svn: 344205

5 years ago[WebAssembly] Saturating float to int intrinsics
Thomas Lively [Thu, 11 Oct 2018 00:01:25 +0000 (00:01 +0000)]
[WebAssembly] Saturating float to int intrinsics

Summary:
Although the saturating float to int instructions are already
emitted from normal IR, the fpto{s,u}i instructions produce poison
values if the argument cannot fit in the result type. These intrinsics
are therefore necessary to get guaranteed defined saturating behavior.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 344204

5 years ago[hwasan] simplify a test
Kostya Serebryany [Wed, 10 Oct 2018 23:57:38 +0000 (23:57 +0000)]
[hwasan] simplify a test

llvm-svn: 344203

5 years agollvm-c: Add C APIs to access DebugLoc info
Saleem Abdulrasool [Wed, 10 Oct 2018 23:53:12 +0000 (23:53 +0000)]
llvm-c: Add C APIs to access DebugLoc info

Add thin shims to C interface to provide access to DebugLoc info for
Instructions, GlobalVariables and Functions.  Patch by Josh Berdine!

llvm-svn: 344202

5 years agoUpdate documentation to indicate that profile remapping support is only
Richard Smith [Wed, 10 Oct 2018 23:33:18 +0000 (23:33 +0000)]
Update documentation to indicate that profile remapping support is only
implemented for the new pass manager so far.

llvm-svn: 344201

5 years agoAdd a flag to remap manglings when reading profile data information.
Richard Smith [Wed, 10 Oct 2018 23:13:47 +0000 (23:13 +0000)]
Add a flag to remap manglings when reading profile data information.

This can be used to preserve profiling information across codebase
changes that have widespread impact on mangled names, but across which
most profiling data should still be usable. For example, when switching
from libstdc++ to libc++, or from the old libstdc++ ABI to the new ABI,
or even from a 32-bit to a 64-bit build.

The user can provide a remapping file specifying parts of mangled names
that should be treated as equivalent (eg, std::__1 should be treated as
equivalent to std::__cxx11), and profile data will be treated as
applying to a particular function if its name is equivalent to the name
of a function in the profile data under the provided equivalences. See
the documentation change for a description of how this is configured.

Remapping is supported for both sample-based profiling and instruction
profiling. We do not support remapping indirect branch target
information, but all other profile data should be remapped
appropriately.

Support is only added for the new pass manager. If someone wants to also
add support for this for the old pass manager, doing so should be
straightforward.

This is the LLVM side of Clang r344199.

Reviewers: davidxl, tejohnson, dlj, erik.pilkington

Subscribers: mehdi_amini, steven_wu, dexonsmith, llvm-commits

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

llvm-svn: 344200

5 years agoAdd a flag to remap manglings when reading profile data information.
Richard Smith [Wed, 10 Oct 2018 23:13:35 +0000 (23:13 +0000)]
Add a flag to remap manglings when reading profile data information.

This can be used to preserve profiling information across codebase
changes that have widespread impact on mangled names, but across which
most profiling data should still be usable. For example, when switching
from libstdc++ to libc++, or from the old libstdc++ ABI to the new ABI,
or even from a 32-bit to a 64-bit build.

The user can provide a remapping file specifying parts of mangled names
that should be treated as equivalent (eg, std::__1 should be treated as
equivalent to std::__cxx11), and profile data will be treated as
applying to a particular function if its name is equivalent to the name
of a function in the profile data under the provided equivalences. See
the documentation change for a description of how this is configured.

Remapping is supported for both sample-based profiling and instruction
profiling. We do not support remapping indirect branch target
information, but all other profile data should be remapped
appropriately.

Support is only added for the new pass manager. If someone wants to also
add support for this for the old pass manager, doing so should be
straightforward.

llvm-svn: 344199

5 years ago[LTO] Account for overriding lib calls via the alias attribute
Warren Ristow [Wed, 10 Oct 2018 22:54:31 +0000 (22:54 +0000)]
[LTO] Account for overriding lib calls via the alias attribute

Given a library call that is represented as an llvm intrinsic call, but
later transformed to an actual call, if an overriding definition of that
library routine is provided indirectly via an alias, prevent LTO from
eliminating the definition.

This is a fix for PR38547.

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

llvm-svn: 344198

5 years ago[MC][ELF] compute entity size for explicit sections
Nick Desaulniers [Wed, 10 Oct 2018 22:52:32 +0000 (22:52 +0000)]
[MC][ELF] compute entity size for explicit sections

Summary:
Global variables might declare themselves to be in explicit sections.
Calculate the entity size always to prevent assembler warnings
"entity size for SHF_MERGE not specified" when sections are to be
marked merge-able.

Fixes PR31828.

Reviewers: rnk, echristo

Reviewed By: rnk

Subscribers: llvm-commits, pirama, srhines

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

llvm-svn: 344197

5 years agoMake a member function private and rename it to avoid function overloading.
Rui Ueyama [Wed, 10 Oct 2018 22:49:29 +0000 (22:49 +0000)]
Make a member function private and rename it to avoid function overloading.

llvm-svn: 344196