OSDN Git Service

android-x86/external-llvm.git
7 years agoMIRLangRef: Add a section on simplifying .mir tests
Matthias Braun [Thu, 13 Apr 2017 23:45:14 +0000 (23:45 +0000)]
MIRLangRef: Add a section on simplifying .mir tests

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

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

7 years ago[Profile] PE binary coverage bug fix
Xinliang David Li [Thu, 13 Apr 2017 23:37:12 +0000 (23:37 +0000)]
[Profile] PE binary coverage bug fix

PR/32584

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

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

7 years ago[AArch64] Avoid partial register writes on lane 0 of BUILD_VECTOR for i8/i16/f16
Adam Nemet [Thu, 13 Apr 2017 23:32:47 +0000 (23:32 +0000)]
[AArch64] Avoid partial register writes on lane 0 of BUILD_VECTOR for i8/i16/f16

This further improves Ahmed's change in rL299482.  See the new comment for the
rationale.

The patch recovers most of the regression for bzip2 after D31965. We're down
to +2.68% from +6.97%.

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

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

7 years agoAMDGPU/GFX9: Do not use v_pack_b32_f16 when packing
Konstantin Zhuravlyov [Thu, 13 Apr 2017 23:17:00 +0000 (23:17 +0000)]
AMDGPU/GFX9: Do not use v_pack_b32_f16 when packing

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

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

7 years agobuild_llvm_package.bat: Move to VS2017
Hans Wennborg [Thu, 13 Apr 2017 23:13:23 +0000 (23:13 +0000)]
build_llvm_package.bat: Move to VS2017

It's required for building the clang-format plugin after r300225.

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

7 years ago[IR] Make getParamAttributes take argument numbers, not ArgNo+1
Reid Kleckner [Thu, 13 Apr 2017 23:12:13 +0000 (23:12 +0000)]
[IR] Make getParamAttributes take argument numbers, not ArgNo+1

Add hasParamAttribute() and use it instead of hasAttribute(ArgNo+1,
Kind) everywhere.

The fact that the AttributeList index for an argument is ArgNo+1 should
be a hidden implementation detail.

NFC

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

7 years ago[bpf] Fix memory offset check for loads and stores
Alexei Starovoitov [Thu, 13 Apr 2017 22:24:13 +0000 (22:24 +0000)]
[bpf] Fix memory offset check for loads and stores

If the offset cannot fit into the instruction, an addition to the
pointer is emitted before the actual access. However, BPF offsets are
16-bit but LLVM considers them to be, for the matter of this check,
to be 32-bit long.

This causes the following program:

int bpf_prog1(void *ign)
{

volatile unsigned long t = 0x8983984739ull;
return *(unsigned long *)((0xffffffff8fff0002ull) + t);

}

To generate the following (wrong) code:

0: 18 01 00 00 39 47 98 83 00 00 00 00 89 00 00 00

r1 = 590618314553ll

2: 7b 1a f8 ff 00 00 00 00 *(u64 *)(r10 - 8) = r1
3: 79 a1 f8 ff 00 00 00 00 r1 = *(u64 *)(r10 - 8)
4: 79 10 02 00 00 00 00 00 r0 = *(u64 *)(r1 + 2)
5: 95 00 00 00 00 00 00 00 exit

Fix it by changing the offset check to 16-bit.

Patch by Nadav Amit <nadav.amit@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Differential Revision: https://reviews.llvm.org/D32055

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

7 years agoMIRLangRef: Simplify/update documentation
Matthias Braun [Thu, 13 Apr 2017 22:14:45 +0000 (22:14 +0000)]
MIRLangRef: Simplify/update documentation

- Refer to options by `-option` instead of `option`
- Use `-mtriple=` instead of `-march` in the example (-march will still
  target the default operating system which is usually not what you want
  in a test)
- Rephrase sentence because output does not go to stdout by default (you
  need -o - for that as should be expected).

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

7 years ago[Support] Fix ErrorOr assertion when /proc/cpuinfo doesn't exist.
Teresa Johnson [Thu, 13 Apr 2017 21:51:49 +0000 (21:51 +0000)]
[Support] Fix ErrorOr assertion when /proc/cpuinfo doesn't exist.

The ErrorOr should not be dereferenced on the error path.

Patch by Jacob Young

Reviewers: tejohnson

Subscribers: llvm-commits

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

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

7 years ago[InstCombine] Use APInt::getBitsSetFrom instead of inverting the result of getLowBits...
Craig Topper [Thu, 13 Apr 2017 21:49:48 +0000 (21:49 +0000)]
[InstCombine] Use APInt::getBitsSetFrom instead of inverting the result of getLowBitsSet. NFC

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

7 years ago[CMake][runtimes] Use -nodefaultlibs for the runtimes build
Petr Hosek [Thu, 13 Apr 2017 21:29:03 +0000 (21:29 +0000)]
[CMake][runtimes] Use -nodefaultlibs for the runtimes build

We may not have a working C++ standard library at this point so we
shouldn't rely on it when running CMake checks.

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

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

7 years ago[llvm-pdbdump] Recursively dump class layout.
Zachary Turner [Thu, 13 Apr 2017 21:11:00 +0000 (21:11 +0000)]
[llvm-pdbdump] Recursively dump class layout.

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

7 years ago[ValueTracking] Remove duplicate call to computeKnownBits for the operands of Select.
Craig Topper [Thu, 13 Apr 2017 20:39:37 +0000 (20:39 +0000)]
[ValueTracking] Remove duplicate call to computeKnownBits for the operands of Select.

