Commit Graph

232144 Commits

Author SHA1 Message Date
Steven Wu ec6f56eb39 Revert "[CMake] LINK_LIBS need to be public for Darwin dylib targets"
This reverts r270723. This commit breaks greendragon.

llvm-svn: 270820
2016-05-26 04:35:35 +00:00
Craig Topper a423aa4642 [X86] Add the AVX storeu intrinsics to InstCombine and LoopStrengthReduce in the same places that the SSE/SSE2 storeu intrinsics appear.
I don't really know how to test this. Just seemed like we should be consistent.

llvm-svn: 270819
2016-05-26 04:28:45 +00:00
Jason Molenda 0bc8994a4c Small further refinement to the check in ObjectFileMachO::ParseSymtab
which looks for binaries missing an LC_FUNCTION_STARTS section because
it was stripped/not emitted.  If we see a normal user process binary
(executable, dylib, framework, bundle) without LC_FUNCTION_STARTS, that
is unusual and we should disallow instruction emulation because that
binary has likely been stripped a lot.

If this is a non-user process binary -- a kernel, a standalone bare-board
binary, a kernel extension (kext) -- and there is no LC_FUNCTION_STARTS,
we should not assume anything about the binary and allow instruction
emulation as we would normally do.

<rdar://problem/26453952> 

llvm-svn: 270818
2016-05-26 04:22:47 +00:00
Akira Hatanaka d1af08c3d6 Don't feed standard error to FileCheck.
This is an attempt to fix the buildbot that started failing after
r270808.

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/13141 

llvm-svn: 270817
2016-05-26 02:32:10 +00:00
Saleem Abdulrasool 18ef564c8b libc++abi: build with -fvisibility=hidden
Enable building libc++abi with hidden visibility by default.  The ABI mandated
interfaces (and a few extra) are already set up to be externally visible.  This
allows us to ensure that any implementation details are not leaked.

llvm-svn: 270816
2016-05-26 02:12:20 +00:00
Sanjoy Das ee77a4828e [IRCE] Use C++11 style initializers; NFC
llvm-svn: 270815
2016-05-26 01:50:18 +00:00
Teresa Johnson 683abe79b2 [ThinLTO/gold] Handle bitcode archives
Summary:
Several changes were required for ThinLTO links involving bitcode
archive static libraries. With this patch clang/llvm bootstraps with
ThinLTO and gold.

The first is that the gold callbacks get_input_file and
release_input_file can normally be used to get file information for
each constituent bitcode file within an archive. However, these
interfaces lock the underlying file and can't be for each archive
constituent for ThinLTO backends where we get all the input files up
front and don't release any until after the backend threads complete.
However, it is sufficient to only get and release once per file, and
then each consituent bitcode file can be accessed via get_view. This
required saving some information to identify which file handle is the
"leader" for each claimed file sharing the same file descriptor, and
other information so that get_input_file isn't necessary later when
processing the backends.

Second, the module paths in the index need to distinguish between
different constituent bitcode files within the same archive file,
otherwise they will all end up with the same archive file path.
Do this by appending the offset within the archive for the start of the
bitcode file, returned by get_input_file when we claim each bitcode file,
and saving that along with the file handle.

Third, rather than have the function importer try to load a file based
on the module path identifier (which now contains a suffix to
distinguish different bitcode files within an archive), use a custom
module loader. This is the same approach taken in libLTO, and I am using
the support refactored into the new LTO.h header in r270509. The module
loader parses the bitcode files out of the memory buffers returned from
gold via the get_view callback and saved in a map. This also means that
we call the function importer directly, rather than add it to the pass
pipeline (which was in the plan to do already for other reasons).

Reviewers: pcc, joker.eph

Subscribers: llvm-commits, joker.eph

Differential Revision: http://reviews.llvm.org/D20559

llvm-svn: 270814
2016-05-26 01:46:41 +00:00
Saleem Abdulrasool fbf920f9b4 llvm-objdump: support dumping AUX records for weak externals
This is a support COFF feature.  Ensure that we can display the weak externals
auxiliary symbol.  It contains useful information (such as the default binding
and how to resolve the symbol).

This reapplies the previous patch with a modification which hopefully should fix
the endianness issues.  The variadic call would promote the ulittle32_t to a
uint32_t which would lose the byte-swapping behaviour desired.

