platform/upstream/llvm.git
8 years agoSimplify Clang's version number configuration in CMake.
David L. Jones [Thu, 15 Sep 2016 22:12:26 +0000 (22:12 +0000)]
Simplify Clang's version number configuration in CMake.

Currently, the Clang version is computed as follows:

 1. LLVM defines major, minor, and patch versions, all statically set. Today,
    these are 4, 0, and 0, respectively.
 2. The static version numbers are combined into PACKAGE_VERSION along with a
    suffix, so the result today looks like "4.0.0svn".
 3. Clang extracts CLANG_VERSION from PACKAGE_VERSION using a regexp. The regexp
    allows the patch level to omitted, and drops any non-digit trailing values.
    Today, this result looks like "4.0.0".
 4. CLANG_VERSION is then split further into CLANG_VERSION_MAJOR and
    CLANG_VERSION_MINOR. Today, these resolve to 4 and 0, respectively.
 5. If CLANG_VERSION matches a regexp with three version components, then
    CLANG_VERSION_PATCHLEVEL is extracted and the CLANG_HAS_VERSION_PATCHLEVEL
    variable is set to 1. Today, these values are 0 and 1, respectively.
 6. The CLANG_VERSION_* variables (and CLANG_HAS_VERSION_PATCHLEVEL) are
    configured into [llvm/tools/clang/]include/clang/Basic/Version.inc
    verbatim by CMake.
 7. In [llvm/tools/clang/]include/clang/Basic/Version.h, macros are defined
    conditionally, based on CLANG_HAS_VERSION_PATCHLEVEL, to compute
    CLANG_VERSION_STRING as either a two- or three-level version number. Today,
    this value is "4.0.0", because despite the patchlevel being 0, it was
    matched by regexp and is thus "HAS"ed by the preprocessor. This string is
    then used wherever Clang's "version" is needed [*].

[*] Including, notably, by compiler-rt, for computing its installation path.

This change collapses steps 2-5 by defaulting Clang to use LLVM's (non-string)
version components for the Clang version (see [*] for why not PACKAGE_VERSION),
and collapses steps 6 and 7 by simply writing CLANG_VERSION_STRING into
Version.inc. The Clang version today always uses the patchlevel form, so the
collapsed Version.inc does not have logic for a version without a patch level.