We call it unconditionally on the operands of the select. Then decide if its a min/max and call it on the min/max operands or on the select operands again. Either of those second calls will overwrite the results of the initial call so we can just delete the first call.

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

7 years ago[LCSSA] Efficiently compute blocks dominating at least one exit.
Davide Italiano [Thu, 13 Apr 2017 20:36:59 +0000 (20:36 +0000)]
[LCSSA] Efficiently compute blocks dominating at least one exit.

For LCSSA purposes, loop BBs not dominating any of the exits aren't
interesting, as none of the values defined in these blocks can be
used outside the loop.

The way the code computed this information was by comparing each
BB of the loop with each of the exit blocks and ask the dominator tree
about their dominance relation. This is slow.

A more efficient way, implemented here, is that of starting from the
exit blocks and walking the dom upwards until we hit an header. By
transitivity, all the blocks we encounter in our path dominate an exit.

For the testcase provided in PR31851, this reduces compile time on
`opt -O2` by ~25%, going from 1m47s to 1m22s.

Thanks to Dan/MichaelZ for discussions/suggesting the approach/review.

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

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

7 years agoFix -Wunused-value warning
Reid Kleckner [Thu, 13 Apr 2017 20:32:58 +0000 (20:32 +0000)]
Fix -Wunused-value warning

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

7 years agoRevert accidentally-committed files in r300252.
Richard Smith [Thu, 13 Apr 2017 20:31:21 +0000 (20:31 +0000)]
Revert accidentally-committed files in r300252.

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

7 years agoRemove all allocation and divisions from GreatestCommonDivisor
Richard Smith [Thu, 13 Apr 2017 20:29:59 +0000 (20:29 +0000)]
Remove all allocation and divisions from GreatestCommonDivisor

Switch from Euclid's algorithm to Stein's algorithm for computing GCD. This
avoids the (expensive) APInt division operation in favour of bit operations.
Remove all memory allocation from within the GCD loop by tweaking our `lshr`
implementation so it can operate in-place.

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

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

7 years ago[InstCombine] Fix !prof metadata preservation for invokes
Reid Kleckner [Thu, 13 Apr 2017 20:26:38 +0000 (20:26 +0000)]
[InstCombine] Fix !prof metadata preservation for invokes

Summary:
Bug noticed by inspection.

Extend the test to handle invokes as well as calls, and rewrite it to
not depend on the inliner and other passes.

Also simplify the call site replacement code with CallSite, similar to
what I did to dead arg elimination and arg promotion (rL300235 and
rL300229).

Reviewers: danielcdh, davidxl

Subscribers: llvm-commits

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

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

7 years ago[LCSSA] Assert that we always have a valid loop.
Davide Italiano [Thu, 13 Apr 2017 20:05:37 +0000 (20:05 +0000)]
[LCSSA] Assert that we always have a valid loop.

We could otherwise add BBs not belonging to a loop in `formLCSSA`
and later crash when trying to iterate the loop blocks.

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

7 years ago[LCSSA] Remove spurious whitespaces. NFCI.
Davide Italiano [Thu, 13 Apr 2017 20:02:27 +0000 (20:02 +0000)]
[LCSSA] Remove spurious whitespaces. NFCI.

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

7 years ago[LCSSA] Use `auto` when the type is obvious. NFCI.
Davide Italiano [Thu, 13 Apr 2017 20:01:30 +0000 (20:01 +0000)]
[LCSSA] Use `auto` when the type is obvious. NFCI.

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

7 years ago[DAG] Fold away temporary vector in store candidate merge NFC.
Nirav Dave [Thu, 13 Apr 2017 20:00:27 +0000 (20:00 +0000)]
[DAG] Fold away temporary vector in store candidate merge NFC.

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

7 years agoSamplePGO: convert callsite samples map key from callsite_location to callsite_locati...
Dehao Chen [Thu, 13 Apr 2017 19:52:10 +0000 (19:52 +0000)]
SamplePGO: convert callsite samples map key from callsite_location to callsite_location+callee_name

Summary: For iterative SamplePGO, an indirect call can be speculatively promoted to multiple direct calls and get inlined. All these promoted direct calls will share the same callsite location (offset+discriminator). With the current implementation, we cannot distinguish between different promotion candidates and its inlined instance. This patch adds callee_name to the key of the callsite sample map. And added helper functions to get all inlined callee samples for a given callsite location. This helps the profile annotator promote correct targets and inline it before annotation, and ensures all indirect call targets to be annotated correctly.

Reviewers: davidxl, dnovillo

Reviewed By: davidxl

Subscribers: andreadb, llvm-commits

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

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

7 years ago[ValueTracking] Prevent a call to computeKnownBits if we already know the state of...
Craig Topper [Thu, 13 Apr 2017 19:04:45 +0000 (19:04 +0000)]
[ValueTracking] Prevent a call to computeKnownBits if we already know the state of the bit we would calculate. Also reuse a temporary APInt instead of creating a new one.

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

7 years ago[LV] Fix the vector code generation for first order recurrence
Anna Thomas [Thu, 13 Apr 2017 18:59:25 +0000 (18:59 +0000)]
[LV] Fix the vector code generation for first order recurrence

Summary:
In first order recurrences where phi's are used outside the loop,
we should generate an additional vector.extract of the second last element from
the vectorized phi update.
This is because we require the phi itself (which is the value at the second last
iteration of the vector loop) and not the phi's update within the loop.
Also fix the code gen when we just unroll, but don't vectorize.
Fixes PR32396.

Reviewers: mssimpso, mkuper, anemet

Subscribers: llvm-commits, mzolotukhin

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

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

