OSDN Git Service

android-x86/external-llvm.git
5 years ago[SimplifyCFG] Fix a cost modeling oversight in branch commoning
Philip Reames [Thu, 30 Aug 2018 00:03:02 +0000 (00:03 +0000)]
[SimplifyCFG] Fix a cost modeling oversight in branch commoning

The cost modeling was not accounting for the fact we were duplicating the instruction once per predecessor.  With a default threshold of 1, this meant we were actually creating #pred copies.

Adding to the fun, there is *absolutely no* test coverage for this.  Simply bailing for more than one predecessor passes all checked in tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341001 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MS Demangler] Fix several crashes and demangling bugs.
Zachary Turner [Wed, 29 Aug 2018 23:56:09 +0000 (23:56 +0000)]
[MS Demangler] Fix several crashes and demangling bugs.

These bugs were found by writing a Python script which spidered
the entire Chromium build directory tree demangling every symbol
in every object file.  At the start, the tool printed:

  Processed 27443 object files.
  2926377/2936108 symbols successfully demangled (99.6686%)
  9731 symbols could not be demangled (0.3314%)
  14589 files crashed while demangling (53.1611%)

After this patch, it prints:

  Processed 27443 object files.
  41295518/41295617 symbols successfully demangled (99.9998%)
  99 symbols could not be demangled (0.0002%)
  0 files crashed while demangling (0.0000%)

The issues fixed in this patch are:

  * Ignore empty parameter packs.  Previously we would encounter
    a mangling for an empty parameter pack and add a null node
    to the AST.  Since we don't print these anyway, we now just
    don't add anything to the AST and ignore it entirely.  This
    fixes some of the crashes.

  * Account for "incorrect" string literal demanglings.  Apparently
    an older version of clang would not truncate mangled string
    literals to 32 bytes of encoded character data.  The demangling
    code however would allocate a 32 byte buffer thinking that it
    would not encounter more than this, and overrun the buffer.
    We now demangle up to 128 bytes of data, since the buggy
    clang would encode up to 32 *characters* of data.

  * Extended support for demangling init-fini stubs.  If you had
    something like
      struct Foo {
        static vector<string> S;
      };
    this would generate a dynamic atexit initializer *for the
    variable*.  We didn't handle this, but now we print something
    nice.  This is actually an improvement over undname, which will
    fail to demangle this at all.

  * Fixed one case of static this adjustment.  We weren't handling
    several thunk codes so we didn't recognize the mangling.  These
    are now handled.

  * Fixed a back-referencing problem.  Member pointer templates
    should have their components considered for back-referencing

The remaining 99 symbols which can't be demangled are all symbols
which are compiler-generated and undname can't demangle either.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341000 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Make getPreferredAlignment honor section markings.
Eli Friedman [Wed, 29 Aug 2018 23:46:26 +0000 (23:46 +0000)]
[NFC] Make getPreferredAlignment honor section markings.

This should more accurately reflect what the AsmPrinter will actually
do.

This is NFC, as far as I can tell; all the places that might be affected
already have an extra check to avoid using the result of
getPreferredAlignment in this situation.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340999 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SimplifyCFG] Common debug handling [NFC]
Philip Reames [Wed, 29 Aug 2018 23:22:07 +0000 (23:22 +0000)]
[SimplifyCFG] Common debug handling [NFC]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340997 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-strip] Fix -p|--preserve-dates to not truncate output when used in-place.
Jordan Rupprecht [Wed, 29 Aug 2018 23:21:56 +0000 (23:21 +0000)]
[llvm-strip] Fix -p|--preserve-dates to not truncate output when used in-place.

The restoreDateOnFile() method used to preserve dates uses sys::fs::openFileForWrite(). That method defaults to opening files with CD_CreateAlways, which truncates the output file if it exists. Use CD_OpenExisting instead to open it and *not* truncate it, which also has the side benefit of erroring if the file does not exist (it should always exist, because we just wrote it out).

Also, fix the test case to make sure the output is a valid output file, and not empty. The extra test assertions are enough to catch this regression.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340996 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MemorySSA] Silence warning.
Alina Sbirlea [Wed, 29 Aug 2018 23:20:29 +0000 (23:20 +0000)]
[MemorySSA] Silence warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340995 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoReverse subregister saved loops in register usage info collector; NFC
Matthias Braun [Wed, 29 Aug 2018 23:12:42 +0000 (23:12 +0000)]
Reverse subregister saved loops in register usage info collector; NFC

On AMDGPU we have 70 register classes, so iterating over all 70
each time and exiting is costly on the CPU, this flips the loop
around so that it loops over the 70 register classes first,
and exits without doing the inner loop if needed.

On my test just starting radv this takes
RegUsageInfoCollector::runOnMachineFunction
from 6.0% of total time to 2.7% of total time,
and reduces the startup from 2.24s to 2.19s

Patch by David Airlie!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340993 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r340947 "[InstCombine] Expand the simplification of pow() into exp2()"
Reid Kleckner [Wed, 29 Aug 2018 22:58:33 +0000 (22:58 +0000)]
Revert r340947 "[InstCombine] Expand the simplification of pow() into exp2()"

It broke the clang-cl self-host.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340991 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MemorySSA] Fix checkClobberSanity to skip Start only for Defs and Uses.
Alina Sbirlea [Wed, 29 Aug 2018 22:38:51 +0000 (22:38 +0000)]
[MemorySSA] Fix checkClobberSanity to skip Start only for Defs and Uses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340981 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd a todo and tests to Address a review commnt from D50925 [NFC]
Philip Reames [Wed, 29 Aug 2018 22:09:21 +0000 (22:09 +0000)]
Add a todo and tests to Address a review commnt from D50925 [NFC]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340978 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LICM] Hoist stores of invariant values to invariant addresses out of loops
Philip Reames [Wed, 29 Aug 2018 21:49:30 +0000 (21:49 +0000)]
[LICM] Hoist stores of invariant values to invariant addresses out of loops