Historically speaking, this technique began with the VER file in r82085 (which
survives in the form of the regexp in #3). The major, minor, and patchlevel
versions were introduced by r106863 (which remains in #4-6). The VER file itself
was deleted in favor of the LLVM version number in r106914. On the LLVM side,
the individual LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR, and PACKAGE_VERSION
weren't introduced for nearly two more years, until r150405.

llvm-svn: 281666

8 years ago[sanitizer-coverage] make trace-pc-guard and indirect-call work together
Kostya Serebryany [Thu, 15 Sep 2016 22:11:08 +0000 (22:11 +0000)]
[sanitizer-coverage] make trace-pc-guard and indirect-call work together

llvm-svn: 281665

8 years ago[codeview] Optimize the size of defranges with gaps
Reid Kleckner [Thu, 15 Sep 2016 22:05:08 +0000 (22:05 +0000)]
[codeview] Optimize the size of defranges with gaps

For small, discontiguous local variable regions, CodeView can use a
single defrange record with a gap, rather than having two defrange
records. I expect that this optimization will only have a minor impact
on debug info size.

llvm-svn: 281664

8 years ago[InstCombine] allow icmp (shr/shl) folds for vectors
Sanjay Patel [Thu, 15 Sep 2016 21:35:30 +0000 (21:35 +0000)]
[InstCombine] allow icmp (shr/shl) folds for vectors

These 2 helper functions were already using APInt internally, so just
change the API and caller to allow folds for splats. The scalar
regression tests look quite thorough, so I just added a couple of
tests to prove that vectors are handled too.

These folds should be grouped with the other cmp+shift folds though.
That can be an NFC follow-up.

llvm-svn: 281663

8 years agoAllow ArchSpec to take a StringRef.
Zachary Turner [Thu, 15 Sep 2016 21:32:57 +0000 (21:32 +0000)]
Allow ArchSpec to take a StringRef.

llvm-svn: 281662

8 years ago[cmake] Don't depend on lldb-server unless it's built.
Zachary Turner [Thu, 15 Sep 2016 21:32:51 +0000 (21:32 +0000)]
[cmake] Don't depend on lldb-server unless it's built.

llvm-svn: 281661

8 years agoError out instead of producing a corrupt PT_LOAD.
Rafael Espindola [Thu, 15 Sep 2016 21:22:11 +0000 (21:22 +0000)]
Error out instead of producing a corrupt PT_LOAD.

What bfd and gold do is give up in putting the headers in the PT_LOAD
and just start the PT_LOAD in the second page.

llvm-svn: 281660

8 years ago[sanitizer] Fixup: Do not introduce __sanitizer namespace globally
Anna Zaks [Thu, 15 Sep 2016 21:15:06 +0000 (21:15 +0000)]
[sanitizer] Fixup: Do not introduce __sanitizer namespace globally

Use the namespace in asan_win_dll_thunk.cc to fix the Windows bot.

llvm-svn: 281659

8 years ago[compiler-rt] Remove the system includes from __sanitizer namespace
Anna Zaks [Thu, 15 Sep 2016 21:02:22 +0000 (21:02 +0000)]
[compiler-rt] Remove the system includes from __sanitizer namespace

llvm-svn: 281658

8 years ago[compiler-rt] Do not introduce __sanitizer namespace globally
Anna Zaks [Thu, 15 Sep 2016 21:02:18 +0000 (21:02 +0000)]
[compiler-rt] Do not introduce __sanitizer namespace globally

The definitions in sanitizer_common may conflict with definitions from system headers because:

The runtime includes the system headers after the project headers (as per LLVM coding guidelines).
lib/sanitizer_common/sanitizer_internal_defs.h pollutes the namespace of everything defined after it, which is all/most of the sanitizer .h and .cc files and the included system headers with: using namespace __sanitizer; // NOLINT
This patch solves the problem by introducing the namespace only within the sanitizer namespaces as proposed by Dmitry.

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

llvm-svn: 281657

8 years ago[sanitizers] DLAddr Symbolizer should fail if demangle fails
Anna Zaks [Thu, 15 Sep 2016 21:02:09 +0000 (21:02 +0000)]
[sanitizers] DLAddr Symbolizer should fail if demangle fails

This can case crashes in high verbosity mode when demangling fails.
Not including a test case since this is hard to reproduce.

llvm-svn: 281656

8 years agoregenerate checks
Sanjay Patel [Thu, 15 Sep 2016 20:39:01 +0000 (20:39 +0000)]
regenerate checks

llvm-svn: 281655

8 years ago[SE] Fix config bug with CUDA tests
Jason Henline [Thu, 15 Sep 2016 20:26:28 +0000 (20:26 +0000)]
[SE] Fix config bug with CUDA tests

Summary:
It turns out CMake errors out if a processed directory contains source
files that are not used. This was causing an error with the CUDATest.cpp
file when configuring StreamExecutor with the CUDA platform disabled.

Moving CUDATest.cpp to its own directory fixes this problem.

Reviewers: jlebar, jprice

Subscribers: beanz, mgorny, jlebar, parallel_libs-commits

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

llvm-svn: 281654

8 years ago[GlobalOpt] Dead Eliminate declarations
Mehdi Amini [Thu, 15 Sep 2016 20:26:27 +0000 (20:26 +0000)]
[GlobalOpt] Dead Eliminate declarations

GlobalOpt is already dead-code-eliminating global definitions. With
this change it also takes care of declarations.
Hopefully this should make it now a strict superset of GlobalDCE.
This is important for LTO/ThinLTO as we don't want the linker to see
"undefined reference" when it processes the input files: it could
prevent proper internalization (or even load an extra file from a
static archive, changing the behavior of the program!).

llvm-svn: 281653

8 years agoFixing bot failures
Chris Bieneman [Thu, 15 Sep 2016 20:23:31 +0000 (20:23 +0000)]
Fixing bot failures

Need to only add debugserver as a test dependency on Darwin.

llvm-svn: 281652

8 years ago[LIT] First pass of LLDB LIT support
Chris Bieneman [Thu, 15 Sep 2016 20:13:55 +0000 (20:13 +0000)]
[LIT] First pass of LLDB LIT support

Summary:
This patch supplies basic infrastructure for LLDB to use LIT, and ports a few basic test cases from the LLDB test suite into LIT.

With this patch the LLDB lit system is not capable or intended to fully replace the existing LLDB test suite, but this first patch enables people to write lit tests for LLDB.

The lit substitution for %cc and %cxx default to the host compiler unless the CMake option LLDB_TEST_CLANG is On, in which case the in-tree clang will be used.

The target check-lldb-lit will run all lit tests including the lit-based executor for the unit tests. Alternatively there is a target generated for each subdirectory under the lit directory, so check-lldb-unit and check-lldb-expr will run just the tests under their respective directories.

The ported tests are not removed from the existing suite, and should not be until such a time when the lit runner is mature and in use by bots and workflows.

Reviewers: zturner, labath, jingham, tfiala

Subscribers: beanz, mgorny, lldb-commits

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

llvm-svn: 281651

8 years ago[InstCombine] Do not RAUW a constant GEP
David Majnemer [Thu, 15 Sep 2016 20:10:09 +0000 (20:10 +0000)]
[InstCombine] Do not RAUW a constant GEP

canRewriteGEPAsOffset expects to process instructions, not constants.

This fixes PR30342.

llvm-svn: 281650

8 years ago[AArch64] Support for FP FMA when -ffp-contract=fast
Evandro Menezes [Thu, 15 Sep 2016 19:55:23 +0000 (19:55 +0000)]
[AArch64] Support for FP FMA when -ffp-contract=fast

Currently, the machine combiner can proceed matching when -ffast-math is on.
It should also match when only -ffp-contract=fast is specified as was the
case before when DAGCombiner was doing the job.

Patch by: Abderrazek Zaafrani <a.zaafrani@samsung.com>.

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

llvm-svn: 281649

8 years agoclang-format VS plugin: upgrade the project files to VS2015
Hans Wennborg [Thu, 15 Sep 2016 19:44:49 +0000 (19:44 +0000)]
clang-format VS plugin: upgrade the project files to VS2015

The plugin itself runs on previous VS versions, but this enables
it to be built with VS2015.

llvm-svn: 281648

8 years agoMake sure we create all necessary PT_LOADs.
Rafael Espindola [Thu, 15 Sep 2016 19:36:01 +0000 (19:36 +0000)]
Make sure we create all necessary PT_LOADs.

We were some times stopping early when using linker scripts.

llvm-svn: 281647

8 years ago[ELF] - Linkerscript: implemented SORT_BY_INIT_PRIORITY.
George Rimar [Thu, 15 Sep 2016 19:15:12 +0000 (19:15 +0000)]
[ELF] - Linkerscript: implemented SORT_BY_INIT_PRIORITY.

This is PR30386,

SORT_BY_INIT_PRIORITY is a keyword can be used to sort sections by numerical value of the
GCC init_priority attribute encoded in the section name.

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

llvm-svn: 281646

8 years agoRevert "[ARM] Promote small global constants to constant pools"
Evgeniy Stepanov [Thu, 15 Sep 2016 19:13:32 +0000 (19:13 +0000)]
Revert "[ARM] Promote small global constants to constant pools"

This reverts r281604, which adds text relocations to ARM binaries.

llvm-svn: 281645

8 years ago[InstCombine] simplify code; NFCI
Sanjay Patel [Thu, 15 Sep 2016 19:04:55 +0000 (19:04 +0000)]
[InstCombine] simplify code; NFCI

llvm-svn: 281644

8 years agoUse SuperBlock struct defined in MSFCommon.h.
Rui Ueyama [Thu, 15 Sep 2016 18:55:18 +0000 (18:55 +0000)]
Use SuperBlock struct defined in MSFCommon.h.

llvm-svn: 281643

8 years agoConvert ArchSpec::ParseMachOCPUDashSubtypeTriple to use StringRef.
Zachary Turner [Thu, 15 Sep 2016 18:41:48 +0000 (18:41 +0000)]
Convert ArchSpec::ParseMachOCPUDashSubtypeTriple to use StringRef.

This makes the code easier to grok, and since this is a very low
level function it also is very helpful to have this take a StringRef
since it means anyone higher up the chain who has a StringRef would
have to first convert it to a null-terminated string.  This way it
can work equally well with StringRefs or const char*'s, which will
enable the conversion of higher up functions to StringRef.

Tested on Windows, Linux, and OSX and saw no regressions.

llvm-svn: 281642

8 years ago[libc++] Avoid <memory> include in locale_win32.h
Shoaib Meenai [Thu, 15 Sep 2016 18:36:13 +0000 (18:36 +0000)]
[libc++] Avoid <memory> include in locale_win32.h

When `_LIBCPP_NO_EXCEPTIONS` is defined, we end up with compile errors
when targeting MSVCRT:

* Code includes `<new>`
* `<new>` includes `<cstdlib>` in order to get `abort`
* `<cstdlib>` includes `<stdlib.h>`, _before_ the `using ::abort`
* `<stdlib.h>` includes `locale_win32.h`
* `locale_win32.h` includes `<memory>`
* `<memory>` includes `<stdexcept>`
* `<stdexcept>` includes `<cstdlib` for `abort`, but that inclusion gets
  (correctly) ignored because of header guards
* `<stdexcept>` references `_VSTD::abort`, which isn't declared

The easiest solution is to make `locale_win32.h` not include `<memory>`,
by removing the use of `unique_ptr` and manually restoring the locale
instead.

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

llvm-svn: 281641

8 years ago[PM] Port CFGViewer and CFGPrinter to the new Pass Manager
Sriraman Tallam [Thu, 15 Sep 2016 18:35:27 +0000 (18:35 +0000)]
[PM] Port CFGViewer and CFGPrinter to the new Pass Manager
Differential Revision: https://reviews.llvm.org/D24592

llvm-svn: 281640

8 years agoadded LLDB_PYTHON_TESTSUITE_ARCH Xcode variable
Todd Fiala [Thu, 15 Sep 2016 18:28:03 +0000 (18:28 +0000)]
added LLDB_PYTHON_TESTSUITE_ARCH Xcode variable

This Xcode build variable defaults to x86_64.  It can be set to i386
to cause the lldb-python-test-suite target run the tests in the
specified architecture.

This flag is being added for the zorg build script so that Green Dragon
can run the test suite against both x86_64 and i386 macOS targets.

llvm-svn: 281639

8 years ago[pdb] Write the IPI stream.
Zachary Turner [Thu, 15 Sep 2016 18:22:31 +0000 (18:22 +0000)]
[pdb] Write the IPI stream.

The IPI stream is structurally identical to the TPI stream, but it
contains different record types.  So we just re-use the TPI writing
code.

llvm-svn: 281638

8 years agofix function names; NFC
Sanjay Patel [Thu, 15 Sep 2016 18:22:25 +0000 (18:22 +0000)]
fix function names; NFC

llvm-svn: 281637

8 years ago[pdb] Fix the TPI stream size computation.
Zachary Turner [Thu, 15 Sep 2016 18:22:21 +0000 (18:22 +0000)]
[pdb] Fix the TPI stream size computation.

We were inadvertently adding the size of the hash value stream to
the size of the TPI stream, even though the hash value stream is
an entirely separate stream.

llvm-svn: 281636

8 years ago[SE] Support CUDA dynamic shared memory
Jason Henline [Thu, 15 Sep 2016 18:11:04 +0000 (18:11 +0000)]
[SE] Support CUDA dynamic shared memory

Summary:
Add proper handling for shared memory arguments in the CUDA platform. Also add
in unit tests for CUDA.

Reviewers: jlebar

Subscribers: beanz, mgorny, jprice, jlebar, parallel_libs-commits

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

llvm-svn: 281635

8 years ago[libFuzzer] fix the build for AFLDriverTest
Kostya Serebryany [Thu, 15 Sep 2016 18:10:38 +0000 (18:10 +0000)]
[libFuzzer] fix the build for  AFLDriverTest

llvm-svn: 281633

8 years agoReapply: Silence false positive diagnostics regarding passing an object of enumeratio...
Aaron Ballman [Thu, 15 Sep 2016 18:07:51 +0000 (18:07 +0000)]
Reapply: Silence false positive diagnostics regarding passing an object of enumeration type to va_start().

The underlying type for an enumeration in C is either char, signed int, or unsigned int. In the case the underlying type is chosen to be char (such as when passing -fshort-enums or using __attribute__((packed)) on the enum declaration), the enumeration can result in undefined behavior. However, when the underlying type is signed int or unsigned int (or long long as an extension), there is no undefined behavior because the types are compatible. This patch silences diagnostics for the latter while retaining the diagnostics for the former.

This patch addresses PR29140.

llvm-svn: 281632

8 years ago[InstCombine] allow icmp (sub nsw) folds for vectors
Sanjay Patel [Thu, 15 Sep 2016 18:05:17 +0000 (18:05 +0000)]
[InstCombine] allow icmp (sub nsw) folds for vectors

Also, clean up the code and comments for the existing folds in foldICmpSubConstant().

llvm-svn: 281631

8 years ago[InstCombine] add vector tests for icmp (sub nsw)
Sanjay Patel [Thu, 15 Sep 2016 17:54:47 +0000 (17:54 +0000)]
[InstCombine] add vector tests for icmp (sub nsw)

llvm-svn: 281630

8 years ago[IRObjectFile] Handle undefined weak symbols in RecordStreamer.
Davide Italiano [Thu, 15 Sep 2016 17:54:22 +0000 (17:54 +0000)]
[IRObjectFile] Handle undefined weak symbols in RecordStreamer.

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

llvm-svn: 281629

8 years agoTake ownership of libLTO as discussed on llvm-dev.
Peter Collingbourne [Thu, 15 Sep 2016 17:42:39 +0000 (17:42 +0000)]
Take ownership of libLTO as discussed on llvm-dev.

llvm-svn: 281628

8 years ago[InstCombine] remove duplicated fold ; NFCI
Sanjay Patel [Thu, 15 Sep 2016 17:01:17 +0000 (17:01 +0000)]
[InstCombine] remove duplicated fold ; NFCI

This pattern is matched in foldICmpBinOpEqualityWithConstant() and already works
with vectors too. I changed some comments over there to point out the current
location. The tests for this transform are currently in 'sub.ll'.

Note that the remaining folds in this block all require a sub too, so they should
get grouped with the other icmp(sub) patterns.

llvm-svn: 281627

8 years ago[SE] Let users specify CUDA path
Jason Henline [Thu, 15 Sep 2016 16:48:55 +0000 (16:48 +0000)]
[SE] Let users specify CUDA path

Summary: Add logic to allow users to specify the CUDA path at configuration time.

Reviewers: jlebar

Subscribers: beanz, mgorny, jlebar, jprice, parallel_libs-commits

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

llvm-svn: 281626

8 years ago[analyzer] Fix HTMLRewriter style sheets to support non-webkit browsers.
Artem Dergachev [Thu, 15 Sep 2016 16:25:42 +0000 (16:25 +0000)]
[analyzer] Fix HTMLRewriter style sheets to support non-webkit browsers.

This fixes rounded corners and shadows of analyzer diagnostic pieces
in browsers such as Firefox.

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

llvm-svn: 281625

8 years ago[InstCombine] allow (icmp sgt smin(PosA, B), 0) fold for vectors
Sanjay Patel [Thu, 15 Sep 2016 16:23:20 +0000 (16:23 +0000)]
[InstCombine] allow (icmp sgt smin(PosA, B), 0) fold for vectors

llvm-svn: 281624

8 years ago[InstCombine] add vector tests for icmp sgt smin
Sanjay Patel [Thu, 15 Sep 2016 16:13:41 +0000 (16:13 +0000)]
[InstCombine] add vector tests for icmp sgt smin

llvm-svn: 281623

8 years ago[sanitizer] Test the allocator with the ASan win64 memory constants
Reid Kleckner [Thu, 15 Sep 2016 16:00:46 +0000 (16:00 +0000)]
[sanitizer] Test the allocator with the ASan win64 memory constants

These got out of sync and the tests were failing for me locally.  We
assume a 47 bit address space in ASan, so we should do the same in the
tests.

llvm-svn: 281622

8 years ago[InstCombine] auto-generate checks
Sanjay Patel [Thu, 15 Sep 2016 15:48:53 +0000 (15:48 +0000)]
[InstCombine] auto-generate checks

llvm-svn: 281621

8 years ago[compiler-rt] Changing function prototype returning unused value
Etienne Bergeron [Thu, 15 Sep 2016 15:45:05 +0000 (15:45 +0000)]
[compiler-rt] Changing function prototype returning unused value

Summary: The return value of `maybeInsertAsanInitAtFunctionEntry` is ignored.

Reviewers: rnk

Subscribers: llvm-commits, chrisha, dberris

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

llvm-svn: 281620

8 years agoReally fix the Windows sanitizer build
Reid Kleckner [Thu, 15 Sep 2016 15:39:52 +0000 (15:39 +0000)]
Really fix the Windows sanitizer build

Don't list __sanitizer_print_memory profile as an INTERFACE_FUNCTION. It
is not exported by ASan; it is exported by user code.

Move the weak definition from asan_win.cc to sanitizer_win.cc to fix the
ubsan tests.

llvm-svn: 281619

8 years agoFix silly mistake introduced here : https://reviews.llvm.org/D24566
Etienne Bergeron [Thu, 15 Sep 2016 15:35:59 +0000 (15:35 +0000)]
Fix silly mistake introduced here : https://reviews.llvm.org/D24566
Asan bots are currently broken without this patch.

llvm-svn: 281618

8 years agoaddress comments from: https://reviews.llvm.org/D24566
Etienne Bergeron [Thu, 15 Sep 2016 15:19:19 +0000 (15:19 +0000)]
address comments from: https://reviews.llvm.org/D24566
using startswith instead of find.

llvm-svn: 281617

8 years agoDocument our extension to the COFF .section directive flags
Reid Kleckner [Thu, 15 Sep 2016 15:11:49 +0000 (15:11 +0000)]
Document our extension to the COFF .section directive flags

llvm-svn: 281616

8 years ago[InstCombine] clean up foldICmpWithConstant(); NFC
Sanjay Patel [Thu, 15 Sep 2016 15:11:12 +0000 (15:11 +0000)]
[InstCombine] clean up foldICmpWithConstant(); NFC
1. Early exit to reduce indent
2. Rename variables
3. Add local 'Pred' variable

llvm-svn: 281615

8 years ago[InstCombine] add helper function for foldICmpWithConstant; NFC
Sanjay Patel [Thu, 15 Sep 2016 14:37:50 +0000 (14:37 +0000)]
[InstCombine] add helper function for foldICmpWithConstant; NFC

This is a big glob of transforms that probably should work for vectors,
but currently they are disallowed because of ConstantInt guards.

llvm-svn: 281614

8 years ago[InstCombine] use m_APInt to allow icmp folds using known bits for splat constant...
Sanjay Patel [Thu, 15 Sep 2016 14:15:47 +0000 (14:15 +0000)]
[InstCombine] use m_APInt to allow icmp folds using known bits for splat constant vectors

llvm-svn: 281613

8 years agoReverting r281609; it caused some build bots to break.
Aaron Ballman [Thu, 15 Sep 2016 14:12:33 +0000 (14:12 +0000)]
Reverting r281609; it caused some build bots to break.

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/20061/steps/test/logs/stdio

llvm-svn: 281612

8 years agoGPGPU: Do not assume arrays start at 0
Tobias Grosser [Thu, 15 Sep 2016 14:05:58 +0000 (14:05 +0000)]
GPGPU: Do not assume arrays start at 0

Our alias checks precisely check that the minimal and maximal accessed elements
do not overlap in a kernel. Hence, we must ensure that our host <-> device
transfers do not touch additional memory locations that are not covered in
the alias check. To ensure this, we make sure that the data we copy for a
given array is only the data from the smallest element accessed to the largest
element accessed.

We also adjust the size of the array according to the offset at which the array
is actually accessed.

An interesting result of this is: In case array are accessed with negative
subscripts ,e.g., A[-100], we automatically allocate and transfer _more_ data to
cover the full array. This is important as such code indeed exists in the wild.

llvm-svn: 281611

8 years ago[mips][ias] Enable IAS by default for N64 on Debian mips64el.
Simon Dardis [Thu, 15 Sep 2016 14:01:55 +0000 (14:01 +0000)]
[mips][ias] Enable IAS by default for N64 on Debian mips64el.

Unfortunately we can't enable it for all N64 because it is not yet possible to
distinguish N32 from N64 from the triple on other environments.

N64 has been confirmed to produce identical (within reason) objects to GAS
during stage 2 of compiler recursion on N64-abi Fedora. Unfortunately,
Fedora's triples do not distinguish N32 from N64 so I can't enable it by
default there. I'm currently repeating this testing for Debian mips64el but
it's very unlikely to produce a different result.

Patch by: Daniel Sanders

Reviewers: sdardis

Differential Review: https://reviews.llvm.org/D22679

llvm-svn: 281610

8 years agoSilence false positive diagnostics regarding passing an object of enumeration type...
Aaron Ballman [Thu, 15 Sep 2016 14:01:10 +0000 (14:01 +0000)]
Silence false positive diagnostics regarding passing an object of enumeration type to va_start(). The underlying type for an enumeration in C is either char, signed int, or unsigned int. In the case the underlying type is chosen to be char (such as when passing -fshort-enums or using __attribute__((packed)) on the enum declaration), the enumeration can result in undefined behavior. However, when the underlying type is signed int or unsigned int (or long long as an extension), there is no undefined behavior because the types are compatible. This patch silences diagnostics for the latter while retaining the diagnostics for the former.

This patch addresses PR29140.

llvm-svn: 281609

8 years agoCheck the return of getInteger.
Rafael Espindola [Thu, 15 Sep 2016 13:36:44 +0000 (13:36 +0000)]
Check the return of getInteger.

llvm-svn: 281608

8 years ago[mips][ias] Enable IAS by default for N64 on Debian mips64el.
Simon Dardis [Thu, 15 Sep 2016 13:13:01 +0000 (13:13 +0000)]
[mips][ias] Enable IAS by default for N64 on Debian mips64el.

Unfortunately we can't enable it for all N64 because it is not yet possible to
distinguish N32 from N64.

N64 has been confirmed to produce identical (within reason) objects to GAS
during stage 2 of compiler recursion on N64-abit Fedora. Unfortunately,
Fedora's triples do not distinguish N32 from N64 so I can't enable it by
default there. I'm currently repeating this testing for Debian mips64el but
it's very unlikely to produce a different result.

Patch by: Daniel Sanders

Reviewers: sdardis

Differential Review: https://reviews.llvm.org/D22678

llvm-svn: 281607

8 years agoReformat x86_64 register infos defines table
Dimitar Vlahovski [Thu, 15 Sep 2016 12:58:27 +0000 (12:58 +0000)]
Reformat x86_64 register infos defines table

Fix the table format of the register defines after clang-format.
Added guards to prevent future reformatting again from clang-format.

llvm-svn: 281606

8 years agoRecommit r281318 "[ELF] - Versionscript: support mangled symbols with the same name."
George Rimar [Thu, 15 Sep 2016 12:44:38 +0000 (12:44 +0000)]
Recommit r281318 "[ELF] - Versionscript: support mangled symbols with the same name."

Previouly bot was failing:
http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/413/steps/test-stage1-compiler/logs/stdio
Fixed possible segfault, so commit should bix the buildbot.

Initial commit message:

This is PR30312. Info from bug page:

Both of these symbols demangle to abc::abc():
_ZN3abcC1Ev
_ZN3abcC2Ev
(These would be abc's complete object constructor and base object constructor, respectively.)
however with "abc::abc()" in the version script only one of the two receives the symbol version.

Patch fixes that.
It uses testcase created by Ed Maste (D24306).

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

llvm-svn: 281605

8 years ago[ARM] Promote small global constants to constant pools
James Molloy [Thu, 15 Sep 2016 12:30:27 +0000 (12:30 +0000)]
[ARM] Promote small global constants to constant pools

If a constant is unamed_addr and is only used within one function, we can save
on the code size and runtime cost of an indirection by changing the global's storage
to inside the constant pool. For example, instead of:

      ldr r0, .CPI0
      bl printf
      bx lr
    .CPI0: &format_string
    format_string: .asciz "hello, world!\n"

We can emit:

      adr r0, .CPI0
      bl printf
      bx lr
    .CPI0: .asciz "hello, world!\n"

This can cause significant code size savings when many small strings are used in one
function (4 bytes per string).

This recommit contains fixes for a nasty bug related to fast-isel fallback - because
fast-isel doesn't know about this optimization, if it runs and emits references to
a string that we inline (because fast-isel fell back to SDAG) we will end up
with an inlined string and also an out-of-line string, and we won't emit the
out-of-line string, causing backend failures.

llvm-svn: 281604

8 years ago[libcxx] Allow sanitizing libcxx with ASan+UBSan simultaneously
Kuba Brecka [Thu, 15 Sep 2016 11:04:53 +0000 (11:04 +0000)]
[libcxx] Allow sanitizing libcxx with ASan+UBSan simultaneously

Allow building with LLVM_USE_SANITIZER=“Address;Undefined” (and “Undefined;Address”).

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

llvm-svn: 281603

8 years agoGlobalISel: legalize GEP instructions with small offsets.
Tim Northover [Thu, 15 Sep 2016 11:02:19 +0000 (11:02 +0000)]
GlobalISel: legalize GEP instructions with small offsets.

llvm-svn: 281602

8 years agoFix TestSymbolContextTwoFiles on Android after rL281595
Tamas Berghammer [Thu, 15 Sep 2016 10:49:55 +0000 (10:49 +0000)]
Fix TestSymbolContextTwoFiles on Android after rL281595

llvm-svn: 281601

8 years agoGlobalISel: relax type constraints on G_ICMP to allow pointers.
Tim Northover [Thu, 15 Sep 2016 10:40:38 +0000 (10:40 +0000)]
GlobalISel: relax type constraints on G_ICMP to allow pointers.

llvm-svn: 281600

8 years agoGlobalISel: remove "unsized" LLT
Tim Northover [Thu, 15 Sep 2016 10:09:59 +0000 (10:09 +0000)]
GlobalISel: remove "unsized" LLT

It was only really there as a sentinel when instructions had to have precisely
one type. Now that registers are typed, each register really has to have a type
that is sized.

llvm-svn: 281599

8 years agollvm/test/Transforms/CorrelatedValuePropagation/alloca.ll REQUIRES +Asserts.
NAKAMURA Takumi [Thu, 15 Sep 2016 09:45:31 +0000 (09:45 +0000)]
llvm/test/Transforms/CorrelatedValuePropagation/alloca.ll REQUIRES +Asserts.

llvm-svn: 281598

8 years agoGlobalISel: cache pointer sizes in LLT
Tim Northover [Thu, 15 Sep 2016 09:20:34 +0000 (09:20 +0000)]
GlobalISel: cache pointer sizes in LLT

Otherwise everything that needs to work out what size they are has to keep a
DataLayout handy, which is a bit silly and very annoying.

llvm-svn: 281597

8 years ago[ARM] ARM-specific attributes should be accepted for big-endian
Oliver Stannard [Thu, 15 Sep 2016 08:55:41 +0000 (08:55 +0000)]
[ARM] ARM-specific attributes should be accepted for big-endian

The ARM-specific C attributes (currently just interrupt) need to check
for both the big- and little-endian versions of the triples, so that
they are accepted for both big and little endian targets.

TargetWindows and TargetMicrosoftCXXABI also only use the little-endian
triples, but this is correct as windows is not supported on big-endian
ARM targets (and this is asserted in lib/Basic/Targets.cpp).

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

llvm-svn: 281596

8 years agoAdd support for DW_AT_ranges_base attribute
Tamas Berghammer [Thu, 15 Sep 2016 08:53:33 +0000 (08:53 +0000)]
Add support for DW_AT_ranges_base attribute

It is a new attribute emitted by clang as a GNU extension and will
be part of Dwarf5. The purpose of the attribute is to specify a compile
unit level base value for all DW_AT_ranges to reduce the number of
relocations have to be done by the linker.

Fixes (at least partially): https://llvm.org/pr28826

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

llvm-svn: 281595

8 years agoTry to fix windows build after rL281569
Tamas Berghammer [Thu, 15 Sep 2016 08:47:59 +0000 (08:47 +0000)]
Try to fix windows build after rL281569

llvm-svn: 281594

8 years ago[asan] Reify ErrorInvalidPointerPair
Filipe Cabecinhas [Thu, 15 Sep 2016 08:10:56 +0000 (08:10 +0000)]
[asan] Reify ErrorInvalidPointerPair

Summary: Continue work on PR30351

Reviewers: vitalybuka, kcc, eugenis

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 281593

8 years ago[asan] Reify ErrorODRViolation
Filipe Cabecinhas [Thu, 15 Sep 2016 08:10:52 +0000 (08:10 +0000)]
[asan] Reify ErrorODRViolation

Summary: Continue work on PR30351

Reviewers: vitalybuka, kcc, eugenis

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 281592

8 years ago[asan] Reify ErrorBadParamsToAnnotateContiguousContainer
Filipe Cabecinhas [Thu, 15 Sep 2016 08:10:48 +0000 (08:10 +0000)]
[asan] Reify ErrorBadParamsToAnnotateContiguousContainer

Summary: Continue work on PR30351

Reviewers: vitalybuka, kcc, eugenis

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 281591

8 years ago[llvm-cov] Move some layout logic to the right spot (NFC)
Vedant Kumar [Thu, 15 Sep 2016 06:49:13 +0000 (06:49 +0000)]
[llvm-cov] Move some layout logic to the right spot (NFC)

llvm-svn: 281590

8 years ago[llvm-cov] Hide instantiation views for unexecuted functions
Vedant Kumar [Thu, 15 Sep 2016 06:44:51 +0000 (06:44 +0000)]
[llvm-cov] Hide instantiation views for unexecuted functions

Copying in the full text of the function doesn't help at all when we
already know that it's never executed. Just say that it's unexecuted --
the relevant source text has already been printed.

llvm-svn: 281589

8 years ago[llvm-cov] Don't create 'jump to ...' links in nested views
Vedant Kumar [Thu, 15 Sep 2016 06:44:48 +0000 (06:44 +0000)]
[llvm-cov] Don't create 'jump to ...' links in nested views

Doing so is pointless, since the whole view is usually visible in a
small amount of space.

llvm-svn: 281588

8 years agoUpdate clang unittests for rL281586.
Wei Mi [Thu, 15 Sep 2016 06:31:30 +0000 (06:31 +0000)]
Update clang unittests for rL281586.

The change in rL281586 is in llvm component and tests updated here are
in clang component, so I have to commit them consecutively.

llvm-svn: 281587

8 years agoAdd some shortcuts in LazyValueInfo to reduce compile time of Correlated Value Propag...
Wei Mi [Thu, 15 Sep 2016 06:28:34 +0000 (06:28 +0000)]
Add some shortcuts in LazyValueInfo to reduce compile time of Correlated Value Propagation.

The patch is to partially fix PR10584. Correlated Value Propagation queries LVI
to check non-null for pointer params of each callsite. If we know the def of
param is an alloca instruction, we know it is non-null and can return early from
LVI. Similarly, CVP queries LVI to check whether pointer for each mem access is
constant. If the def of the pointer is an alloca instruction, we know it is not
a constant pointer. These shortcuts can reduce the cost of CVP significantly.

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

llvm-svn: 281586

8 years ago[CMake] Fixing lit for runtimes directory
Jonas Hahnfeld [Thu, 15 Sep 2016 06:14:13 +0000 (06:14 +0000)]
[CMake] Fixing lit for runtimes directory

Copy variable LLVM_BUILD_MAIN_SRC_DIR from LLVMConfig.cmake to
LLVM_MAIN_SRC_DIR as it is named for in-tree builds. This ensures that
add_lit_target() can reliably find llvm-lit which is not necessarily
in the PATH.

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

llvm-svn: 281585

8 years ago[libFuzzer] disable test that requires debug info -- it fails on the bot
Kostya Serebryany [Thu, 15 Sep 2016 05:46:58 +0000 (05:46 +0000)]
[libFuzzer] disable test that requires debug info -- it fails on the bot

llvm-svn: 281584

8 years ago[libFuzzer] move the AFL driver build rule test into the uninstrumented dir
Kostya Serebryany [Thu, 15 Sep 2016 05:17:39 +0000 (05:17 +0000)]
[libFuzzer] move the AFL driver build rule test into the uninstrumented dir

llvm-svn: 281583

8 years agoBuiltins.def: Explicitly undef finitef, to appease mingw. It defines finitef as alias...
NAKAMURA Takumi [Thu, 15 Sep 2016 05:11:43 +0000 (05:11 +0000)]
Builtins.def: Explicitly undef finitef, to appease mingw. It defines finitef as alias of _finitef.

llvm-svn: 281582

8 years ago[llvm-cov] Make a method name more accurate (NFC)
Vedant Kumar [Thu, 15 Sep 2016 04:45:59 +0000 (04:45 +0000)]
[llvm-cov] Make a method name more accurate (NFC)

llvm-svn: 281581

8 years ago[libFuzzer] fix print_pcs test
Kostya Serebryany [Thu, 15 Sep 2016 04:43:06 +0000 (04:43 +0000)]
[libFuzzer] fix print_pcs test

llvm-svn: 281580

8 years ago[llvm-cov] Don't print a verbose title when looking at one file
Vedant Kumar [Thu, 15 Sep 2016 04:41:39 +0000 (04:41 +0000)]
[llvm-cov] Don't print a verbose title when looking at one file

Having the same title, timestamp, etc. occur repeatedly creates an
unnecessary distraction when paging through a report.

llvm-svn: 281579

8 years ago[llvm-cov] Fix tests that aren't checking anything (NFC)
Vedant Kumar [Thu, 15 Sep 2016 04:41:37 +0000 (04:41 +0000)]
[llvm-cov] Fix tests that aren't checking anything (NFC)

E.g the 'showProjectSummary' test contains some checks which can't fail
because they match themselves...

llvm-svn: 281578

8 years ago[libFuzzer] implement print_pcs with trace-pc-guard. Change the trace-pc-guard heuris...
Kostya Serebryany [Thu, 15 Sep 2016 04:36:45 +0000 (04:36 +0000)]
[libFuzzer] implement print_pcs with trace-pc-guard. Change the trace-pc-guard heuristic for 8-bit counters to look more like in AFL (not that it's provable better, but the existin test preferes this heuristic)

llvm-svn: 281577

8 years ago[sanitizer] Fix darwin Go tsan build by unifying r281567 and r281553.
Ahmed Bougacha [Thu, 15 Sep 2016 04:28:20 +0000 (04:28 +0000)]
[sanitizer] Fix darwin Go tsan build by unifying r281567 and r281553.

Avoid redefining the weak stub when building gotsan.cc

llvm-svn: 281576

8 years agoAdd a C++ unittest to test the fix for PR30213.
Wei Mi [Thu, 15 Sep 2016 04:06:44 +0000 (04:06 +0000)]
Add a C++ unittest to test the fix for PR30213.

The test exercises the branch in scev expansion when the value in ValueOffsetPair
is a ptr and the offset is not divisible by the elem type size of value.

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

llvm-svn: 281575

8 years ago[sanitizer] one more attempt to fix things with __sanitizer_print_memory_profile
Kostya Serebryany [Thu, 15 Sep 2016 02:11:07 +0000 (02:11 +0000)]
[sanitizer] one more attempt to fix things with  __sanitizer_print_memory_profile

llvm-svn: 281574

8 years ago[doc] [CUDA] Add sections about STL support and differences between nvcc and clang...
Justin Lebar [Thu, 15 Sep 2016 02:04:32 +0000 (02:04 +0000)]
[doc] [CUDA] Add sections about STL support and differences between nvcc and clang to CompileCudaWithLLVM.rst.

llvm-svn: 281573

8 years ago[LangRef] Add a clarifying example for undef
Sanjoy Das [Thu, 15 Sep 2016 01:56:58 +0000 (01:56 +0000)]
[LangRef] Add a clarifying example for undef

llvm-svn: 281570

8 years agoMake the keys enumerations for options and resolvers enum classes.
Jim Ingham [Thu, 15 Sep 2016 01:47:22 +0000 (01:47 +0000)]
Make the keys enumerations for options and resolvers enum classes.

This keeps them from conflicting with other symbols names, so it's
worth their being less convenient to use for indexing.

llvm-svn: 281569

8 years ago[libFuzzer] add 8-bit counters to trace-pc-guard handler
Kostya Serebryany [Thu, 15 Sep 2016 01:30:18 +0000 (01:30 +0000)]
[libFuzzer] add 8-bit counters to trace-pc-guard handler

llvm-svn: 281568

8 years agoDefine the weak symbol added by r281546 on mac.
Ahmed Bougacha [Thu, 15 Sep 2016 01:04:32 +0000 (01:04 +0000)]
Define the weak symbol added by r281546 on mac.

'weak' doesn't behave like it does on linux.

llvm-svn: 281567

8 years agomath: Implement tgamma
Aaron Watry [Thu, 15 Sep 2016 00:17:34 +0000 (00:17 +0000)]
math: Implement tgamma

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 281566

8 years agomath: Implement lgamma
Aaron Watry [Thu, 15 Sep 2016 00:17:31 +0000 (00:17 +0000)]
math: Implement lgamma

Just use lgamma_r and ignore the value returned in the second argument

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 281565

8 years agomath: Implement lgamma_r
Aaron Watry [Thu, 15 Sep 2016 00:17:28 +0000 (00:17 +0000)]
math: Implement lgamma_r

Ported from the amd-builtins branch, which is itself based on the
Sun Microsystems implementation.

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 281564