7 years ago[InstCombine] fold X == 0 || X == -1 to one compare (PR32524)
Sanjay Patel [Thu, 13 Apr 2017 18:47:06 +0000 (18:47 +0000)]
[InstCombine] fold X == 0 || X == -1 to one compare (PR32524)

This is effectively a retry of:
https://reviews.llvm.org/rL299851
but now we have tests and an assert to make sure the bug
that was exposed with that attempt will not happen again.

I'll fix the code duplication and missing sibling fold next,
but I want to make this change as small as possible to reduce
risk since I messed it up last time.

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

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

7 years ago[DAE] Simplify call site replacement code with CallSite NFC
Reid Kleckner [Thu, 13 Apr 2017 18:42:03 +0000 (18:42 +0000)]
[DAE] Simplify call site replacement code with CallSite NFC

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

7 years ago[ValueTracking] Move a temporary APInt instead of copying it.
Craig Topper [Thu, 13 Apr 2017 18:25:53 +0000 (18:25 +0000)]
[ValueTracking] Move a temporary APInt instead of copying it.

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

7 years ago[InstCombine] Simplify attribute code with new AttributeList::get NFC
Reid Kleckner [Thu, 13 Apr 2017 18:11:03 +0000 (18:11 +0000)]
[InstCombine] Simplify attribute code with new AttributeList::get NFC

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

7 years ago[ArgPromotion] Don't drop !prof metadata on promoted calls
Reid Kleckner [Thu, 13 Apr 2017 18:10:30 +0000 (18:10 +0000)]
[ArgPromotion] Don't drop !prof metadata on promoted calls

Noticed by inspection while doing attribute work. DAE, InstCombineCalls,
and ArgPromotion have a fair amount of duplicated code for hacking on
call sites, and you can find bugs by comparing them.

Add a test case for this.

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

7 years ago[AMDGPU] Combine DS operations with offsets bigger than byte
Stanislav Mekhanoshin [Thu, 13 Apr 2017 17:53:07 +0000 (17:53 +0000)]
[AMDGPU] Combine DS operations with offsets bigger than byte

In many cases ds operations can be combined even if offsets do not
fit into 8 bit encoding. What it takes is to adjust base address.

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

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

7 years ago[APSInt] Remove named And/Or/Xor methods.
Craig Topper [Thu, 13 Apr 2017 17:39:46 +0000 (17:39 +0000)]
[APSInt] Remove named And/Or/Xor methods.

No one uses them and I may improve the operator&, operator|, and operator^ to better reuse memory allocations like APInt.

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

7 years ago[InstCombine] use similar ops for related folds; NFCI
Sanjay Patel [Thu, 13 Apr 2017 17:36:24 +0000 (17:36 +0000)]
[InstCombine] use similar ops for related folds; NFCI

It's less efficient to produce 'ule' than 'ult' since we know we're going to
canonicalize to 'ult', but we shouldn't have duplicated code for these folds.

As a trade-off, this was a pretty terrible way to make a '2'. :)
       if (LHSC == SubOne(RHSC))
         AddC = ConstantExpr::getSub(AddOne(RHSC), LHSC);

The next steps are to share the code to fix PR32524 and add the missing 'and'
fold that was left out when PR14708 was fixed:
https://bugs.llvm.org/show_bug.cgi?id=14708

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

7 years ago[APInt] Fix the returns description for the postfix increment/decrement operators...
Craig Topper [Thu, 13 Apr 2017 17:12:00 +0000 (17:12 +0000)]
[APInt] Fix the returns description for the postfix increment/decrement operators. NFC

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

7 years agoRevert r300213 "[APSInt] Add a static_assert to ensure APSInt is packed well with...
Craig Topper [Thu, 13 Apr 2017 16:54:25 +0000 (16:54 +0000)]
Revert r300213 "[APSInt] Add a static_assert to ensure APSInt is packed well with APInt after r300171"

MSVC doesn't pack derived classes the same way clang/gcc do.

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

7 years ago[Analysis] Support bitreverse in -demanded-bits pass
Brian Gesiak [Thu, 13 Apr 2017 16:44:25 +0000 (16:44 +0000)]
[Analysis] Support bitreverse in -demanded-bits pass

Summary:
* Add a bitreverse case in the demanded bits analysis pass.
* Add tests for the bitreverse (and bswap) intrinsic in the
  demanded bits pass.
* Add a test case to the BDCE tests: that manipulations to
  high-order bits are eliminated once the bits are reversed
  and then right-shifted.

Reviewers: mkuper, jmolloy, hfinkel, trentxintong

Reviewed By: jmolloy

Subscribers: llvm-commits

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

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

7 years ago[APSInt] Add a static_assert to ensure APSInt is packed well with APInt after r300171.
Craig Topper [Thu, 13 Apr 2017 16:34:49 +0000 (16:34 +0000)]
[APSInt] Add a static_assert to ensure APSInt is packed well with APInt after r300171.

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

7 years agoLTO: Pass SF_Executable flag through to InputFile::Symbol
Tobias Edler von Koch [Thu, 13 Apr 2017 16:24:14 +0000 (16:24 +0000)]
LTO: Pass SF_Executable flag through to InputFile::Symbol

Summary:
The linker needs to be able to determine whether a symbol is text or data to
handle the case of a common being overridden by a strong definition in an
archive. If the archive contains a text member of the same name as the common,
that function is discarded. However, if the archive contains a data member of
the same name, that strong definition overrides the common. This is a behavior
of ld.bfd, which the Qualcomm linker also supports in LTO.

Here's a test case to illustrate:

####

cat > 1.c << \!
int blah;
!