Teach LICM to hoist stores out of loops when the store writes to a location otherwise unused in the loop, writes a value which is invariant, and is guaranteed to execute if the loop is entered.

Worth noting is that this transformation is partially overlapping with the existing promotion transformation. Reasons this is worthwhile anyway include:
 * For multi-exit loops, this doesn't require duplication of the store.
 * It kicks in for case where we can't prove we exit through a normal exit (i.e. we may throw), but can prove the store executes before that possible side exit.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340974 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU: Handle 32-bit address wraparounds for SMRD opcodes
Marek Olsak [Wed, 29 Aug 2018 20:03:00 +0000 (20:03 +0000)]
AMDGPU: Handle 32-bit address wraparounds for SMRD opcodes

Summary: This fixes GPU hangs with OpenGL bindless handle arithmetic.

Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340959 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SimpleLoopUnswitch] After unswitch delete dead blocks in parent loops
Fedor Sergeev [Wed, 29 Aug 2018 19:10:44 +0000 (19:10 +0000)]
[SimpleLoopUnswitch] After unswitch delete dead blocks in parent loops

Summary:
Assert from PR38737 happens on the dead block inside the parent loop
after unswitching nontrivial switch in the inner loop.

deleteDeadBlocksFromLoop now takes extra care to detect/remove dead
blocks in all the parent loops in addition to the blocks from original
loop being unswitched.

Reviewers: asbirlea, chandlerc

Reviewed By: asbirlea

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340955 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[libFuzzer] Port to Windows"
Matt Morehouse [Wed, 29 Aug 2018 18:40:41 +0000 (18:40 +0000)]
Revert "[libFuzzer] Port to Windows"

This reverts r340949 due to bot breakage again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340954 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] canonicalize fneg with llvm.sin
Sanjay Patel [Wed, 29 Aug 2018 18:27:49 +0000 (18:27 +0000)]
[InstCombine] canonicalize fneg with llvm.sin

This is a follow-up to rL339604 which did the same transform
for a sin libcall. The handling of intrinsics vs. libcalls
is unfortunately scattered, so I'm just adding this next to
the existing transform for llvm.cos for now.

This should resolve PR38458:
https://bugs.llvm.org/show_bug.cgi?id=38458
If the call was already negated, the negates will cancel
each other out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340952 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MemorySSA] Add expesive check for validating clobber accesses.
Alina Sbirlea [Wed, 29 Aug 2018 18:26:04 +0000 (18:26 +0000)]
[MemorySSA] Add expesive check for validating clobber accesses.

Summary: Add validation of clobber accesses as expensive check.

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, Prazek, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340951 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] add tests for llvm.sin(-x); NFC
Sanjay Patel [Wed, 29 Aug 2018 18:11:42 +0000 (18:11 +0000)]
[InstCombine] add tests for llvm.sin(-x); NFC

Also add a corresponding test for llvm.cos with FMF to
make sure that was handled correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340950 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[libFuzzer] Port to Windows
Matt Morehouse [Wed, 29 Aug 2018 18:08:34 +0000 (18:08 +0000)]
[libFuzzer] Port to Windows

Summary:
Port libFuzzer to windows-msvc.
This patch allows libFuzzer targets to be built and run on Windows, using -fsanitize=fuzzer and/or fsanitize=fuzzer-no-link. It allows these forms of coverage instrumentation to work on Windows as well.
It does not fix all issues, such as those with -fsanitize-coverage=stack-depth, which is not usable on Windows as of this patch.
It also does not fix any libFuzzer integration tests. Nearly all of them fail to compile, fixing them will come in a later patch, so libFuzzer tests are disabled on Windows until them.

Reviewers: morehouse, rnk

Reviewed By: morehouse, rnk

Subscribers: #sanitizers, delcypher, morehouse, kcc, eraman

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340949 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Expand the simplification of pow() with nested exp{,2}()
Evandro Menezes [Wed, 29 Aug 2018 17:59:48 +0000 (17:59 +0000)]
[InstCombine] Expand the simplification of pow() with nested exp{,2}()

Expand the simplification of `pow(exp{,2}(x), y)` to all FP types.

This improvement helps some benchmarks in SPEC CPU2000 and CPU2006, such as
252.eon, 447.dealII, 453.povray.  Otherwise, no significant regressions on
x86-64 or A64.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340948 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Expand the simplification of pow() into exp2()
Evandro Menezes [Wed, 29 Aug 2018 17:59:34 +0000 (17:59 +0000)]
[InstCombine] Expand the simplification of pow() into exp2()

Generalize the simplification of `pow(2.0, y)` to `pow(2.0 ** n, y)` for all
scalar and vector types.

This improvement helps some benchmarks in SPEC CPU2000 and CPU2006, such as
252.eon, 447.dealII, 453.povray.  Otherwise, no significant regressions on
x86-64 or A64.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340947 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-mca] Add fields "Total uOps" and "uOps Per Cycle" to the report generated by...
Andrea Di Biagio [Wed, 29 Aug 2018 17:56:39 +0000 (17:56 +0000)]
[llvm-mca] Add fields "Total uOps" and "uOps Per Cycle" to the report generated by the SummaryView.

This patch adds two new fields to the perf report generated by the SummaryView.
Fields are now logically organized into two small groups; only the second group
contains throughput indicators.

Example:
```
Iterations:        100
Instructions:      300
Total Cycles:      414
Total uOps:        700

Dispatch Width:    4
uOps Per Cycle:    1.69
IPC:               0.72
Block RThroughput: 4.0
```

This patch also updates the docs for llvm-mca.
Due to the nature of this change, several tests in the tools/llvm-mca directory
were affected, and had to be updated using script `update_mca_test_checks.py`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340946 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-mca] Don't disable the SummaryView if flag `-all-stats` is false.
Andrea Di Biagio [Wed, 29 Aug 2018 17:40:04 +0000 (17:40 +0000)]
[llvm-mca] Don't disable the SummaryView if flag `-all-stats` is false.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340945 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MinGW] [X86] Add stubs for references to data variables that might end up imported...
Martin Storsjo [Wed, 29 Aug 2018 17:28:34 +0000 (17:28 +0000)]
[MinGW] [X86] Add stubs for references to data variables that might end up imported from a dll

