OSDN Git Service

android-x86/external-llvm.git
7 years ago[XRay] Include <numeric> for std::accumulate.
Dean Michael Berris [Thu, 12 Jan 2017 07:43:54 +0000 (07:43 +0000)]
[XRay] Include <numeric> for std::accumulate.

Fix-up following D24377.

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

7 years ago[XRay] Implement the `llvm-xray account` subcommand
Dean Michael Berris [Thu, 12 Jan 2017 07:38:13 +0000 (07:38 +0000)]
[XRay] Implement the `llvm-xray account` subcommand

Summary:
This is the third of a multi-part change to implement subcommands for
the `llvm-xray` tool.

Here we define the `account` subcommand which does simple function call
accounting, generating basic statistics on function calls we find in an
XRay log/trace. We support text output and csv output for this
subcommand.

This change also supports sorting, summing, and filtering the top N
results.

Part of this tool will later be turned into a library that could be used
for basic function call accounting.

Depends on D24376.

Reviewers: dblaikie, echristo

Subscribers: mehdi_amini, dberris, beanz, llvm-commits

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

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

7 years agoAMDGPU: Fix sub_oneuse being marked commutative
Matt Arsenault [Thu, 12 Jan 2017 07:17:28 +0000 (07:17 +0000)]
AMDGPU: Fix sub_oneuse being marked commutative

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

7 years ago[AVX-512] Improve lowering of zero_extend of v4i1 to v4i32 and v2i1 to v2i64 with...
Craig Topper [Thu, 12 Jan 2017 06:49:12 +0000 (06:49 +0000)]
[AVX-512] Improve lowering of zero_extend of v4i1 to v4i32 and v2i1 to v2i64 with VLX, but no DQ or BW support.

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

7 years ago[AVX-512] Improve lowering of sign_extend of v4i1 to v4i32 and v2i1 to v2i64 when...
Craig Topper [Thu, 12 Jan 2017 06:49:08 +0000 (06:49 +0000)]
[AVX-512] Improve lowering of sign_extend of v4i1 to v4i32 and v2i1 to v2i64 when avx512vl is available, but not avx512dq.

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

7 years ago[X86][AVX512] Fix PR31515 - Do not flip vselect condition if it's not a vXi1 mask
Elad Cohen [Thu, 12 Jan 2017 06:49:03 +0000 (06:49 +0000)]
[X86][AVX512] Fix PR31515 - Do not flip vselect condition if it's not a vXi1 mask

