Commit Graph

214119 Commits

Author SHA1 Message Date
Evgeniy Stepanov 1a1973b846 [msan] Fix process_vm_readv test.
The check for the glibc version was not working as expected (dlsym
was finding the interceptor instead of the libc implementation).

llvm-svn: 251345
2015-10-26 20:55:35 +00:00
Diego Novillo e822b63681 Remove unused local variable. NFC.
llvm-svn: 251344
2015-10-26 20:50:26 +00:00
Peter Collingbourne 56fff8d394 Fix tests.
llvm-svn: 251343
2015-10-26 20:49:49 +00:00
Peter Collingbourne 99fac80db2 ARM/ELF: Restore original (pre-r251322) logic for deciding whether to use GOT.
Unbreaks linking with gold, which cannot resolve direct relocations referring
to global symbols.

llvm-svn: 251342
2015-10-26 20:46:44 +00:00
Tobias Grosser 3e9560200f RegionGenerator: Clear local maps after statement construction
These maps are only needed during the construction of a single region statement.
Clearing them is important, as we otherwise get an assert in case some of the
referenced values are erased before the RegionGenerator is deleted.

llvm-svn: 251341
2015-10-26 20:41:53 +00:00
Sean Callanan df0ac7038f Clang module compilation options need to be per-platform.
On UNIX (but not Darwin) the username needs to be respected when creating a 
temporary module directory, so that different users don't pollute each others'
module caches.

llvm-svn: 251340
2015-10-26 20:33:24 +00:00
Alexey Samsonov f3ecfd3af4 [LLVMSymbolize] Use symbol table only if function linkage name was requested.
Now it's enough to just specify -functions=short without additionally
providing -use-symbol-table=false.

llvm-svn: 251339
2015-10-26 20:12:29 +00:00
Alexey Samsonov 1d3f3271ac Fix build error by fully qualifying llvm::make_unique.
llvm-svn: 251338
2015-10-26 20:12:27 +00:00
Rui Ueyama df94852a60 Optimize StringTableBuilder.
This is a patch to improve StringTableBuilder's performance. That class'
finalize function is very hot particularly in LLD because the function
does tail-merge strings in string tables or SHF_MERGE sections.

Generic std::sort-style sorter is not efficient for sorting strings.
The function implemented in this patch seems to be more efficient.

Here's a benchmark of LLD to link Clang with or without this patch.
The numbers are medians of 50 runs.

-O0
real 0m0.455s
real 0m0.430s (5.5% faster)

-O3
real 0m0.487s
real 0m0.452s (7.2% faster)

Since that is a benchmark of the whole linker, the speedup of
StringTableBuilder itself is much more than that.

http://reviews.llvm.org/D14053

llvm-svn: 251337
2015-10-26 19:58:29 +00:00
Alexey Samsonov 7a952e53f9 [LLVMSymbolize] Use std::unique_ptr more extensively to clarify ownership.
llvm-svn: 251336
2015-10-26 19:41:23 +00:00
Ismail Pazarbasi 7ff1836471 MismatchingNewDeleteDetector uses incorrect field, and finds no initializer
Summary:
In `MismatchingNewDeleteDetector::analyzeInClassInitializer`, if
`Field`'s initializer expression is null, lookup the field in
implicit instantiation, and use found field's the initializer.

Reviewers: rsmith, rtrieu

Subscribers: cfe-commits

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

llvm-svn: 251335
2015-10-26 19:20:24 +00:00
Eric Fiselier 4630f63a64 Fix test suite configuration. Sorry Marshall
llvm-svn: 251334
2015-10-26 19:08:53 +00:00
Igor Laevsky 1ef06559f4 [RS4GC] Strip noalias attribute after statepoint rewrite
We should remove noalias along with dereference and dereference_or_null attributes 
because statepoint could potentially touch the entire heap including noalias objects.

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

llvm-svn: 251333
2015-10-26 19:06:01 +00:00
Rui Ueyama 0b2b964797 ELF2: Ignore -( and -).
They are aliases to --start-group and --end-group, respectively.

llvm-svn: 251332
2015-10-26 19:05:44 +00:00
Adhemerval Zanella 6153ecc4fd [compiler-rt] Fix ptrace interceptor for aarch64
This patch fixes the ptrace interceptor for aarch64. The PTRACE_GETREGSET
ptrace syscall with with invalid memory might zero the iovec::iov_base
field and then masking the subsequent check after the syscall (since it
will be 0 and it will not trigger an invalid access). The fix is to copy
the value on a local variable and use its value on the checks.

The patch also adds more coverage on the Linux/ptrace.cc testcase by addding
check for PTRACE_GETREGSET for both general and floating registers (aarch64
definitions added only).

