platform/upstream/llvm.git
7 years ago[x86][inline-asm][avx512] allow swapping of '{k<num>}' & '{z}' marks
Michael Zuckerman [Tue, 18 Oct 2016 13:52:39 +0000 (13:52 +0000)]
[x86][inline-asm][avx512] allow swapping of '{k<num>}' & '{z}' marks

Committing on behalf of Coby Tayree: After check-all and LGTM

Desc:

AVX512 allows dest operand to be followed by an op-mask register specifier ('{k<num>}', which in turn may be followed by a merging/zeroing specifier ('{z}')
 Currently, the following forms are allowed:
 {k<num>}
 {k<num>}{z}

This patch allows the following forms:
 {z}{k<num>}

and ignores the next form:
 {z}

Justification would be quite simple - GCC

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

llvm-svn: 284479

7 years agoStrip trailing whitespace (NFCI)
Simon Pilgrim [Tue, 18 Oct 2016 13:44:00 +0000 (13:44 +0000)]
Strip trailing whitespace (NFCI)

llvm-svn: 284478

7 years agoalpha.core.UnreachableCode - don't warn about unreachable code inside macro
Daniel Marjamaki [Tue, 18 Oct 2016 13:16:53 +0000 (13:16 +0000)]
alpha.core.UnreachableCode - don't warn about unreachable code inside macro

In macros, 'do {...} while (0)' is often used. Don't warn about the condition 0 when it is unreachable.

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

llvm-svn: 284477

7 years agoFix signed/unsigned comparison warnings
Simon Pilgrim [Tue, 18 Oct 2016 13:15:31 +0000 (13:15 +0000)]
Fix signed/unsigned comparison warnings

llvm-svn: 284476

7 years ago[mips][FastISel] Instantiate the MipsFastISel class only for targets that support...
Vasileios Kalintiris [Tue, 18 Oct 2016 13:05:42 +0000 (13:05 +0000)]
[mips][FastISel] Instantiate the MipsFastISel class only for targets that support FastISel.

Summary:
Instead of instantiating the MipsFastISel class and checking if the
target is supported in the overriden methods, we should perform that
check before creating the class. This allows us to enable FastISel *only*
for targets that truly support it, ie. MIPS32 to MIPS32R5.

Reviewers: sdardis

Subscribers: ehostunreach, llvm-commits

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

llvm-svn: 284475

7 years ago[ELF] - Update testcases after llvm change.
George Rimar [Tue, 18 Oct 2016 11:11:03 +0000 (11:11 +0000)]
[ELF] - Update testcases after llvm change.

llvm-svn: 284474

7 years ago[analyzer] Add NumberObjectConversion checker.
Artem Dergachev [Tue, 18 Oct 2016 11:06:28 +0000 (11:06 +0000)]
[analyzer] Add NumberObjectConversion checker.

When dealing with objects that represent numbers, such as Objective-C NSNumber,
the language provides little protection from accidentally interpreting
the value of a pointer to such object as the value of the number represented
by the object. Results of such mis-interpretation may be unexpected.

The checker attempts to fill this gap in cases when the code is obviously
incorrect.

With "Pedantic" option enabled, this checker enforces a coding style to
completely prevent errors of this kind (off by default).

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

llvm-svn: 284473

7 years ago[CodeCompletion] Add a block property setter completion result
Alex Lorenz [Tue, 18 Oct 2016 10:55:01 +0000 (10:55 +0000)]
[CodeCompletion] Add a block property setter completion result

This commit changes code completion results for Objective-C block properties:
clang now suggests an additional completion result that displays the block
property together with '=' and the block literal placeholder for the appropriate
readwrite block properties.

This commit uses a simple heuristic to determine when it's appropriate to
suggest a setter completion for block properties: the additional block setter
completion is provided iff the member access that's being completed is a
standalone statement.

rdar://28481726

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

llvm-svn: 284472

7 years ago[llvm-readobj] - Teach readobj to print PT_OPENBSD_RANDOMIZE/PT_OPENBSD_WXNEEDED...
George Rimar [Tue, 18 Oct 2016 10:54:56 +0000 (10:54 +0000)]
[llvm-readobj] - Teach readobj to print PT_OPENBSD_RANDOMIZE/PT_OPENBSD_WXNEEDED headers.

These are OpenBSD specific program headers and
currently we support them in LLD.

Description of headers (just in case) available here:
http://man.openbsd.org/OpenBSD-current/man5/elf.5

OpenBSD commits were:
For PT_OPENBSD_RANDOMIZE:
https://github.com/openbsd/src/commit/c494713c450d98da3f2e1451ee8c7fb675a7c461
For PT_OPENBSD_WXNEEDED:
https://github.com/openbsd/src/commit/2a5a8fc7e30928c2cff57cfe5fb491c90d8478ad

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

llvm-svn: 284471

7 years ago[ELF] - Linkerscript: accept integer values for PHDRS types.
George Rimar [Tue, 18 Oct 2016 10:49:50 +0000 (10:49 +0000)]
[ELF] - Linkerscript: accept integer values for PHDRS types.

Both gold and ld accepts integers instead of named constants
for PHDRS.
Patch adds support for that.

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

llvm-svn: 284470

7 years agoFixup r284466 - try to unbreak NetBSD
Pavel Labath [Tue, 18 Oct 2016 10:46:45 +0000 (10:46 +0000)]
Fixup r284466 - try to unbreak NetBSD

NetBSD does not have getopt as well - we need to apply the workaround there too.
FreeBSD seems to be fine though.

llvm-svn: 284469

7 years ago[CodeCompletion][NFC] Extract a function that formats block placeholders.
Alex Lorenz [Tue, 18 Oct 2016 10:38:58 +0000 (10:38 +0000)]
[CodeCompletion][NFC] Extract a function that formats block placeholders.

This commit extracts a new function named `formatBlockPlaceholder` from
the function `FormatFunctionParameter` so that it can be reused in follow-up
commits that improve code completion for block property setters.

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

llvm-svn: 284468

7 years ago[CodeCompletion][NFC] Extract a function that looks for block decl type locs.
Alex Lorenz [Tue, 18 Oct 2016 10:35:27 +0000 (10:35 +0000)]
[CodeCompletion][NFC] Extract a function that looks for block decl type locs.

This commit extracts a new function named `findTypeLocationForBlockDecl` from
the function `FormatFunctionParameter` so that it can be reused in follow-up
commits that improve code completion for block property setters.

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

llvm-svn: 284467

7 years ago[cmake] Make dependencies of lldb libraries private, take 2
Pavel Labath [Tue, 18 Oct 2016 10:26:57 +0000 (10:26 +0000)]
[cmake] Make dependencies of lldb libraries private, take 2

Summary:
The dependencies of our libraries (only liblldb, really) we marked as public, which caused all
their dependencies to be repeated when linking any executables to them. This is a problem because
then all the .a files could end up being linked twice, once to liblldb and once
again to to the executable linking against liblldb (lldb, lldb-mi). As it turns out,
our build actually depends on this behavior:
- on windows, lldb does not have getopt, so it pulls it from inside liblldb, even
  though getopt is not a part of the exported interface of liblldb (maybe some of
  the bsd variants have this problem as well)
- lldb-mi uses llvm, which again is not exported by liblldb

This change does not actually fix these problems (that is going to be a hard
one), but it does make them explicit by moving this magic from add_lldb_library
to the places the executable targets are defined. That way, I can link the
additional .a files only on targets that really need it, and the other targets
can build cleanly and make sure we don't regress further. It also fixes the
LLVM_LINK_LLVM_DYLIB build on linux.

Reviewers: zturner, beanz

Subscribers: ki.stfu, lldb-commits, mgorny

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

llvm-svn: 284466

7 years ago[SCEV] More accurate calculation of max backedge count of some less-than loops
John Brawn [Tue, 18 Oct 2016 10:10:53 +0000 (10:10 +0000)]
[SCEV] More accurate calculation of max backedge count of some less-than loops

In loops that look something like
 i = n;
 do {
  ...
 } while(i++ < n+k);
where k is a constant, the maximum backedge count is k (in fact the backedge
count will be either 0 or k, depending on whether n+k wraps). More generally
for LHS < RHS if RHS-(LHS of first comparison) is a constant then the loop will
iterate either 0 or that constant number of times.

This allows for more loop unrolling with the recent upper bound loop unrolling
changes, and I'm working on a patch that will let loop unrolling additionally
make use of the loop being executed either 0 or k times (we need to retain the
loop comparison only on the first unrolled iteration).

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

llvm-svn: 284465

7 years ago[libclang] Add missing cursor kinds to python bindings.
Igor Kudrin [Tue, 18 Oct 2016 09:42:03 +0000 (09:42 +0000)]
[libclang] Add missing cursor kinds to python bindings.

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

llvm-svn: 284464

7 years ago[libclang] Fix a failure in a test for python bindings on CursorKind.OVERLOAD_CANDIDATE.
Igor Kudrin [Tue, 18 Oct 2016 09:30:33 +0000 (09:30 +0000)]
[libclang] Fix a failure in a test for python bindings on CursorKind.OVERLOAD_CANDIDATE.

The test fails because the value does not lay in any existing group.

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

llvm-svn: 284463

7 years agoRevert "Resubmit "Add support for advanced number formatting.""
Renato Golin [Tue, 18 Oct 2016 09:30:18 +0000 (09:30 +0000)]
Revert "Resubmit "Add support for advanced number formatting.""

This reverts commits 284436 and 284437 because they still break AArch64 bots:

Value of: format_number(-10, IntegerStyle::Integer, 1)
  Actual: "-0"
  Expected: "-10"

llvm-svn: 284462

7 years ago[X86][SSE] Added extra (mul x, (1 << c)) -> x << c style vector tests
Simon Pilgrim [Tue, 18 Oct 2016 09:29:13 +0000 (09:29 +0000)]
[X86][SSE] Added extra (mul x, (1 << c)) -> x << c style vector tests

vXi64 will benefit more from lowering to shifts than multiplies

llvm-svn: 284461

7 years ago[ARM] Assign cost of scaling for Cortex-R52
Javed Absar [Tue, 18 Oct 2016 09:08:54 +0000 (09:08 +0000)]
[ARM] Assign cost of scaling for Cortex-R52

This patch assigns cost of the scaling used in addressing for Cortex-R52.

On Cortex-R52 a negated register offset takes longer than a non-negated
register offset, in a register-offset addressing mode.

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

Reviewer: jmolloy
llvm-svn: 284460

7 years ago[X86][SSE] Add lowering to cvttpd2dq/cvttps2dq for sitofp v2f64/2f32 to 2i32
Simon Pilgrim [Tue, 18 Oct 2016 07:42:15 +0000 (07:42 +0000)]
[X86][SSE] Add lowering to cvttpd2dq/cvttps2dq for sitofp v2f64/2f32 to 2i32

As discussed on PR28461 we currently miss the chance to lower "fptosi <2 x double> %arg to <2 x i32>" to cvttpd2dq due to its use of illegal types.

This patch adds support for fptosi to 2i32 from both 2f64 and 2f32.

It also recognises that cvttpd2dq zeroes the upper 64-bits of the xmm result (similar to D23797) - we still don't do this for the cvttpd2dq/cvttps2dq intrinsics - this can be done in a future patch.

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

llvm-svn: 284459

7 years ago[c++1z] Include "noexcept" in builtin function types where appropriate. Fixes
Richard Smith [Tue, 18 Oct 2016 07:13:55 +0000 (07:13 +0000)]
[c++1z] Include "noexcept" in builtin function types where appropriate. Fixes
an assertion failure looking up a matching ::operator delete for
__builtin_operator_delete.

llvm-svn: 284458

7 years ago[c++1z] Use canonical expression equivalence to determine whether two different
Richard Smith [Tue, 18 Oct 2016 06:47:03 +0000 (06:47 +0000)]
[c++1z] Use canonical expression equivalence to determine whether two different
dependent noexcept specifications result in the same canonical function type.

We still use non-canonical hashing when deduplicating type sugar so that
diagnostics will point to the right place.

llvm-svn: 284457

7 years ago[XRay] Support for for tail calls for ARM no-Thumb
Dean Michael Berris [Tue, 18 Oct 2016 05:54:15 +0000 (05:54 +0000)]
[XRay] Support for for tail calls for ARM no-Thumb

This patch adds simplified support for tail calls on ARM with XRay instrumentation.

Known issue: compiled with generic flags: `-O3 -g -fxray-instrument -Wall
-std=c++14  -ffunction-sections -fdata-sections` (this list doesn't include my
specific flags like --target=armv7-linux-gnueabihf etc.), the following program

    #include <cstdio>
    #include <cassert>
    #include <xray/xray_interface.h>

    [[clang::xray_always_instrument]] void __attribute__ ((noinline)) fC() {
      std::printf("In fC()\n");
    }

    [[clang::xray_always_instrument]] void __attribute__ ((noinline)) fB() {
      std::printf("In fB()\n");
      fC();
    }

    [[clang::xray_always_instrument]] void __attribute__ ((noinline)) fA() {
      std::printf("In fA()\n");
      fB();
    }

    // Avoid infinite recursion in case the logging function is instrumented (so calls logging
    //   function again).
    [[clang::xray_never_instrument]] void simplyPrint(int32_t functionId, XRayEntryType xret)
    {
      printf("XRay: functionId=%d type=%d.\n", int(functionId), int(xret));
    }

    int main(int argc, char* argv[]) {
      __xray_set_handler(simplyPrint);

      printf("Patching...\n");
      __xray_patch();
      fA();

      printf("Unpatching...\n");
      __xray_unpatch();
      fA();

      return 0;
    }

gives the following output:

    Patching...
    XRay: functionId=3 type=0.
    In fA()
    XRay: functionId=3 type=1.
    XRay: functionId=2 type=0.
    In fB()
    XRay: functionId=2 type=1.
    XRay: functionId=1 type=0.
    XRay: functionId=1 type=1.
    In fC()
    Unpatching...
    In fA()
    In fB()
    In fC()

So for function fC() the exit sled seems to be called too much before function
exit: before printing In fC().

Debugging shows that the above happens because printf from fC is also called as
a tail call. So first the exit sled of fC is executed, and only then printf is
jumped into. So it seems we can't do anything about this with the current
approach (i.e. within the simplification described in
https://reviews.llvm.org/D23988 ).

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

llvm-svn: 284456

7 years ago[AVX-512] Add test case to check shuffle decoding for masked vpermilps for r284450.
Craig Topper [Tue, 18 Oct 2016 05:44:04 +0000 (05:44 +0000)]
[AVX-512] Add test case to check shuffle decoding for masked vpermilps for r284450.

This is harder to do for vpermilpd as shuffle combining turns the constant vector into an immediate since all vpermilpd's inputs with constant vector can also be encoded with the immediate form.

llvm-svn: 284455

7 years agoObject: Add a missing return in ObjectFile::createObjectFile
Justin Bogner [Tue, 18 Oct 2016 05:17:23 +0000 (05:17 +0000)]
Object: Add a missing return in ObjectFile::createObjectFile

When Error was threaded through these APIs back in r265606 the
"return" was missed here, which triggers a warning if/when I add
LLVM_NODISCARD to the Error type.

llvm-svn: 284454

7 years ago[X86] Fix DecodeVPERMVMask to handle cases where the constant pool entry has a differ...
Craig Topper [Tue, 18 Oct 2016 04:48:33 +0000 (04:48 +0000)]
[X86] Fix DecodeVPERMVMask to handle cases where the constant pool entry has a different type than the shuffle itself.

This is especially important for 32-bit targets with 64-bit shuffle elements.

llvm-svn: 284453

7 years agoImprove tablegen gen-subtarget diagnostics for missing machine models.
Andrew Trick [Tue, 18 Oct 2016 04:17:44 +0000 (04:17 +0000)]
Improve tablegen gen-subtarget diagnostics for missing machine models.

-debug-only=subtarget-emitter prints a lot of machine model diagnostics.
This prunes the output so that the "No machine model for XXX on processor YYY"
only appears when there is definitely no machine model for that opcode.
Previously it was printing that error even if the opcode was covered by
a more general scheduling class.

<rdar://problem/15919845> [TableGen][CodeGenSchedule] Debug output does not help spotting the missing scheduling classes

llvm-svn: 284452

7 years ago[AVX-512] Fix DecodeVPERMV3Mask to handle cases where the constant pool entry has...
Craig Topper [Tue, 18 Oct 2016 04:00:32 +0000 (04:00 +0000)]
[AVX-512] Fix DecodeVPERMV3Mask to handle cases where the constant pool entry has a different type than the shuffle itself.

Summary: This is especially important for 32-bit targets with 64-bit shuffle elements.This is similar to how PSHUFB and VPERMIL handle the same problem.

Reviewers: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 284451

7 years ago[AVX-512] Add support for decoding shuffle mask from constant pool for masked VPERMIL...
Craig Topper [Tue, 18 Oct 2016 03:36:52 +0000 (03:36 +0000)]
[AVX-512] Add support for decoding shuffle mask from constant pool for masked VPERMILPS/PD.

llvm-svn: 284450

7 years agoRemove a debug print statement.
Jim Ingham [Tue, 18 Oct 2016 01:52:32 +0000 (01:52 +0000)]
Remove a debug print statement.

llvm-svn: 284448

7 years agoMore testsuite xfail markings cleanup.
Jim Ingham [Tue, 18 Oct 2016 01:43:22 +0000 (01:43 +0000)]
More testsuite xfail markings cleanup.

llvm-svn: 284446

7 years ago[analyzer] Update alpha and potential checker documentation, esp. alpha.valist
Dominic Chen [Tue, 18 Oct 2016 01:15:19 +0000 (01:15 +0000)]
[analyzer] Update alpha and potential checker documentation, esp. alpha.valist

Summary:
Move alpha.valist from potential to alpha since it was implemented in D15227

Cleanup some HTML comments, add a missing link

Reviewers: jordan_rose, zaks.anna

Subscribers: cfe-commits, xazax.hun

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

llvm-svn: 284445

7 years ago[CMake] Add missing dependency on intrinsics_gen
Chris Bieneman [Tue, 18 Oct 2016 00:50:39 +0000 (00:50 +0000)]
[CMake] Add missing dependency on intrinsics_gen

COFF/InputFiles.h includes LTOModule.h which transitively relies on Attributes.inc.

llvm-svn: 284444

7 years ago[CMake] Add a few default passthrough variables for bootstrap builds
Chris Bieneman [Tue, 18 Oct 2016 00:50:20 +0000 (00:50 +0000)]
[CMake] Add a few default passthrough variables for bootstrap builds

This just passes through a few missing CMake variables for multi-stage builds.

llvm-svn: 284443

7 years ago[Basic] unique_ptr-ify SourceManager::MacroArgsCacheMap (NFC)
Vedant Kumar [Tue, 18 Oct 2016 00:23:27 +0000 (00:23 +0000)]
[Basic] unique_ptr-ify SourceManager::MacroArgsCacheMap (NFC)

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

llvm-svn: 284442

7 years agoFix differences in codegen between Linux and Windows toolchains
Mandeep Singh Grang [Tue, 18 Oct 2016 00:11:19 +0000 (00:11 +0000)]
Fix differences in codegen between Linux and Windows toolchains

Summary:
    There are differences in codegen between Linux and Windows due to:
    1. Using std::sort which uses quicksort which is a non-stable sort.

    2. Iterating over Set data structure where the iteration order is
       non deterministic.

Reviewers: arsenm, grosbach, junbuml, zinob, MatzeB

Subscribers: MatzeB, wdng

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

llvm-svn: 284441

7 years ago[profile] Mark lprofCurFilename as COMPILER_RT_WEAK
Vedant Kumar [Tue, 18 Oct 2016 00:02:28 +0000 (00:02 +0000)]
[profile] Mark lprofCurFilename as COMPILER_RT_WEAK

This makes __llvm_profile_set_filename() work across dylib boundaries on
Darwin.

This functionality was originally meant to work on all platforms, but
was moved to a Linux-only directory with r272404. The root cause of the
test failure on Darwin was that lprofCurFilename was not marked weak.
Each dylib maintained its own copy of the variable due to the two-level
namespace.

Tested with check-profile (on Darwin). I don't expect this to regress
other platforms.

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

llvm-svn: 284440

7 years agoFix a crash in expressions with fixits in the dummy target.
Jim Ingham [Mon, 17 Oct 2016 23:59:41 +0000 (23:59 +0000)]
Fix a crash in expressions with fixits in the dummy target.

In the expression command, if the target is NULL, you have to use the dummy
target.

<rdar://problem/28811687>

llvm-svn: 284439

7 years agoRename HexStyle -> HexFormatStyle, and remove a constexpr.
Zachary Turner [Mon, 17 Oct 2016 23:08:47 +0000 (23:08 +0000)]
Rename HexStyle -> HexFormatStyle, and remove a constexpr.

This should fix the remaining broken builds.

llvm-svn: 284437

7 years agoResubmit "Add support for advanced number formatting."
Zachary Turner [Mon, 17 Oct 2016 22:49:24 +0000 (22:49 +0000)]
Resubmit "Add support for advanced number formatting."

This resubmits commits 284425 and r284428, which were reverted
in r284429 due to some infinite recursion caused by an incorrect
selection of function overloads.  Reproduced the failure on Linux
using GCC 4.8.4, and confirmed that with the new patch the tests
path on GCC as well as MSVC.  So hopefully this fixes everything.

llvm-svn: 284436

7 years ago[AMDGPU] Mark .note section SHF_ALLOC so lld creates a segment for it
Konstantin Zhuravlyov [Mon, 17 Oct 2016 22:40:15 +0000 (22:40 +0000)]
[AMDGPU] Mark .note section SHF_ALLOC so lld creates a segment for it

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

llvm-svn: 284435

7 years ago[ADT] Move CachedHashString to its own header in ADT, and rename to CachedHashStringRef.
Justin Lebar [Mon, 17 Oct 2016 22:24:36 +0000 (22:24 +0000)]
[ADT] Move CachedHashString to its own header in ADT, and rename to CachedHashStringRef.

Summary:
Reclaiming the name 'CachedHashString' will let us add a type with that
name that owns its value.

Reviewers: timshen

Subscribers: llvm-commits

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

llvm-svn: 284434

7 years ago[ADT] Add an initializer_list constructor to {Small,}DenseSet.
Justin Lebar [Mon, 17 Oct 2016 22:24:32 +0000 (22:24 +0000)]
[ADT] Add an initializer_list constructor to {Small,}DenseSet.

Reviewers: timshen

Subscribers: llvm-commits

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

llvm-svn: 284433

7 years ago[ADT] Add SmallDenseSet.
Justin Lebar [Mon, 17 Oct 2016 22:24:28 +0000 (22:24 +0000)]
[ADT] Add SmallDenseSet.

Summary: This matches SmallDenseMap.

Reviewers: timshen

Subscribers: llvm-commits

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

llvm-svn: 284432

7 years agoNext set of additional error checks for invalid Mach-O files for the
Kevin Enderby [Mon, 17 Oct 2016 22:09:25 +0000 (22:09 +0000)]
Next set of additional error checks for invalid Mach-O files for the
load commands that use the MachO::sub_framework_command,
MachO::sub_umbrella_command, MachO::sub_library_command
and MachO::sub_client_command types but are not used in llvm
libObject code but used in llvm tool code.

This includes the LC_SUB_FRAMEWORK, LC_SUB_UMBRELLA,
LC_SUB_LIBRARY and LC_SUB_CLIENT load commands.

llvm-svn: 284431

7 years ago[Driver] Use stem rather than filename for executable name
Petr Hosek [Mon, 17 Oct 2016 22:02:53 +0000 (22:02 +0000)]
[Driver] Use stem rather than filename for executable name

When comparing the linker name in Fuchsia driver, use stem rather
than filename to get the name of the linker becase on Windows, the
filename will have an extension.

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

llvm-svn: 284430

7 years agoRevert formatting changes.
Zachary Turner [Mon, 17 Oct 2016 21:25:41 +0000 (21:25 +0000)]
Revert formatting changes.

This reverts r288425 and r284428 as they are causing test crashes
on some systems.

llvm-svn: 284429

7 years agoTry to fix build after invalid pointer conversion.
Zachary Turner [Mon, 17 Oct 2016 21:14:27 +0000 (21:14 +0000)]
Try to fix build after invalid pointer conversion.

llvm-svn: 284428

7 years agoremove FIXME comment (fixed with r284424); NFC
Sanjay Patel [Mon, 17 Oct 2016 21:08:39 +0000 (21:08 +0000)]
remove FIXME comment (fixed with r284424); NFC

llvm-svn: 284427

7 years agoHandle multi-dimensional invariant load.
Eli Friedman [Mon, 17 Oct 2016 21:04:26 +0000 (21:04 +0000)]
Handle multi-dimensional invariant load.

If the address of a load depends on another load, make sure to emit
the loads in the right order.

llvm-svn: 284426

7 years ago[Support] Add support for "advanced" number formatting.
Zachary Turner [Mon, 17 Oct 2016 20:57:45 +0000 (20:57 +0000)]
[Support] Add support for "advanced" number formatting.

raw_ostream has not afforded a lot of flexibility in terms of
how to format numbers when outputting.  Wrap this all up into
a set of low level helper functions that can be used to output
numbers with arbitrary precision, alignment, format, etc and
then update raw_ostream to use these functions.

This will be useful for upcoming improvements to llvm's string
formatting libraries, but are still useful independently.

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

llvm-svn: 284425

7 years ago[DAG] use isConstOrConstSplat in ComputeNumSignBits to optimize SRA
Sanjay Patel [Mon, 17 Oct 2016 20:41:39 +0000 (20:41 +0000)]
[DAG] use isConstOrConstSplat in ComputeNumSignBits to optimize SRA

The scalar version of this pattern was noted in:
https://reviews.llvm.org/D25485

and fixed with:
https://reviews.llvm.org/rL284395

More refactoring of the constant/splat helpers is needed and will happen in follow-up patches.

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

llvm-svn: 284424

7 years agoExplicitly pass an isysroot to avoid the SDKROOT overriding the deployment target.
Adrian Prantl [Mon, 17 Oct 2016 20:37:56 +0000 (20:37 +0000)]
Explicitly pass an isysroot to avoid the SDKROOT overriding the deployment target.
This fixes the green dragon builders after r284416.

llvm-svn: 284423

7 years ago[lldb] Read modules from memory when a local copy is not available
Walter Erquinigo [Mon, 17 Oct 2016 20:28:19 +0000 (20:28 +0000)]
[lldb] Read modules from memory when a local copy is not available

Summary:
When the local lldb doesn't have access to a copy of the modules in the target, e.g. winphone, with this change now we read these modules from memory.

There are mainly 2 changes:
1. create pecoff object files from memory
2. read from memory when the local file is not available

Reviewers: sas, fjricci, zturner

Subscribers: #lldb

Tags: #lldb

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

llvm-svn: 284422

7 years ago[DAG] make isConstOrConstSplat and isConstOrConstSplatFP more accessible; NFC
Sanjay Patel [Mon, 17 Oct 2016 20:26:46 +0000 (20:26 +0000)]
[DAG] make isConstOrConstSplat and isConstOrConstSplatFP more accessible; NFC

As noted in:
https://reviews.llvm.org/D25685

This is the next-to-smallest step needed to enable the ComputeNumSignBits fix in that patch.
In a minor attempt to keep some structure, we're pulling the FP helper over along with its
integer sibling, but clearly we can and should do more refactoring of the similar helper
functions in DAGCombiner and SelectionDAG to simplify and not duplicate functionality.

llvm-svn: 284421

7 years agoImprove the CHECK lines in debug-options.c by separating out the check
Adrian Prantl [Mon, 17 Oct 2016 20:14:23 +0000 (20:14 +0000)]
Improve the CHECK lines in debug-options.c by separating out the check
for debug info kind and dwarf version.

llvm-svn: 284420

7 years ago[Coverage] Update test after r284418.
Davide Italiano [Mon, 17 Oct 2016 20:06:32 +0000 (20:06 +0000)]
[Coverage] Update test after r284418.

We now strip coverage metadata if debug info are not present.

llvm-svn: 284419

7 years ago[opt] Strip coverage if debug info is not present.
Davide Italiano [Mon, 17 Oct 2016 20:05:35 +0000 (20:05 +0000)]
[opt] Strip coverage if debug info is not present.

If -coverage is passed, but -g is not, clang populates the PassManager
pipeline with StripSymbols(debugOnly = true).
The stripSymbol pass therefore scans the list of named metadata,
drops !llvm.dbg.cu, but leaves !llvm.gcov and !0 (the compileUnit MD)
around. The verifier runs, and finds out that there's a CU not listed
in !llvm.dbg.cu (as it was previously dropped) -> crash.
When we strip debug info, so, check if there's coverage data,
and strip it as well, in order to avoid pending metadata left around.

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

llvm-svn: 284418

7 years agoUpdate testcase for r284416.
Adrian Prantl [Mon, 17 Oct 2016 19:46:26 +0000 (19:46 +0000)]
Update testcase for r284416.

llvm-svn: 284417

7 years agoDriver/Darwin: Set the DWARF version based on the deployment target.
Adrian Prantl [Mon, 17 Oct 2016 19:36:18 +0000 (19:36 +0000)]
Driver/Darwin: Set the DWARF version based on the deployment target.

System utilities such as atos only support DWARF 4 on OS X 10.11+ and
iOS 9+. We thus want to enable DWARF 4 only if the deployment target
has a recent enough operating system version and use DWARF 2 for older
systems.

<rdar://problem/28766743>

llvm-svn: 284416

7 years agoIgnore debug info when making optimization decisions in SimplifyCFG.
Dehao Chen [Mon, 17 Oct 2016 19:28:44 +0000 (19:28 +0000)]
Ignore debug info when making optimization decisions in SimplifyCFG.

Summary: Debug info should *not* affect code generation. This patch properly handles debug info to make sure the generated code are the same with or without debug info.

Reviewers: davidxl, mzolotukhin, jmolloy

Subscribers: aprantl, llvm-commits

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

llvm-svn: 284415

7 years agoDelete dead code.
Rafael Espindola [Mon, 17 Oct 2016 19:25:42 +0000 (19:25 +0000)]
Delete dead code.

llvm-svn: 284414

7 years agoAvoid using getComdatSymbolTable.
Rafael Espindola [Mon, 17 Oct 2016 19:25:08 +0000 (19:25 +0000)]
Avoid using getComdatSymbolTable.

This is not particularly efficient, but does avoid exposing Comdat*
out of LTO.h.

I will send a patch for review with a more efficient interface that
should map nicely to a bitcode symbol table.

llvm-svn: 284413

7 years ago[doc] use double `` to prevent html output of merging double dash
Mehdi Amini [Mon, 17 Oct 2016 19:23:19 +0000 (19:23 +0000)]
[doc] use double `` to prevent html output of merging double dash

llvm-svn: 284412

7 years agoTest commit.
Michael LeMay [Mon, 17 Oct 2016 19:09:19 +0000 (19:09 +0000)]
Test commit.

llvm-svn: 284411

7 years agoHandle relocations to thumb functions when dynamic linking COFF modules
Walter Erquinigo [Mon, 17 Oct 2016 18:56:18 +0000 (18:56 +0000)]
Handle relocations to thumb functions when dynamic linking COFF modules

Summary:
This adds the necessary logic to support relocations to thumb functions in the COFF dynamic linker.
The jumps to function addresses are mostly blx, which requires the ISA selection bit when jumping to a thumb function.

Note: I'm determining if the relocation requires the ISA bit when creating the relocation entries and not when resolving the relocation. I have to do that because I need the ObjectFile and the actual Symbol, which are available only when creating the entries. It would require a gross refactor if I do it otherwise, but I'm okay with doing it if you think it's better.

Reviewers: peter.smith, compnerd

Subscribers: rengolin, sas

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

llvm-svn: 284410

7 years agoUpdate for llvm change.
Rafael Espindola [Mon, 17 Oct 2016 18:51:27 +0000 (18:51 +0000)]
Update for llvm change.

llvm-svn: 284409

7 years agoReturn a StringRef instead of a Comdat*.
Rafael Espindola [Mon, 17 Oct 2016 18:51:02 +0000 (18:51 +0000)]
Return a StringRef instead of a Comdat*.

This is a small step in making this interface compatible with an
bitcode symbol table.

llvm-svn: 284408

7 years agoELF: Implement skip() as (void)next()
Justin Bogner [Mon, 17 Oct 2016 18:40:35 +0000 (18:40 +0000)]
ELF: Implement skip() as (void)next()

Thanks to Rafael for pointing out the simplification.

llvm-svn: 284407

7 years agoGlobalISel: support wider range of load/store sizes in AArch64.
Tim Northover [Mon, 17 Oct 2016 18:36:53 +0000 (18:36 +0000)]
GlobalISel: support wider range of load/store sizes in AArch64.

llvm-svn: 284406

7 years agounittests: Specify types in a bunch of unittest EXPECT's
Justin Bogner [Mon, 17 Oct 2016 18:22:03 +0000 (18:22 +0000)]
unittests: Specify types in a bunch of unittest EXPECT's

The EXPECT and ASSERT macros in gtest don't do the usual arithmetic
conversions. Specify types in several of them to fix -Werror.

llvm-svn: 284405

7 years ago[ELF] Support for R_ARM_TARGET2 relocation
Peter Smith [Mon, 17 Oct 2016 18:12:24 +0000 (18:12 +0000)]
[ELF] Support for R_ARM_TARGET2 relocation

The R_ARM_TARGET2 relocation is used in ARM exception tables to encode
a data dependency that will only be dereferenced by code in the
run-time support library. In a similar way to R_ARM_TARGET1 the
handling of the relocation is target specific, it maps to one of
R_ARM_ABS32, R_ARM_REL32 or R_ARM_GOT_PREL. The choice depends on the
run-time library. R_ARM_GOT_PREL is used for linux and BSD,
R_ARM_ABS32 and R_ARM_REL32 are used for bare-metal.

The command line option --target2=<target> can be used to select the
relocation used for R_ARM_TARGET2. The default is R_ARM_GOT_PREL.

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

llvm-svn: 284404

7 years ago[Driver] Use VFS to perform all distribution checks
Michal Gorny [Mon, 17 Oct 2016 18:07:15 +0000 (18:07 +0000)]
[Driver] Use VFS to perform all distribution checks

Use the VFS provided by D.getVFS() for all distribution checks,
including those performing read of the release file. Requested
by @bruno on D24954.

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

llvm-svn: 284403

7 years agoAdd a dummy file in each subdirectory in test/Driver/Inputs/hexagon_tree
Krzysztof Parzyszek [Mon, 17 Oct 2016 18:04:05 +0000 (18:04 +0000)]
Add a dummy file in each subdirectory in test/Driver/Inputs/hexagon_tree

Git does not store empty subdirectories (while SVN does). Git clone of
the clang repository did not create the fake Hexagon installation tree
used for testing the driver. This only became evident after a change
in the Hexagon toolchain that started checking for existence of certain
directories.

llvm-svn: 284402

7 years agoHexagon: add dummy files to test dir so git keeps them.
Tim Northover [Mon, 17 Oct 2016 18:00:27 +0000 (18:00 +0000)]
Hexagon: add dummy files to test dir so git keeps them.

Should fix hexagon-elf-toolchain.c tests on Git.

llvm-svn: 284401

7 years agoFix a typo.
Adrian Prantl [Mon, 17 Oct 2016 17:41:51 +0000 (17:41 +0000)]
Fix a typo.

llvm-svn: 284400

7 years ago[clang-tidy] Clean up code after applying replacements.
Alexander Kornienko [Mon, 17 Oct 2016 17:25:02 +0000 (17:25 +0000)]
[clang-tidy] Clean up code after applying replacements.

Summary:
Remove empty namespaces and initializer list commas / colons in
affected ranges. Initial patch: proper options for enabling the cleanup and
specifying the format style are needed.

Reviewers: hokein, ioeric

Subscribers: beanz, mgorny, cfe-commits

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

llvm-svn: 284399

7 years agoAMDGPU/SI: LowerParameter() should be computing align based on memory type
Tom Stellard [Mon, 17 Oct 2016 16:56:19 +0000 (16:56 +0000)]
AMDGPU/SI: LowerParameter() should be computing align based on memory type

Reviewers: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, tony-tye, llvm-commits

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

llvm-svn: 284398

7 years agoAMDGPU/SI: Fix LowerParameter() for i16 arguments
Tom Stellard [Mon, 17 Oct 2016 16:21:45 +0000 (16:21 +0000)]
AMDGPU/SI: Fix LowerParameter() for i16 arguments

Summary:
If we are loading an i16 value from a 32-bit memory location, then
we need to be able to truncate the loaded value to i16.

Reviewers: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, tony-tye, llvm-commits

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

llvm-svn: 284397

7 years agoRename skip(StringRef) -> consume(StringRef).
Rui Ueyama [Mon, 17 Oct 2016 16:01:53 +0000 (16:01 +0000)]
Rename skip(StringRef) -> consume(StringRef).

skip() and skip(StringRef) were overloaded functions that
have different semantics. This patch rename one of the functions
to avoid function overloading.

llvm-svn: 284396

7 years ago[DAG] optimize away an arithmetic-right-shift of a 0 or -1 value
Sanjay Patel [Mon, 17 Oct 2016 15:58:28 +0000 (15:58 +0000)]
[DAG] optimize away an arithmetic-right-shift of a 0 or -1 value

This came up as part of:
https://reviews.llvm.org/D25485

Note that the vector case is missed because ComputeNumSignBits() is deficient for vectors.

llvm-svn: 284395

7 years ago[x86] add tests to show missing DAG folds for arithmetic-shift-right
Sanjay Patel [Mon, 17 Oct 2016 15:44:59 +0000 (15:44 +0000)]
[x86] add tests to show missing DAG folds for arithmetic-shift-right

llvm-svn: 284394

7 years ago[x86] auto-generate checks
Sanjay Patel [Mon, 17 Oct 2016 15:38:41 +0000 (15:38 +0000)]
[x86] auto-generate checks

llvm-svn: 284393

7 years agoReapply r284383. The test failures were due to a missing dir in test/
Krzysztof Parzyszek [Mon, 17 Oct 2016 15:30:10 +0000 (15:30 +0000)]
Reapply r284383. The test failures were due to a missing dir in test/

llvm-svn: 284392

7 years ago[clang-move] Fix generating illegal header guard.
Haojian Wu [Mon, 17 Oct 2016 15:26:34 +0000 (15:26 +0000)]
[clang-move] Fix generating illegal header guard.

The filepath might contain some characters (i.e. '@') which are not
illegal in c identifiers. This patch changes all non-alphanumeric characters
to '_'.

llvm-svn: 284391

7 years agoRename interface for querying physical hardware concurrency
Teresa Johnson [Mon, 17 Oct 2016 14:56:53 +0000 (14:56 +0000)]
Rename interface for querying physical hardware concurrency

Based on post-commit review for D25585/r284180, rename
hardware_physical_concurrency to heavyweight_hardware_concurrency,
to better reflect what type of tasks it should be used for and
to enable other systems to map this to something other than the
number of physical cores.

llvm-svn: 284390

7 years agoRevert r284383, while I figure out how to reproduce the failures locally
Krzysztof Parzyszek [Mon, 17 Oct 2016 14:47:29 +0000 (14:47 +0000)]
Revert r284383, while I figure out how to reproduce the failures locally

llvm-svn: 284389

7 years ago[ELF] - Add support for -nopie
George Rimar [Mon, 17 Oct 2016 14:42:11 +0000 (14:42 +0000)]
[ELF] - Add support for -nopie

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

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

llvm-svn: 284388

7 years ago[Object/ELF] - Check Header->e_shoff value earlier and do not crash.
George Rimar [Mon, 17 Oct 2016 14:28:12 +0000 (14:28 +0000)]
[Object/ELF] - Check Header->e_shoff value earlier and do not crash.

Patch checks that section pointer is aligned properly.
This should be done before getStringTable() call.

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

llvm-svn: 284387

7 years ago[Support] remove_dots: Remove windows test.
Benjamin Kramer [Mon, 17 Oct 2016 13:57:16 +0000 (13:57 +0000)]
[Support] remove_dots: Remove windows test.

Windows doesn't have roots, so I think this test doesn't make sense
there.

llvm-svn: 284386

7 years ago[ScopDetect] Depend transitively on ScalarEvolution.
Michael Kruse [Mon, 17 Oct 2016 13:29:20 +0000 (13:29 +0000)]
[ScopDetect] Depend transitively on ScalarEvolution.

ScopDetection might be queried by -dot-scops or -view-scops passes for which
it accesses ScalarEvolution.

llvm-svn: 284385

7 years ago[Support] remove_dots: Remove .. from absolute paths.
Benjamin Kramer [Mon, 17 Oct 2016 13:28:21 +0000 (13:28 +0000)]
[Support] remove_dots: Remove .. from absolute paths.

/../foo is still a proper path after removing the dotdot. This should
now finally match https://9p.io/sys/doc/lexnames.html [Cleaning names].

llvm-svn: 284384

7 years agoReturn correct path from HexagonToolChain::getHexagonTargetDir
Krzysztof Parzyszek [Mon, 17 Oct 2016 13:23:41 +0000 (13:23 +0000)]
Return correct path from HexagonToolChain::getHexagonTargetDir

This problem was exposed by r284129, causing clang-hexagon-elf to fail
clang tests.

llvm-svn: 284383

7 years agoRevert "Reinstate r281429, reverted in r281452, with a fix for its mishandling of"
Benjamin Kramer [Mon, 17 Oct 2016 13:00:44 +0000 (13:00 +0000)]
Revert "Reinstate r281429, reverted in r281452, with a fix for its mishandling of"

This reverts commit r284176. It still marks some modules as invisible
that should be visible. Will follow up with the author with a test case.

llvm-svn: 284382

7 years ago[SDAG] Use ABI type alignment for constant pools when optimizing for size
James Molloy [Mon, 17 Oct 2016 12:54:07 +0000 (12:54 +0000)]
[SDAG] Use ABI type alignment for constant pools when optimizing for size

SelectionDAG::getConstantPool will automatically determine an appropriate alignment if one is not specified. It does this by querying the type's preferred alignment. This can end up creating quite a lot of padding when the preferred alignment for vectors is 128.

In optimize-for-size mode, it makes sense to instead query the ABI type alignment which is often smaller and causes less padding.

llvm-svn: 284381

7 years ago[docs] Reduce the number of places 'minimum requirements' is mentioned to one
Renato Golin [Mon, 17 Oct 2016 12:29:00 +0000 (12:29 +0000)]
[docs] Reduce the number of places 'minimum requirements' is mentioned to one

llvm-svn: 284380

7 years ago[SimplifyCFG] Don't lower complex ConstantExprs to lookup tables
Oliver Stannard [Mon, 17 Oct 2016 12:00:24 +0000 (12:00 +0000)]
[SimplifyCFG] Don't lower complex ConstantExprs to lookup tables

Not all ConstantExprs can be represented by a global variable, for example most
pointer arithmetic other than addition of a constant, so we can't convert these
values from switch statements to lookup tables.

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

llvm-svn: 284379

7 years ago[SCEV] Consider delinearization pattern with extension with identity factor
Tobias Grosser [Mon, 17 Oct 2016 11:56:26 +0000 (11:56 +0000)]
[SCEV] Consider delinearization pattern with extension with identity factor

Summary: The delinearization algorithm did not consider terms which had an extension without a multiply factor, i.e. a identify factor. We lose cases where size is char type where there will no multiply factor.

Reviewers: sanjoy, grosser

Subscribers: mzolotukhin, Eugene.Zelenko, llvm-commits, mssimpso, sanjoy, grosser

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

llvm-svn: 284378

7 years ago[CodeGenPrepare] When moving a zext near to its associated load, do not retain the...
Andrea Di Biagio [Mon, 17 Oct 2016 11:32:26 +0000 (11:32 +0000)]
[CodeGenPrepare] When moving a zext near to its associated load, do not retain the original debug location.

CodeGenPrepare knows how to move a zext of a load into the same basic block
where the load lives. The goal is to help ISel match a zero-extending load
instead of two separated instructions.

CGP attempts to move a zext computation even if it lives in a basic block that
does not post-dominate the load's basic block. That means, the hoisted zext may
be speculated. Preserving the zext location would hurt the debugging experience
and the quality of sample pgo.
With this patch, when moving a zext near to its associated load, CGP no longer
propagates the zext's debug location. Instead, CGP conservatively reuses the
same debug location for the load and the zext.

An alternative approach would be to assign an artificial line-0 location to the
zext. However we don't want to over-use the 'line-0' for this particular case
because it would have a size cost in the line-table section for no additional
benefit.

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

llvm-svn: 284377