Commit Graph

257500 Commits

Author SHA1 Message Date
Dean Michael Berris 4cb8e11884 [XRay][compiler-rt] Add missing include to <string>
Fixes a build break when using clang-3.9.1 (reported upstream,
post-commit review of D30850).

llvm-svn: 298039
2017-03-17 03:38:12 +00:00
Peter Collingbourne a3abce911a Fix the touch command to be Darwin-compatible.
llvm-svn: 298038
2017-03-17 02:44:23 +00:00
Dean Michael Berris edb0b93bad [XRay][compiler-rt] Add missing include for <functional>
Fixes http://llvm.org/PR32313

llvm-svn: 298037
2017-03-17 02:36:17 +00:00
Peter Collingbourne ee59e43f92 ELF: Add cache pruning support.
This patch causes us to use pruneCache() to prune the ThinLTO cache after
completing LTO. A new flag --thinlto-cache-policy allows users to configure
the policy.

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

llvm-svn: 298036
2017-03-17 02:24:16 +00:00
Peter Collingbourne 8713bf69b6 COFF: Strip /lldsavetemps from MSVC command line during /msvclto.
llvm-svn: 298035
2017-03-17 02:11:09 +00:00
Peter Collingbourne db7447deed COFF: Do not create empty temporary archives for /msvclto.
The MSVC linker doesn't support them.

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

llvm-svn: 298034
2017-03-17 02:04:22 +00:00
Peter Collingbourne a6ffbdd922 COFF: Fix use-after-free in /msvclto implementation.
The Archive object owns the memory buffers of any thin archive members, so we
need to make sure the object is still in scope when we access archive members.

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

llvm-svn: 298033
2017-03-17 02:03:20 +00:00
Kostya Serebryany 7acabdc497 [libFuzzer] inline the code of __sanitizer_cov_trace_pc_guard into it
llvm-svn: 298032
2017-03-17 01:45:15 +00:00
Kostya Serebryany f7e610eda1 [libFuzzer] Experimenting with dictionary minimization.
Summary:
Tracking issue: https://github.com/google/oss-fuzz/issues/331


Reviewers: kcc

Reviewed By: kcc

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

llvm-svn: 298031
2017-03-17 01:40:09 +00:00
Kostya Serebryany a52c8d0daf [libFuzzer] add a test with two different bugs
llvm-svn: 298030
2017-03-17 01:33:16 +00:00
Juergen Ributzka eecb0ec2ea Revert "[PowerPC] Fix sanitizer frame unwind on 32-bit ABIs"
This broke GreenDragon:
http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/29210/

llvm-svn: 298029
2017-03-17 01:15:39 +00:00
Sanjoy Das c4e4dcdf64 [RSForGC] Handle vector GEPs
We were not handling getelemenptr instructions of vector type before.
Since getelemenptr instructions for vector types follow the same rule as
getelementptr instructions for non-vector types, we can just handle them
in the same way.

llvm-svn: 298028
2017-03-17 00:55:53 +00:00
Argyrios Kyrtzidis c6c4ec8099 [Serialization] Follow-up to r297972, deserialize name/loc in separate statements to make sure they deserialize in defined order.
This should fix the windows bots.

llvm-svn: 298027
2017-03-17 00:49:42 +00:00
Zachary Turner 2d9c082033 Revert "Make NativeExeSymbol a concrete subclass of NativeRawSymbol [PDB]"
For some reason this is causing ANSI color codes to be printed
even when run through FileCheck.

llvm-svn: 298026
2017-03-17 00:46:42 +00:00
Matthias Braun f0b68d3fbc SplitKit: Correctly implement partial subregister copies
- This fixes a bug where subregister incompatible with the vregs register
  class where used.
- Implement the case where multiple copies are necessary to cover a
  given lanemask.

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

llvm-svn: 298025
2017-03-17 00:41:39 +00:00
Matthias Braun fa289ec7f0 VirtRegMap: Correctly deal with bundles when deleting identity copies.
This fixes two problems when VirtRegMap encounters bundles:

- When substituting a vreg subregister def with an actual register the
  internal read flag must be cleared.
- Removing an identity COPY from a bundle needs to use
  removeFromBundle() and a newly introduced function to update
  SlotIndexes.

No testcase here, because none of the in-tree targets trigger this,
however an upcoming commit of mine will need this and the testcase there
will trigger this.

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

llvm-svn: 298024
2017-03-17 00:41:33 +00:00
Eric Christopher 53da761570 Remove LessPreciseFPMADOption from TargetOptions along with all of the
associated command line options and functions - it's currently unused
in all of llvm and clang other than being set and reset.