cat > 2.c << \!
int blah() {
  return 0;
}
!

cat > 3.c << \!
int blah = 20;
!

clang -c 1.c
clang -c 2.c
clang -c 3.c

ar cr lib.a 2.o 3.o
ld 1.o lib.a -t

####

The correct output is:

1.o
(lib.a)3.o

Thanks to Shankar Easwaran and Hemant Kulkarni for the test case!

Reviewers: mehdi_amini, rafael, pcc, davide

Reviewed By: pcc

Subscribers: davide, llvm-commits, inglorion

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

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

7 years ago[Hexagon] Unxfail passing tests
Krzysztof Parzyszek [Thu, 13 Apr 2017 16:05:35 +0000 (16:05 +0000)]
[Hexagon] Unxfail passing tests

r300198 fixed a problem that caused two tests to be xfailed. Unxfail
these tests now, since they are passing.

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

7 years ago[InstCombine] fix assert to not always be true
Sanjay Patel [Thu, 13 Apr 2017 16:05:01 +0000 (16:05 +0000)]
[InstCombine] fix assert to not always be true

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

7 years ago[InstCombine] add/move tests for or-of-icmps; NFC
Sanjay Patel [Thu, 13 Apr 2017 15:46:39 +0000 (15:46 +0000)]
[InstCombine] add/move tests for or-of-icmps; NFC

If we had these tests, the bug caused by https://reviews.llvm.org/rL299851 would have been caught sooner.
There's also an assert in the code that should have caught that bug, but the assert line itself has a bug.

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

7 years agoRe-apply "[GVNHoist] Move GVNHoist to function simplification part of pipeline."
Geoff Berry [Thu, 13 Apr 2017 15:36:25 +0000 (15:36 +0000)]
Re-apply "[GVNHoist] Move GVNHoist to function simplification part of pipeline."

This reverts commit r296872 now that PR32153 has been fixed.

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

7 years ago[Hexagon] Implement HexagonTargetLowering::CanLowerReturn
Krzysztof Parzyszek [Thu, 13 Apr 2017 15:05:51 +0000 (15:05 +0000)]
[Hexagon] Implement HexagonTargetLowering::CanLowerReturn

Patch by Michael Wu.

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

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

7 years ago[Hexagon] Fix "LowerFormalArguments emitted a value with the wrong type!" assertion
Krzysztof Parzyszek [Thu, 13 Apr 2017 15:00:18 +0000 (15:00 +0000)]
[Hexagon] Fix "LowerFormalArguments emitted a value with the wrong type!" assertion

Patch by Michael Wu.

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

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

7 years agoUse methods to access data stored with frame instructions
Serge Pavlov [Thu, 13 Apr 2017 14:10:52 +0000 (14:10 +0000)]
Use methods to access data stored with frame instructions

Instructions CALLSEQ_START..CALLSEQ_END and their target dependent
counterparts keep data like frame size, stack adjustment etc. These
data are accessed by getOperand using hard coded indices. It is
error prone way. This change implements the access by special methods,
which improve readability and allow changing data representation without
massive changes of index values.

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

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

7 years agollvm/test/BugPoint/compile-custom.ll: Use %/s for its path not to be mis-escaped.
NAKAMURA Takumi [Thu, 13 Apr 2017 11:40:32 +0000 (11:40 +0000)]
llvm/test/BugPoint/compile-custom.ll: Use %/s for its path not to be mis-escaped.

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

7 years ago[X86] Added missing mayLoad/mayStore attributes to some X86 instructions.
Ayman Musa [Thu, 13 Apr 2017 10:03:45 +0000 (10:03 +0000)]
[X86] Added missing mayLoad/mayStore attributes to some X86 instructions.

Throughout the effort of automatically generating the X86 memory folding tables these missing information were encountered.
This is a preparation work for a future patch including the automation of these tables.

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

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

7 years ago[DWARF] - Simplify (use dyn_cast instead of isa + cast).
George Rimar [Thu, 13 Apr 2017 09:52:50 +0000 (09:52 +0000)]
[DWARF] - Simplify (use dyn_cast instead of isa + cast).

This addresses post commit review comments for r300039.

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

7 years ago[globalisel][tablegen] Report more detail in some SelectionDAG import failures. NFC
Daniel Sanders [Thu, 13 Apr 2017 09:45:37 +0000 (09:45 +0000)]
[globalisel][tablegen] Report more detail in some SelectionDAG import failures. NFC

Reviewers: ab, t.p.northover, qcolombet, aditya_nandakumar, rovka

Reviewed By: ab

Subscribers: dberris, kristof.beyls, igorb, llvm-commits

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

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

7 years agoReverting cmake/modules/AddLLVM.cmake changes from revision 300184 (Added by mistake).
Ayman Musa [Thu, 13 Apr 2017 09:26:49 +0000 (09:26 +0000)]
Reverting cmake/modules/AddLLVM.cmake changes from revision 300184 (Added by mistake).

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

7 years ago[X86] Change instructions names to keep consistency with the naming convention. NFC
Ayman Musa [Thu, 13 Apr 2017 09:12:32 +0000 (09:12 +0000)]
[X86] Change instructions names to keep consistency with the naming convention. NFC

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

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

7 years ago[LV] Refactor ILV to provide vectorizeInstruction(); NFC
Ayal Zaks [Thu, 13 Apr 2017 09:07:23 +0000 (09:07 +0000)]
[LV] Refactor ILV to provide vectorizeInstruction(); NFC

