platform/upstream/llvm.git
7 years ago[X86] Teach shuffle lowering to use 256-bit SHUF128 when possible.
Craig Topper [Sat, 4 Nov 2017 06:44:47 +0000 (06:44 +0000)]
[X86] Teach shuffle lowering to use 256-bit SHUF128 when possible.

This allows masked operations to be used and allows the register allocator to use YMM16-31 if necessary.

As a follow up I'll look into teaching EVEX->VEX how to turn this back into PERM2X128 if any of the additional features don't work out.

llvm-svn: 317403

7 years agoCMake: Let LLVM_BUILD_32_BITS aware of large file.
NAKAMURA Takumi [Sat, 4 Nov 2017 06:03:29 +0000 (06:03 +0000)]
CMake: Let LLVM_BUILD_32_BITS aware of large file.

llvm-svn: 317402

7 years agollvm/test/Object/archive-SYM64-write.test: Delete large temp files. They are 8GiB...
NAKAMURA Takumi [Sat, 4 Nov 2017 06:00:11 +0000 (06:00 +0000)]
llvm/test/Object/archive-SYM64-write.test: Delete large temp files. They are 8GiB total.

llvm-svn: 317401

7 years agoCodeGenCXX: no default dllimport storage for mingw
Martell Malone [Sat, 4 Nov 2017 02:15:49 +0000 (02:15 +0000)]
CodeGenCXX: no default dllimport storage for mingw

GNU frontends don't have options like /MT, /MD
This fixes a few link error regressions with libc++ and libc++abi

Reviewers: rnk, mstorsjo, compnerd

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

llvm-svn: 317398

7 years ago[Driver] MinGW: Remove custom linker detection
Martell Malone [Sat, 4 Nov 2017 02:07:59 +0000 (02:07 +0000)]
[Driver] MinGW: Remove custom linker detection

This is a re-apply of rL313082 which was reverted in rL313088

In rL289668 the ability to specify the default linker at compile time
was added but because the MinGW driver used custom detection we could
not take advantage of this new CMAKE flag CLANG_DEFAULT_LINKER.

rL289668 added no test cases and the mingw driver was either overlooked
or purposefully skipped because it has some custom linker tests
Removing them here because they are covered by the generic case.

Reviewers: rnk

Differntial Revision: https://reviews.llvm.org/D37727

llvm-svn: 317397

7 years ago[ELF] Support expressions with -defsym option
Petr Hosek [Sat, 4 Nov 2017 02:03:58 +0000 (02:03 +0000)]
[ELF] Support expressions with -defsym option

Fixes PR34948.

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

llvm-svn: 317396

7 years agoRevert "[LTO][ThinLTO] Use the linker resolutions to mark global values ..."
Sean Fertile [Sat, 4 Nov 2017 01:54:20 +0000 (01:54 +0000)]
Revert "[LTO][ThinLTO] Use the linker resolutions to mark global values ..."

Changes more tests then expected on one of the build bots.
reverting to investigate.

This reverts https://llvm.org/svn/llvm-project/llvm/trunk@317374

llvm-svn: 317395

7 years agoUpdate ODR hashing tests
Richard Trieu [Sat, 4 Nov 2017 01:20:50 +0000 (01:20 +0000)]
Update ODR hashing tests

Add a mix of postive and negative tests to check that wrong Decls won't be
flagged in the diagnostic.  Split the check everything test and moved the
pieces closer to where the related tests are.

llvm-svn: 317394

7 years ago[CallSiteSplitting] clang-format my last commit. NFCI.
Davide Italiano [Sat, 4 Nov 2017 00:44:01 +0000 (00:44 +0000)]
[CallSiteSplitting] clang-format my last commit. NFCI.

Thanks to Rui for pointing out.

llvm-svn: 317393

7 years agoRename Body -> Sym.
Rui Ueyama [Sat, 4 Nov 2017 00:31:04 +0000 (00:31 +0000)]
Rename Body -> Sym.