llvm-svn: 298023
2017-03-17 00:38:03 +00:00
Eric Christopher 2be653f716 Remove setting LessPreciseFPMADOption on the TargetOption as it's
unused anywhere in llvm.

llvm-svn: 298022
2017-03-17 00:37:53 +00:00
Eli Friedman da228fee0c [ARM] Use alias analysis in ARMPreAllocLoadStoreOpt.
This allows the optimization to rearrange loads and stores more
aggressively. This doesn't really affect performance, but it helps
codesize.

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

llvm-svn: 298021
2017-03-17 00:34:26 +00:00
Peter Collingbourne 128423f99b LTO: Fix a potential race condition in the caching API.
After the call to sys::fs::exists succeeds, indicating a cache hit, we call
AddFile and the client will open the file using the supplied path. If the
client is using cache pruning, there is a potential race between the pruner
and the client. To avoid this, change the caching API so that it provides
a MemoryBuffer to the client, and have clients use that MemoryBuffer where
possible.

This scheme won't work with the gold plugin because the plugin API expects a
file path. So we have the gold plugin use the buffer identifier as a path and
live with the race for now. (Note that the gold plugin isn't actually affected
by the problem at the moment because it doesn't support cache pruning.)

This effectively reverts r279883 modulo the change to use the existing path
in the gold plugin.

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

llvm-svn: 298020
2017-03-17 00:34:07 +00:00
Zachary Turner 3735006063 SmallString doesn't have implicit conversion from const char*.
llvm-svn: 298019
2017-03-17 00:28:23 +00:00
Zachary Turner 8fb09e3ea7 Don't rely on an implicit std::tuple constructor.
Apparently it doesn't have one, so using an initializer list
doesn't work correctly.

llvm-svn: 298018
2017-03-17 00:16:21 +00:00
Zachary Turner 2ed2aa75bf [pdb] Fix an uninitialized read, and add a test for it.
This was originally reported in pr32249, uncovered by PTVS-Studio.
There was no code coverage for this path because it was
difficult to construct odd-case PDB files that were not generated
by cl.

Now that we can write construct minimal PDB files from YAML,
it's easy to construct fragments that generate whatever we want.

In this patch I add a test that creates 2 type records.  One
with a unique name, and one without.  I verify that we can go
from PDB to Yaml with no errors.  In a future patch I'd like
to add something like llvm-pdbdump raw -lookup-type that will
just dump one record and nothing else, which should make it
a bit cleaner to find this kind of thing.

llvm-svn: 298017
2017-03-17 00:15:55 +00:00
Zachary Turner 42cb87f401 [PDB] It is not an error getting the "Invalid" Annotation opcode.
The linker can insert invalid opcodes to indicate padding
bytes, and we should not fail in this case.

llvm-svn: 298016
2017-03-17 00:15:27 +00:00
Jacques Pienaar da9352c173 clean Lanai namespace
Summary: This patch cleans the namespace of the Lanai target.

Reviewers: jpienaar

Reviewed By: jpienaar

Subscribers: llvm-commits

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

llvm-svn: 298015
2017-03-16 23:22:10 +00:00
Zachary Turner 78d15af1fa Fix unit test.
llvm-svn: 298014
2017-03-16 23:19:40 +00:00
Bruno Cardoso Lopes ae1249e4f2 [Headers] Reapply: Add #include_next for tgmath.h on Darwin
Reapply r289181 but rename the include guard to avoid
conflict with the one from Darwin.

Allow darwin to provide additional definitions and implementation
specifc values for tgmath.h on Apple platforms.

rdar://problem/19019845

llvm-svn: 298013
2017-03-16 23:19:00 +00:00
Bruno Cardoso Lopes 448d4289b0 [Modules] Add documentation on private frameworks
Expand a bit on private modules with some guidance on how to write
them in the context of frameworks.

rdar://problem/24758771

llvm-svn: 298012
2017-03-16 23:18:55 +00:00
Reid Kleckner 20670ba52c Update for LLVM API removal of Function::getArgumentList()
llvm-svn: 298011
2017-03-16 23:13:49 +00:00
Reid Kleckner 45707d4d5a Remove getArgumentList() in favor of arg_begin(), args(), etc
Users often call getArgumentList().size(), which is a linear way to get
the number of function arguments. arg_size(), on the other hand, is
constant time.

In general, the fact that arguments are stored in an iplist is an
implementation detail, so I've removed it from the Function interface
and moved all other users to the argument container APIs (arg_begin(),
arg_end(), args(), arg_size()).

Reviewed By: chandlerc

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

llvm-svn: 298010
2017-03-16 22:59:15 +00:00
Reid Kleckner c9a392b9dd Remove dead F parameter from Argument constructor
When Function creates its argument list, it does the ilist push_back
itself. No other caller passes in a parent function, so this is dead,
and it uses the soon-to-be-deleted getArgumentList accessor.

llvm-svn: 298009
2017-03-16 22:58:56 +00:00
Kuba Mracek 720883520d Fix macOS version detection to also allow missing 3rd part of the version number.
llvm-svn: 298008
2017-03-16 22:35:34 +00:00
Zachary Turner 1875334f32 Fix linux build.
llvm-svn: 298007
2017-03-16 22:34:18 +00:00
Eric Christopher dec1b92ccc Add a small test for __STRUCT_PARM_ALIGN__ for ppc64 darwin.
llvm-svn: 298006
2017-03-16 22:31:07 +00:00
Adrian McCarthy 21b54cf632 Make NativeExeSymbol a concrete subclass of NativeRawSymbol [PDB]
This moves exe symbol-specific method implementations out of NativeRawSymbol
into a concrete subclass. Also adds implementations for hasCTypes and
hasPrivateSymbols and a simple test to ensure the native reader can access
the summary information for the executable from the PDB.

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

llvm-svn: 298005
2017-03-16 22:28:39 +00:00
Zachary Turner 5c5091fcb7 [Support] Support both Windows and Posix paths on both platforms.
Previously which path syntax we supported dependend on what
platform we were compiling LLVM on.  While this is normally
desirable, there are situations where we need to be able to
handle a path that we know was generated on a remote host.
Remote debugging, for example, or parsing debug info.

99% of the code in LLVM for handling paths was platform
agnostic and literally just a few branches were gated behind
pre-processor checks, so this changes those sites to use
runtime checks instead, and adds a flag to every path
API that allows one to override the host native syntax.

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

llvm-svn: 298004
2017-03-16 22:28:04 +00:00
Reid Kleckner eb54909c8c Make Argument::getArgNo() constant time, not O(#args)
getArgNo is actually hot in LLVM, because its how we check for
attributes on arguments:
  bool Argument::hasNonNullAttr() const {
    if (!getType()->isPointerTy()) return false;
    if (getParent()->getAttributes().
          hasAttribute(getArgNo()+1, Attribute::NonNull))
      return true;

It actually shows up as the 23rd hottest leaf function in a 13s sample
of LTO of llc.

This grows Argument by four bytes, but I have another pending patch to
shrink it by removing its ilist_node base.

Reviewed By: chandlerc

Subscribers: inglorion, llvm-commits, mehdi_amini

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

llvm-svn: 298003
2017-03-16 22:25:45 +00:00
Zachary Turner 93afe18fbd Remove eol-style:native from Path.h
llvm-svn: 298002
2017-03-16 22:24:19 +00:00
Rui Ueyama 98e55de699 Revert r297850: [ELF] - Linkerscript: make Dot public and remove getDot(). NFC.
This reverts commit r297850 because this change was made
based on a miscommunication.

llvm-svn: 298001
2017-03-16 21:50:30 +00:00
Kyle Butt d609d6ebf0 CodeGen: BlockPlacement: Adjust test case so it covers rL297925. NFC
I had ajusted the test case before when testing a chain of length 2, and then
reverted it with rL296845 when I switched to 3 triangles. After running
benchmarks and examining generated code at length 2 I forgot to put the test
back.

llvm-svn: 298000
2017-03-16 21:33:29 +00:00
Tobias Grosser f4fe34bfb8 Update to isl-0.18-387-g3fa6191
This is a normal / regular maintenance update.

llvm-svn: 297999
2017-03-16 21:33:20 +00:00
Reid Kleckner a902600881 Create msbuild only when using MSVC
Patch by: Mateusz Mikula

Reviewers: rnk

Reviewed By: rnk

Subscribers: asl, mgorny, cfe-commits

Tags: #clang-c

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

llvm-svn: 297998
2017-03-16 21:21:00 +00:00
Rui Ueyama e1bf1365d7 Do not pass archive files containing non-native object files.
The MSVC linker doesn't like archive files containing non-native object
files.

When we are doing an LTO build, we may create archive files containing
both LLVM bitcode files and native object files. For example, if a
project contains assembly files and C++ files, we create native object
files for the assembly files and LLVM bitcode files for the C++ files.

With the /msvclto option, LLD passes archive files to the MSVC linker.
Previously, we didn't pass archive files if they contain at least one
bitcode files. That wasn't correct because the native object files that
weren't passed to the MSVC linker may be needed to complete linking.

In this patch, we create new temporary archive files to strip bitcode
files.

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

llvm-svn: 297997
2017-03-16 21:19:36 +00:00
Rong Xu 60faea19f8 Resubmit r297897: [PGO] Value profile for size of memory intrinsic calls
R297897 inadvertently enabled annotation for memop profiling. This new patch
fixed it.

llvm-svn: 297996
2017-03-16 21:15:48 +00:00
Bill Seurer 6c0f69da68 [PowerPC] Fix sanitizer frame unwind on 32-bit ABIs
This fixes many sanitizer problems with -m32.  It is really intended
for gcc but patches to the sanitizers make their way through llvm
first.

ref:  https://gcc.gnu.org/ml/gcc-patches/2017-02/msg00855.html
llvm-svn: 297995
2017-03-16 21:14:13 +00:00
Adrian Prantl 47ea6478ed Salvage debug info from instructions about to be deleted
[Reapplies r297971 and punting on finding a better API for findDbgValues()]

This patch improves debug info quality in InstCombine by looking at
values that are about to be deleted, checking whether there are any
dbg.value instrinsics referring to them, and potentially encoding the
semantics of the deleted instruction into the dbg.value's
DIExpression.

In the example in the testcase (which was extracted from XNU) there is a sequence of

 %4 = load %struct.entry*, %struct.entry** %next2, align 8, !dbg !41
 %5 = bitcast %struct.entry* %4 to i8*, !dbg !42
 %add.ptr4 = getelementptr inbounds i8, i8* %5, i64 -8, !dbg !43
 %6 = bitcast i8* %add.ptr4 to %struct.entry*, !dbg !44
 call void @llvm.dbg.value(metadata %struct.entry* %6, i64 0, metadata !20, metadata !21), !dbg 34

When these instructions are eliminated by instcombine one after
another, we can still salvage the otherwise dead debug info:

- Bitcasts have no effect, so have the dbg.value point to operand(0)
- Loads can be expressed via a DW_OP_deref
- Constant gep instructions can be replaced by DWARF expression arithmetic

The API introduced by this patch is not specific to instcombine and
can be useful in other places, too.

rdar://problem/30725338

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

llvm-svn: 297994
2017-03-16 21:14:09 +00:00
Michael Kuperstein 2da2bfa088 [LoopUnroll] Don't peel loops where the latch isn't the exiting block
Peeling assumed this doesn't happen, but didn't check it.
This fixes PR32178.

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

llvm-svn: 297993
2017-03-16 21:07:48 +00:00
Michael Zolotukhin 99de88d1f3 [SCEV] Compute affine range in another way to avoid bitwidth extending.
Summary:
This approach has two major advantages over the existing one:
1. We don't need to extend bitwidth in our computations. Extending
bitwidth is a big issue for compile time as we often end up working with
APInts wider than 64bit, which is a slow case for APInt.
2. When we zero extend a wrapped range, we lose some information (we
replace the range with [0, 1 << src bit width)). Thus, avoiding such
extensions better preserves information.

Correctness testing:
I ran 'ninja check' with assertions that the new implementation of
getRangeForAffineAR gives the same results as the old one (this
functionality is not present in this patch). There were several failures
- I inspected them manually and found out that they all are caused by
the fact that we're returning more accurate results now (see bullet (2)
above).
Without such assertions 'ninja check' works just fine, as well as
SPEC2006.

Compile time testing:
CTMark/Os:
 - mafft/pairlocalalign	-16.98%
 - tramp3d-v4/tramp3d-v4	-12.72%
 - lencod/lencod	-11.51%
 - Bullet/bullet	-4.36%
 - ClamAV/clamscan	-3.66%
 - 7zip/7zip-benchmark	-3.19%
 - sqlite3/sqlite3	-2.95%
 - SPASS/SPASS	-2.74%
 - Average	-5.81%

Performance testing:
The changes are expected to be neutral for runtime performance.

Reviewers: sanjoy, atrick, pete

Subscribers: llvm-commits

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

llvm-svn: 297992
2017-03-16 21:07:38 +00:00
Derek Schuff b879539aac [WebAssembly] Fix some broken type encodings in wasm binary
A recent change switch the in-memory wasm value types
to be signed integers, but I missing a few cases where
these were being writing to the binary.

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

Patch by Sam Clegg

llvm-svn: 297991
2017-03-16 20:49:48 +00:00
Zachary Turner c9500616d8 Silence -Wcovered-switch-default warning.
llvm-svn: 297990
2017-03-16 20:45:11 +00:00