Refactoring InnerLoopVectorizer's vectorizeBlockInLoop() to provide
vectorizeInstruction(). Aligning DeadInstructions with its only user.
Facilitates driving the transformation by VPlan - follows
https://reviews.llvm.org/D28975 and its tentative breakdown.

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

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

7 years agoFix typo in static_assert message. NFC
Craig Topper [Thu, 13 Apr 2017 07:31:52 +0000 (07:31 +0000)]
Fix typo in static_assert message. NFC

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

7 years ago[ORC] Temporarily disable the RPC Error/Expected unit tests while I investigate
Lang Hames [Thu, 13 Apr 2017 06:20:45 +0000 (06:20 +0000)]
[ORC] Temporarily disable the RPC Error/Expected unit tests while I investigate
bot failures.

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

7 years ago[Orc] Fix bool serialization for RawByteChannels.
Lang Hames [Thu, 13 Apr 2017 05:23:50 +0000 (05:23 +0000)]
[Orc] Fix bool serialization for RawByteChannels.

The bool type may be larger than the char type, so assuming we can cast from
bool to char and write a byte out to the stream is unsafe.

Hopefully this will get RPCUtilsTest.ReturnExpectedFailure passing on the bots.

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

7 years ago[ORC] Remove more extraneous semicolons from r300167, rename the RPC Expected
Lang Hames [Thu, 13 Apr 2017 05:05:26 +0000 (05:05 +0000)]
[ORC] Remove more extraneous semicolons from r300167, rename the RPC Expected
tests to be consistent with the Error tests.

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

7 years agoRemove more lies from the LangRef.
George Burgess IV [Thu, 13 Apr 2017 05:00:31 +0000 (05:00 +0000)]
Remove more lies from the LangRef.

Same change as in r300168, but for invoke instead of call.

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

7 years ago[APInt] Reorder fields to avoid a hole in the middle of the class
Craig Topper [Thu, 13 Apr 2017 04:59:11 +0000 (04:59 +0000)]
[APInt] Reorder fields to avoid a hole in the middle of the class

Summary:
APInt is currently implemented with an unsigned BitWidth field first and then a uint_64/pointer union. Due to the 64-bit size of the union there is a hole after the bitwidth.

Putting the union first allows the class to be packed. Making it 12 bytes instead of 16 bytes. An APSInt goes from 20 bytes to 16 bytes.

This shows a 4k reduction on the size of the opt binary on my local x86-64 build. So this enables some other improvement to the code as well.

Reviewers: dblaikie, RKSimon, hans, davide

Reviewed By: davide

Subscribers: davide, llvm-commits

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

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

7 years ago[ORC] Remove extraneous semi-colon added in r300167.
Lang Hames [Thu, 13 Apr 2017 04:49:00 +0000 (04:49 +0000)]
[ORC] Remove extraneous semi-colon added in r300167.

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

7 years ago[APInt] Generalize the implementation of tcIncrement to support adding a full 'word...
Craig Topper [Thu, 13 Apr 2017 04:36:06 +0000 (04:36 +0000)]
[APInt] Generalize the implementation of tcIncrement to support adding a full 'word' by introducing tcAddPart. Use this to support tcIncrement, operator++ and operator+=(uint64_t). Do the same for subtract. NFCI.

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

7 years agoUpdate the LangRef to reflect reality.
George Burgess IV [Thu, 13 Apr 2017 04:01:55 +0000 (04:01 +0000)]
Update the LangRef to reflect reality.

At the very least, we have CallInst::setIsNoInline() for adding the
noinline attribute to callsites, and I'm told alwaysinline seems to
work.

Thought of adding "not all attributes are guaranteed to work here". If
someone thinks that would be better (or has a better way of phrasing
that, etc.), happy to add it.

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

7 years ago[ORC] Add RPC and serialization support for Errors and Expecteds.
Lang Hames [Thu, 13 Apr 2017 03:51:35 +0000 (03:51 +0000)]
[ORC] Add RPC and serialization support for Errors and Expecteds.

This patch allows Error and Expected types to be passed to and returned from
RPC functions.

Serializers and deserializers for custom error types (types deriving from the
ErrorInfo class template) can be registered with the SerializationTraits for
a given channel type (see registerStringError in RPCSerialization.h for an
example), allowing a given custom type to be sent/received. Unregistered types
will be serialized/deserialized as StringErrors using the custom type's log
message as the error string.

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

7 years agoRemove some unused private fields.
Zachary Turner [Thu, 13 Apr 2017 02:28:17 +0000 (02:28 +0000)]
Remove some unused private fields.

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

7 years ago[InstCombine] Add vector version of a test to show missing optimization.
Craig Topper [Thu, 13 Apr 2017 01:31:40 +0000 (01:31 +0000)]
[InstCombine] Add vector version of a test to show missing optimization.

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

7 years agoSupport: Add a VCSRevision.h header file.
Peter Collingbourne [Thu, 13 Apr 2017 01:26:12 +0000 (01:26 +0000)]
Support: Add a VCSRevision.h header file.

This is a magic header file supported by the build system that provides a
single definition, LLVM_REVISION, containing an LLVM revision identifier,
if available. This functionality previously lived in the LTO library, but
I am moving it out to lib/Support because I want to also start using it in
lib/Object to create the IR symbol table.

This change also fixes a bug where LLVM_REVISION was never actually being
used in lib/LTO because the macro HAS_LLVM_REVISION was never defined (it
was misspelled as HAVE_SVN_VERSION_INC in lib/LTO/CMakeLists.txt, and was
only being defined in a non-existent file Version.cpp).