r289653 added a case where `vselect <cond> <vector1> <all-zeros>`
is transformed to:
`vselect xor(cond, DAG.getConstant(1, DL, CondVT) <all-zeros> <vector1>`
This was not aimed to catch cases where Cond is not a vXi1
mask but it does. Moreover, when Cond type is VxiN (N > 1)
then xor(cond, DAG.getConstant(1, DL, CondVT) != NOT(cond).
This patch changes the above to xor with allones, and avoids
entering the case for non-mask Conds.

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

7 years ago[AVX-512] Add more varied avx512 feature command lines to the avx512-cvt.ll test...
Craig Topper [Thu, 12 Jan 2017 06:49:03 +0000 (06:49 +0000)]
[AVX-512] Add more varied avx512 feature command lines to the avx512-cvt.ll test to show some poor codegen examples.

We're definitely doing bad things when avx512vl is enabled without avx512dq. It looks like avx512vl/dq without avx512bw may also have some issues.

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

7 years agoMake a test actually test what it set out to test.
Chandler Carruth [Thu, 12 Jan 2017 03:49:07 +0000 (03:49 +0000)]
Make a test actually test what it set out to test.

This test seems to have largely been relying on asserts being tripped.
It had a very specific and somewhat uninteresting grep of the output,
but it never really did anything to cause SCEV to be preserved across
loop simplify, certainly not explicitly. And a later addition to it
actually added CHECK lines despite the test never running FileCheck.

Now we actually print SCEV before and after loop simplify to make sure
it is *changing* and being *updated*. Which seems to be much more likely
the point of the test.

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

7 years agoAMDGPU: Fold fneg into fma or fmad
Matt Arsenault [Thu, 12 Jan 2017 00:32:16 +0000 (00:32 +0000)]
AMDGPU: Fold fneg into fma or fmad

Patch mostly by Fiona Glaser

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

7 years agoAMDGPU: Fold fneg into fmul
Matt Arsenault [Thu, 12 Jan 2017 00:23:20 +0000 (00:23 +0000)]
AMDGPU: Fold fneg into fmul

Patch mostly by Fiona Glaser

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

7 years agoAMDGPU: Fold fneg into fadd
Matt Arsenault [Thu, 12 Jan 2017 00:09:34 +0000 (00:09 +0000)]
AMDGPU: Fold fneg into fadd

Patch mostly by Fiona Glaser

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

7 years agoAMDGPU: Pull fneg/fabs out of a select
Matt Arsenault [Wed, 11 Jan 2017 23:57:38 +0000 (23:57 +0000)]
AMDGPU: Pull fneg/fabs out of a select

Allows better source modifier usage.

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

7 years ago[NewGVN] Fixup store count for the `initial` congruency class.
Davide Italiano [Wed, 11 Jan 2017 23:41:24 +0000 (23:41 +0000)]
[NewGVN] Fixup store count for the `initial` congruency class.

It was always zero. When we move a store from `initial` to its
own congruency class, we end up with a negative store count, which
is obviously wrong.
Also, while here, change StoreCount to be signed so that the assertions
actually fire.

Ack'ed by Daniel Berlin.

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

7 years ago[CodeView] Finish decoupling TypeDatabase from TypeDumper.
Zachary Turner [Wed, 11 Jan 2017 23:24:22 +0000 (23:24 +0000)]
[CodeView] Finish decoupling TypeDatabase from TypeDumper.

Previously the type dumper itself was passed around to a lot of different
places and manipulated in ways that were more appropriate on the type
database. For example, the entire TypeDumper was passed into the symbol
dumper, when all the symbol dumper wanted to do was lookup the name of a
TypeIndex so it could print it. That's what the TypeDatabase is for --
mapping type indices to names.

Another example is how if the user runs llvm-pdbdump with the option to
dump symbols but not types, we still have to visit all types so that we
can print minimal information about the type of a symbol, but just without
dumping full symbol records. The way we did this before is by hacking it
up so that we run everything through the type dumper with a null printer,
so that the output goes to /dev/null. But really, we don't need to dump
anything, all we want to do is build the type database. Since
TypeDatabaseVisitor now exists independently of TypeDumper, we can do
this. We just build a custom visitor callback pipeline that includes a
database visitor but not a dumper.

All the hackery around printers etc goes away. After this patch, we could
probably even delete the entire CVTypeDumper class since really all it is
at this point is a thin wrapper that hides the details of how to build a
useful visitation pipeline. It's not a priority though, so CVTypeDumper
remains for now.

After this patch we will be able to easily plug in a different style of
type dumper by only implementing the proper visitation methods to dump
one-line output and then sticking it on the pipeline.

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

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

7 years agoX86: Remove dead code. NFC.
Peter Collingbourne [Wed, 11 Jan 2017 23:00:28 +0000 (23:00 +0000)]
X86: Remove dead code. NFC.

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

7 years agoAMDGPU: Fix shrinking of addc/subb.
Matt Arsenault [Wed, 11 Jan 2017 22:58:12 +0000 (22:58 +0000)]
AMDGPU: Fix shrinking of addc/subb.

To shrink to VOP2 the input carry must also be VCC.

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

7 years agoAdd -Wl,-color-diagnostics if a linker supports the option.
Rui Ueyama [Wed, 11 Jan 2017 22:55:35 +0000 (22:55 +0000)]
Add -Wl,-color-diagnostics if a linker supports the option.

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

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

7 years agoAMDGPU: Fix sext_inreg for i1 in i16
Matt Arsenault [Wed, 11 Jan 2017 22:35:22 +0000 (22:35 +0000)]
AMDGPU: Fix sext_inreg for i1 in i16

This produces worse code when i16 is legal, mostly
due to combines getting confused by conversions inserted
for uniform 16-bit operations.

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

7 years agoAMDGPU: Fix breaking VOP3 v_add_i32s
Matt Arsenault [Wed, 11 Jan 2017 22:35:17 +0000 (22:35 +0000)]
AMDGPU: Fix breaking VOP3 v_add_i32s

This was shrinking the instruction even though the carry output
register was a virtual register, not known VCC.

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

7 years ago[asan] Set alignment of __asan_global_* globals to sizeof(GlobalStruct)
Kuba Mracek [Wed, 11 Jan 2017 22:26:10 +0000 (22:26 +0000)]
[asan] Set alignment of __asan_global_* globals to sizeof(GlobalStruct)

When using profiling and ASan together (-fprofile-instr-generate -fcoverage-mapping -fsanitize=address), at least on Darwin, the section of globals that ASan emits (__asan_globals) is misaligned and starts at an odd offset. This really doesn't have anything to do with profiling, but it triggers the issue because profiling emits a string section, which can have arbitrary size.  This patch changes the alignment to sizeof(GlobalStruct).

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

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

7 years agoUse EXPECT_EQ instead of ASSERT_EQ in a unit test.
Rui Ueyama [Wed, 11 Jan 2017 22:02:51 +0000 (22:02 +0000)]
Use EXPECT_EQ instead of ASSERT_EQ in a unit test.

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

7 years agoRevert "[NewGVN] Strengthen a couple of assertions."
Davide Italiano [Wed, 11 Jan 2017 22:00:29 +0000 (22:00 +0000)]
Revert "[NewGVN] Strengthen a couple of assertions."

It's breaking some bots. Will investigate and recommit.

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

7 years agoAMDGPU: Fix folding immediates into mac src2
Matt Arsenault [Wed, 11 Jan 2017 22:00:02 +0000 (22:00 +0000)]
AMDGPU: Fix folding immediates into mac src2

Whether it is legal or not needs to check for the instruction
it will be replaced with.

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

7 years ago[NewGVN] Parenthesise assertion condition (-Wparenthesis).
Davide Italiano [Wed, 11 Jan 2017 21:58:42 +0000 (21:58 +0000)]
[NewGVN] Parenthesise assertion condition (-Wparenthesis).

Format an assertion message while I'm here.

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

7 years ago[NewGVN] Strengthen a couple of assertions.
Davide Italiano [Wed, 11 Jan 2017 21:49:00 +0000 (21:49 +0000)]
[NewGVN] Strengthen a couple of assertions.

StoreCount >= 0 on `unsigned` is always true, otherwise.

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

7 years agoAdd test that verifies we don't peel loops in optsize functions. NFC.
Michael Kuperstein [Wed, 11 Jan 2017 21:42:51 +0000 (21:42 +0000)]
Add test that verifies we don't peel loops in optsize functions. NFC.

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

7 years agoLowerTypeTests: Represent the memory region size with the constant size-1.
Peter Collingbourne [Wed, 11 Jan 2017 21:32:10 +0000 (21:32 +0000)]
LowerTypeTests: Represent the memory region size with the constant size-1.

This means that we can use a shorter instruction sequence in the case where
the size is a power of two and on the boundary between two representations.

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

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

7 years ago[SCEV] Make howFarToZero max backedge-taken count check for precondition.
Eli Friedman [Wed, 11 Jan 2017 21:07:15 +0000 (21:07 +0000)]
[SCEV] Make howFarToZero max backedge-taken count check for precondition.

Refines max backedge-taken count if a loop like
"for (int i = 0; i != n; ++i) { /* body */ }" is rotated.

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

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

7 years ago[SCEV] Make howFarToZero use a simpler formula for max backedge-taken count.
Eli Friedman [Wed, 11 Jan 2017 20:55:48 +0000 (20:55 +0000)]
[SCEV] Make howFarToZero use a simpler formula for max backedge-taken count.

This is both easier to understand, and produces a tighter bound in certain
cases.

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

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

7 years agoRe-apply r291205, "LowerTypeTests: Split the pass in two: a resolution phase and...
Peter Collingbourne [Wed, 11 Jan 2017 20:28:46 +0000 (20:28 +0000)]
Re-apply r291205, "LowerTypeTests: Split the pass in two: a resolution phase and a lowering phase.", with a fix for an off-by-one error.

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

7 years agoNewGVN: Fix PR31594, by tracking the store count of congruence
Daniel Berlin [Wed, 11 Jan 2017 20:22:36 +0000 (20:22 +0000)]
NewGVN: Fix PR31594, by tracking the store count of congruence
classes, and updating checking to allow for equivalence through
reachability.

(Sadly, the checking here is not perfect, and can't be made perfect,
so we'll have to disable it after we are satisfied with correctness.
Right now it is just "very unlikely" to happen.)

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

7 years agoNewGVN: Refactor performCongruenceFinding and split out congruence class moving
Daniel Berlin [Wed, 11 Jan 2017 20:22:05 +0000 (20:22 +0000)]
NewGVN: Refactor performCongruenceFinding and split out congruence class moving

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

7 years agoResubmit "[PGO] Turn off comdat renaming in IR PGO by default"
Rong Xu [Wed, 11 Jan 2017 20:19:41 +0000 (20:19 +0000)]
Resubmit "[PGO] Turn off comdat renaming in IR PGO by default"

This patch resubmits the changes in r291588.

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

7 years agoRevert "CodeGen: Allow small copyable blocks to "break" the CFG."
Kyle Butt [Wed, 11 Jan 2017 19:55:19 +0000 (19:55 +0000)]
Revert "CodeGen: Allow small copyable blocks to "break" the CFG."

This reverts commit ada6595a526d71df04988eb0a4b4fe84df398ded.

This needs a simple probability check because there are some cases where it is
not profitable.

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

7 years agoMake some operator bools explicit for sanity/safety.
David Blaikie [Wed, 11 Jan 2017 19:47:16 +0000 (19:47 +0000)]
Make some operator bools explicit for sanity/safety.

There are a couple left in bool-like containers (BitVector, etc) where
the implicit conversions seem more suitable - though it might be worth
considering explicitifying those too.

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

7 years ago[ARM] More aggressive matching for vpadd and vpaddl.
Eli Friedman [Wed, 11 Jan 2017 19:33:38 +0000 (19:33 +0000)]
[ARM] More aggressive matching for vpadd and vpaddl.

The new matchers work after legalization to make them simpler, and to avoid
blocking other optimizations.

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

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

7 years ago[SLP] Remove bogus assert.
Michael Kuperstein [Wed, 11 Jan 2017 19:23:57 +0000 (19:23 +0000)]
[SLP] Remove bogus assert.

The removed assert seems bogus - it's perfectly legal for the roots of the
vectorized subtrees to be equal even if the original scalar values aren't,
if the original scalars happen to be equivalent.

This fixes PR31599.

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

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

7 years ago[lib/Object] Unbreak build with -Werror (unused variable). NFCI.
Davide Italiano [Wed, 11 Jan 2017 19:05:27 +0000 (19:05 +0000)]
[lib/Object] Unbreak build with -Werror (unused variable). NFCI.

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

7 years ago[X86][XOP] Add vpermil2ps target shuffle -> insertps combine test
Simon Pilgrim [Wed, 11 Jan 2017 18:48:00 +0000 (18:48 +0000)]
[X86][XOP] Add vpermil2ps target shuffle -> insertps combine test

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

7 years agoRemove all variants of DWARFDie::getAttributeValueAs...() that had parameters that...
Greg Clayton [Wed, 11 Jan 2017 17:43:37 +0000 (17:43 +0000)]
Remove all variants of DWARFDie::getAttributeValueAs...() that had parameters that specified default values.

Now we only support returning Optional<> values and have changed all clients over to use Optional::getValueOr().

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

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

7 years agoGlobalISel: only print debug info with -debug. NFC.
Tim Northover [Wed, 11 Jan 2017 17:33:37 +0000 (17:33 +0000)]
GlobalISel: only print debug info with -debug. NFC.

Turns out DEBUG(...) has uses even inside NDEBUG checks.

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

7 years agoRevert rL291205 because it breaks Chrome tests under CFI.
Ivan Krasin [Wed, 11 Jan 2017 16:54:04 +0000 (16:54 +0000)]
Revert rL291205 because it breaks Chrome tests under CFI.

Summary:
Revert LowerTypeTests: Split the pass in two: a resolution phase and a lowering phase.

This change separates how type identifiers are resolved from how intrinsic
calls are lowered. All information required to lower an intrinsic call
is stored in a new TypeIdLowering data structure. The idea is that this
data structure can either be initialized using the module itself during
regular LTO, or using the module summary in ThinLTO backends.

Original URL: https://reviews.llvm.org/D28341

Reviewers: pcc

Subscribers: mehdi_amini, llvm-commits

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

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

7 years agobuild_llvm_package.bat: Add note about what SWIG version to use
Hans Wennborg [Wed, 11 Jan 2017 16:42:31 +0000 (16:42 +0000)]
build_llvm_package.bat: Add note about what SWIG version to use

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

7 years agoRemove trailing whitespace. NFCI.
Simon Pilgrim [Wed, 11 Jan 2017 16:38:20 +0000 (16:38 +0000)]
Remove trailing whitespace. NFCI.

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

7 years ago[MemDep] NFC variable name change
Piotr Padlewski [Wed, 11 Jan 2017 16:23:54 +0000 (16:23 +0000)]
[MemDep] NFC variable name change

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

7 years ago[ARM] Fix test CodeGen/ARM/fpcmp_ueq.ll broken by rL290616
Evgeny Astigeevich [Wed, 11 Jan 2017 16:23:28 +0000 (16:23 +0000)]
[ARM] Fix test CodeGen/ARM/fpcmp_ueq.ll broken by rL290616

Commit rL290616 (https://reviews.llvm.org/rL290616) changed a checking command
for the triple arm-apple-darwin in LLVM::CodeGen/ARM/fpcmp_ueq.ll. As a result
of the changes the test could fail for the valid generated code.

These changes fixes the test to check only instructions we would expect.

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

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

7 years ago[lib/Object] - Introduce Decompressor class.
George Rimar [Wed, 11 Jan 2017 15:26:41 +0000 (15:26 +0000)]
[lib/Object] - Introduce Decompressor class.

Decompressor intention is to reduce duplication of code.
Currently LLD has own implementation of decompressor
for compressed debug sections.

This class helps to avoid it and share the code.
LLD patch for reusing it is D28106

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

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

7 years ago[SystemZ] Improve isFoldableMemAccessOffset().
Jonas Paulsson [Wed, 11 Jan 2017 14:40:39 +0000 (14:40 +0000)]
[SystemZ]  Improve isFoldableMemAccessOffset().

A store of an extracted element or a load which gets inserted into a vector,
will be combined into a vector load/store element instruction.

Therefore, isFoldableMemAccessOffset(), which is called by LSR, should
return false in these cases.

Reviewer: Ulrich Weigand

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

7 years agoMake processing @llvm.assume more efficient - Add affected values to the assumption...
Hal Finkel [Wed, 11 Jan 2017 13:24:24 +0000 (13:24 +0000)]
Make processing @llvm.assume more efficient - Add affected values to the assumption cache

Here's my second try at making @llvm.assume processing more efficient. My
previous attempt, which leveraged operand bundles, r289755, didn't end up
working: it did make assume processing more efficient but eliminating the
assumption cache made ephemeral value computation too expensive. This is a
more-targeted change. We'll keep the assumption cache, but extend it to keep a
map of affected values (i.e. values about which an assumption might provide
some information) to the corresponding assumption intrinsics. This allows
ValueTracking and LVI to find assumptions relevant to the value being queried
without scanning all assumptions in the function. The fact that ValueTracking
started doing O(number of assumptions in the function) work, for every
known-bits query, has become prohibitively expensive in some cases.

As discussed during the review, this is a pragmatic fix that, longer term, will
likely be replaced by a more-principled solution (perhaps based on an extended
SSA form).

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

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

7 years agoX86 CodeGen: Optimized pattern for truncate with unsigned saturation.
Elena Demikhovsky [Wed, 11 Jan 2017 12:59:32 +0000 (12:59 +0000)]
X86 CodeGen: Optimized pattern for truncate with unsigned saturation.

DAG patterns optimization: truncate + unsigned saturation supported by VPMOVUS* instructions in AVX-512.
And VPACKUS* instructions on SEE* targets.

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

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

7 years ago[AMDGPU] Assembler: SDWA/DPP should not accept scalar registers and immediate operands
Sam Kolton [Wed, 11 Jan 2017 11:46:30 +0000 (11:46 +0000)]
[AMDGPU] Assembler: SDWA/DPP should not accept scalar registers and immediate operands

Reviewers: artem.tamazov, nhaustov, vpykhtin, tstellarAMD

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, tony-tye

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

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

7 years agoFix unused variable warning
Simon Pilgrim [Wed, 11 Jan 2017 10:40:33 +0000 (10:40 +0000)]
Fix unused variable warning

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

7 years ago[X86][AVX512BW] Vectorize v64i8 vector shifts
Simon Pilgrim [Wed, 11 Jan 2017 10:36:51 +0000 (10:36 +0000)]
[X86][AVX512BW] Vectorize v64i8 vector shifts

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

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

7 years agoFix line endings
Simon Pilgrim [Wed, 11 Jan 2017 10:25:31 +0000 (10:25 +0000)]
Fix line endings

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

7 years ago[PM] Separate the LoopAnalysisManager from the LoopPassManager and move
Chandler Carruth [Wed, 11 Jan 2017 09:43:56 +0000 (09:43 +0000)]
[PM] Separate the LoopAnalysisManager from the LoopPassManager and move
the latter to the Transforms library.

While the loop PM uses an analysis to form the IR units, the current
plan is to have the PM itself establish and enforce both loop simplified
form and LCSSA. This would be a layering violation in the analysis
library.

Fundamentally, the idea behind the loop PM is to *transform* loops in
addition to running passes over them, so it really seemed like the most
natural place to sink this was into the transforms library.

We can't just move *everything* because we also have loop analyses that
rely on a subset of the invariants. So this patch splits the the loop
infrastructure into the analysis management that has to be part of the
analysis library, and the transform-aware pass manager.

This also required splitting the loop analyses' printer passes out to
the transforms library, which makes sense to me as running these will
transform the code into LCSSA in theory.

I haven't split the unittest though because testing one component
without the other seems nearly intractable.

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

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

7 years ago[PM] Take more drastic measures to work around MSVC's failure on this
Chandler Carruth [Wed, 11 Jan 2017 09:20:24 +0000 (09:20 +0000)]
[PM] Take more drastic measures to work around MSVC's failure on this
code. If this doesn't work and I can't find someone to help who has MSVC
installed, I'll back everything out I guess. =[

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

7 years ago[X86] Fix PR30926 - Add patterns for (v)cvtsi2s{s,d} and (v)cvtsd2s{s,d}
Elad Cohen [Wed, 11 Jan 2017 09:11:48 +0000 (09:11 +0000)]
[X86] Fix PR30926 - Add patterns for (v)cvtsi2s{s,d} and (v)cvtsd2s{s,d}

The code emiited by Clang's intrinsics for (v)cvtsi2ss, (v)cvtsi2sd,
(v)cvtsd2ss and (v)cvtss2sd is lowered to a code sequence that includes
redundant (v)movss/(v)movsd instructions. This patch adds patterns for
optimizing these sequences.

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

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

7 years ago[X86] fixing failed test in commit: r291657
Mohammed Agabaria [Wed, 11 Jan 2017 09:03:11 +0000 (09:03 +0000)]
[X86] fixing failed test in commit: r291657

Missing Requires asserts.

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

7 years ago[X86] updating TTI costs for arithmetic instructions on X86\SLM arch.
Mohammed Agabaria [Wed, 11 Jan 2017 08:23:37 +0000 (08:23 +0000)]
[X86] updating TTI costs for arithmetic instructions on X86\SLM arch.

updated instructions:
pmulld, pmullw, pmulhw, mulsd, mulps, mulpd, divss, divps, divsd, divpd, addpd and subpd.

special optimization case which replaces pmulld with pmullw\pmulhw\pshuf seq.
In case if the real operands bitwidth <= 16.

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

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

7 years ago[PM] Pull a lambda out of an argument into a named variable to try and
Chandler Carruth [Wed, 11 Jan 2017 08:23:29 +0000 (08:23 +0000)]
[PM] Pull a lambda out of an argument into a named variable to try and
get a little more clarity about the nature of the issue MSVC is having
with this code.

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

7 years ago[PM] Another attempt to satisfy MSVC.
Chandler Carruth [Wed, 11 Jan 2017 07:53:12 +0000 (07:53 +0000)]
[PM] Another attempt to satisfy MSVC.

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

7 years ago[PM] Try to appease MSVC by explicitly disambiguating a member name as
Chandler Carruth [Wed, 11 Jan 2017 07:37:50 +0000 (07:37 +0000)]
[PM] Try to appease MSVC by explicitly disambiguating a member name as
a template.

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

7 years ago[XRay] Define the library for XRay trace logs
Dean Michael Berris [Wed, 11 Jan 2017 06:39:09 +0000 (06:39 +0000)]
[XRay] Define the library for XRay trace logs

Summary:
In this change we move the definition of the log reading routines from
the tools directory in LLVM to {include/llvm,lib}/XRay. We improve the
documentation a little bit for the publicly accessible headers, and
adjust the top-matter. This also leads to some refactoring and cleanup
in the tooling code.

In particular, we do the following:

  - Rename the class from LogReader to Trace, as it better represents
    the logical set of records as opposed to a log.
  - Use file type detection instead of asking the user to say what
    format the input file is. This allows us to keep the interface
    simple and encapsulate the logic of loading the data appropriately.

In future changes we increase the API surface and write dedicated unit
tests for the XRay library.

Depends on D24376.

Reviewers: dblaikie, echristo

Subscribers: mehdi_amini, mgorny, llvm-commits, varno

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

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

7 years ago[PM] Rewrite the loop pass manager to use a worklist and augmented run
Chandler Carruth [Wed, 11 Jan 2017 06:23:21 +0000 (06:23 +0000)]
[PM] Rewrite the loop pass manager to use a worklist and augmented run
arguments much like the CGSCC pass manager.

This is a major redesign following the pattern establish for the CGSCC layer to
support updates to the set of loops during the traversal of the loop nest and
to support invalidation of analyses.

An additional significant burden in the loop PM is that so many passes require
access to a large number of function analyses. Manually ensuring these are
cached, available, and preserved has been a long-standing burden in LLVM even
with the help of the automatic scheduling in the old pass manager. And it made
the new pass manager extremely unweildy. With this design, we can package the
common analyses up while in a function pass and make them immediately available
to all the loop passes. While in some cases this is unnecessary, I think the
simplicity afforded is worth it.

This does not (yet) address loop simplified form or LCSSA form, but those are
the next things on my radar and I have a clear plan for them.

While the patch is very large, most of it is either mechanically updating loop
passes to the new API or the new testing for the loop PM. The code for it is
reasonably compact.

I have not yet updated all of the loop passes to correctly leverage the update
mechanisms demonstrated in the unittests. I'll do that in follow-up patches
along with improved FileCheck tests for those passes that ensure things work in
more realistic scenarios. In many cases, there isn't much we can do with these
until the loop simplified form and LCSSA form are in place.

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

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

7 years agoRevert r291645 "[DAGCombiner] Teach DAG combiner to fold (vselect (N0 xor AllOnes...
Craig Topper [Wed, 11 Jan 2017 04:59:25 +0000 (04:59 +0000)]
Revert r291645 "[DAGCombiner] Teach DAG combiner to fold (vselect (N0 xor AllOnes), N1, N2) -> (vselect N0, N2, N1). Only do this if the target indicates its vector boolean type is ZeroOrNegativeOneBooleanContent."

Some test appears to be hanging on the build bots.

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

7 years ago[LICM] Report failing to hoist conditionally-executed loads
Adam Nemet [Wed, 11 Jan 2017 04:39:49 +0000 (04:39 +0000)]
[LICM] Report failing to hoist conditionally-executed loads

These are interesting again because the user may not be aware that this
is a common reason preventing LICM.

A const is removed from an instruction pointer declaration in order to
pass it to ORE.

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

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

7 years ago[LICM] Report failing to hoist a load with an invariant address
Adam Nemet [Wed, 11 Jan 2017 04:39:45 +0000 (04:39 +0000)]
[LICM] Report failing to hoist a load with an invariant address

These are interesting because lack of precision in alias information
could be standing in the way of this optimization.

An example is the case in the test suite that I showed in the DevMeeting
talk:

http://lab.llvm.org:8080/artifacts/opt-view_test-suite/build/MultiSource/Benchmarks/FreeBench/distray/CMakeFiles/distray.dir/html/_org_test-suite_MultiSource_Benchmarks_FreeBench_distray_distray.c.html#L236

canSinkOrHoistInst is also used from LoopSink, which does not use
opt-remarks so we need to take ORE as an optional argument.

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

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

7 years agoFix typo in comment
Adam Nemet [Wed, 11 Jan 2017 04:39:41 +0000 (04:39 +0000)]
Fix typo in comment

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

7 years ago[LICM] Report successful hoist/sink/promotion
Adam Nemet [Wed, 11 Jan 2017 04:39:35 +0000 (04:39 +0000)]
[LICM] Report successful hoist/sink/promotion

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

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

7 years ago[DAGCombiner] Teach DAG combiner to fold (vselect (N0 xor AllOnes), N1, N2) -> (vsele...
Craig Topper [Wed, 11 Jan 2017 04:02:23 +0000 (04:02 +0000)]
[DAGCombiner] Teach DAG combiner to fold (vselect (N0 xor AllOnes), N1, N2) -> (vselect N0, N2, N1). Only do this if the target indicates its vector boolean type is ZeroOrNegativeOneBooleanContent.

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

7 years agoDAGCombiner: Add hasOneUse checks to fadd/fma combine
Matt Arsenault [Wed, 11 Jan 2017 02:02:12 +0000 (02:02 +0000)]
DAGCombiner: Add hasOneUse checks to fadd/fma combine

Even with aggressive fusion enabled, this requires duplicating
the fmul, or increases an fadd to another fma which is not an
improvement.

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

7 years ago[Target] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Wed, 11 Jan 2017 01:45:03 +0000 (01:45 +0000)]
[Target] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

7 years agoRe-commit r289955: [X86] Fold (setcc (cmp (atomic_load_add x, -C) C), COND) to (setcc...
Hans Wennborg [Wed, 11 Jan 2017 01:36:57 +0000 (01:36 +0000)]
Re-commit r289955: [X86] Fold (setcc (cmp (atomic_load_add x, -C) C), COND) to (setcc (LADD x, -C), COND) (PR31367)

This was reverted because it would miscompile code where the cmp had
multiple uses. That was due to a deficiency in the existing code, which
was fixed in r291630 (see the PR for details).

This re-commit includes an extra test for the kind of code that got
miscompiled: @test_sub_1_setcc_jcc.

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

7 years agotools/llvm-xray: Avoid std::errc::protocol_* to appease mingw, like r285261.
NAKAMURA Takumi [Wed, 11 Jan 2017 01:06:57 +0000 (01:06 +0000)]
tools/llvm-xray: Avoid std::errc::protocol_* to appease mingw, like r285261.

They are oriented from winsock and mingw doesn't import them.

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

7 years agoInstSimplify: Refactor function to use more switches
Matt Arsenault [Wed, 11 Jan 2017 00:57:54 +0000 (00:57 +0000)]
InstSimplify: Refactor function to use more switches

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

7 years agoRemove unused field.
Zachary Turner [Wed, 11 Jan 2017 00:56:53 +0000 (00:56 +0000)]
Remove unused field.

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

7 years ago[X86] Dont run combineSetCCAtomicArith() when the cmp has multiple uses
Hans Wennborg [Wed, 11 Jan 2017 00:49:54 +0000 (00:49 +0000)]
[X86] Dont run combineSetCCAtomicArith() when the cmp has multiple uses

We would miscompile the following:

  void g(int);
  int f(volatile long long *p) {
    bool b = __atomic_fetch_add(p, 1, __ATOMIC_SEQ_CST) < 0;
    g(b ? 12 : 34);
    return b ? 56 : 78;
  }

into

  pushq   %rax
  lock            incq    (%rdi)
  movl    $12, %eax
  movl    $34, %edi
  cmovlel %eax, %edi
  callq   g(int)
  testq   %rax, %rax   <---- Bad.
  movl    $56, %ecx
  movl    $78, %eax
  cmovsl  %ecx, %eax
  popq    %rcx
  retq

because the code failed to take into account that the cmp has multiple
uses, replaced one of them, and left the other one comparing garbage.

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

7 years ago[RegBankSelect] Improve the output of the debug messages.
Quentin Colombet [Wed, 11 Jan 2017 00:48:41 +0000 (00:48 +0000)]
[RegBankSelect] Improve the output of the debug messages.

Add more information about mapping cost and chosen solution.

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

7 years ago[CodeView/PDB] Rename a bunch of files.
Zachary Turner [Wed, 11 Jan 2017 00:35:43 +0000 (00:35 +0000)]
[CodeView/PDB] Rename a bunch of files.

We were starting to get some name clashes between llvm-pdbdump
and the common CodeView framework, so I took this opportunity
to rename a bunch of files to more accurately describe their
usage.  This also helps in llvm-pdbdump to distinguish
between different files and whether they are used for pretty
dump mode or raw dump mode.

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

7 years ago[CodeView] Add TypeDatabase class.
Zachary Turner [Wed, 11 Jan 2017 00:35:08 +0000 (00:35 +0000)]
[CodeView] Add TypeDatabase class.

This creates a centralized class in which to store type records.
It stores types as an array of entries, which matches the
notion of a type stream being a topologically sorted DAG.
Logic to build up such a database was already being used in
CVTypeDumper, so CVTypeDumper is now updated to to read from
a TypeDatabase which is filled out by an earlier visitor in
the pipeline.

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

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

7 years agoAdd better documentation for iterator facade subclasses.
Zachary Turner [Wed, 11 Jan 2017 00:34:41 +0000 (00:34 +0000)]
Add better documentation for iterator facade subclasses.

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

7 years agoInstSimplify: Eliminate fabs on known positive
Matt Arsenault [Wed, 11 Jan 2017 00:33:24 +0000 (00:33 +0000)]
InstSimplify: Eliminate fabs on known positive

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

7 years ago[gmock] Teach gmock ElementsAre and BeginEndDistanceIs matchers to
Chandler Carruth [Wed, 11 Jan 2017 00:16:03 +0000 (00:16 +0000)]
[gmock] Teach gmock ElementsAre and BeginEndDistanceIs matchers to
handle generic ranges by using std::begin and std::end rather than
requiring things to look exactly like an STL container.

Much of the credit for this goes to Dave Blaikie who helped me figure
out the right incantations.

This will probably be re-designed when I send this to the maintainers of
gmock, so I've instead structured it to change is little as possible
while it is a local patch. That makes it somewhat ugly, but I think a focused
change is better for getting this to work for LLVM today and letting the
upstream maintainers figure out the correct long-term pattern.

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

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

7 years agoAMDGPU/EG,CM: Add fp16 conversion instructions
Jan Vesely [Wed, 11 Jan 2017 00:12:39 +0000 (00:12 +0000)]
AMDGPU/EG,CM: Add fp16 conversion instructions

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

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

7 years agoRevert "[PGO] Turn off comdat renaming in IR PGO by default"
Rong Xu [Tue, 10 Jan 2017 23:54:31 +0000 (23:54 +0000)]
Revert "[PGO] Turn off comdat renaming in IR PGO by default"

This patch reverts r291588: [PGO] Turn off comdat renaming in IR PGO by default,
as we are seeing some hash mismatches in our internal tests.

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

7 years ago[InstCombine] add a wrapper for a common pair of transforms; NFCI
Sanjay Patel [Tue, 10 Jan 2017 23:49:07 +0000 (23:49 +0000)]
[InstCombine] add a wrapper for a common pair of transforms; NFCI

Some of the callers are artificially limiting this transform to integer types;
this should make it easier to incrementally remove that restriction.

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

7 years ago[loop-unroll] Properly populate LoopInfo for loops cloned in LoopUnrollRuntime.
Florian Hahn [Tue, 10 Jan 2017 23:43:35 +0000 (23:43 +0000)]
[loop-unroll] Properly populate LoopInfo for loops cloned in LoopUnrollRuntime.

Summary:
This fixes Transforms/LoopUnroll/runtime-loop3.ll which failed with
EXTENSIVE_DEBUG, because the cloned basic blocks were not added to the
correct sub-loops in LoopUnrollRuntime.cpp.

Reviewers: dexonsmith, mzolotukhin

Subscribers: llvm-commits

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

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

7 years ago[TM] Restore default TargetOptions in TargetMachine::resetTargetOptions.
Justin Lebar [Tue, 10 Jan 2017 23:43:04 +0000 (23:43 +0000)]
[TM] Restore default TargetOptions in TargetMachine::resetTargetOptions.

Summary:
Previously if you had

 * a function with the fast-math-enabled attr, followed by
 * a function without the fast-math attr,

the second function would inherit the first function's fast-math-ness.

This means that mixing fast-math and non-fast-math functions in a module
was completely broken unless you explicitly annotated every
non-fast-math function with "unsafe-fp-math"="false".  This appears to
have been broken since r176986 (March 2013), when the resetTargetOptions
function was introduced.

This patch tests the correct behavior as best we can.  I don't think I
can test FPDenormalMode and NoTrappingFPMath, because they aren't used
in any backends during function lowering.  Surprisingly, I also can't
find any uses at all of LessPreciseFPMAD affecting generated code.

The NVPTX/fast-math.ll test changes are an expected result of fixing
this bug.  When FMA is disabled, we emit add as "add.rn.f32", which
prevents fma combining.  Before this patch, fast-math was enabled in all
functions following the one which explicitly enabled it on itself, so we
were emitting plain "add.f32" where we should have generated
"add.rn.f32".

Reviewers: mkuper

Subscribers: hfinkel, majnemer, jholewinski, nemanjai, llvm-commits

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

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

7 years ago[NVPTX] Add CHECK-LABEL where appropriate to fast-math.ll test.
Justin Lebar [Tue, 10 Jan 2017 23:42:46 +0000 (23:42 +0000)]
[NVPTX] Add CHECK-LABEL where appropriate to fast-math.ll test.

Also fix up whitespace.

Test-only change.

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

7 years ago[AArch64] Consider all vector types for FeatureSlowMisaligned128Store
Evandro Menezes [Tue, 10 Jan 2017 23:42:21 +0000 (23:42 +0000)]
[AArch64] Consider all vector types for FeatureSlowMisaligned128Store

The original code considered only v2i64 as slow for this feature. This patch
consider all 128-bit long vector types as slow candidates.

In internal tests, extending this feature to all 128-bit vector types
resulted in an overall improvement of 1% on Exynos M1.

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

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

7 years agoAMDGPU: Constant fold when immediate is materialized
Matt Arsenault [Tue, 10 Jan 2017 23:32:04 +0000 (23:32 +0000)]
AMDGPU: Constant fold when immediate is materialized

In future commits these patterns will appear after moveToVALU changes.

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

7 years ago[loop-unroll] Factor out code to update LoopInfo (NFC).
Florian Hahn [Tue, 10 Jan 2017 23:24:54 +0000 (23:24 +0000)]
[loop-unroll] Factor out code to update LoopInfo (NFC).

Move the code to update LoopInfo for cloned basic blocks to
addClonedBlockToLoopInfo, as suggested in
https://reviews.llvm.org/D28482.

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

7 years agoMove the section name from GlobalObject to the LLVMContext
Reid Kleckner [Tue, 10 Jan 2017 23:23:58 +0000 (23:23 +0000)]
Move the section name from GlobalObject to the LLVMContext

Summary:
Convention wisdom says that bytes in Function are precious, and the
vast, vast majority of globals do not live in special sections. Even
when they do, they tend to live in the same section. Store the section
name on the LLVMContext in a StringSet, and maintain a map from
GlobalObject* to section name like we do for metadata, prefix data, etc.

The fact that we've survived this long wasting at least three pointers
of space in Function suggests that Function bytes are perhaps not as
precious as we once thought. Given that most functions have metadata
attachments when debug info is enabled, we might consider adding a
pointer here to make that access more efficient.

Reviewers: jlebar, dexonsmith, mehdi_amini

Subscribers: mehdi_amini, aprantl, llvm-commits

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

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

7 years agoInstCombine: Set operands instead of creating new call
Matt Arsenault [Tue, 10 Jan 2017 23:17:52 +0000 (23:17 +0000)]
InstCombine: Set operands instead of creating new call

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

7 years agoInstCombine: fdiv -x, -y -> fdiv x, y
Matt Arsenault [Tue, 10 Jan 2017 23:08:54 +0000 (23:08 +0000)]
InstCombine: fdiv -x, -y -> fdiv x, y

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

7 years agoCodeGen: Allow small copyable blocks to "break" the CFG.
Kyle Butt [Tue, 10 Jan 2017 23:04:30 +0000 (23:04 +0000)]
CodeGen: Allow small copyable blocks to "break" the CFG.

When choosing the best successor for a block, ordinarily we would have preferred
a block that preserves the CFG unless there is a strong probability the other
direction. For small blocks that can be duplicated we now skip that requirement
as well.

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

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

7 years agoRemove unused CONVERT_RNDSAT intrinsics
Matt Arsenault [Tue, 10 Jan 2017 22:38:02 +0000 (22:38 +0000)]
Remove unused CONVERT_RNDSAT intrinsics

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

7 years agoAdd the 'googlemock' component of Google Test to LLVM's unittest libraries.
Chandler Carruth [Tue, 10 Jan 2017 22:32:26 +0000 (22:32 +0000)]
Add the 'googlemock' component of Google Test to LLVM's unittest libraries.

I have two immediate motivations for adding this:
1) It makes writing expectations in tests *dramatically* easier. A
   quick example that is a taste of what is possible:

     std::vector<int> v = ...;
     EXPECT_THAT(v, UnorderedElementsAre(1, 2, 3));

   This checks that v contains '1', '2', and '3' in some order. There
   are a wealth of other helpful matchers like this. They tend to be
   highly generic and STL-friendly so they will in almost all cases work
   out of the box even on custom LLVM data structures.

   I actually find the matcher syntax substantially easier to read even
   for simple assertions:

     EXPECT_THAT(a, Eq(b));
     EXPECT_THAT(b, Ne(c));

   Both of these make it clear what is being *tested* and what is being
   *expected*. With `EXPECT_EQ` this is implicit (the LHS is expected,
   the RHS is tested) and often confusing. With `EXPECT_NE` it is just
   not clear. Even the failure error messages are superior with the
   matcher based expectations.

2) When testing any kind of generic code, you are continually defining
   dummy types with interfaces and then trying to check that the
   interfaces are manipulated in a particular way. This is actually what
   mocks are *good* for -- testing *interface interactions*. With
   generic code, there is often no "fake" or other object that can be
   used.

   For a concrete example of where this is currently causing significant
   pain, look at the pass manager unittests which are riddled with
   counters incremented when methods are called. All of these could be
   replaced with mocks. The result would be more effective at testing
   the code by having tighter constraints. It would be substantially
   more readable and maintainable when updating the code. And the error
   messages on failure would have substantially more information as
   mocks automatically record stack traces and other information *when
   the API is misused* instead of trying to diagnose it after the fact.

I expect that #1 will be the overwhelming majority of the uses of gmock,
but I think that is sufficient to justify having it. I would actually
like to update the coding standards to encourage the use of matchers
rather than any other form of `EXPECT_...` macros as they are IMO
a strict superset in terms of functionality and readability.

I think that #2 is relatively rarely useful, but there *are* cases where
it is useful. Historically, I think misuse of actual mocking as
described in #2 has led to resistance towards this framework. I am
actually sympathetic to this -- mocking can easily be overused. However
I think this is not a significant concern in LLVM. First and foremost,
LLVM has very careful and rare exposure of abstract interfaces or
dependency injection, which are the most prone to abuse with mocks. So
there are few opportunities to abuse them. Second, a large fraction of
LLVM's unittests are testing *generic code* where mocks actually make
tremendous sense. And gmock is well suited to building interfaces that
exercise generic libraries. Finally, I still think we should be willing
to have testing utilities in tree even if they should be used rarely. We
can use code review to help guide the usage here.

For a longer and more complete discussion of this, see the llvm-dev
thread here:
http://lists.llvm.org/pipermail/llvm-dev/2017-January/108672.html

The general consensus seems that this is a reasonable direction to start
down, but that doesn't mean we should race ahead and use this
everywhere. I have one test that is blocked on this to land and that was
specifically used as an example. Before widespread adoption, I'm going
to work up some (brief) guidelines as some of these facilities should be
used sparingly and carefully.

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

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

7 years agoMake the test accept different OpCode values since it doesn't really care about the...
Douglas Yung [Tue, 10 Jan 2017 22:10:22 +0000 (22:10 +0000)]
Make the test accept different OpCode values since it doesn't really care about the value.

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

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

7 years agoDAG: Avoid OOB when legalizing vector indexing
Matt Arsenault [Tue, 10 Jan 2017 22:02:30 +0000 (22:02 +0000)]
DAG: Avoid OOB when legalizing vector indexing

If a vector index is out of bounds, the result is supposed to be
undefined but is not undefined behavior. Change the legalization
for indexing the vector on the stack so that an out of bounds
index does not create an out of bounds memory access.

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