llvm-svn: 270813
2016-05-26 01:45:12 +00:00
Peter Collingbourne ffecb1441b MemorySSA: Remove argument to createNewAccess function.
There is only one caller of MemorySSA::createNewAccess, and it passes true
as the IgnoreNonMemory argument. Remove that argument and fold its behavior
into createNewAccess.

llvm-svn: 270812
2016-05-26 01:19:17 +00:00
Peter Collingbourne 7c10dd1411 MemorySSA: Fix example in header comment.
This fixes the example so that it matches the pass's behavior. I was a
little confused by the example until I tried running it and realized that
there was a mistake.

Differential Revision: http://reviews.llvm.org/D20657

llvm-svn: 270811
2016-05-26 01:19:14 +00:00
Lang Hames be84d2beee [Kaleidoscope][BuildingAJIT] Add a stub Chapter 2 doc.
llvm-svn: 270809
2016-05-26 00:38:04 +00:00
Akira Hatanaka de6f25f6a3 [ObjC] Remove _Atomic from return type and parameter type of
objective-c properties.

This fixes an assert in CodeGen that fires when the getter and setter
functions for an objective-c property of type _Atomic(_Bool) are
synthesized.

rdar://problem/26322972

Differential Revision: http://reviews.llvm.org/D20407

llvm-svn: 270808
2016-05-26 00:37:30 +00:00
Lang Hames deb27681d7 [Kaleidoscope][BuildingAJIT] Make the optimizeModule method for Chapter2
private.

llvm-svn: 270807
2016-05-26 00:24:18 +00:00
David Blaikie 2274808153 PR11740: Disable assembly debug info when assembly already contains line directives
If there is already debug info in the assembly file, and user hope to
use -g option for compiling, we think we should not directly report an
error.

According to what GNU assembler did, it just reused the debug info in
the assembly file, and turned off the DEBUG_TYPE option so that there
will be no new debug info emitted by assembler. This fix is just as what
GNU assembler did.

The concern is the situation that there are two .text sections in the
assembly file, one with debug info and the other one without. Currently
with this fix, the assembler will no longer generate any debug info for
the second .text section. And this is what GNU assembler exactly did for
this situation. So I think this still make some sense.

Patch by Zhizhou Yang!

Differential Revision: http://reviews.llvm.org/D20002

llvm-svn: 270806
2016-05-26 00:22:26 +00:00
Sanjoy Das a099268e85 [IRCE] Optimize conjunctions of range checks
After this change, we do the expected thing for cases like

```
Check0Passed = /* range check IRCE can optimize */
Check1Passed = /* range check IRCE can optimize */
if (!(Check0Passed && Check1Passed))
  throw_Exception();
```

llvm-svn: 270804
2016-05-26 00:09:02 +00:00
Greg Clayton a61d0a5b01 Make sure to try and take the process stop lock when calling:
uint32_t SBProcess::GetNumQueues();
SBQueue SBProcess::GetQueueAtIndex (size_t index);

Otherwise this code will run when the process is running and cause problems.

<rdar://problem/26482744>

llvm-svn: 270803
2016-05-26 00:08:39 +00:00
Sanjoy Das 8fe8892c2d [IRCE] Refactor out a parseRangeCheckFromCond; NFC
This will later hold more general logic to parse conjunctions of range
checks.

llvm-svn: 270802
2016-05-26 00:08:24 +00:00
Hal Finkel 678635e010 Fix columns for member function calls
After r270775, Clang is smarter about the generating the locations for
member-function calls. Update some ubsan tests accordingly.

llvm-svn: 270801
2016-05-25 23:47:34 +00:00
Davide Italiano e3cc8b314d [PM/PartiallyInlineLibCalls] Commit missing header.
This should have been committed with the previous commit, but
I forgot to `git add`. Sorry.

llvm-svn: 270800
2016-05-25 23:44:01 +00:00
Lang Hames 9ed5f00026 [KaleidoscopeJIT][BuildingAJIT] Remove some copy-pasta from Chapter 1.
This text was accidentally left in when the original document was copied from
Chapter 7 of the Kaleidoscope language series.