I also changed the code to use "git rev-parse --git-dir" to locate the .git
directory, instead of looking for it in the LLVM source root directory,
which makes this compatible with monorepos as well as git worktrees.

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

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

7 years ago[ORC] Add missing file from r300155.
Lang Hames [Thu, 13 Apr 2017 01:06:45 +0000 (01:06 +0000)]
[ORC] Add missing file from r300155.

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

7 years ago[ORC] Use native Errors rather than converted std::error_codes for ORC RPC.
Lang Hames [Thu, 13 Apr 2017 01:03:06 +0000 (01:03 +0000)]
[ORC] Use native Errors rather than converted std::error_codes for ORC RPC.

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

7 years ago[IR] Take func, ret, and arg attrs separately in AttributeList::get
Reid Kleckner [Thu, 13 Apr 2017 00:58:09 +0000 (00:58 +0000)]
[IR] Take func, ret, and arg attrs separately in AttributeList::get

This seems like a much more natural API, based on Derek Schuff's
comments on r300015. It further hides the implementation detail of
AttributeList that function attributes come last and appear at index
~0U, which is easy for the user to screw up. git diff says it saves code
as well: 97 insertions(+), 137 deletions(-)

This also makes it easier to change the implementation, which I want to
do next.

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

7 years ago[IR] Remove the APIntMoveTy typedef from ConstantRange. Use APInt type directly.
Craig Topper [Thu, 13 Apr 2017 00:20:31 +0000 (00:20 +0000)]
[IR] Remove the APIntMoveTy typedef from ConstantRange. Use APInt type directly.

This typedef used to be conditional based on whether rvalue references were supported. Looks like it got left behind when we switched to always having rvalue references with c++11. I don't think it provides any value now.

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

7 years agoWork around MSVC rejects-valid bug related to C++11 narrowing conversions.
Richard Smith [Thu, 13 Apr 2017 00:14:39 +0000 (00:14 +0000)]
Work around MSVC rejects-valid bug related to C++11 narrowing conversions.

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

7 years agoFix compiler error in Attributes.cpp
Konstantin Zhuravlyov [Wed, 12 Apr 2017 23:57:37 +0000 (23:57 +0000)]
Fix compiler error in Attributes.cpp
```
Compiling Attributes.cpp ...
../../../Attributes.cpp: In member function 'std::__1::pair<unsigned int, llvm::Optional<unsigned int> > llvm::AttributeSet::getAllocSizeArgs() const':
../../../Attributes.cpp:542:69: error: operands to ?: have different types 'std::__1::pair<unsigned int, llvm::Optional<unsigned int> >' and 'std::__1::pair<int, int>'
   return SetNode ? SetNode->getAllocSizeArgs() : std::make_pair(0, 0);
                                                                     ^
../../../Attributes.cpp:543:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^
```

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

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

7 years agoAMDGPU : Fix common dominator of two incoming blocks terminates with uniform branch...
Wei Ding [Wed, 12 Apr 2017 23:51:47 +0000 (23:51 +0000)]
AMDGPU : Fix common dominator of two incoming blocks terminates with uniform branch issue.

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

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

7 years agoFix some ArgList uses after API change in r300135.
Richard Smith [Wed, 12 Apr 2017 23:43:58 +0000 (23:43 +0000)]
Fix some ArgList uses after API change in r300135.

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

7 years agoFix initialization order of class members.
Zachary Turner [Wed, 12 Apr 2017 23:27:43 +0000 (23:27 +0000)]
Fix initialization order of class members.

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

7 years agoArgList: cache index ranges containing arguments with each ID
Richard Smith [Wed, 12 Apr 2017 23:19:51 +0000 (23:19 +0000)]
ArgList: cache index ranges containing arguments with each ID

Improve performance of argument list parsing with large numbers of IDs and
large numbers of arguments, by tracking a conservative range of indexes within
the argument list that might contain an argument with each ID. In the worst
case (when the first and last argument with a given ID are at the opposite ends
of the argument list), this still results in a linear-time walk of the list,
but it helps substantially in the common case where each ID occurs only once,
or a few times close together in the list.

This gives a ~10x speedup to clang's `test/Driver/response-file.c`, which
constructs a very large set of command line arguments and feeds them to the
clang driver.

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

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

7 years ago[llvm-pdbdump] Minor prepatory refactor of Class Def Dumper.
Zachary Turner [Wed, 12 Apr 2017 23:18:51 +0000 (23:18 +0000)]
[llvm-pdbdump] Minor prepatory refactor of Class Def Dumper.

In a followup patch I intend to introduce an additional dumping
mode which dumps a graphical representation of a class's layout.
In preparation for this, the text-based layout printer needs to
be split out from the graphical layout printer, and both need
to be able to use the same code for printing the intro and outro
of a class's definition (e.g. base class list, etc).

This patch does so, and in the process introduces a skeleton
definition for the graphical printer, while currently making
the graphical printer just print nothing.

NFC

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

7 years ago[llvm-pdbdump] More advanced class definition dumping.
Zachary Turner [Wed, 12 Apr 2017 23:18:21 +0000 (23:18 +0000)]
[llvm-pdbdump] More advanced class definition dumping.

Previously the dumping of class definitions was very primitive,
and it made it hard to do more than the most trivial of output
formats when dumping.  As such, we would only dump one line for
each field, and then dump non-layout items like nested types
and enums.

With this patch, we do a complete analysis of the object
hierarchy including aggregate types, bases, virtual bases,
vftable analysis, etc.  The only immediately visible effects
of this are that a) we can now dump a line for the vfptr where
before we would treat that as padding, and b) we now don't
treat virtual bases that come at the end of a class as padding
since we have a more detailed analysis of the class's storage
usage.