llvm-svn: 251331
2015-10-26 18:55:04 +00:00
Diego Novillo 7963ea1996 SamplePGO - Add optimization reports.
This adds a couple of optimization remarks to the SamplePGO
transformation. When it decides to inline a hot function (to mimic the
inline stack and repeat useful inline decisions in the original build).

It will also report branch destinations. For instance, given the code
fragment:

     6      if (i < 1000)
     7        sum -= i;
     8      else
     9        sum += -i * rand();

If the 'else' branch is taken most of the time, building this code with
-Rpass=sample-profile will produce:

a.cc:9:14: remark: most popular destination for conditional branches at small.cc:6:9 [-Rpass=sample-profile]
      sum += -i * rand();
             ^

llvm-svn: 251330
2015-10-26 18:52:53 +00:00
Zachary Turner cd236b8cc6 Python 3: Convert uses of `callable(x)` to `six.callable(x)`.
llvm-svn: 251329
2015-10-26 18:48:24 +00:00
Zachary Turner 1411668b6a Remove use of octal literals.
Python 3 has a different syntax for octal literals than Python 2
and they are incompatible with each other.  Six doesn't provide
a transparent wrapper around this, so the most sane thing to do
is to not use octal literals.  If you need an octal literal,
use a decimal literal and if it's not obvious what the value is,
provide the value in octal as a comment.

llvm-svn: 251328
2015-10-26 18:48:14 +00:00
David Blaikie 7b54b525cd Remove assert(false) in favor of asserting the if conditional it is contained within.
Also adjust the code to avoid 3 redundant map lookups.

llvm-svn: 251327
2015-10-26 18:41:13 +00:00
David Blaikie 94c83370b5 Move the canonical header to the top of its matching cpp file as per coding convention
This ensures that the header will be verified to be standalone (and
avoid mistakes like the one fixed in r251178)

llvm-svn: 251326
2015-10-26 18:40:56 +00:00
Mehdi Amini 5d303285b9 Add an (optional) identification block in the bitcode
Processing bitcode from a different LLVM version can lead to
unexpected behavior. The LLVM project guarantees autoupdating
bitcode from a previous minor revision for the same major, but
can't make any promise when reading bitcode generated from a
either a non-released LLVM, a vendor toolchain, or a "future"
LLVM release. This patch aims at being more user-friendly and
allows a bitcode produce to emit an optional block at the
beginning of the bitcode that will contains an opaque string
intended to describe the bitcode producer information. The
bitcode reader will dump this information alongside any error it
reports.

The optional block also includes an "epoch" number, monotonically
increasing when incompatible changes are made to the bitcode. The
reader will reject bitcode whose epoch is different from the one
expected.

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 251325
2015-10-26 18:37:00 +00:00
Evgeniy Stepanov d1aad26589 [safestack] Fast access to the unsafe stack pointer on AArch64/Android.
Android libc provides a fixed TLS slot for the unsafe stack pointer,
and this change implements direct access to that slot on AArch64 via
__builtin_thread_pointer() + offset.

This change also moves more code into TargetLowering and its
target-specific subclasses to get rid of target-specific codegen
in SafeStackPass.

This change does not touch the ARM backend because ARM lowers
builting_thread_pointer as aeabi_read_tp, which is not available
on Android.

The previous iteration of this change was reverted in r250461. This
version leaves the generic, compiler-rt based implementation in
SafeStack.cpp instead of moving it to TargetLoweringBase in order to
allow testing without a TargetMachine.

llvm-svn: 251324
2015-10-26 18:28:25 +00:00
Peter Collingbourne 693499cefc BitstreamWriter: Fix integer overflow.
We were previously overflowing a 32-bit multiply operation when emitting large
(>512MB) bitcode files, resulting in corrupted bitcode. Fix by extending
one of the operands to 64 bits.

There are a few other 32-bit integer types in this code that seem like they
also ought to be extended to 64 bits; this will be done separately.

llvm-svn: 251323
2015-10-26 18:23:21 +00:00
Peter Collingbourne 97aae40880 ARM/ELF: Better codegen for global variable addresses.
In PIC mode we were previously computing global variable addresses (or GOT
entry addresses) by adding the PC, the PC-relative GOT displacement and
the GOT-relative symbol/GOT entry displacement. Because the latter two
displacements are fixed, we ended up performing one more addition than
necessary.

This change causes us to compute addresses using a single PC-relative
displacement, resulting in a shorter code sequence. This reduces code size
by about 4% in a recent build of Chromium for Android.

As a result of this change we no longer need to compute the GOT base address
in the ARM backend, which allows us to remove the Global Base Reg pass and
SDAG lowering for the GOT.