llvm-svn: 270799
2016-05-25 23:42:48 +00:00
Davide Italiano 1021c68e92 [PM] Port PartiallyInlineLibCalls to the new pass manager.
llvm-svn: 270798
2016-05-25 23:38:53 +00:00
David Blaikie 1fc3e6bda2 llvm-dwp: Ensure uncompressed sections are not relocated during processing of later inputs
Richard Smith identified this in post commit review of r270466. The
string sections in particular (in the future, possibly all sections - so
I'm not going to bother pulling out just the string sections for the
extra lifetime handling right now) need to remain valid during
processing of all inputs so that elements of the DWPStringPool can be
looked up repeatedly without having to make in-memory copies of string
contents in the noncompressed case (more common in dwp+dwp merge steps
where the memory is a bigger problem because the files are larger).

Using the SmallVector (or any vector) a reallocation on push_back could
cause any of the nested SmallStrings in small mode to move in memory and
invalid pointers to their contents. Using a deque the SmallStrings will
never move around since no elements are removed from the container.

llvm-svn: 270797
2016-05-25 23:37:06 +00:00
Lang Hames 9d4ea6df8b [Kaleidoscope][BuildingAJIT] Shorten the name of the BuildingAJIT tutorial
series.

The original name was pretty long, and likely to look awkward as more
chapters get added.

llvm-svn: 270796
2016-05-25 23:34:19 +00:00
Reid Kleckner 63d3d6df7d Revert "[MC] Support symbolic expressions in assembly directives"
This reverts commit r270786, it causes the directive_fill.s to fail.

llvm-svn: 270795
2016-05-25 23:29:08 +00:00
Lang Hames 684ec17cd9 [Kaleidoscope][BuildingAJIT] Add code for the 2nd chapter of the BuildingAJIT
tutorial.

llvm-svn: 270794
2016-05-25 23:25:23 +00:00
Enrico Granata fee0aba006 It has been brought to my attention that, given two variables
T x;
U y;

doing

x = *((T*)y)

is undefined behavior, even if sizeof(T) == sizeof(U), due to pointer aliasing rules

Fix up a couple of places in LLDB that were doing this, and transform them into a defined and safe memcpy() operation

Also, add a test case to ensure we didn't regress by doing this w.r.t. tagged pointer NSDate instances

llvm-svn: 270793
2016-05-25 23:19:01 +00:00
Reid Kleckner 5d122f872d [codeview] Use comdats for debug info describing comdat functions
Summary:
This allows the linker to discard unused symbol information for comdat
functions that were discarded during the link. Before this change,
searching for the name of an inline function in the debugger would
return multiple results, one per symbol subsection in the object file.
After this change, there is only one result, the result for the function
chosen by the linker.

Reviewers: zturner, majnemer

Subscribers: aaboud, amccarth, llvm-commits

Differential Revision: http://reviews.llvm.org/D20642

llvm-svn: 270792
2016-05-25 23:16:12 +00:00
Manman Ren b5d7ff4fa3 Objective-C Class Properties: Autoupgrade "Class Properties" module flag.
When we have "Image Info Version" module flag but don't have "Class Properties"
module flag, set "Class Properties" module flag to 0, so we can correctly emit
errors when one module has the flag set and another module does not.

rdar://26469641

llvm-svn: 270791
2016-05-25 23:14:48 +00:00
Justin Lebar fea8a8d70a [NVPTX] Don't (incorrectly) say that the NVVMReflect pass preserves all analyses.
Reviewers: tra

Subscribers: jholewinski, llvm-commits

Differential Revision: http://reviews.llvm.org/D20585

llvm-svn: 270790
2016-05-25 23:12:38 +00:00
Justin Lebar b649e75593 [CUDA] Add section to docs about controlling fp optimizations.
Reviewers: rnk

Subscribers: llvm-commits, tra

Differential Revision: http://reviews.llvm.org/D20494

llvm-svn: 270789
2016-05-25 23:11:31 +00:00
Eric Christopher 42de80ea79 Remove unused header.
llvm-svn: 270788
2016-05-25 22:56:58 +00:00
Lang Hames 1469f7f4a7 [Kaleidoscope][BuildingAJIT] Delete trailing whitespace.
llvm-svn: 270787
2016-05-25 22:48:43 +00:00
Petr Hosek e25837528b [MC] Support symbolic expressions in assembly directives
This matches the behavior of GNU assembler which supports symbolic
expressions in absolute expressions used in assembly directives.

Differential Revision: http://reviews.llvm.org/D20337