In subsequent patches, we should be able to use this analysis
to display a complete graphical view of a class's layout including
recursing arbitrarily deep into an object's base class / aggregate
member hierarchy.

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

7 years ago[libFuzzer] XFAIL fuzzer-oom.test on Darwin.
Akira Hatanaka [Wed, 12 Apr 2017 23:15:10 +0000 (23:15 +0000)]
[libFuzzer] XFAIL fuzzer-oom.test on Darwin.

The test fails on Darwin because Fuzzer::DeathCallback (which calls
DumpCurrentUnit("crash-")) is called before DumpCurrentUnit("oom-") is
called in Fuzzer::RssLimitCallback. DeathCallback is transitively called
from __sanitizer_print_memory_profile.

This should fix the fuzzer bot that has been failing for a while:

http://lab.llvm.org:8080/green/job/libFuzzer/

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

7 years ago[InstSimplify] Don't try to constant fold AllocaInsts since it won't do anything.
Craig Topper [Wed, 12 Apr 2017 22:54:24 +0000 (22:54 +0000)]
[InstSimplify] Don't try to constant fold AllocaInsts since it won't do anything.

Should give a small compile time improvement.

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

7 years ago[IR] Make AttributeSet constructor from AttributeSetNode* explicit
Reid Kleckner [Wed, 12 Apr 2017 22:30:37 +0000 (22:30 +0000)]
[IR] Make AttributeSet constructor from AttributeSetNode* explicit

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

7 years ago[ValueTracking] Teach GetUnderlyingObject to stop when it reachs an alloca instruction.
Craig Topper [Wed, 12 Apr 2017 22:29:23 +0000 (22:29 +0000)]
[ValueTracking] Teach GetUnderlyingObject to stop when it reachs an alloca instruction.

Previously it tried to call SimplifyInstruction which doesn't know anything about alloca so defers to constant folding which also doesn't do anything with alloca. This results in wasted cycles making calls that won't do anything. Given the frequency with which this function is called this time adds up.

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

7 years ago[IR] Assert that we never create an empty AttributeListImpl, NFC
Reid Kleckner [Wed, 12 Apr 2017 22:22:01 +0000 (22:22 +0000)]
[IR] Assert that we never create an empty AttributeListImpl, NFC

Delete following conditional that is always true as a result.

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

7 years agoAMDGPU: Fix invalid copies when copying i1 to phys reg
Matt Arsenault [Wed, 12 Apr 2017 21:58:23 +0000 (21:58 +0000)]
AMDGPU: Fix invalid copies when copying i1 to phys reg

Insert a VReg_1 virtual register so the i1 workaround pass
can handle it.

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

7 years ago[AMDGPU] Generate range metadata for workitem id
Stanislav Mekhanoshin [Wed, 12 Apr 2017 20:48:56 +0000 (20:48 +0000)]
[AMDGPU] Generate range metadata for workitem id

If workgroup size is known inform llvm about range returned by local
id  and local size queries.

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

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

7 years agoRemove readnone from invariant.group.barrier
Piotr Padlewski [Wed, 12 Apr 2017 20:45:12 +0000 (20:45 +0000)]
Remove readnone from invariant.group.barrier

Summary:
Readnone attribute would cause CSE of two barriers with
the same argument, which is invalid by example:

    struct Base {
          virtual int foo() { return 42; }
    };

    struct Derived1 : Base {
          int foo() override { return 50; }
    };

    struct Derived2 : Base {
          int foo() override { return 100; }
    };

    void foo() {
        Base *x = new Base{};
        new (x) Derived1{};
        int a = std::launder(x)->foo();
        new (x) Derived2{};
        int b = std::launder(x)->foo();
    }

Here 2 calls of std::launder will produce @llvm.invariant.group.barrier,
which would be merged into one call, causing devirtualization
to devirtualize second call into Derived1::foo() instead of
Derived2::foo()

Reviewers: chandlerc, dberlin, hfinkel

Subscribers: llvm-commits, rsmith, amharc

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

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

7 years agoAppend -w when LLVM_ENABLE_WARNINGS is Off.
Vassil Vassilev [Wed, 12 Apr 2017 20:43:11 +0000 (20:43 +0000)]
Append -w when LLVM_ENABLE_WARNINGS is Off.

Reviewed by rnk (D31702)!

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

7 years agoBitcode: Move version and global value module code parsers to separate functions...
Peter Collingbourne [Wed, 12 Apr 2017 20:02:09 +0000 (20:02 +0000)]
Bitcode: Move version and global value module code parsers to separate functions. NFCI.

This will make it easier to teach this code about the string table.

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

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

7 years ago[Support] Add support for unique_ptr<> to Casting.h.
Zachary Turner [Wed, 12 Apr 2017 19:59:37 +0000 (19:59 +0000)]
[Support] Add support for unique_ptr<> to Casting.h.

Often you have a unique_ptr<T> where T supports LLVM's
casting methods, and you wish to cast it to a unique_ptr<U>.
Prior to this patch, this requires doing hacky things like:

unique_ptr<U> Casted;
if (isa<U>(Orig.get()))
  Casted.reset(cast<U>(Orig.release()));

This is overly verbose, and it would be nice to just be able
to use unique_ptr directly with cast and dyn_cast.  To this end,
this patch updates cast<> to work directly with unique_ptr<T>,
so you can now write:

auto Casted = cast<U>(std::move(Orig));

Since it's possible for dyn_cast<> to fail, however, we choose
to use a slightly different API here, because it's awkward to
write

if (auto Casted = dyn_cast<U>(std::move(Orig))) {}