Variables declared with the dllimport attribute are accessed via a
stub variable named __imp_<var>. In MinGW configurations, variables that
aren't declared with a dllimport attribute might still end up imported
from another DLL with runtime pseudo relocs.

For x86_64, this avoids the risk that the target is out of range
for a 32 bit PC relative reference, in case the target DLL is loaded
further than 4 GB from the reference. It also avoids having to make the
text section writable at runtime when doing the runtime fixups, which
makes it worthwhile to do for i386 as well.

Add stub variables for all dso local data references where a definition
of the variable isn't visible within the module, since the DLL data
autoimporting might make them imported even though they are marked as
dso local within LLVM.

Don't do this for variables that actually are defined within the same
module, since we then know for sure that it actually is dso local.

Don't do this for references to functions, since there's no need for
runtime pseudo relocations for autoimporting them; if a function from
a different DLL is called without the appropriate dllimport attribute,
the call just gets routed via a thunk instead.

GCC does something similar since 4.9 (when compiling with -mcmodel=medium
or large; from that version, medium is the default code model for x86_64
mingw), but only for x86_64.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340942 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Replace two calls to getNumUses() with !hasNUsesOrMore
Craig Topper [Wed, 29 Aug 2018 17:09:21 +0000 (17:09 +0000)]
[InstCombine] Replace two calls to getNumUses() with !hasNUsesOrMore

We were calling getNumUses to check for 1 or 2 uses. But getNumUses is linear in the number of uses. We can instead use !hasNUsesOrMore(3) which will stop the linear scan as soon as it determines there are at least 3 uses even if there are more.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340939 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoUpdate Visual Studio Integration version number.
Zachary Turner [Wed, 29 Aug 2018 16:57:37 +0000 (16:57 +0000)]
Update Visual Studio Integration version number.

This updates the version number in the manifest file to match
the SVN revision at which it was committed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340938 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] Match udot4 pattern.
Farhana Aleen [Wed, 29 Aug 2018 16:31:18 +0000 (16:31 +0000)]
[AMDGPU] Match udot4 pattern.

Summary: D.u32 = S0.u8[0] * S1.u8[0] +
                 S0.u8[1] * S1.u8[1] +
                 S0.u8[2] * S1.u8[2] +
                 S0.u8[3] * S1.u8[3] + S2.u32

Author: FarhanaAleen

Reviewed By: arsenm

Subscribers: llvm-commits, AMDGPU

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340936 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DebugCounters] Fix DebugCounterTest when running all SupportTests
Alexandre Ganea [Wed, 29 Aug 2018 16:11:48 +0000 (16:11 +0000)]
[DebugCounters] Fix DebugCounterTest when running all SupportTests

Previously, the DebugCounterTest was failing because CommandLineTest.GetCommandLineArguments was clearing all the global singletons.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340935 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] add test for vector demanded elements + shrinking; NFC
Sanjay Patel [Wed, 29 Aug 2018 15:34:19 +0000 (15:34 +0000)]
[InstCombine] add test for vector demanded elements + shrinking; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340933 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[mips] Fix microMIPS unconditional branch offset handling
Simon Atanasyan [Wed, 29 Aug 2018 14:54:01 +0000 (14:54 +0000)]
[mips] Fix microMIPS unconditional branch offset handling

MipsSEInstrInfo class defines for internal purpose unconditional
branches as Mips::B nad Mips:J even in case of microMIPS code
generation. Under some conditions that leads to the bug - for rather long
branch which fits to Mips jump instruction offset size, but does not fit
to microMIPS jump offset size, we generate 'short' branch and later show
an error 'out of range PC16 fixup' after check in the isBranchOffsetInRange
routine.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340932 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[mips] Involves microMIPS's jump in the analyzable branch set
Simon Atanasyan [Wed, 29 Aug 2018 14:53:55 +0000 (14:53 +0000)]
[mips] Involves microMIPS's jump in the analyzable branch set

Involves microMIPS's jump in the analyzable branch set to reduce some
code patterns.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340931 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] move declarations closer to uses; NFC
Sanjay Patel [Wed, 29 Aug 2018 14:42:12 +0000 (14:42 +0000)]
[InstCombine] move declarations closer to uses; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340930 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[mips] Prevent shrink-wrap for BuildPairF64, ExtractElementF64 when they use $sp
Vladimir Stefanovic [Wed, 29 Aug 2018 14:07:14 +0000 (14:07 +0000)]
[mips] Prevent shrink-wrap for BuildPairF64, ExtractElementF64 when they use $sp

For a certain combination of options, BuildPairF64_{64}, ExtractElementF64{_64}
may be expanded into instructions using stack.
Add implicit operand $sp for such cases so that ShrinkWrapping doesn't move
prologue setup below them.

Fixes MultiSource/Benchmarks/MallocBench/cfrac for
'--target=mips-img-linux-gnu -mcpu=mips32r6 -mfpxx -mnan=2008'
and
'--target=mips-img-linux-gnu -mcpu=mips32r6 -mfp64 -mnan=2008 -mno-odd-spreg'.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340927 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] remove unnecessary shuffle undef folding
Sanjay Patel [Wed, 29 Aug 2018 13:24:34 +0000 (13:24 +0000)]
[InstCombine] remove unnecessary shuffle undef folding

Add a test for constant folding to show that
(shuffle undef, undef, mask)
should already be handled via instsimplify.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340926 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r340922 "[GVNHoist] Re-enable GVNHoist by default"
Alexandros Lamprineas [Wed, 29 Aug 2018 13:00:55 +0000 (13:00 +0000)]
Revert r340922 "[GVNHoist] Re-enable GVNHoist by default"