llvm-svn: 270786
2016-05-25 22:47:51 +00:00
Rafael Espindola 6b93bf5783 Don't repeat name in comment and git-clang-format.
llvm-svn: 270785
2016-05-25 22:44:06 +00:00
George Burgess IV a145e25431 [Sema] Use the failure bits introduced by r270781.
r270781 introduced the ability to track whether or not we might have
had unmodeled side-effects during constant expression evaluation. This
patch makes the constexpr evaluator use that tracking.

Reviewed as a part of D18540.

llvm-svn: 270784
2016-05-25 22:38:36 +00:00
Adrian Prantl 00698731ed Work around an MSVC compiler issue in r270776.
llvm-svn: 270783
2016-05-25 22:37:29 +00:00
Lang Hames 59a5ad8f6a [Kaleidoscope][BuildingAJIT] Fix code-block indents.
llvm-svn: 270782
2016-05-25 22:33:25 +00:00
George Burgess IV 8c892b556f [Sema] Note when we encounter a problem in ExprConstant.
Currently, the constexpr evaluator is very conservative about unmodeled
side-effects when we're evaluating an expression in a mode that allows
such side-effects.

This patch makes us note when we might have actually encountered an
unmodeled side-effect, which allows us to be more accurate when we know
an unmodeled side-effect couldn't have occurred.

This patch has been split into two commits; this one primarily
introduces the bits necessary to track whether we might have potentially
hit such a side-effect. The one that actually does the tracking (which
boils down to more or less a rename of keepEvaluatingAfterFailure to
noteFailure) is coming soon.

Differential Revision: http://reviews.llvm.org/D18540

llvm-svn: 270781
2016-05-25 22:31:54 +00:00
Omair Javaid 1b356bf898 Mark some aarch64-linux specific xfails marking bug entries
TestBSDArchives.py and TestWatchLocation.py fail due to unicode error and bug has already been reported for arm and macOSx.

TestConstVariables.py fails because lldb cant figure out frame variable type when used in expr.

llvm-svn: 270780
2016-05-25 22:30:05 +00:00
Davide Italiano bd543d0a0b [LazyValueInfo] Simplify `return after else`. NFCI.
llvm-svn: 270779
2016-05-25 22:29:34 +00:00
Lang Hames e0fc5aef18 [Kaleidoscope][BuildingAJIT] Add a description of the KaleidoscopeJIT addModule
method to Chapter1 of the BuildingAJIT tutorial.

llvm-svn: 270778
2016-05-25 22:27:25 +00:00
Michael Kuperstein 82069c44ca [BasicAA] Improve precision of alloca vs. inbounds GEP alias queries
If a we have (a) a GEP and (b) a pointer based on an alloca, and the
beginning of the object the GEP points would have a negative offset with
repsect to the alloca, then the GEP can not alias pointer (b).

For example, consider code like:

struct { int f0, int f1, ...} foo;
...
foo alloca;
foo *random = bar(alloca);
int *f0 = &alloca.f0
int *f1 = &random->f1;

Which is lowered, approximately, to:
%alloca = alloca %struct.foo
%random = call %struct.foo* @random(%struct.foo* %alloca)
%f0 = getelementptr inbounds %struct, %struct.foo* %alloca, i32 0, i32 0
%f1 = getelementptr inbounds %struct, %struct.foo* %random, i32 0, i32 1

Assume %f1 and %f0 alias. Then %f1 would point into the object allocated
by %alloca. Since the %f1 GEP is inbounds, that means %random must also
point into the same object. But since %f0 points to the beginning of %alloca,
the highest %f1 can be is (%alloca + 3). This means %random can not be higher
than (%alloca - 1), and so is not inbounds, a contradiction.

Differential Revision: http://reviews.llvm.org/D20495

llvm-svn: 270777
2016-05-25 22:23:08 +00:00
Adrian Prantl 6ee02c7fce PR26055: Speed up LiveDebugValues by replacing lists with bitvectors.
This patch modifies the LiveDebugValues pass to use more efficient set
data structures as outlined in PR26055. Both VarLocSet and VarLocList are
now SparseBitVectors which allows us to perform much faster bitvector
arithmetic on them.

The speedup can be in the order of minutes especially on ASANified code.

The change is not NFC in the assembler output because the inserted
DBG_VALUEs are now sorted by variable and location.