when Orig may end up not having been moved at all.  So the
interface for dyn_cast is

if (auto Casted = unique_dyn_cast<U>(Orig)) {}

Where the inclusion of `unique` in the name of the cast operator
re-affirms that regardless of success of or fail of the casting,
exactly one of the input value and the return value will contain
a non-null result.

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

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

7 years agoRemove svnprop eol-style:native from Casting.h
Zachary Turner [Wed, 12 Apr 2017 19:52:47 +0000 (19:52 +0000)]
Remove svnprop eol-style:native from Casting.h

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

7 years ago[InstCombine] Teach SimplifyMultipleUseDemandedBits to handle And/Or/Xor known bits...
Craig Topper [Wed, 12 Apr 2017 19:32:47 +0000 (19:32 +0000)]
[InstCombine] Teach SimplifyMultipleUseDemandedBits to handle And/Or/Xor known bits using the LHS/RHS known bits it already acquired without recursing back into computeKnownBits.

This replicates the known bits and constant creation code from the single use case for these instructions and adds it here. The computeKnownBits and constant creation code for other instructions is now in the default case of the opcode switch.

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

7 years ago[InstCombine] Remove unreachable code for turning an And where all demanded bits...
Craig Topper [Wed, 12 Apr 2017 19:08:03 +0000 (19:08 +0000)]
[InstCombine] Remove unreachable code for turning an And where all demanded bits on both sides are known to be zero into a constant 0.

We already handled a superset check that included the known ones too and folded to a constant that may include ones. But it can also handle the case of no ones.

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

7 years ago[InstCombine] fix wrong undef handling when converting select to shuffle
Sanjay Patel [Wed, 12 Apr 2017 18:39:53 +0000 (18:39 +0000)]
[InstCombine] fix wrong undef handling when converting select to shuffle

As discussed in:
https://bugs.llvm.org/show_bug.cgi?id=32486
...the canonicalization of vector select to shufflevector does not hold up
when undef elements are present in the condition vector.

Try to make the undef handling clear in the code and the LangRef.

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

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

7 years ago[SelectionDAG] Use APInt move assignment to avoid 2 memory allocations and copies...
Craig Topper [Wed, 12 Apr 2017 18:39:27 +0000 (18:39 +0000)]
[SelectionDAG] Use APInt move assignment to avoid 2 memory allocations and copies when bit width is larger than 64-bits.

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

7 years agoCodeGen: BlockPlacement: Add comment about DenseMap Safety.
Kyle Butt [Wed, 12 Apr 2017 18:30:32 +0000 (18:30 +0000)]
CodeGen: BlockPlacement: Add comment about DenseMap Safety.

The use of a DenseMap in precomputeTriangleChains does not cause
non-determinism, even though it is iterated over, as the only thing the
iteration does is to insert entries into a new DenseMap, which is not iterated.
Comment only change.

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

7 years agollvm-lto2: Add a dump-symtab subcommand.
Peter Collingbourne [Wed, 12 Apr 2017 18:27:00 +0000 (18:27 +0000)]
llvm-lto2: Add a dump-symtab subcommand.

This allows us to test the symbol table APIs for LTO input files.

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

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

7 years ago[InstCombine] In SimplifyMultipleUseDemandedBits, use a switch instead of cascaded...
Craig Topper [Wed, 12 Apr 2017 18:25:25 +0000 (18:25 +0000)]
[InstCombine] In SimplifyMultipleUseDemandedBits, use a switch instead of cascaded ifs on opcode. NFC

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

7 years ago[InstCombine] Teach SimplifyDemandedInstructionBits that even if we reach an instruct...
Craig Topper [Wed, 12 Apr 2017 18:17:46 +0000 (18:17 +0000)]
[InstCombine] Teach SimplifyDemandedInstructionBits that even if we reach an instruction that has multiple uses, if we know all the bits for the demanded bits for this context we can go ahead and create a constant.

Currently if we reach an instruction with multiples uses we know we can't do any optimizations to that instruction itself since we only have the demanded bits for one of the users. But if we know all of the bits are zero/one for that one user we can still go ahead and create a constant to give to that user.

This might then reduce the instruction to having a single use and allow additional optimizations on the other path.

This picks up an additional case that r300075 didn't catch.

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

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

7 years agoMachineScheduler: Skip acyclic latency heuristic for in-order cores
Matthias Braun [Wed, 12 Apr 2017 18:09:05 +0000 (18:09 +0000)]
MachineScheduler: Skip acyclic latency heuristic for in-order cores

The current heuristic is triggered on `InFlightCount > BufferLimit`
which isn't really helpful on in-order cores where BufferLimit is zero.

Note that we already get latency hiding effects for in order cores
by instructions staying in the pending queue on stalls; The additional
latency scheduling heuristics only have minimal effects after that while
occasionally increasing register pressure too much resulting in extra
spills.

My motivation here is additional spills/reloads ending up in a loop in
464.h264ref / BlockMotionSearch function resulting in a 4% overal
regression on an in order core. rdar://30264380

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

7 years ago[InstCombine] Move portion of SimplifyDemandedUseBits that deals with instructions...
Craig Topper [Wed, 12 Apr 2017 18:05:21 +0000 (18:05 +0000)]
[InstCombine] Move portion of SimplifyDemandedUseBits that deals with instructions with multiple uses out to a separate method. NFCI

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

7 years ago[SystemZ] Fix more target specific tests
Renato Golin [Wed, 12 Apr 2017 18:03:09 +0000 (18:03 +0000)]
[SystemZ] Fix more target specific tests

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