This patch is mechanically created by

  sed -i -e s/Body/Sym/g lld/ELF/*.{cpp,h}

and clang-format-diff.

llvm-svn: 317392

7 years agoFix CMake definitions of tsan runtime to make it installed by "install-compiler-rt"
Mehdi Amini [Sat, 4 Nov 2017 00:07:20 +0000 (00:07 +0000)]
Fix CMake definitions of tsan runtime to make it installed by "install-compiler-rt"

Summary: The PARENT_TARGET was correctly set under APPLE but not under linux.

Reviewers: kubamracek, samsonov

Subscribers: dberris, mgorny, llvm-commits

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

llvm-svn: 317391

7 years ago[scudo] Rearrange #include order
Kostya Kortchinsky [Fri, 3 Nov 2017 23:48:25 +0000 (23:48 +0000)]
[scudo] Rearrange #include order

Summary:
To be compliant with https://llvm.org/docs/CodingStandards.html#include-style,
system headers have to come after local headers.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 317390

7 years ago[Sanitizers] Call NanoTime() conditionally.
Alex Shlyapnikov [Fri, 3 Nov 2017 23:31:00 +0000 (23:31 +0000)]
[Sanitizers] Call NanoTime() conditionally.

Summary:
Call NanoTime() in primary 64 bit allocator only when necessary,
otherwise the unwarranted syscall causes problems in sandbox environments.
ReleaseToOSIntervalMs() conditional allows them to turn the feature off
with allocator_release_to_os_interval_ms=-1 flag.

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 317386

7 years ago[CallSiteSplitting] Silence GCC's -Wparentheses. NFCI.
Davide Italiano [Fri, 3 Nov 2017 23:03:38 +0000 (23:03 +0000)]
[CallSiteSplitting] Silence GCC's -Wparentheses. NFCI.

llvm-svn: 317385

7 years ago[COFF] Avoid "Body" as a local variable name.
Rui Ueyama [Fri, 3 Nov 2017 22:49:02 +0000 (22:49 +0000)]
[COFF] Avoid "Body" as a local variable name.

Since SymbolBody is gone, "Body" is not a good variable name.
This patch renames or eliminates them.

llvm-svn: 317384

7 years agoRename replaceBody -> replaceSymbol.
Rui Ueyama [Fri, 3 Nov 2017 22:48:47 +0000 (22:48 +0000)]
Rename replaceBody -> replaceSymbol.

llvm-svn: 317383

7 years ago[X86] Give unary PERMI priority over SHUF128 in lowerV8I64VectorShuffle to make it...
Craig Topper [Fri, 3 Nov 2017 22:48:13 +0000 (22:48 +0000)]
[X86] Give unary PERMI priority over SHUF128 in lowerV8I64VectorShuffle to make it possible to fold a load.

llvm-svn: 317382

7 years ago[Basic] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Fri, 3 Nov 2017 22:35:27 +0000 (22:35 +0000)]
[Basic] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 317381

7 years agoFix variable name.
Zachary Turner [Fri, 3 Nov 2017 22:33:49 +0000 (22:33 +0000)]
Fix variable name.

A mechanical rename caused an illegal name conflict between
a variable and a type, which was picked up by GCC.

llvm-svn: 317380

7 years agoMove TargetFrameLowering.h to CodeGen where it's implemented
David Blaikie [Fri, 3 Nov 2017 22:32:11 +0000 (22:32 +0000)]
Move TargetFrameLowering.h to CodeGen where it's implemented

This header already includes a CodeGen header and is implemented in
lib/CodeGen, so move the header there to match.

This fixes a link error with modular codegeneration builds - where a
header and its implementation are circularly dependent and so need to be
in the same library, not split between two like this.

llvm-svn: 317379

7 years agoRevert "[ELF] - Teach LLD to use information from .debug_str for error reporting."
Bob Haarman [Fri, 3 Nov 2017 22:23:19 +0000 (22:23 +0000)]
Revert "[ELF] - Teach LLD to use information from .debug_str for error reporting."

This reverts commit 00b7acb8f6c8a4663bb7c8396d217c210209b562.

It was causing some links to execute llvm_unreachable.

llvm-svn: 317378

7 years agoRemove ProcessGdbRemote::m_flags
Pavel Labath [Fri, 3 Nov 2017 22:12:50 +0000 (22:12 +0000)]
Remove ProcessGdbRemote::m_flags

The member is completely unused. Discussed on lldb-dev.

llvm-svn: 317377

7 years ago[MinGW] Output debug info by default, unless the -s parameter is passed
Martin Storsjo [Fri, 3 Nov 2017 22:10:37 +0000 (22:10 +0000)]
[MinGW] Output debug info by default, unless the -s parameter is passed

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

llvm-svn: 317376

7 years agoInvoke salvageDebugInfo from CodeGenPrepare's SinkCast()
Adrian Prantl [Fri, 3 Nov 2017 21:55:03 +0000 (21:55 +0000)]
Invoke salvageDebugInfo from CodeGenPrepare's SinkCast()

This preserves the debug info for the cast operation in the original location.

rdar://problem/33460652

Reapplied r317340 with the test moved into an ARM-specific directory.

llvm-svn: 317375

7 years ago[LTO][ThinLTO] Use the linker resolutions to mark global values as dso_local.
Sean Fertile [Fri, 3 Nov 2017 21:45:55 +0000 (21:45 +0000)]
[LTO][ThinLTO] Use the linker resolutions to mark global values as dso_local.

Now that we have a way to mark GlobalValues as local we can use the symbol
resolutions that the linker plugin provides as part of lto/thinlto link
step to refine the compilers view on what symbols will end up being local.

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

llvm-svn: 317374

7 years agoFix a crash in llvm-objdump when printing a bad x86_64 relocation in a Mach-O
Kevin Enderby [Fri, 3 Nov 2017 21:32:44 +0000 (21:32 +0000)]
Fix a crash in llvm-objdump when printing a bad x86_64 relocation in a Mach-O
file with a bad section number.

rdar://35207539

llvm-svn: 317373

7 years agoAdd -fcxx-exceptions for ExtractionSemicolonPolicy.cpp to appease PS4 bots
Alex Lorenz [Fri, 3 Nov 2017 21:31:10 +0000 (21:31 +0000)]
Add -fcxx-exceptions for ExtractionSemicolonPolicy.cpp to appease PS4 bots

llvm-svn: 317372

7 years agoRevert r317046, "Object: Move some code from ELF.h into ELF.cpp."
Peter Collingbourne [Fri, 3 Nov 2017 21:30:06 +0000 (21:30 +0000)]
Revert r317046, "Object: Move some code from ELF.h into ELF.cpp."

This change resulted in a measured 1.5-2% perf regression linking
chrome.

llvm-svn: 317371

7 years agoRename SymbolBody -> Symbol
Rui Ueyama [Fri, 3 Nov 2017 21:21:47 +0000 (21:21 +0000)]
Rename SymbolBody -> Symbol

Now that we have only SymbolBody as the symbol class. So, "SymbolBody"
is a bit strange name now. This is a mechanical change generated by

  perl -i -pe s/SymbolBody/Symbol/g $(git grep -l SymbolBody lld/ELF lld/COFF)

nd clang-format-diff.

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

llvm-svn: 317370

7 years agoLate fixup in _lwp_exit on TSan/NetBSD
Kamil Rytarowski [Fri, 3 Nov 2017 21:08:52 +0000 (21:08 +0000)]
Late fixup in _lwp_exit on TSan/NetBSD

Call DestroyThreadState() before REAL(_lwp_exit)();

This variation is less racy.

Sponsored by <The NetBSD Foundation>

llvm-svn: 317369

7 years ago[SimplifyCFG] When merging conditional stores, don't count the store we're merging...
Craig Topper [Fri, 3 Nov 2017 21:08:13 +0000 (21:08 +0000)]
[SimplifyCFG] When merging conditional stores, don't count the store we're merging against the PHINodeFoldingThreshold

Merging conditional stores tries to check to see if the code is if convertible after the store is moved. But the store hasn't been moved yet so its being counted against the threshold.

The patch adds 1 to the threshold comparison to make sure we don't count the store. I've adjusted a test to use a lower threshold to ensure we still do that conversion with the lower threshold.

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

llvm-svn: 317368

7 years ago[COFF] Autoexport symbols as data if they don't point to an executable section
Martin Storsjo [Fri, 3 Nov 2017 20:58:20 +0000 (20:58 +0000)]
[COFF] Autoexport symbols as data if they don't point to an executable section

This was already taken care of for the output def file.

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

llvm-svn: 317367

7 years agoGCOV: Move GCOV from IR & Support into ProfileData to fix layering
David Blaikie [Fri, 3 Nov 2017 20:57:10 +0000 (20:57 +0000)]
GCOV: Move GCOV from IR & Support into ProfileData to fix layering

This class was split between libIR and libSupport, which breaks under
modular code generation. Move it into the one library that uses it,
ProfileData, to resolve this issue.

llvm-svn: 317366

7 years agollvm-objdump: Fix unused-lambda-capture warning by removing unused lambda capture
David Blaikie [Fri, 3 Nov 2017 20:57:09 +0000 (20:57 +0000)]
llvm-objdump: Fix unused-lambda-capture warning by removing unused lambda capture

llvm-svn: 317365

7 years ago[cfi-verify] Add blacklist parsing for result filtering.
Mitch Phillips [Fri, 3 Nov 2017 20:54:26 +0000 (20:54 +0000)]
[cfi-verify] Add blacklist parsing for result filtering.

Adds blacklist parsing behaviour for filtering results into four categories:

 - Expected Protected: Things that are not in the blacklist and are protected.
 - Unexpected Protected: Things that are in the blacklist and are protected.
 - Expected Unprotected: Things that are in the blacklist and are unprotected.
 - Unexpected Unprotected: Things that are not in the blacklist and are unprotected.

 now can optionally be invoked with a second command line argument, which specifies the blacklist file that the binary was built with.

Current  statistics for chromium:

Reviewers: vlad.tsyrklevich

Subscribers: mgorny, llvm-commits, pcc, kcc

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

llvm-svn: 317364

7 years agoCorrect detection of a thread termination
Kamil Rytarowski [Fri, 3 Nov 2017 20:48:19 +0000 (20:48 +0000)]
Correct detection of a thread termination

Summary:
Stop using the Linux solution with pthread_key_create(3).
This approach does not work on NetBSD, because calling
the thread destructor is not the latest operation on a POSIX
thread entity. NetBSD's libpthread still calls at least
pthread_mutex_lock and pthread_mutex_unlock.

Detect _lwp_exit(2) call as it is really the latest operation
called from a detaching POSIX thread.

This resolves one set of crashes observed in
the Thread Sanitizer execution.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, kcc, vitalybuka, dvyukov, eugenis

Reviewed By: vitalybuka

Subscribers: llvm-commits, kubamracek, #sanitizers

Tags: #sanitizers

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

llvm-svn: 317363

7 years agoRecommit r317351 : Add CallSiteSplitting pass
Jun Bum Lim [Fri, 3 Nov 2017 20:41:16 +0000 (20:41 +0000)]
Recommit r317351 : Add CallSiteSplitting pass

This recommit r317351 after fixing a buildbot failure.

Original commit message:

    Summary:
    This change add a pass which tries to split a call-site to pass
    more constrained arguments if its argument is predicated in the control flow
    so that we can expose better context to the later passes (e.g, inliner, jump
    threading, or IPA-CP based function cloning, etc.).
    As of now we support two cases :

    1) If a call site is dominated by an OR condition and if any of its arguments
    are predicated on this OR condition, try to split the condition with more
    constrained arguments. For example, in the code below, we try to split the
    call site since we can predicate the argument (ptr) based on the OR condition.

    Split from :
          if (!ptr || c)
            callee(ptr);
    to :
          if (!ptr)
            callee(null ptr)  // set the known constant value
          else if (c)
            callee(nonnull ptr)  // set non-null attribute in the argument

    2) We can also split a call-site based on constant incoming values of a PHI
    For example,
    from :
          BB0:
           %c = icmp eq i32 %i1, %i2
           br i1 %c, label %BB2, label %BB1
          BB1:
           br label %BB2
          BB2:
           %p = phi i32 [ 0, %BB0 ], [ 1, %BB1 ]
           call void @bar(i32 %p)
    to
          BB0:
           %c = icmp eq i32 %i1, %i2
           br i1 %c, label %BB2-split0, label %BB1
          BB1:
           br label %BB2-split1
          BB2-split0:
           call void @bar(i32 0)
           br label %BB2
          BB2-split1:
           call void @bar(i32 1)
           br label %BB2
          BB2:
           %p = phi i32 [ 0, %BB2-split0 ], [ 1, %BB2-split1 ]

llvm-svn: 317362

7 years agoDisable detection of on_exit()/TSan on NetBSD
Kamil Rytarowski [Fri, 3 Nov 2017 20:39:51 +0000 (20:39 +0000)]
Disable detection of on_exit()/TSan on NetBSD

Summary:
NetBSD does not ship with on_exit() function.

Introduce TSAN_MAYBE_INTERCEPT_ON_EXIT.
It looks like this addition fixes build for Darwin.

Sponsored by <The NetBSD Foundation>

Reviewers: vitalybuka, joerg, eugenis, dvyukov, kcc

Reviewed By: vitalybuka

Subscribers: llvm-commits, kubamracek, #sanitizers

Tags: #sanitizers

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

llvm-svn: 317361

7 years agoModularize: Include some required headers
David Blaikie [Fri, 3 Nov 2017 20:24:19 +0000 (20:24 +0000)]
Modularize: Include some required headers

DenseMaps require the definition of a type to be available when using a
pointer to that type as a key to know how many bits are available for
tombstone/etc.

llvm-svn: 317360

7 years agoReplace a use of std::for_each() with llvm::for_each(); NFC.
Aaron Ballman [Fri, 3 Nov 2017 20:09:17 +0000 (20:09 +0000)]
Replace a use of std::for_each() with llvm::for_each(); NFC.

llvm-svn: 317359

7 years ago[llvm-ar] Support an options string that start with a dash
Martin Storsjo [Fri, 3 Nov 2017 20:09:10 +0000 (20:09 +0000)]
[llvm-ar] Support an options string that start with a dash

Some projects call $AR like "$AR -crs output input1 input2".

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

llvm-svn: 317358

7 years agoCorrecting some CRLFs that snuck in with my previous commit; NFC.
Aaron Ballman [Fri, 3 Nov 2017 20:05:51 +0000 (20:05 +0000)]
Correcting some CRLFs that snuck in with my previous commit; NFC.

llvm-svn: 317357

7 years agoAdd llvm::for_each as a range-based extensions to <algorithm> and make use of it...
Aaron Ballman [Fri, 3 Nov 2017 20:01:25 +0000 (20:01 +0000)]
Add llvm::for_each as a range-based extensions to <algorithm> and make use of it in some cases where it is a more clear alternative to std::for_each.

llvm-svn: 317356

7 years ago[cfi-verify] Add an interesting unit test where undef search length changes result.
Mitch Phillips [Fri, 3 Nov 2017 20:00:05 +0000 (20:00 +0000)]
[cfi-verify] Add an interesting unit test where undef search length changes result.

Add an interesting unit test, found by changing --search-length-undef from the default. Program handles it correctly but good for ensuring correctness on further changes :)

Reviewers: pcc

Subscribers: mgorny, llvm-commits, kcc, vlad.tsyrklevich

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

llvm-svn: 317355

7 years ago[X86] Promote athlon, athlon-xp, k8, and k8-sse3 to types instead of subtypes in...
Craig Topper [Fri, 3 Nov 2017 19:37:41 +0000 (19:37 +0000)]
[X86] Promote athlon, athlon-xp, k8, and k8-sse3 to types instead of subtypes in getHostCPUName. NFCI

This removes the athlon type and simplifies the string decoding. We only really need these type/subtype breaks where we need to match libgcc/compiler-rt and these CPUs aren't part of that.

I'm looking into moving some of this information to a .def file to share with clang's __builtin_cpu_is handling. And while these CPUs aren't part of that the less lines I have to deal with in the .def file the better.

llvm-svn: 317354

7 years agoRevert "Add CallSiteSplitting pass"
Jun Bum Lim [Fri, 3 Nov 2017 19:17:11 +0000 (19:17 +0000)]
Revert "Add CallSiteSplitting pass"

Revert due to Buildbot failure.

This reverts commit r317351.

llvm-svn: 317353

7 years agoReland "Add support for writing 64-bit symbol tables for archives when offsets become...
Jake Ehrlich [Fri, 3 Nov 2017 19:15:06 +0000 (19:15 +0000)]
Reland "Add support for writing 64-bit symbol tables for archives when offsets become too large for 32-bit"

Tests were failing because some bots were running out of address
space and memory. Additionally the test was very slow. These issues
were solved by changing the test to take advantage of sparse filse and
restricting the test to run only on 64-bit systems.

This should fix https://bugs.llvm.org//show_bug.cgi?id=34189

This change makes it so that if writing a K_GNU style archive, you need
to output a > 32-bit offset it should output in K_GNU64 style instead.

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

llvm-svn: 317352

7 years agoAdd CallSiteSplitting pass
Jun Bum Lim [Fri, 3 Nov 2017 19:01:57 +0000 (19:01 +0000)]
Add CallSiteSplitting pass

Summary:
This change add a pass which tries to split a call-site to pass
more constrained arguments if its argument is predicated in the control flow
so that we can expose better context to the later passes (e.g, inliner, jump
threading, or IPA-CP based function cloning, etc.).
As of now we support two cases :

1) If a call site is dominated by an OR condition and if any of its arguments
are predicated on this OR condition, try to split the condition with more
constrained arguments. For example, in the code below, we try to split the
call site since we can predicate the argument (ptr) based on the OR condition.

Split from :
      if (!ptr || c)
        callee(ptr);
to :
      if (!ptr)
        callee(null ptr)  // set the known constant value
      else if (c)
        callee(nonnull ptr)  // set non-null attribute in the argument

2) We can also split a call-site based on constant incoming values of a PHI
For example,
from :
      BB0:
       %c = icmp eq i32 %i1, %i2
       br i1 %c, label %BB2, label %BB1
      BB1:
       br label %BB2
      BB2:
       %p = phi i32 [ 0, %BB0 ], [ 1, %BB1 ]
       call void @bar(i32 %p)
to
      BB0:
       %c = icmp eq i32 %i1, %i2
       br i1 %c, label %BB2-split0, label %BB1
      BB1:
       br label %BB2-split1
      BB2-split0:
       call void @bar(i32 0)
       br label %BB2
      BB2-split1:
       call void @bar(i32 1)
       br label %BB2
      BB2:
       %p = phi i32 [ 0, %BB2-split0 ], [ 1, %BB2-split1 ]

Reviewers: davidxl, huntergr, chandlerc, mcrosier, eraman, davide

Reviewed By: davidxl

Subscribers: sdesmalen, ashutosh.nema, fhahn, mssimpso, aemerson, mgorny, mehdi_amini, kristof.beyls, llvm-commits

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

llvm-svn: 317351

7 years ago[llvm-objcopy] Add support for dwarf fission
Jake Ehrlich [Fri, 3 Nov 2017 18:58:41 +0000 (18:58 +0000)]
[llvm-objcopy] Add support for dwarf fission

This change adds support for dwarf fission.

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

llvm-svn: 317350

7 years ago[AArch64] Fix the number of iterations for the Newton series
Evandro Menezes [Fri, 3 Nov 2017 18:56:36 +0000 (18:56 +0000)]
[AArch64] Fix the number of iterations for the Newton series

The number of iterations was incorrectly determined for DP FP vector types
and the tests were insufficient to flag this issue.

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

llvm-svn: 317349

7 years agoThe patch fixes PR35131
Evgeny Stupachenko [Fri, 3 Nov 2017 18:50:03 +0000 (18:50 +0000)]
The patch fixes PR35131

Summary:

Fix a misprint which led to false CTLZ recognition.

Reviewers: craig.topper

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

From: Evgeny Stupachenko <evstupac@gmail.com>
llvm-svn: 317348

7 years agoRevert "Rename fields of ompt_frame_t"
Jonas Hahnfeld [Fri, 3 Nov 2017 18:28:25 +0000 (18:28 +0000)]
Revert "Rename fields of ompt_frame_t"

This reverts commit r317338 which discarded some recent commits.

llvm-svn: 317347

7 years agoRevert "Updating implementation of OMPT as specified in OpenMP 5.0 Preview 2 (TR6)"
Jonas Hahnfeld [Fri, 3 Nov 2017 18:28:19 +0000 (18:28 +0000)]
Revert "Updating implementation of OMPT as specified in OpenMP 5.0 Preview 2 (TR6)"

This reverts commit r317339 which discarded some recent commits.

llvm-svn: 317346

7 years agoRevert "Invoke salvageDebugInfo from CodeGenPrepare's SinkCast()"
Adrian Prantl [Fri, 3 Nov 2017 18:26:36 +0000 (18:26 +0000)]
Revert "Invoke salvageDebugInfo from CodeGenPrepare's SinkCast()"

This reverts commit 317342 while investigating bot breakage.

llvm-svn: 317345

7 years agoMove Extract.cpp that wasn't moved in r317343
Alex Lorenz [Fri, 3 Nov 2017 18:21:06 +0000 (18:21 +0000)]
Move Extract.cpp that wasn't moved in r317343

llvm-svn: 317344

7 years ago[refactor][extract] insert semicolons into extracted/inserted code
Alex Lorenz [Fri, 3 Nov 2017 18:11:22 +0000 (18:11 +0000)]
[refactor][extract] insert semicolons into extracted/inserted code
when needed

This commit implements the semicolon insertion logic into the extract
refactoring. The following rules are used:

- extracting expression: add terminating ';' to the extracted function.
- extracting statements that don't require terminating ';' (e.g. switch): add
  terminating ';' to the callee.
- extracting statements with ';':  move (if possible) the original ';' from the
  callee and add terminating ';'.
- otherwise, add ';' to both places.

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

llvm-svn: 317343

7 years ago[CodeGen] Remove unnecessary semicolons to fix a warning. NFC
Craig Topper [Fri, 3 Nov 2017 18:02:46 +0000 (18:02 +0000)]
[CodeGen] Remove unnecessary semicolons to fix a warning. NFC

llvm-svn: 317342

7 years ago[X86] Initialize Type and Subtype in getHostCPUName to 0.
Craig Topper [Fri, 3 Nov 2017 18:02:44 +0000 (18:02 +0000)]
[X86] Initialize Type and Subtype in getHostCPUName to 0.

llvm-svn: 317341

7 years agoInvoke salvageDebugInfo from CodeGenPrepare's SinkCast()
Adrian Prantl [Fri, 3 Nov 2017 18:00:02 +0000 (18:00 +0000)]
Invoke salvageDebugInfo from CodeGenPrepare's SinkCast()

This preserves the debug info for the cast operation in the original location.

rdar://problem/33460652

llvm-svn: 317340

7 years agoUpdating implementation of OMPT as specified in OpenMP 5.0 Preview 2 (TR6)
Joachim Protze [Fri, 3 Nov 2017 17:09:00 +0000 (17:09 +0000)]
Updating implementation of OMPT as specified in OpenMP 5.0 Preview 2 (TR6)

The TR6 document is expected to be publically released around November 15.
This patch does not implement OMPT for libomptarget.

Patch by Simon Convent and Joachim Protze

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

llvm-svn: 317339

7 years agoRename fields of ompt_frame_t
Joachim Protze [Fri, 3 Nov 2017 17:08:40 +0000 (17:08 +0000)]
Rename fields of ompt_frame_t

This is part of the renaming of data types from OpenMP TR4 to TR6

Patch by Simon Convent

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

llvm-svn: 317338

7 years ago[Driver] Add Scudo as a possible -fsanitize= option
Kostya Kortchinsky [Fri, 3 Nov 2017 17:04:13 +0000 (17:04 +0000)]
[Driver] Add Scudo as a possible -fsanitize= option

Summary:
This change adds Scudo as a possible Sanitizer option via -fsanitize=.
This allows for easier static & shared linking of the Scudo library, it allows
us to enforce PIE (otherwise the security of the allocator is moot), and check
for incompatible Sanitizers combo.

In its current form, Scudo is not compatible with any other Sanitizer, but the
plan is to make it work in conjunction with UBsan (-fsanitize=scudo,undefined),
which will require additional work outside of the scope of this change.

Reviewers: eugenis, kcc, alekseyshl

Reviewed By: eugenis, alekseyshl

Subscribers: llvm-commits, srhines

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

llvm-svn: 317337

7 years ago[CodeGen] add libcall attr tests to show errno-related diffs; NFC
Sanjay Patel [Fri, 3 Nov 2017 16:27:27 +0000 (16:27 +0000)]
[CodeGen] add libcall attr tests to show errno-related diffs; NFC

See rL317220 for the builtin siblings.

llvm-svn: 317336

7 years ago[LICM] sink through non-trivially replicable PHI
Jun Bum Lim [Fri, 3 Nov 2017 16:24:53 +0000 (16:24 +0000)]
[LICM] sink through non-trivially replicable PHI

Summary:
The current LICM allows sinking an instruction only when it is exposed to exit
blocks through a trivially replacable PHI of which all incoming values are the
same instruction. This change enhance LICM to sink a sinkable instruction
through non-trivially replacable PHIs by spliting predecessors of loop
exits.

Reviewers: hfinkel, majnemer, davidxl, bmakam, mcrosier, danielcdh, efriedma, jtony

Reviewed By: efriedma

Subscribers: nemanjai, dberlin, llvm-commits

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

llvm-svn: 317335

7 years ago[SLP] Test for PR23510, NFC.
Alexey Bataev [Fri, 3 Nov 2017 16:17:13 +0000 (16:17 +0000)]
[SLP] Test for PR23510, NFC.

llvm-svn: 317334

7 years agoUse ToolExecutor framework in the sample tool-template.
Eric Liu [Fri, 3 Nov 2017 16:03:56 +0000 (16:03 +0000)]
Use ToolExecutor framework in the sample tool-template.

llvm-svn: 317333

7 years ago[Tooling] Fix linking of StandaloneToolExecutorPlugin.
Eric Liu [Fri, 3 Nov 2017 15:57:27 +0000 (15:57 +0000)]
[Tooling] Fix linking of StandaloneToolExecutorPlugin.

llvm-svn: 317332

7 years ago[mips] Match 'ins' and its' variants with C++ code
Simon Dardis [Fri, 3 Nov 2017 15:35:13 +0000 (15:35 +0000)]
[mips] Match 'ins' and its' variants with C++ code

Change the ISel matching of 'ins', 'dins[mu]' from tablegen code to
C++ code. This resolves an issue where ISel would select 'dins' instead
of 'dinsm' when the instructions size and position were individually in
range but their sum was out of range according to the ISA specification.

Reviewers: atanasyan

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

llvm-svn: 317331

7 years agoFix for Bug 34475 - LOCK/REP/REPNE prefixes emitted as instruction on their own.
Andrew V. Tischenko [Fri, 3 Nov 2017 15:25:13 +0000 (15:25 +0000)]
Fix for Bug 34475 - LOCK/REP/REPNE prefixes emitted as instruction on their own.
Differential Revision: https://reviews.llvm.org/D39546

llvm-svn: 317330

7 years agoAdd float/vector registers for ppc64le
Pavel Labath [Fri, 3 Nov 2017 15:22:36 +0000 (15:22 +0000)]
Add float/vector registers for ppc64le

Summary: Add read and write functions for VSX, VMX and float registers and fix watchpoint size

Reviewers: clayborg

Reviewed By: clayborg

Subscribers: eugene, labath, clayborg, nemanjai, kbarton, JDevlieghere, anajuliapc, gut, lbianc, lldb-commits

Differential Revision: https://reviews.llvm.org/D39487
Patch by: Alexandre Yukio Yamashita <alexandre.yamashita@eldorado.org.br>

llvm-svn: 317329

7 years ago[Tooling] Put createExecutorFromCommandLineArgs implementation in a wrapper. NFC
Eric Liu [Fri, 3 Nov 2017 15:20:57 +0000 (15:20 +0000)]
[Tooling] Put createExecutorFromCommandLineArgs implementation in a wrapper. NFC

llvm-svn: 317328

7 years agoAdd type to FileSpec::PathSyntax enum.
Don Hinton [Fri, 3 Nov 2017 14:59:36 +0000 (14:59 +0000)]
Add type to FileSpec::PathSyntax enum.

Summary:
Add type to FileSpec::PathSyntax enum to decrease size for
FileSpec on systems with 32 bit pointers.

Thanks to @zturner for pointing this out.

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

llvm-svn: 317327

7 years agoXfail test_stack_info_in_minidump test
Pavel Labath [Fri, 3 Nov 2017 14:42:37 +0000 (14:42 +0000)]
Xfail test_stack_info_in_minidump test

The test has been failing since we enabled the i386 ABI plugin on
windows. See pr35193 for details.

llvm-svn: 317326

7 years ago[clang-format] Sort using-declarations case sensitively with a special case for '_'
Krasimir Georgiev [Fri, 3 Nov 2017 14:38:07 +0000 (14:38 +0000)]
[clang-format] Sort using-declarations case sensitively with a special case for '_'

Summary:
This makes clang-format sort using declarations case-sensitive with the
exception that '_' comes just before 'A'. This is better than the current case
insensitive version, because it groups uppercase names in the same namespace
together.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits, klimek

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

llvm-svn: 317325

7 years ago[LoopPredication] NFC: Refactored code to separate out functions being reused
Anna Thomas [Fri, 3 Nov 2017 14:25:39 +0000 (14:25 +0000)]
[LoopPredication] NFC: Refactored code to separate out functions being reused

Summary:
Refactored the code to separate out common functions that are being
reused.
This is to reduce the changes for changes coming up wrt loop
predication with reverse loops.

This refactoring is what we have in our downstream code.

llvm-svn: 317324

7 years ago[ADCE] Use MapVector for BlockInfo to make iteration order deterministic
Mikael Holmen [Fri, 3 Nov 2017 14:15:08 +0000 (14:15 +0000)]
[ADCE] Use MapVector for BlockInfo to make iteration order deterministic

Summary:
Also added a reserve() method to MapVector since we want to use that from
ADCE.

DenseMap does not provide deterministic iteration order so with that
we will handle the members of BlockInfo in random order, eventually
leading to random order of the blocks in the predecessor lists.

Without this change, I get the same predecessor order in about 90% of the
time when I compile a certain reproducer and in 10% I get a different one.

No idea how to make a proper test case for this.

Reviewers: kuhar, david2050

Reviewed By: kuhar

Subscribers: llvm-commits

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

llvm-svn: 317323

7 years ago[clangd] Handle clangd.applyFix server-side
Marc-Andre Laperle [Fri, 3 Nov 2017 13:39:15 +0000 (13:39 +0000)]
[clangd] Handle clangd.applyFix server-side

Summary:
When the user selects a fix-it (or any code action with commands), it is
possible to let the client forward the selected command to the server.
When the clangd.applyFix command is handled on the server, it can send a
workspace/applyEdit request to the client. This has the advantage that
the client doesn't explicitly have to know how to handle
clangd.applyFix. Therefore, the code to handle clangd.applyFix in the VS
Code extension (and any other Clangd client) is not required anymore.

Reviewers: ilya-biryukov, sammccall, Nebiroth, hokein

Reviewed By: hokein

Subscribers: ioeric, hokein, rwols, puremourning, bkramer, ilya-biryukov

Tags: #clang-tools-extra

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

llvm-svn: 317322

7 years ago[ELF] - Remove excessive field initialization. NFC.
George Rimar [Fri, 3 Nov 2017 13:19:41 +0000 (13:19 +0000)]
[ELF] - Remove excessive field initialization. NFC.

It is already initialized in header file to same value.

llvm-svn: 317320

7 years agoFix classifications on two concurrent event tests
Pavel Labath [Fri, 3 Nov 2017 12:13:22 +0000 (12:13 +0000)]
Fix classifications on two concurrent event tests

I have classified one as a watchpoint test even though it wasn't and
vice versa. Fix that.

llvm-svn: 317319

7 years agore-land [ExpandMemCmp] Split ExpandMemCmp from CodeGen into its own pass."
Clement Courbet [Fri, 3 Nov 2017 12:12:27 +0000 (12:12 +0000)]
re-land [ExpandMemCmp] Split ExpandMemCmp from CodeGen into its own pass."

Fix undefined references: ExpandMemCmp belongs to CodeGen/, not Scalar/.

llvm-svn: 317318

7 years ago[ELf] - Fix compilation after r317307.
George Rimar [Fri, 3 Nov 2017 11:57:01 +0000 (11:57 +0000)]
[ELf] - Fix compilation after r317307.

Not sure why that seems did not break any llvm bots or
my windows local build, but is was required to fix compilation
breakage of my ubuntu build when using
gcc version 8.0.0 20171019 (experimental)

llvm-svn: 317317

7 years ago[ELF] - Removed unused variable. NFC.
George Rimar [Fri, 3 Nov 2017 11:51:58 +0000 (11:51 +0000)]
[ELF] - Removed unused variable. NFC.

llvm-svn: 317316

7 years ago[X86][SSE] Add PACKUS support to combineVectorTruncation
Simon Pilgrim [Fri, 3 Nov 2017 11:33:48 +0000 (11:33 +0000)]
[X86][SSE] Add PACKUS support to combineVectorTruncation

Similar to the existing code to lower to PACKSS, we can use PACKUS if the input vector's leading zero bits extend all the way to the packed/truncated value.

We have to account for pre-SSE41 targets not supporting PACKUSDW

llvm-svn: 317315

7 years ago[PartialInliner] Skip call sites where inlining fails.
Florian Hahn [Fri, 3 Nov 2017 11:29:00 +0000 (11:29 +0000)]
[PartialInliner] Skip call sites where inlining fails.

Summary:
InlineFunction can fail, for example when trying to inline vararg
fuctions. In those cases, we do not want to bump partial inlining
counters or set AnyInlined to true, because this could leave an unused
function hanging around.

Reviewers: davidxl, davide, gyiu

Reviewed By: davide

Subscribers: llvm-commits, eraman

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

llvm-svn: 317314

7 years ago[globalisel][tablegen] Skip src child predicates
Diana Picus [Fri, 3 Nov 2017 10:30:19 +0000 (10:30 +0000)]
[globalisel][tablegen] Skip src child predicates

The GlobalISel TableGen backend didn't check for predicates on the
source children. This caused it to generate code for ARM patterns such
as SMLABB or similar, but without properly checking for the sext_16_node
part of the operands. This in turn meant that we would select SMLABB
instead of MLA for simple sequences such as s32 + s32 * s32, which is
wrong (we want a MLA on the full operands, not just their bottom 16
bits).

This patch forces TableGen to skip patterns with predicates on the src
children, so it doesn't generate code for SMLABB and other similar ARM
instructions at all anymore. AArch64 and X86 are not affected.

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

llvm-svn: 317313

7 years ago[ARM GlobalISel] Move the check for Thumb higher up
Diana Picus [Fri, 3 Nov 2017 10:30:12 +0000 (10:30 +0000)]
[ARM GlobalISel] Move the check for Thumb higher up

We're currently bailing out for Thumb targets while lowering formal
parameters, but there used to be some other checks before it, which
could've caused some functions (e.g. those without formal parameters) to
sneak through unnoticed.

llvm-svn: 317312

7 years ago[Analysis] Refine matching and merging of TBAA tags
Ivan A. Kosarev [Fri, 3 Nov 2017 10:26:25 +0000 (10:26 +0000)]
[Analysis] Refine matching and merging of TBAA tags

This patch combines the code that matches and merges TBAA access
tags. The aim is to simplify future changes and making sure that
these operations produce consistent results.

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

llvm-svn: 317311

7 years ago[PEI] Simplify handling of targets with no phys regs. NFC
Francis Visoiu Mistrih [Fri, 3 Nov 2017 09:46:36 +0000 (09:46 +0000)]
[PEI] Simplify handling of targets with no phys regs. NFC

Make doSpillCalleeSavedRegs a member function, instead of passing most of the
members of PEI as arguments.

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

llvm-svn: 317309

7 years ago[preamble] Also record the "skipping" state of the preprocessor
Erik Verbruggen [Fri, 3 Nov 2017 09:40:07 +0000 (09:40 +0000)]
[preamble] Also record the "skipping" state of the preprocessor

When a preamble ends in a conditional preprocessor block that is being
skipped, the preprocessor needs to continue skipping that block when
the preamble is used.

This fixes PR34570.

llvm-svn: 317308

7 years ago[ELF] - Linkerscript: fixed non-determinism when handling MEMORY.
George Rimar [Fri, 3 Nov 2017 08:21:51 +0000 (08:21 +0000)]
[ELF] - Linkerscript: fixed non-determinism when handling MEMORY.

When findMemoryRegion do search to find a region for output section it
iterates over MemoryRegions which is DenseMap and so does not
guarantee iteration in insertion order. As a result selected region depends
on its name and not on its definition position
Testcase shows the issue, patch fixes it. Behavior after applying the patch
seems consistent with bfd.

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

llvm-svn: 317307

7 years ago[ELF] - Teach LLD to strip .zdebug_* sections when --strip-debug/--strip-all is speci...
George Rimar [Fri, 3 Nov 2017 08:13:16 +0000 (08:13 +0000)]
[ELF] - Teach LLD to strip .zdebug_* sections when --strip-debug/--strip-all is specified.

Currently we do not strip .zdebug_*, what looks wrong.
Also this simplifies the testcase we have for this options.

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

llvm-svn: 317306

7 years ago[ELF] - Teach LLD to use information from .debug_str for error reporting.
George Rimar [Fri, 3 Nov 2017 08:04:27 +0000 (08:04 +0000)]
[ELF] - Teach LLD to use information from .debug_str for error reporting.

Recently we teached LLD to report line numbers for duplicate variables
definitions, though currently LLD is unable to do that for case when
strings are not built in .debug_info, but stored in .debug_str instead.
That is because out LLDDwarfObj does not handle .debug_str yet.
Patch fixes that.

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

llvm-svn: 317305

7 years ago[AArch64] Use dwarf exception handling on MinGW
Martin Storsjo [Fri, 3 Nov 2017 07:33:20 +0000 (07:33 +0000)]
[AArch64] Use dwarf exception handling on MinGW

Ideally we should probably produce WinEH here as well, but until
then, we can use dwarf exceptions, without any further changes
required in clang, libunwind or libcxxabi.

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

llvm-svn: 317304

7 years ago[NFC] Get rid of hard-coded value ID in test
Max Kazantsev [Fri, 3 Nov 2017 07:30:45 +0000 (07:30 +0000)]
[NFC] Get rid of hard-coded value ID in test

llvm-svn: 317303

7 years ago[MinGW] Add an option -Xlink for passing options through to lld-link
Martin Storsjo [Fri, 3 Nov 2017 07:18:37 +0000 (07:18 +0000)]
[MinGW] Add an option -Xlink for passing options through to lld-link

Also move the -mllvm option to the right section of the options
list.

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

llvm-svn: 317302

7 years ago[llvm-nm] Don't error out on multiple occurrances of the -g/--external-only flag
Martin Storsjo [Fri, 3 Nov 2017 07:18:21 +0000 (07:18 +0000)]
[llvm-nm] Don't error out on multiple occurrances of the -g/--external-only flag

GNU binutils nm doesn't error out on this, and some projects' build
systems can end up doing that in some cases. Allowing that seems like
a better target than trying to avoid user projects passing multiple
-g parameters to $NM.

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

llvm-svn: 317301

7 years ago[llvm-nm] Print 'I' for import table data in COFF
Martin Storsjo [Fri, 3 Nov 2017 07:18:14 +0000 (07:18 +0000)]
[llvm-nm] Print 'I' for import table data in COFF

The character gets uppercased into 'I' when it's a global symbol.

In GNU binutils, nm prints 'I' for symbols classified by
bfd_is_ind_section - which probably isn't exactly/only import
tables.

When building for win32, (some incarnations of?) libtool has got
rules that try to inspect linked libraries, and in order to
be sure that it is linking to a DLL import library as opposed to
a static library, it expects to find the string " I " in the output
of $NM when run on such an import library.

GNU binutils nm also flags all of the .idata$X chunks as 'i' (while
this patch only makes it set on .idata$2 and .idata$6) and also
flags __imp__function as 'I'.

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

llvm-svn: 317300

7 years ago[X86] Remove PALIGNR/VALIGN handling from combineBitcastForMaskedOp and move to isel...
Craig Topper [Fri, 3 Nov 2017 06:48:02 +0000 (06:48 +0000)]
[X86] Remove PALIGNR/VALIGN handling from combineBitcastForMaskedOp and move to isel patterns instead. Prefer 128-bit VALIGND/VALIGNQ over PALIGNR during lowering when possible.

llvm-svn: 317299

7 years ago[TableGen] Add an extra blank line to DAGISel output file to separate functions.
Craig Topper [Fri, 3 Nov 2017 05:19:34 +0000 (05:19 +0000)]
[TableGen] Add an extra blank line to DAGISel output file to separate functions.

llvm-svn: 317298

7 years ago[CUDA] Mark CUDA as a no-errno platform.
Justin Lebar [Fri, 3 Nov 2017 02:30:00 +0000 (02:30 +0000)]
[CUDA] Mark CUDA as a no-errno platform.

Summary:
CUDA doesn't support errno at all, so this is the right thing -- or at
least, in the right direction.

But also, this unbreaks the CUDA test-suite math tests [0] after D39481.
__cuda_cmath.h forwards nexttoward() to __builtin_nexttoward, which,
after that patch, was lowering to a libcall that doesn't exist in NVPTX.

[0] http://lab.llvm.org:8011/builders/clang-cuda-build/builds/14999

Reviewers: tra

Subscribers: sanjoy, cfe-commits

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

llvm-svn: 317297