We also now no longer use the GOT when addressing a symbol which is known
to be defined in the same linkage unit. Specifically, the symbol must have
either hidden visibility or a strong definition in the current module in
order to not use the the GOT.

This is a change from the previous behaviour where we would use the GOT to
address externally visible symbols defined in the same module. I think the
only cases where this could matter are cases involving symbol interposition,
but we don't really support that well anyway.

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

llvm-svn: 251322
2015-10-26 18:23:16 +00:00
Adhemerval Zanella 871d324799 [compiler-rt] Enable ptrace sanitizer for arm
This patch enables the ptrace syscall interceptors for arm and adds support
for both PTRACE_GETVFPREGS and PTRACE_SETVFPREGS used to get the VFP register
from ARM.

The ptrace tests is also updated with arm and PTRACE_GETVFPREGS tests.

llvm-svn: 251321
2015-10-26 18:15:14 +00:00
Diego Novillo 5eb5ad09d5 Cleanup test case debug info. NFC.
llvm-svn: 251320
2015-10-26 18:14:44 +00:00
Tamas Berghammer c9eb2fcd7d Fix an API missues in ParseTypeFromDWARF
The arguments for ClangASTContext::CreateMemberPointerType was passed
in in the wrong order.

llvm-svn: 251319
2015-10-26 18:10:55 +00:00
Alexey Samsonov 145b0fd2a0 Refactor: Simplify boolean conditional return statements in lib/Transforms/Instrumentation
Summary: Use clang-tidy to simplify boolean conditional return statements.

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

Patch by Richard (legalize@xmission.com)!

llvm-svn: 251318
2015-10-26 18:06:40 +00:00
Cong Hou fff8ccf579 Check the case that the numerator and denominator are both zeros when getting edge probabilities in BPI and return 100% in this case.
This issue is triggered in PGO mode when bootstrapping LLVM. It seems that it is not guaranteed that edge weights are always greater than zero which are read from profile data.

llvm-svn: 251317
2015-10-26 18:00:17 +00:00
Alexey Samsonov 57f8837ada Move parts of llvm-symbolizer tool into LLVMSymbolize library.
Summary: See http://lists.llvm.org/pipermail/llvm-dev/2015-October/091624.html

Reviewers: echristo

Subscribers: llvm-commits, aizatsky

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

llvm-svn: 251316
2015-10-26 17:56:12 +00:00
Greg Clayton 22fd3b1dee Fixed the test suite on MacOSX so that "test/api/multithreaded/TestMultithreaded.py" works without errors.
The problem was that the @skipIfNoSBHeaders on darwin was trying to use self.lib_dir when it hadn't been set yet.

I looked at the code and places were required to set "self.lib_dir" for no real reason as all places that used it just used the LLDB_LIB_DIR environment variable. So I removed all uses of self.lib_dir and replaced them to use 'os.environ["LLDB_LIB_DIR"]'. Did the same for self.implib_dir.

llvm-svn: 251315
2015-10-26 17:52:16 +00:00
Gabor Horvath 2f929b4093 [analyzer] Added a missing test case for r251289.
llvm-svn: 251313
2015-10-26 17:42:14 +00:00
Devin Coughlin 8e850d45e4 [analyzer] ccc-analyzer: Fix -isystem value passing.
The regex for -isystem matching is broken. -[D,I,Usystem] matches "-D", "-,",
"-I", "-U", "-s" "-y", etc. Besides that, "-isystem /foo" gets interpreted as
"-i" with a non-empty value "system" and thus the next "/foo" argument is not
read. This patch corrects the regex.

This fixes PR13237 <https://llvm.org/bugs/show_bug.cgi?id=13237>.

A patch by Peter Wu!

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

llvm-svn: 251312
2015-10-26 17:19:51 +00:00
Greg Clayton 5dff6969ea Re-use prologue parsing code that was already written instead of having two copies of code that parse line table prologues.
Also since we always read in the DWARF data or mmap it, we don't need to make a copy of the strings for the directories and file names, we can just store "cosnt char *" values. Every place that uses the prologues use them temporarily and then throw them away so no one is expecting the directory and filename strings to live longer than the parse functions.

llvm-svn: 251310
2015-10-26 17:16:50 +00:00
Eugene Zelenko 315b688457 Fix Clang-tidy modernize-use-override warnings in some files in source; other minor fixes.
llvm-svn: 251309
2015-10-26 17:00:13 +00:00
Zachary Turner b2662a27ec Fix tabs and spaces in one of the python files.
llvm-svn: 251308
2015-10-26 16:51:36 +00:00
Zachary Turner 598c661d40 Wrap call to zip() in list()
llvm-svn: 251307
2015-10-26 16:51:28 +00:00
Zachary Turner da3dea6122 Python3 - Change sys.maxint to sys.maxsize.
Python3 has no analogue to sys.maxint since ints in Python 3 have
arbitrary size.  However, the distinction was not actually important
in any of these cases, and in a few cases using maxint was already
a bug to begin with.