Another sanitizer buildbot failed this time at bootstrap when
compiling SemaTemplateInstantiate.cpp with this assertion:
`dominates(MD, U) && "Memory Def does not dominate it's uses"'.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340925 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r340921 "[NFC] Unify guards detection"
Hans Wennborg [Wed, 29 Aug 2018 12:21:32 +0000 (12:21 +0000)]
Revert r340921 "[NFC] Unify guards detection"

This broke the build, see e.g.

http://lab.llvm.org:8011/builders/clang-cmake-armv8-lnt/builds/4626/
http://lab.llvm.org:8011/builders/clang-ppc64be-linux-lnt/builds/18647/
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-avx2-linux/builds/5856/
http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/22800/

> We have multiple places in code where we try to identify whether or not
> some instruction is a guard. This patch factors out this logic into a separate
> utility function which works uniformly in all places.
>
> Differential Revision: https://reviews.llvm.org/D51152
> Reviewed By: fedor.sergeev

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340923 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GVNHoist] Re-enable GVNHoist by default
Alexandros Lamprineas [Wed, 29 Aug 2018 11:58:34 +0000 (11:58 +0000)]
[GVNHoist] Re-enable GVNHoist by default

Rebase rL338240 since the excessive memory usage observed when using
GVNHoist with UBSan has been fixed by rL340818.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340922 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Unify guards detection
Max Kazantsev [Wed, 29 Aug 2018 11:37:34 +0000 (11:37 +0000)]
[NFC] Unify guards detection

We have multiple places in code where we try to identify whether or not
some instruction is a guard. This patch factors out this logic into a separate
utility function which works uniformly in all places.

Differential Revision: https://reviews.llvm.org/D51152
Reviewed By: fedor.sergeev

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340921 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[mips] Add missing instructions
Aleksandar Beserminji [Wed, 29 Aug 2018 11:35:03 +0000 (11:35 +0000)]
[mips] Add missing instructions

Add pll.ps, plu.ps, cvt.s.pu, cvt.s.pl, cvt.ps instructions for FP64.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340920 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombiner] Add X / X -> 1 & X % X -> 0 folds
Simon Pilgrim [Wed, 29 Aug 2018 11:30:16 +0000 (11:30 +0000)]
[DAGCombiner] Add X / X -> 1 & X % X -> 0 folds

Adds more divrem folds to try and get in sync with InstructionSimplify

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340919 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombiner] Add X / X -> 1 & X % X -> 0 folds (test tweaks)
Simon Pilgrim [Wed, 29 Aug 2018 11:23:59 +0000 (11:23 +0000)]
[DAGCombiner] Add X / X -> 1 & X % X -> 0 folds (test tweaks)

Adjust missed test to avoid the X / X -> 1 & X % X -> 0 folds while keeping their original purposes.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340917 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombiner] Add X / X -> 1 & X % X -> 0 folds (test tweaks)
Simon Pilgrim [Wed, 29 Aug 2018 11:18:14 +0000 (11:18 +0000)]
[DAGCombiner] Add X / X -> 1 & X % X -> 0 folds (test tweaks)

Adjust tests to avoid the X / X -> 1 & X % X -> 0 folds while keeping their original purposes.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340916 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Factor out guard utility methods into a separate file
Max Kazantsev [Wed, 29 Aug 2018 10:51:59 +0000 (10:51 +0000)]
[NFC] Factor out guard utility methods into a separate file

This patch creates file GuardUtils which will contain logic for work with guards
that can be shared across different passes.

Differential Revision: https://reviews.llvm.org/D51151
Reviewed By: fedor.sergeev

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340914 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][AVX] Prefer VPBLENDW+VPBLENDD to VPBLENDVB for v16i16 blend shuffles
Simon Pilgrim [Wed, 29 Aug 2018 10:51:08 +0000 (10:51 +0000)]
[X86][AVX] Prefer VPBLENDW+VPBLENDD to VPBLENDVB for v16i16 blend shuffles

Noticed while looking at D49562 codegen - we can avoid a large constant mask load and a slow VPBLENDVB select op by using VPBLENDW+VPBLENDD instead.

TODO: As discussed on the patch, we should investigate adding VPBLENDVB handling to target shuffle combining as well, that will allow us to extend this to VPBLENDW+VPBLENDW+VPBLENDD.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340913 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MC] fix a clang-tidy warning, NFC
Krasimir Georgiev [Wed, 29 Aug 2018 10:40:51 +0000 (10:40 +0000)]
[MC] fix a clang-tidy warning, NFC

Summary:
Per clang-tidy:
function 'llvm::MCStreamer::checkCVLocSection' has a definition with different parameter names

.../llvm/lib/MC/MCStreamer.cpp:275:18: the definition seen here

.../llvm/include/llvm/MC/MCStreamer.h:235:8: differing parameters are named here: ('FuncId'), in definition: ('FunctionId')

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340912 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRemove debug code accidently committed in rL340837. NFCI.
Simon Pilgrim [Wed, 29 Aug 2018 10:10:58 +0000 (10:10 +0000)]
Remove debug code accidently committed in rL340837. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340908 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r340904 "[llvm-mc] - Allow to set custom flags for debug sections."
George Rimar [Wed, 29 Aug 2018 09:04:52 +0000 (09:04 +0000)]
Revert r340904 "[llvm-mc] - Allow to set custom flags for debug sections."

It broke PPC64 BB:
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/23252

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340906 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[benchmark] NFC: Turn benchmark ON on all non-Windows buildbots
Kirill Bobyrev [Wed, 29 Aug 2018 08:59:36 +0000 (08:59 +0000)]
[benchmark] NFC: Turn benchmark ON on all non-Windows buildbots

The problems with benchmark build should be fixed now, but Windows
buildbots still run into errors seemingly because of the bug in
clang-cl. Because of that, benchmark shouldn't be built on Windows at
this point.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340905 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-mc] - Allow to set custom flags for debug sections.
George Rimar [Wed, 29 Aug 2018 08:42:02 +0000 (08:42 +0000)]
[llvm-mc] - Allow to set custom flags for debug sections.

I am experimenting with a single split dwarf (.dwo sections in .o files).
I want to make linker to ignore .dwo sections in .o, for that I am trying to add
SHF_EXCLUDE flag ("E") for them in my asm sample.

I found that currently, it is impossible to add any flag for debug sections using llvm-mc.

That happens because we have a set of predefined unique sections created early with default flags:
https://github.com/llvm-mirror/llvm/blob/master/lib/MC/MCObjectFileInfo.cpp#L391

This patch allows a user to add any flags he wants.

I had to edit TargetLoweringObjectFileImpl.cpp to set MetaData type for debug sections.
Their kind was Data by default (so they were allocatable) and so after changes introduced by
this patch the SHF_ALLOC flag was applied for them, what does not make sense for debug sections.
One of OrcJITTests tests failed because of that.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340904 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU: Fix getInstSizeInBytes
Nicolai Haehnle [Wed, 29 Aug 2018 07:46:09 +0000 (07:46 +0000)]
AMDGPU: Fix getInstSizeInBytes

Summary:
Add some optional code to validate getInstSizeInBytes for emitted
instructions. This flushed out some issues which are fixed by this
patch:

- Streamline getInstSizeInBytes
- Properly define the VI readlane/writelane instruction as VOP3
- Fix the inline constant determination. Specifically, this change
  fixes an issue where a 32-bit value of 0xffffffff was recorded
  as unsigned. This is equal to -1 when restricting to a 32-bit
  comparison, and an inline constant can be used.

Reviewers: arsenm, rampitec

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

Change-Id: Id87c3b7975839da0de8156a124b0ce98c5fb47f2

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340903 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoLoopSink: Don't sink into blocks without an insertion point (PR38462)
Hans Wennborg [Wed, 29 Aug 2018 06:55:27 +0000 (06:55 +0000)]
LoopSink: Don't sink into blocks without an insertion point (PR38462)

In the PR, LoopSink was trying to sink into a catchswitch block, which
doesn't have a valid insertion point.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340900 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SelectionDAG] Remove masked_gather/scatter from TargetSelectionDAG.td.
Craig Topper [Wed, 29 Aug 2018 04:45:33 +0000 (04:45 +0000)]
[SelectionDAG] Remove masked_gather/scatter from TargetSelectionDAG.td.

These aren't used in tree and the number of operands in the type profile is wrong. X86 uses its own ISD opcode and type profile after op legalization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340899 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SelectionDAG] Add some comments to ISDOpcodes.h about the operands of MLOAD, MSTORE...
Craig Topper [Wed, 29 Aug 2018 04:45:32 +0000 (04:45 +0000)]
[SelectionDAG] Add some comments to ISDOpcodes.h about the operands of MLOAD, MSTORE, MGATHER, MSCATTER. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340898 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd support for various C++14 demanglings.
Zachary Turner [Wed, 29 Aug 2018 04:12:44 +0000 (04:12 +0000)]
Add support for various C++14 demanglings.

Mostly this includes <auto> and <decltype-auto> return values.
Additionally, this fixes a fairly obscure back-referencing bug
that was encountered in one of the C++14 tests, which is that
if you have something like Foo<&bar, &bar> then the `bar`
forms a backreference.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340896 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MS Demangler] Add output flags to all function calls.
Zachary Turner [Wed, 29 Aug 2018 03:59:17 +0000 (03:59 +0000)]
[MS Demangler] Add output flags to all function calls.

Previously we had a FunctionSigFlags, but it's more flexible
to just have one set of output flags that apply to the entire
process and just pipe the entire set of flags through the
output process.

This will be useful when we start allowing the user to customize
the outputting behavior.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340894 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoNFC. fixing time-passes test failure on Windows.
Fedor Sergeev [Wed, 29 Aug 2018 03:53:30 +0000 (03:53 +0000)]
NFC. fixing time-passes test failure on Windows.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340893 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GISel]: Add legalization support for Widening UADDO/USUBO
Aditya Nandakumar [Wed, 29 Aug 2018 03:17:08 +0000 (03:17 +0000)]
[GISel]: Add legalization support for Widening UADDO/USUBO

https://reviews.llvm.org/D51384

Added code in LegalizerHelper to widen UADDO/USUBO along with unit
tests.

Reviewed by volkan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340892 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Support v2i32 gather/scatter indices with -x86-experimental-vector-widening...
Craig Topper [Wed, 29 Aug 2018 02:12:49 +0000 (02:12 +0000)]
[X86] Support v2i32 gather/scatter indices with -x86-experimental-vector-widening-legalization

Summary: This is split out from D41062 to cover the code in LegalVectorTypes.cpp

Reviewers: RKSimon, spatel, efriedma

Reviewed By: efriedma

Subscribers: sdardis, jvesely, nhaehnle, jrtc27, atanasyan, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340891 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoStart reserving x18 by default on Android targets.
Peter Collingbourne [Wed, 29 Aug 2018 01:38:47 +0000 (01:38 +0000)]
Start reserving x18 by default on Android targets.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340889 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-mca] Remove unused formal. NFC.
Matt Davis [Wed, 29 Aug 2018 00:41:04 +0000 (00:41 +0000)]
[llvm-mca] Remove unused formal. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340888 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-mca] Move the initialization of Pipeline. NFC.
Matt Davis [Wed, 29 Aug 2018 00:34:32 +0000 (00:34 +0000)]
[llvm-mca] Move the initialization of Pipeline. NFC.

Code cleanup to make the pipeline creation routine easier to read.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340887 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[codeview] Clean up machinery for deferring .cv_loc emission
Reid Kleckner [Tue, 28 Aug 2018 23:25:59 +0000 (23:25 +0000)]
[codeview] Clean up machinery for deferring .cv_loc emission

Now that we create the label at the point of the directive, we don't
need to set the "current CV location", and then later when we emit the
next instruction, create a label for it and emit it.

DWARF still defers the labels used in .debug_loc until the next
instruction or value, for reasons unknown.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340883 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[QTOOL-37352] Consider isLegalAddressingImm in Constant Hoisting
Zhaoshi Zheng [Tue, 28 Aug 2018 23:00:59 +0000 (23:00 +0000)]
[QTOOL-37352] Consider isLegalAddressingImm in Constant Hoisting

In Thumb1, legal imm range is [0, 255] for ADD/SUB instructions. However, the
legal imm range for LD/ST in (R+Imm) addressing mode is [0, 127]. Imms in
[128, 255] are materialized by mov R, #imm, and LD/STs use them in (R+R)
addressing mode.

This patch checks if a constant is used as offset in (R+Imm), if so, it checks
isLegalAddressingMode passing the constant value as BaseOffset.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340882 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ORC] Add a testcase for r338975.
Lang Hames [Tue, 28 Aug 2018 22:50:59 +0000 (22:50 +0000)]
[ORC] Add a testcase for r338975.

Tests that bad object files generate a predictable error from the JIT APIs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340881 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[codeview] Emit labels for .cv_loc immediately
Reid Kleckner [Tue, 28 Aug 2018 22:29:12 +0000 (22:29 +0000)]
[codeview] Emit labels for .cv_loc immediately

Previously we followed the DWARF implementation, which waits until the
next instruction or data to emit the label to use in the .debug_loc
section. We might want to consider re-evaluating that design choice as
well, since it means the .loc skips alignment padding, for better or
worse.

This was the most minimal fix I could come up with, but we should be
able to do a lot of cleanups now that we don't need to save a pending CV
location on the CodeViewContext. I plan to do those next, but this
immediately fixes an assertion for some of our users.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340878 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Remove GCCBuiltin from kadd intrinsics.
Craig Topper [Tue, 28 Aug 2018 22:05:55 +0000 (22:05 +0000)]
[X86] Remove GCCBuiltin from kadd intrinsics.

We need to custom handle it in clang so we can bit cast to the mask type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340875 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ORC] Replace lookupFlags in JITSymbolResolver with getResponsibilitySet.
Lang Hames [Tue, 28 Aug 2018 21:18:05 +0000 (21:18 +0000)]
[ORC] Replace lookupFlags in JITSymbolResolver with getResponsibilitySet.

The new method name/behavior more closely models the way it was being used.
It also fixes an assertion that can occur when using the new ORC Core APIs,
where flags alone don't necessarily provide enough context to decide whether
the caller is responsible for materializing a given symbol (which was always
the reason this API existed).

The default implementation of getResponsibilitySet uses lookupFlags to determine
responsibility as before, so existing JITSymbolResolvers should continue to
work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340874 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC][PassTiming] factor out generic PassTimingInfo
Fedor Sergeev [Tue, 28 Aug 2018 21:06:51 +0000 (21:06 +0000)]
[NFC][PassTiming] factor out generic PassTimingInfo

Moving PassTimingInfo from legacy pass manager code into a separate header.
Making it suitable for both legacy and new pass manager.
Adding a test on -time-passes main functionality.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340872 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SimpleLoopUnswitch] Form dedicated exits after trivial unswitches.
Alina Sbirlea [Tue, 28 Aug 2018 20:41:05 +0000 (20:41 +0000)]
[SimpleLoopUnswitch] Form dedicated exits after trivial unswitches.

Summary:
Form dedicated exits after trivial unswitches.
Fixes PR38737, PR38283.

Reviewers: chandlerc, fedor.sergeev

Subscribers: sanjoy, jlebar, uabelho, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340871 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ORC] Add an addObjectFile method to LLJIT.
Lang Hames [Tue, 28 Aug 2018 20:20:31 +0000 (20:20 +0000)]
[ORC] Add an addObjectFile method to LLJIT.

The addObjectFile method adds the given object file to the JIT session, making
its code available for execution.

Support for the -extra-object flag is added to lli when operating in
-jit-kind=orc-lazy mode to support testing of this feature.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340870 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add intrinsics for KADD instructions
Craig Topper [Tue, 28 Aug 2018 19:22:55 +0000 (19:22 +0000)]
[X86] Add intrinsics for KADD instructions

These are intrinsics for supporting kadd builtins in clang. These builtins are already in gcc to implement intrinsics from icc. Though they are missing from the Intel Intrinsics Guide.

This instruction adds two mask registers together as if they were scalar rather than a vXi1. We might be able to get away with a bitcast to scalar and a normal add instruction, but that would require DAG combine smarts in the backend to recoqnize add+bitcast. For now I'd prefer to go with the easiest implementation so we can get these builtins in to clang with good codegen.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340869 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] Fix -Wunused-variable when -DLLVM_ENABLE_ASSERTIONS=off
Fangrui Song [Tue, 28 Aug 2018 19:19:03 +0000 (19:19 +0000)]
[AMDGPU] Fix -Wunused-variable when -DLLVM_ENABLE_ASSERTIONS=off

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340868 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[libFuzzer] Port to Windows"
Matt Morehouse [Tue, 28 Aug 2018 19:07:24 +0000 (19:07 +0000)]
Revert "[libFuzzer] Port to Windows"

This reverts commit r340860 due to failing tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340867 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU: Don't delete instructions if S_ENDPGM has implicit uses
Matt Arsenault [Tue, 28 Aug 2018 18:55:55 +0000 (18:55 +0000)]
AMDGPU: Don't delete instructions if S_ENDPGM has implicit uses

This can leave behind the uses with the defs removed.
Since this should only really happen in tests, it's not worth the
effort of trying to handle this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340866 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GISel]: Add missing opcodes for overflow intrinsics
Aditya Nandakumar [Tue, 28 Aug 2018 18:54:10 +0000 (18:54 +0000)]
[GISel]: Add missing opcodes for overflow intrinsics

https://reviews.llvm.org/D51197

Currently, IRTranslator (and GISel) seems to be arbitrarily picking
which overflow intrinsics get mapped into opcodes which either have a
carry as an input or not.
For intrinsics such as Intrinsic::uadd_with_overflow, translate it to an
opcode (G_UADDO) which doesn't have any carry inputs (similar to LLVM
IR).

This patch adds 4 missing opcodes for completeness - G_UADDO, G_USUBO,
G_SSUBE and G_SADDE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340865 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly][NFC] Document stackifier tablegen backend
Thomas Lively [Tue, 28 Aug 2018 18:49:47 +0000 (18:49 +0000)]
[WebAssembly][NFC] Document stackifier tablegen backend

Summary:
Add comments to help readers avoid having to read tablegen backends to
understand the code. Also remove unecessary breaks from the output.

Reviewers: dschuff, aheejin

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340864 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-mca] use llvm::any_of instead of std::any_of. NFC
Andrea Di Biagio [Tue, 28 Aug 2018 18:49:04 +0000 (18:49 +0000)]
[llvm-mca] use llvm::any_of instead of std::any_of. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340863 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU: Force shrinking of add/sub even if the carry is used
Matt Arsenault [Tue, 28 Aug 2018 18:44:16 +0000 (18:44 +0000)]
AMDGPU: Force shrinking of add/sub even if the carry is used

The original motivating example uses a 64-bit add, so the carry
is used. Insert a copy from VCC. This may allow shrinking of
the used carry instruction. At worst, we are replacing a
mov to materialize the constant with a copy of vcc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340862 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly][NFC] Fix formatting from rL340781
Thomas Lively [Tue, 28 Aug 2018 18:34:33 +0000 (18:34 +0000)]
[WebAssembly][NFC] Fix formatting from rL340781

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340861 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[libFuzzer] Port to Windows
Matt Morehouse [Tue, 28 Aug 2018 18:34:32 +0000 (18:34 +0000)]
[libFuzzer] Port to Windows

Summary:
Port libFuzzer to windows-msvc.
This patch allows libFuzzer targets to be built and run on Windows, using -fsanitize=fuzzer and/or fsanitize=fuzzer-no-link. It allows these forms of coverage instrumentation to work on Windows as well.
It does not fix all issues, such as those with -fsanitize-coverage=stack-depth, which is not usable on Windows as of this patch.
It also does not fix any libFuzzer integration tests. Nearly all of them fail to compile, fixing them will come in a later patch, so libFuzzer tests are disabled on Windows until them.

Patch By: metzman

Reviewers: morehouse, rnk

Reviewed By: morehouse, rnk

Subscribers: morehouse, kcc, eraman

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340860 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU: Shrink insts to fold immediates
Matt Arsenault [Tue, 28 Aug 2018 18:34:24 +0000 (18:34 +0000)]
AMDGPU: Shrink insts to fold immediates

This needs to be done in the SSA fold operands
pass to be effective, so there is a bit of overlap
with SIShrinkInstructions but I don't think this
is practically avoidable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340859 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly][NFC] Fix up SIMD bitwise tests
Thomas Lively [Tue, 28 Aug 2018 18:33:31 +0000 (18:33 +0000)]
[WebAssembly][NFC] Fix up SIMD bitwise tests

Summary:
The updated tests were previously infallible because the SIMD bitwise
operations do not contain vector types in their names.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340858 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] v128.not
Thomas Lively [Tue, 28 Aug 2018 18:31:15 +0000 (18:31 +0000)]
[WebAssembly] v128.not

Implementation and tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340857 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU: Move canShrink into TII
Matt Arsenault [Tue, 28 Aug 2018 18:22:34 +0000 (18:22 +0000)]
AMDGPU: Move canShrink into TII

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340855 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombine] Rework MERGE_VALUES to inline in single pass. NFCI.
Nirav Dave [Tue, 28 Aug 2018 18:13:26 +0000 (18:13 +0000)]
[DAGCombine] Rework MERGE_VALUES to inline in single pass. NFCI.

Avoid hyperlinear cost of inlining MERGE_VALUE node by constructing
temporary vector and doing a single replacement.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340853 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAG] Avoid recomputing Divergence checks. NFCI.
Nirav Dave [Tue, 28 Aug 2018 18:13:00 +0000 (18:13 +0000)]
[DAG] Avoid recomputing Divergence checks. NFCI.

When making multiple updates to the same SDNode, recompute node
divergence only once after all changes have been made.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340852 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAG] Fix updateDivergence calculation
Nirav Dave [Tue, 28 Aug 2018 18:12:35 +0000 (18:12 +0000)]
[DAG] Fix updateDivergence calculation

Check correct SDNode when deciding if we should update the divergence
property.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340851 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU: Remove nan tests in class if src is nnan
Matt Arsenault [Tue, 28 Aug 2018 18:10:02 +0000 (18:10 +0000)]
AMDGPU: Remove nan tests in class if src is nnan

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340850 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Use getCalleeOpNo utility function (NFC)
Heejin Ahn [Tue, 28 Aug 2018 17:49:39 +0000 (17:49 +0000)]
[WebAssembly] Use getCalleeOpNo utility function (NFC)

Reviewers: tlively

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340848 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[XRay][docs] Chrome Trace Viewer Instructions
Dean Michael Berris [Tue, 28 Aug 2018 17:36:30 +0000 (17:36 +0000)]
[XRay][docs] Chrome Trace Viewer Instructions

This patch adds an example on how to generate a Chrome Trace Viewer
loadable trace from an XRay trace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340847 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] fix baseline assertions
Sanjay Patel [Tue, 28 Aug 2018 17:23:20 +0000 (17:23 +0000)]
[InstCombine] fix baseline assertions

rL340842 contained the wrong version of the check lines.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340846 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Mark the FUCOMI instructions as requiring CMOV to be enabled. NFCI
Craig Topper [Tue, 28 Aug 2018 17:17:13 +0000 (17:17 +0000)]
[X86] Mark the FUCOMI instructions as requiring CMOV to be enabled. NFCI

These instructions were added on the PentiumPro along with CMOV.

This was already comprehended by the lowering process which should emit an alternate sequence using FCOM and FNSTW. This just makes it an explicit error if that doesn't work for some reason.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340844 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[XRay][docs] Update instructions
Dean Michael Berris [Tue, 28 Aug 2018 16:46:27 +0000 (16:46 +0000)]
[XRay][docs] Update instructions

Add `xray_mode=xray-basic` to the list of options in the "further
exploration" section of the doc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340843 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] add tests for select narrowing (PR38691); NFC
Sanjay Patel [Tue, 28 Aug 2018 16:45:00 +0000 (16:45 +0000)]
[InstCombine] add tests for select narrowing (PR38691); NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340842 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[lit, shtest-timeout] Always use an internal shell for the shtest-timeout to diagnose...
Stella Stamenova [Tue, 28 Aug 2018 16:24:55 +0000 (16:24 +0000)]
[lit, shtest-timeout] Always use an internal shell for the shtest-timeout to diagnose buildbot failures

Summary:
Right now this test is failing on the builtbots on Windows but we have a very similar setup where the test passes. The test is meant to test that specifying a timeout works correctly by running an infnite loop and having it timeout - on the buildbot, the infinite loop doesn't actually execute. This change runs all of the tests in the set using an internal shell rather than an external shell. I expect this will make the test pass which means that either the way the external shell is invoked or the external shell setup on the buildbots is not correct. Regardless of whether the test passes with this change, we'll need to undo this change and have a real fix.

@gkistanova was able to get logs from the buildbot to rule out a number of theories as to why this test is failing, but they didn't have enough information to confirm exactly what the issue is. The purpose of this change is to narrow it down, but if someone has a local repro and can aid in debugging, that would make it much speedier (and less prone to making the bots fail).

Reviewers: gkistanova, asmith, zturner, modocache, rnk, delcypher

Reviewed By: rnk

Subscribers: delcypher, llvm-commits, gkistanova

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340840 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[debuginfo] generate debug info with asm+.file
Brian Cain [Tue, 28 Aug 2018 16:23:39 +0000 (16:23 +0000)]
[debuginfo] generate debug info with asm+.file

Summary:
For assembly input files, generate debug info even when the .file
directive is present, provided it does not include a file-number
argument.  Fixes PR38695.

Reviewers: probinson, sidneym

Subscribers: aprantl, hiraditya, JDevlieghere, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340839 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[TableGen] CodeGenDAGPatterns::GenerateVariants - basic caching of matching predicates
Simon Pilgrim [Tue, 28 Aug 2018 15:42:08 +0000 (15:42 +0000)]
[TableGen] CodeGenDAGPatterns::GenerateVariants - basic caching of matching predicates

CodeGenDAGPatterns::GenerateVariants is a costly function in many tblgen commands (33.87% of the total runtime of x86 -gen-dag-isel), and due to the O(N^2) nature of the function, there are a high number of repeated comparisons of the pattern's vector<Predicate>.

This initial patch at least avoids repeating these comparisons for every Variant in a pattern. I began investigating caching all the matches before entering the loop but hit issues with how best to store the data and how to update the cache as patterns were added.

Saves around 15secs in debug builds of x86 -gen-dag-isel.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340837 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[benchmark] Stop building benchmarks by default
Kirill Bobyrev [Tue, 28 Aug 2018 15:36:50 +0000 (15:36 +0000)]
[benchmark] Stop building benchmarks by default

Although the benchmark regex-related build issue seems to be
fixed, it appears that benchmark library triggers some stage 2 clang-cl
bugs:

http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/13495/steps/build%20stage%202/logs/stdio

The only sensible option now is to prevent benchmark library from
building in the default configuration.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340836 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Inliner] Attribute callsites with inline remarks
David Bolvansky [Tue, 28 Aug 2018 15:27:25 +0000 (15:27 +0000)]
[Inliner] Attribute callsites with inline remarks

Summary:
Sometimes reading an output *.ll file it is not easy to understand why some callsites are not inlined. We can read output of inline remarks (option --pass-remarks-missed=inline) and try correlating its messages with the callsites.

An easier way proposed by this patch is to add to every callsite processed by Inliner an attribute with the latest message that describes the cause of not inlining this callsite. The attribute is called //inline-remark//. By default this feature is off. It can be switched on by the option //-inline-remark-attribute//.

For example in the provided test the result method //@test1// has two callsites //@bar// and inline remarks report different inlining missed reasons:
  remark: <unknown>:0:0: bar not inlined into test1 because too costly to inline (cost=-5, threshold=-6)
  remark: <unknown>:0:0: bar not inlined into test1 because it should never be inlined (cost=never): recursive

It is not clear which remark correspond to which callsite. With the inline remark attribute enabled we get the reasons attached to their callsites:
  define void @test1() {
    call void @bar(i1 true) #0
    call void @bar(i1 false) #2
    ret void
  }
  attributes #0 = { "inline-remark"="(cost=-5, threshold=-6)" }
  ..
  attributes #2 = { "inline-remark"="(cost=never): recursive" }

Patch by: yrouban (Yevgeny Rouban)

Reviewers: xbolva00, tejohnson, apilipenko

Reviewed By: xbolva00, tejohnson

Subscribers: eraman, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340834 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Fix copy paste mistake in vector-idiv-v2i32.ll. Add missing test case.
Craig Topper [Tue, 28 Aug 2018 15:24:12 +0000 (15:24 +0000)]
[X86] Fix copy paste mistake in vector-idiv-v2i32.ll. Add missing test case.

Some of the test cases contained the same load twice instead of a different load.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340833 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] Add support for a16 modifiear for gfx9
Ryan Taylor [Tue, 28 Aug 2018 15:07:30 +0000 (15:07 +0000)]
[AMDGPU] Add support for a16 modifiear for gfx9

Summary:
Adding support for a16 for gfx9. A16 bit replaces r128 bit for gfx9.

Change-Id: Ie8b881e4e6d2f023fb5e0150420893513e5f4841

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, jfb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340831 91177308-0d34-0410-b5e6-96231b3b80d8