Many thanks to Daniel Berlin for helping design the improved algorithm and
reviewing the patch.

https://llvm.org/bugs/show_bug.cgi?id=26055
http://reviews.llvm.org/D20178
rdar://problem/24091200

llvm-svn: 270776
2016-05-25 22:21:12 +00:00
Hal Finkel ec264b2935 [CGDebugInfo] Modify the preferred expression location for member calls.
If the callee has a valid location (not all do), then use that. Otherwise, fall
back to the starting location. This makes sure that the debug info for calls
points to the call (not the start of the expression providing the object on
which the member function is being called).

For example, given this:

  f->foo()->bar();

we don't want both calls to point to the 'f', but rather to the 'foo()' and
the 'bar()'.

Fixes PR27567.

Differential Revision: http://reviews.llvm.org/D19708

llvm-svn: 270775
2016-05-25 22:08:27 +00:00
Richard Smith c0d04a2567 Fix rejects-valid on constexpr function that accesses a not-yet-defined 'extern
const' variable. That variable might be defined as 'constexpr', so we cannot
prove that a use of it could never be a constant expression.

llvm-svn: 270774
2016-05-25 22:06:25 +00:00
Chad Rosier dca7651d59 [MBB] Early exit to reduce indentation, per coding guidelines. NFC.
llvm-svn: 270773
2016-05-25 21:53:46 +00:00
Hal Finkel c07e19b2c1 Add a loop's debug location to its llvm.loop metadata
Getting accurate locations for loops is important, because those locations are
used by the frontend to generate optimization remarks. Currently, optimization
remarks for loops often appear on the wrong line, often the first line of the
loop body instead of the loop itself. This is confusing because that line might
itself be another loop, or might be somewhere else completely if the body was
an inlined function call. This happens because of the way we find the loop's
starting location. First, we look for a preheader, and if we find one, and its
terminator has a debug location, then we use that. Otherwise, we look for a
location on an instruction in the loop header.

The fallback heuristic is not bad, but will almost always find the beginning of
the body, and not the loop statement itself. The preheader location search
often fails because there's often not a preheader, and even when there is a
preheader, depending on how it was formed, it sometimes carries the location of
some preceeding code.

I don't see any good theoretical way to fix this problem. On the other hand,
this seems like a straightforward solution: Put the debug location in the
loop's llvm.loop metadata. When emitting debug information, this commit causes
us to add the debug location as an operand to each loop's llvm.loop metadata.
Thus, we now generate this metadata for all loops (not just loops with
optimization hints) when we're otherwise generating debug information.

The remark test case changes depend on the companion LLVM commit r270771.

llvm-svn: 270772
2016-05-25 21:53:24 +00:00
Hal Finkel 2f6886844e Look for a loop's starting location in the llvm.loop metadata
Getting accurate locations for loops is important, because those locations are
used by the frontend to generate optimization remarks. Currently, optimization
remarks for loops often appear on the wrong line, often the first line of the
loop body instead of the loop itself. This is confusing because that line might
itself be another loop, or might be somewhere else completely if the body was
inlined function call. This happens because of the way we find the loop's
starting location. First, we look for a preheader, and if we find one, and its
terminator has a debug location, then we use that. Otherwise, we look for a
location on an instruction in the loop header.

The fallback heuristic is not bad, but will almost always find the beginning of
the body, and not the loop statement itself. The preheader location search
often fails because there's often not a preheader, and even when there is a
preheader, depending on how it was formed, it sometimes carries the location of
some preceeding code.

I don't see any good theoretical way to fix this problem. On the other hand,
this seems like a straightforward solution: Put the debug location in the
loop's llvm.loop metadata. A companion Clang patch will cause Clang to insert
llvm.loop metadata with appropriate locations when generating debugging
information. With these changes, our loop remarks have much more accurate
locations.

Differential Revision: http://reviews.llvm.org/D19738

llvm-svn: 270771
2016-05-25 21:42:37 +00:00
Enrico Granata acfe8fadaa Add logging to ValueObjectSyntheticFilter such that one can trace through the creation of synthetic children
llvm-svn: 270770
2016-05-25 21:38:32 +00:00
Rafael Espindola 6b4baa5f58 Sort includes.
llvm-svn: 270769
2016-05-25 21:37:29 +00:00