llvm-svn: 251306
2015-10-26 16:51:20 +00:00
Zachary Turner f67f7e31e7 Convert `long` to `int`, and portably detect all integral types.
llvm-svn: 251305
2015-10-26 16:51:09 +00:00
Zachary Turner 36b225913c Python3 - Change `dict.has_key(x)` to `x in dict`
llvm-svn: 251304
2015-10-26 16:50:51 +00:00
Zachary Turner 210eb970de Convert deprecated unittest method names.
Plural methods were long deprecated, and in Python 3 they are gone.
Convert to the actual supported method names.

llvm-svn: 251303
2015-10-26 16:50:39 +00:00
Zachary Turner 744cd5d8ed Fix usages of range() and xrange() for Python 3.
llvm-svn: 251302
2015-10-26 16:49:57 +00:00
Pavel Labath c4645bb0e6 [lldb-server] Send PC of every thread along in the stop-reply packet
This avoids the need to query the PC for private resume operations (public resumes have the PC
from the bigger jStopInfo packet) and speeds up the stepping on an android target by about 10%
(it some cases even more).

llvm-svn: 251301
2015-10-26 16:25:28 +00:00
Rui Ueyama df985afa14 COFF: De-parallelize ICF for now.
There was a threading issue in the ICF code for COFF. That seems like
a venign bug in the sense that it doesn't produce an incorrect output,
but it oftentimes misses reducible sections. As a result, mergeable
sections could remain in outputs, which makes the output nondeterministic.

Basically the algorithm we are using for ICF is this: We group sections
so that identical sections will eventually be in the same group. Initially,
all sections are in one group. We split the group by relocation targets
until we get a convergence (if relocation targets are in different gruops,
the sections are different). Once a group is split, they will never be
merged.

Each section has a group ID. That variable itself is atomic, so there's
no threading issue at the level that we can use thread sanitizer.
The point is, when we split a group, we re-assign new group IDs to group
of sections. That are multiple separate writes to atomic varaibles.
Thus, splitting a group is not an atomic operation, and there's a small
chance that the other thread observes inconsistent group IDs.

Over-splitting is always "safe", so it will never create incorrect output.

I suspect that the nondeterminism stems from that point. However, I
cannot prove or fix that at this moment, so I'm going to avoid using
threads here.

llvm-svn: 251300
2015-10-26 16:20:00 +00:00
Jonas Paulsson 83553d0cac [SystemZ] LTGFR use regclass should be GR32, not GR64.
Discovered by testing int-cmp-44.ll with -verify-machineinstrs (added to
test run).

llvm-svn: 251299
2015-10-26 15:03:49 +00:00
Jonas Paulsson 7da3820882 [SystemZ] Also clear kill flag for index reg in splitMove().
Discovered by running fp-move-05.ll with -verify-machineinstrs (added
to test case run).

llvm-svn: 251298
2015-10-26 15:03:41 +00:00
Jonas Paulsson 9525b2c0c8 [SystemZ] Don't forget the CC def op on LTEBRCompare pseudos
Discovered by running fp-cmp-02.ll with -verify-machineinstrs (now added
to test run).

llvm-svn: 251297
2015-10-26 15:03:32 +00:00
Jonas Paulsson dab7407258 [SystemZ] Tie operands in SystemZShorteInst if MI becomes 2-address.
Discovered by testing fp-add-02.ll with -verify-machineinstrs.

Test case updated to always run with -verify-machineinstrs.

llvm-svn: 251296
2015-10-26 15:03:07 +00:00
Vasileios Kalintiris 165121f326 [mips] Check for the correct error message in tests for interrupt attributes.
Instead of XFAIL-ing the tests with the wrong usage of the "interrupt"
attribute, we should check that we emit the correct error messages to
the user.

llvm-svn: 251295
2015-10-26 14:24:30 +00:00
James Molloy 493e57de01 [ValueTracking] Extend r251146 to catch a fairly common case
Even though we may not know the value of the shifter operand, it's possible we know the shifter operand is non-zero. This can allow us to infer more known bits - for example:

  %1 = load %p !range {1, 5}
  %2 = shl %q, %1

We don't know %1, but we do know that it is nonzero so %2[0] is known zero, and importantly %2 is known non-zero.

Calling isKnownNonZero is nontrivially expensive so use an Optional to run it lazily and cache its result.

llvm-svn: 251294
2015-10-26 14:10:46 +00:00