Commit Graph

102183 Commits

Author SHA1 Message Date
Craig Topper
e14494685b [APInt] Remove unnecessary min with BitWidth from countTrailingOnesSlowCase.
The unused upper bits are guaranteed to be 0 so we don't need to worry about accidentally counting them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301091 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 19:59:11 +00:00
Xinliang David Li
db0b3ce4eb [PartialInlining] Using existing hasAddressTaken interface to legality check/NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301090 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 19:24:19 +00:00
Sanjay Patel
56bf04cfa4 [InstCombine] use 'match' to reduce code; NFCI
The later uses of dyn_castNotVal in this block are either
incomplete (doesn't handle vector constants) or overstepping
(shouldn't handle constants at all), but this first use is
just unnecessary. 'I' is obviously not a constant, and it 
can't be a not-of-a-not because that would already be
instsimplified.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301088 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 18:05:35 +00:00
Daniel Sanders
cc3830e7da [globalisel][tablegen] Revise API for ComplexPattern operands to improve flexibility.
Summary:
Some targets need to be able to do more complex rendering than just adding an
operand or two to an instruction. For example, it may need to insert an
instruction to extract a subreg first, or it may need to perform an operation
on the operand.

In SelectionDAG, targets would create SDNode's to achieve the desired effect
during the complex pattern predicate. This worked because SelectionDAG had a
form of garbage collection that would take care of SDNode's that were created
but not used due to a later predicate rejecting a match. This doesn't translate
well to GlobalISel and the churn was wasteful.

The API changes in this patch enable GlobalISel to accomplish the same thing
without the waste. The API is now:
	InstructionSelector::OptionalComplexRendererFn selectArithImmed(MachineOperand &Root) const;
where Root is the root of the match. The return value can be omitted to
indicate that the predicate failed to match, or a function with the signature
ComplexRendererFn can be returned. For example:
	return OptionalComplexRendererFn(
	       [=](MachineInstrBuilder &MIB) { MIB.addImm(Immed).addImm(ShVal); });
adds two immediate operands to the rendered instruction. Immed and ShVal are
captured from the predicate function.

As an added bonus, this also reduces the amount of information we need to
provide to GIComplexOperandMatcher.

Depends on D31418

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

Reviewed By: ab

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301079 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 15:11:04 +00:00
David Blaikie
36e99fa5b0 Avoid using relocations for ref_addr in .dwo files
In dwo files the fixed offset can be used - if the dwos are linked into
a dwp, the dwo consumer must use the dwp tables to find out where the
original range of the debug_info was and resolve the "section relative"
value relative to that original range - effectively
avoiding/reimplementing the relocation handling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301072 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 07:53:44 +00:00
Artur Pilipenko
7ff25f5145 Fix for PR32740 - Invalid floating type, unreachable between r300969 and r301029
The bug was introduced by r301018 "[InstCombine] fadd double (sitofp x), y check that the promotion is valid". The patch didn't expect that fadd can be on vectors not necessarily scalars. Add vector support along with the test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301070 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 07:24:52 +00:00
Craig Topper
b75bb044ee [APInt] Add WORD_MAX constant and use it instead of UINT64_MAX. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301069 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 06:31:36 +00:00
David Blaikie
a753d9a103 Remove the unnecessary virtual dtor from the DIEUnit hierarchy (in favor of protected dtor in the base, final derived classes with public non-virtual dtors)
These objects are never polymorphically owned/destroyed, so the virtual
dtor was unnecessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301068 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 02:18:00 +00:00
Matt Arsenault
9254ae141b LowerSwitch: Fix producing invalid IR on unreachable code
If a switch was in an unreachable block that branched
to a block with a phi, it would leave phis with missing
predecessors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301064 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 23:54:12 +00:00
David Blaikie
9c1b0af658 Move Split DWARF handling to an MC option/command line argument rather than using metadata
Since Split DWARF needs to name the actual .dwo file that is generated,
it can't be known at the time the llvm::Module is produced as it may be
merged with other Modules before the object is generated and that object
may be generated with any name.

By passing the Split DWARF file name when LLVM is producing object code
the .dwo file name in the object file can match correctly.

The support for Split DWARF for implicit modules remains the same -
using metadata to store the dwo name and dwo id so that potentially
multiple skeleton CUs referring to different dwo files can be generated
from one llvm::Module.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301062 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 23:35:26 +00:00
Kuba Mracek
9204f8cf4a Fixup for r301054: Use an explicit constructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301061 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 23:28:01 +00:00
Easwaran Raman
4b8e4224d5 Remove a repeated comment line. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301059 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 23:12:16 +00:00
Kuba Mracek
1d830459ca Fixup for r301054: Only use __attribute__((no_sanitize("memory"))) when it's available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301058 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 22:58:55 +00:00
Matthias Braun
d534f62d26 AArch64FrameLowering: Check if the ExtraCSSpill register is actually unused
The code assumed that when saving an additional CSR register
(ExtraCSSpill==true) we would have a free register throughout the
function. This was not true if this CSR register is also used to pass
values as in the swiftself case.

rdar://31451816

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301057 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 22:42:08 +00:00
Kuba Mracek
d0b815c06f [libFuzzer] Always build libFuzzer
There are two reasons why users might want to build libfuzzer:
- To fuzz LLVM itself
- To get the libFuzzer.a archive file, so that they can attach it to their code
This change always builds libfuzzer, and supports the second use case if the specified flag is set.

The point of this patch is to have something that can potentially be shipped with the compiler, and this also ensures that the version of libFuzzer is correct to use with that compiler.

Patch by George Karpenkov.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301054 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 22:38:24 +00:00
Eugene Zelenko
903f87efcc [Object] 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@301049 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 22:03:05 +00:00
Hans Wennborg
960a40ec57 Re-commit r301040 "X86: Don't emit zero-byte functions on Windows"
In addition to the original commit, tighten the condition for when to
pad empty functions to COFF Windows.  This avoids running into problems
when targeting e.g. Win32 AMDGPU, which caused test failures when this
was committed initially.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301047 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 21:48:41 +00:00
Frederich Munch
94f347bd33 [Test commit] Remove extra newline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301046 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 21:39:50 +00:00
Matt Arsenault
cfadbaaf1a InferAddressSpaces: Infer for just GEPs
Fixes leaving intermediate flat addressing computations
where a GEP instruction's source is a constant expression.

Still leaves behind a trivial addrspacecast + gep pair that
instcombine is able to handle, which ideally could be folded
here directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301044 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 21:35:04 +00:00
Xinliang David Li
29f3141f90 [PartialInliner] Partial inliner needs to check use kind before transformation
Differential Revision: https://reviews.llvm.org/D32373



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301042 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 21:20:56 +00:00
Hans Wennborg
0720f631bf Revert r301040 "X86: Don't emit zero-byte functions on Windows"
This broke almost all bots. Reverting while fixing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301041 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 21:10:37 +00:00
Hans Wennborg
fe76aaa6ee X86: Don't emit zero-byte functions on Windows
Empty functions can lead to duplicate entries in the Guard CF Function
Table of a binary due to multiple functions sharing the same RVA,
causing the kernel to refuse to load that binary.

We had a terrific bug due to this in Chromium.

It turns out we were already doing this for Mach-O in certain
situations. This patch expands the code for that in
AsmPrinter::EmitFunctionBody() and renames
TargetInstrInfo::getNoopForMachoTarget() to simply getNoop() since it
seems it was used for not just Mach-O anyway.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301040 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 20:58:12 +00:00
Tim Northover
602538f2e2 ARM: make sure we use all entries in a vector before forming a vpaddl.
Otherwise there's some mismatch, and we'll either form an illegal type or an
illegal node.

Thanks to Eli Friedman for pointing out the problem with my original solution.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301036 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 20:35:52 +00:00
Sanjay Patel
b51ea00f00 [InstCombine] revert r300977 and r301021
This can cause an inf-loop. Investigating...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301035 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 20:29:17 +00:00
Adrian Prantl
cb0aed9eec typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301030 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 20:06:41 +00:00
Konstantin Zhuravlyov
79953642da AMDGPU/GFX9: Enable FastFMAF32
Differential Revision: https://reviews.llvm.org/D32363


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301029 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 19:57:53 +00:00
Konstantin Zhuravlyov
8c373cc5e6 AMDGPU: Temporarily disable packed inlinable literals (v2f16, v2i16)
Differential Revision: https://reviews.llvm.org/D32361


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301028 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 19:45:22 +00:00
Konstantin Zhuravlyov
ac73bb1e6a AMDGPU: Fix S_PACK_HH_B32_B16
- We really ought to zero out lower 16 bits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301026 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 19:35:05 +00:00
Yaxun Liu
5255fef87c [AMDGPU] Handle SI_MASKED_UNREACHABLE in instruction emitter
SI_MASKED_UNREACHABLE does not have machine instruction encoding.
It needs special handling in AMDGPUAsmPrinter::EmitInstruction like some
other pseudo instructions.

This patch fixes compilation failure of RadeonRays.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301025 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 19:32:02 +00:00
Matthias Braun
992d0ddce8 Revert "X86RegisterInfo: eliminateFrameIndex: Avoid code duplication; NFC"
It seems we have on situation in a sanitizer enable bootstrap build
where the return instruction has a frame index operand that does not
point to a fixed object and fails the assert added here.

This reverts commit r300923.
This reverts commit r300922.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301024 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 19:26:45 +00:00
Konstantin Zhuravlyov
989643fa78 AMDGPU: Do not lower fast unsafe div for safe, f32, with fp32 denormals
Differential Revision: https://reviews.llvm.org/D32085


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301023 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 19:25:33 +00:00
Sanjay Patel
39af0db425 [InstCombine] use isSubsetOf() for efficiency
C | ~D == -1
~(C | ~D) == 0
~C & D == 0
D & ~C == 0
D.isSubsetOf(C)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301021 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 19:16:52 +00:00
Akira Hatanaka
586c752a82 [AArch64] Improve code generation for logical instructions taking
immediate operands.

This commit adds an AArch64 dag-combine that optimizes code generation
for logical instructions taking immediate operands. The optimization
uses demanded bits to change a logical instruction's immediate operand
so that the immediate can be folded into the immediate field of the
instruction.

This recommits r300932 and r300930, which was causing dag-combine to
loop forever. The problem was that optimizeLogicalImm was returning
true even when there was no change to the immediate node (which happened
when the immediate was all zeros or ones), which caused dag-combine to
push and pop the same node to the work list over and over again without
making any progress.

This commit fixes the bug by returning false early in optimizeLogicalImm
if the immediate is all zeros or ones. Also, it changes the code to
compare the immediate with 0 or Mask rather than calling
countPopulation.

rdar://problem/18231627

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301019 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 18:53:12 +00:00
Artur Pilipenko
bbc50e81b0 [InstCombine] fadd double (sitofp x), y check that the promotion is valid
Doing these transformations check that the result of integer addition is representable in the FP type.

(fadd double (sitofp x), fpcst) --> (sitofp (add int x, intcst))
(fadd double (sitofp x), (sitofp y)) --> (sitofp (add int x, y))

This is a fix for https://bugs.llvm.org//show_bug.cgi?id=27036

Reviewed By: andrew.w.kaylor, scanon, spatel

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301018 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 18:45:25 +00:00
Kuba Mracek
768a04e3df Fixup for r301007: Restrict the -D hack to Darwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301017 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 18:19:56 +00:00
Kuba Mracek
05c05ab154 Revert r301010: Bot failures on Windows, NetBSD and even some old Darwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301012 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 18:02:22 +00:00
Kuba Mracek
886373139e [libFuzzer] Always build libFuzzer
There are two reasons why users might want to build libfuzzer:
- To fuzz LLVM itself
- To get the libFuzzer.a archive file, so that they can attach it to their code
This change always builds libfuzzer, and supports the second use case if the specified flag is set.

The point of this patch is to have something that can potentially be shipped with the compiler, and this also ensures that the version of libFuzzer is correct to use with that compiler.

Patch by George Karpenkov.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301010 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 17:47:44 +00:00
Kuba Mracek
68f048198a [libFuzzer] Changing thread_local to __thread in libFuzzer
Old Apple compilers do not support thread_local keyword. This patch adds -Dthread_local=__thread when the compiler doesn't support thread_local.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301007 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 17:39:50 +00:00
Joel Jones
afde310afd [AArch64] Refactor instruction selection lowering for addresses. NFCI
Factor out the common code used for generating addresses into common
templated functions that call overloaded versions of a new function,
getTargetNode.

Tested with make check-llvm with targets AArch64.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301005 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 17:31:03 +00:00
Tim Northover
53afc11362 ARM: don't try to create an i8 -> i32 vpaddl.
DAG combine was mistakenly assuming that the step-up it was looking at was
always a doubling, but it can sometimes be a larger extension in which case
we'd crash.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301002 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 17:21:59 +00:00
Kuba Mracek
50c9a25c60 [libFuzzer] Check for target(popcnt) capability before usage
Older compilers (e.g. LLVM 3.4) do not support the attribute target("popcnt").
In order to support those, this diff check the attribute support using the preprocessor.

Patch by George Karpenkov.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300999 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 16:57:37 +00:00
Craig Topper
2602091f82 [ValueTracking] Use APInt::setAllBits and APInt::intersects to simplify some code. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300997 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 16:43:32 +00:00
Craig Topper
fe916169d7 [APInt] Add compare/compareSigned methods that return -1, 0, 1. Reimplement slt/ult and friends using them
Currently sle and ule have to call slt/ult and eq to get the proper answer. This results in extra code for both calls and additional scans of multiword APInts.

This patch replaces slt/ult with a compareSigned/compare that can return -1, 0, or 1 so we can cover all the comparison functions with a single call.

While I was there I removed the activeBits calls and other checks at the start of the slow part of ult. Both of the activeBits calls potentially scan through each of the APInts separately. I can't imagine that's any better than just scanning them in parallel and doing the compares. Now we just share the code with tcCompare.

These changes seem to be good for about a 7-8k reduction on the size of the opt binary on my local x86-64 build.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300995 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 16:13:15 +00:00
Daniel Sanders
e8660ea63d [globalisel][tablegen] Import SelectionDAG's rule predicates and support the equivalent in GIRule.
Summary:
The SelectionDAG importer now imports rules with Predicate's attached via
Requires, PredicateControl, etc. These predicates are implemented as
bitset's to allow multiple predicates to be tested together. However,
unlike the MC layer subtarget features, each target only pays for it's own
predicates (e.g. AArch64 doesn't have 192 feature bits just because X86
needs a lot).

Both AArch64 and X86 derive at least one predicate from the MachineFunction
or Function so they must re-initialize AvailableFeatures before each
function. They also declare locals in <Target>InstructionSelector so that
computeAvailableFeatures() can use the code from SelectionDAG without
modification.

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

Reviewed By: rovka

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300993 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 15:59:56 +00:00
Craig Topper
4f4553914f [SimplifyCFG] Fix the determination of PostBB in conditional store merging to handle the targets on the second branch being commuted
Currently we choose PostBB as the single successor of QFB, but its possible that QTB's single successor is QFB which would make QFB the correct choice.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300992 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 15:53:42 +00:00
Wei Mi
a88bbf0e22 [ConstHoisting] Add BFI in constanthoisting pass and select the best insertion
places based on it.

Existing constant hoisting pass will merge a group of contants in a small range
and hoist the const materialization code to the common dominator of their uses.
However, if the uses are all in cold pathes, existing implementation may hoist
the materialization code from cold pathes to a hot place. This may hurt performance.
The patch introduces BFI to the pass and selects the best insertion places based
on it.

The change is controlled by an option consthoist-with-block-frequency which is
off by default for now.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300989 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 15:50:16 +00:00
Chad Rosier
4961912e73 [AArch64][Falkor] Refine modeling of store-release exclusive instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300987 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 14:58:32 +00:00
Joel Jones
bd2e6e0b1a [Mips] Document Mips Backend Relocation Principles
This revision documents the combination of C++ and table-gen code that
handles relocations and addresses.

Thanks for Simon Dardis for the careful reviews.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300986 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 14:49:27 +00:00
Chad Rosier
3ad4f88821 [AArch64][Falkor] Refine resource needs of STRQ with register offset.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300984 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 14:33:13 +00:00
Matthew Simpson
915a4bc0f9 [LV] Model if-converted phi node costs
Phi nodes in non-header blocks are converted to select instructions after
if-conversion. This patch updates the cost model to account for the selects.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300980 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 14:14:54 +00:00
Daniel Sanders
9eb6db17b6 Revert r300964 + r300970 - [globalisel][tablegen] Import SelectionDAG's rule predicates and support the equivalent in GIRule.
It's causing llvm-clang-x86_64-expensive-checks-win to fail to compile and I
haven't worked out why. Reverting to make it green while I figure it out.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300978 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 14:09:20 +00:00
Sanjay Patel
bd1b03d467 [InstCombine] prefer xor with -1 because 'not' is easier to understand (PR32706)
This matches the demanded bits behavior in the DAG and should fix:
https://bugs.llvm.org/show_bug.cgi?id=32706

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300977 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 14:03:54 +00:00
Chad Rosier
f9f7441f9c [AArch64][Falkor] Refine loads/stores that require an extra LD pipe.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300976 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 13:55:41 +00:00
Chad Rosier
01a74846f0 [AArch64][Falkor] Fix number of microops for WriteSTIdx missed in r300892.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300975 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 13:37:01 +00:00
Chad Rosier
da9c35ab22 [AArch64] Fix a few missed pre/post-inc in Falkor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300974 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 13:36:57 +00:00
Diana Picus
2fe29b4914 [ARM] GlobalISel: Add support for G_TRUNC
Select them as copies. We only select if both the source and the
destination are on the same register bank, so this shouldn't cause any
trouble.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300971 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 13:16:50 +00:00
Diana Picus
17c66f84bb [ARM] GlobalISel: Make struct arguments fail elegantly
The condition in isSupportedType didn't handle struct/array arguments
properly. Fix the check and add a test to make sure we use the fallback
path in this kind of situation. The test deals with some common cases
where the call lowering should error out. There are still some issues
here that need to be addressed (tail calls come to mind), but they can
be addressed in other patches.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300967 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 11:53:01 +00:00
Daniel Sanders
d3ed5b78e5 [globalisel][tablegen] Import SelectionDAG's rule predicates and support the equivalent in GIRule.
Summary:
The SelectionDAG importer now imports rules with Predicate's attached via
Requires, PredicateControl, etc. These predicates are implemented as
bitset's to allow multiple predicates to be tested together. However,
unlike the MC layer subtarget features, each target only pays for it's own
predicates (e.g. AArch64 doesn't have 192 feature bits just because X86
needs a lot).

Both AArch64 and X86 derive at least one predicate from the MachineFunction
or Function so they must re-initialize AvailableFeatures before each
function. They also declare locals in <Target>InstructionSelector so that
computeAvailableFeatures() can use the code from SelectionDAG without
modification.

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

Reviewed By: rovka

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300964 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 10:27:20 +00:00
Clement Courbet
de3d17e6c2 typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300963 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 09:21:05 +00:00
Clement Courbet
69190edbb9 use repmovsb when optimizing forminsize
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300960 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 09:20:55 +00:00
Clement Courbet
e5aaed5aca Rename FastString flag.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300959 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 09:20:50 +00:00
Clement Courbet
3b883555dd X86 memcpy: use REPMOVSB instead of REPMOVS{Q,D,W} for inline copies
when the subtarget has fast strings.

This has two advantages:
  - Speed is improved. For example, on Haswell thoughput improvements increase
    linearly with size from 256 to 512 bytes, after which they plateau:
    (e.g. 1% for 260 bytes, 25% for 400 bytes, 40% for 508 bytes).
  - Code is much smaller (no need to handle boundaries).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300957 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 09:20:39 +00:00
George Rimar
102d78ca39 [DWARF] - Refactoring: localize handling of relocations in a single place.
This is splitted from D32228,
currently DWARF parsers code has few places that applied relocations values manually.
These places has similar duplicated code. Patch introduces separate method that can be
used to obtain relocated value. That helps to reduce code and simplifies things.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300956 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 09:12:18 +00:00
Clement Courbet
9b72933cb9 Delete dead code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300952 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 07:40:59 +00:00
Artyom Skrobov
3e7dae893c [Thumb1] The recently added tADCS and tSBCS pseudo-instructions were missing Uses = [CPSR]
Summary: Thanks to Oliver Stannard for helping catch this.

Reviewers: olista01, efriedma

Subscribers: llvm-commits, rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300951 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 07:35:21 +00:00
Serguei Katkov
9bb6c3a55b [AsmWriter] Eliminate warning. NFC
This patch eliminates the following warning

lib/IR/AsmWriter.cpp:1128:57: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
                 (StrVal[1] >= '0' && StrVal[1] <= '9')) &&

Reviewers: timshen, rnk, davide
Reviewed By: davide
Subscribers: davide, llvm-commits
Differential Revision: https://reviews.llvm.org/D32337


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300950 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 06:14:38 +00:00
George Burgess IV
67bc67ffea [MSSA] Clean up the updater a bit. NFC
- Mark an internal function static
- Remove the llvm namespace (just holding on to the `using namespace
  llvm;` Works on My Machine(TM))


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300947 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 04:54:52 +00:00
Davide Italiano
1b5b740e23 [PartialInliner] Fix crash when inlining functions with unreachable blocks.
CodeExtractor looks up the dominator node corresponding to return blocks
when splitting them. If one of these blocks is unreachable, there's no
node in the Dom and CodeExtractor crashes because it doesn't check
for domtree node validity.
In theory, we could add just a check for skipping null DTNodes in
`splitReturnBlock` but the fix I propose here is slightly different. To the
best of my knowledge, unreachable blocks are irrelevant for the algorithm,
therefore we can just skip them when building the candidate set in the
constructor.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300946 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 04:25:00 +00:00
Serguei Katkov
c849a0cc07 [AsmWriter/APFloat] FP constant printing: Avoid usage of locale dependent snprinf
This should fix the bug https://bugs.llvm.org/show_bug.cgi?id=12906

To print the FP constant AsmWriter does the following:

  1) convert FP value to String (actually using snprintf function which is locale dependent).
  2) Convert String back to FP Value
  3) Compare original and got FP values. If they are not equal just dump as hex.

The problem happens on the 2nd step when APFloat does not expect group delimiter or
fraction delimiter other than period symbol and so on, which can be produced on the
first step if LLVM library is used in an environment with corresponding locale set.

To fix this issue the locale independent APFloat:toString function is used.
However it prints FP values slightly differently than snprintf does. Specifically
it suppress trailing zeros in significant, use capital E and so on.
It results in 117 test failures during make check.
To avoid this I've also updated APFloat.toString a bit to pass make check at least.

Reviewers: sberg, bogner, majnemer, sanjoy, timshen, rnk

Reviewed By: timshen, rnk

Subscribers: rnk, llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300943 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 02:52:17 +00:00
Akira Hatanaka
1933132d0a Revert r300932 and r300930.
It seems that r300930 was creating an infinite loop in dag-combine when
compling the following file:

MultiSource/Benchmarks/MiBench/consumer-typeset/z21.c

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300940 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 01:31:50 +00:00
Akira Hatanaka
2159c695f3 [AArch64] Use suffix ULL to shift a 64-bit value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300932 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 00:35:27 +00:00
Davide Italiano
f113d04b8d [CodeExtractor] Remove an unneeded level of indirection. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300931 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 00:21:09 +00:00
Akira Hatanaka
63da689bdf [AArch64] Improve code generation for logical instructions taking
immediate operands.

This commit adds an AArch64 dag-combine that optimizes code generation
for logical instructions taking immediate operands. The optimization
uses demanded bits to change a logical instruction's immediate operand
so that the immediate can be folded into the immediate field of the
instruction.

This recommits r300913, which broke bots because I didn't fix a call to
ShrinkDemandedConstant in SIISelLowering.cpp after changing the APIs of
TargetLoweringOpt and TargetLowering.

rdar://problem/18231627

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300930 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 00:05:16 +00:00
Eli Friedman
df4849c1dd Revert r300746 (SCEV analysis for or instructions).
There have been multiple reports of this causing problems: a
compile-time explosion on the LLVM testsuite, and a stack
overflow for an opencl kernel.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300928 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 23:59:05 +00:00
Craig Topper
c7e3512b43 [InstCombine] Remove the zextOrTrunc from ShrinkDemandedConstant.
The demanded mask and the constant should always be the same width for all callers today.

Also stop copying the demanded mask as its passed in. We should avoid allocating memory unless we are going to do something. The final AND to create the new constant will take care of it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300927 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 23:58:27 +00:00
Matthias Braun
e0bfbeae68 X86RegisterInfo: eliminateFrameIndex: Avoid code duplication; NFC
X86RegisterInfo::eliminateFrameIndex() and
X86FrameLowering::getFrameIndexReference() both had logic to compute the
base register. This consolidates the code.

Also use MachineInstr::isReturn instead of manually enumerating tail
call instructions (return instructions were not included in the previous
list because they never reference frame indexes).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300923 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 23:34:50 +00:00
Matthias Braun
6ef1610d07 X86RegisterInfo: eliminateFrameIndex: Force SP for AfterFPPop; NFC
AfterFPPop is used for tailcall/tailjump instructions. We shouldn't ever
have frame-pointer/base-pointer relative addressing for those. After all
the frame/base pointer should already be restored to their previous
values at the return.

Make this fact explicit in preparation for an upcoming refactoring.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300922 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 23:34:46 +00:00
Akira Hatanaka
01c014ca98 Revert "[AArch64] Improve code generation for logical instructions taking"
This reverts r300913.

This broke bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300916 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 23:03:30 +00:00
Akira Hatanaka
ac0ecde9f0 [AArch64] Improve code generation for logical instructions taking
immediate operands.

This commit adds an AArch64 dag-combine that optimizes code generation
for logical instructions taking immediate operands. The optimization
uses demanded bits to change a logical instruction's immediate operand
so that the immediate can be folded into the immediate field of the
instruction.

rdar://problem/18231627

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300913 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 22:47:56 +00:00
Sanjay Patel
f23a493cab [InstCombine] function names start with lower-case letter; NFC
Forgot to make this fix with the signature change in r300911.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300912 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 22:37:01 +00:00
Sanjay Patel
e29c6aab81 [InstCombine] allow shl+shr demanded bits folds with splat constants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300911 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 22:33:54 +00:00
Tim Northover
efa8c0e73a AArch64: lower "fence singlethread" to a pure compiler barrier.
Single-threaded fences aren't required to provide any synchronization with
other processing elements so there's no need for a DMB. They should still be a
barrier for compiler optimizations though.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300905 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 21:57:45 +00:00
Tim Northover
ff268972fc ARM: lower "fence singlethread" to a pure compiler barrier.
Single-threaded fences aren't required to provide any synchronization with
other processing elements so there's no need for a DMB. They should still be a
barrier for compiler optimizations though.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300904 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 21:56:52 +00:00
Xinliang David Li
2747b70917 Use basicblock split block utility function
Instead of calling BasicBlock::SplitBasicBlock directly in 
CodeExtractor.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300899 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 21:40:22 +00:00
Sanjay Patel
a24f137360 [InstCombine] allow shl demanded bits folds with splat constants
More fixes are needed to enable the helper SimplifyShrShlDemandedBits().



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300898 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 21:33:02 +00:00
Craig Topper
7b99ac1139 [InstCombine] Use APInt::intersects and APInt::isSubsetOf to improve a few more places in SimplifyDemandedBits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300896 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 21:24:37 +00:00
Chad Rosier
9ec21444cc [AArch64] Whitespace/ordering fixes for Falkor machine description. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300893 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 21:11:17 +00:00
Chad Rosier
4b046c4cf4 [AArch64] Refine Falkor machine description for pre/post-inc and stores.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300892 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 21:11:09 +00:00
Sanjay Patel
f0d51838c5 [InstCombine] allow ashr/lshr demanded bits folds with splat constants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300888 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 20:59:02 +00:00
Craig Topper
a6180c4b3c [InstCombine] Use APInt::isSubsetOf to simplify some code in SimplifyDemandedBits. NFC
This allows us to use less temporary APInt for And and Invert operations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300885 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 20:47:35 +00:00
Adrian Prantl
52a72dacab Don't emit locations that need a DW_OP_stack_value in DWARF 2 & 3.
https://bugs.llvm.org/show_bug.cgi?id=32382

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300883 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 20:42:33 +00:00
Tim Northover
8cc396e7aa ARM: handle post-indexed NEON ops where the offset isn't the access width.
Before, we assumed that any ConstantInt offset was precisely the access width,
so we could use the "[rN]!" form. ISelLowering only ever created that kind, but
further simplification during combining could lead to unexpected constants and
incorrect codegen.

Should fix PR32658.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300878 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 19:54:02 +00:00
Craig Topper
1fa7ca8b26 [InstCombine] Remove redundant code from SimplifyDemandedBits handling for Or. The code above it is equivalent if you work through the bitwise math.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300876 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 19:31:22 +00:00
Paul Robinson
ce35560497 [DWARF] Versioning for DWARF constants; verify FORMs
Associate the version-when-defined with definitions of standard DWARF
constants.  Identify the "vendor" for DWARF extensions.
Use this information to verify FORMs in .debug_abbrev are defined as
of the DWARF version specified in the associated unit.
Removed two tests that had specified DWARF v1 (which essentially does
not exist).

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300875 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 19:16:51 +00:00
Chad Rosier
03b48f8380 [AArch64] Improve scheduling of logical operations on Falkor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300871 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 18:50:21 +00:00
Weiming Zhao
a90b36e98b [Thumb-1] Fix corner cases for compressed jump tables
Summary:
When synthesized TBB/TBH is expanded, we need to avoid the case of:
   BaseReg is redefined after the load of branching target. E.g.:

    %R2 = tLEApcrelJT <jt#1>
    %R1 =  tLDRr %R1, %R2    ==> %R2 = tLEApcrelJT <jt#1>
    %R2 = tLDRspi %SP, 12        %R2 = tLDRspi %SP, 12
    tBR_JTr %R1                  tTBB_JT %R2, %R1
`
Reviewers: jmolloy

Reviewed By: jmolloy

Subscribers: llvm-commits, rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300870 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 18:37:14 +00:00
Davide Italiano
b2a1e2499a [CodeExtractor] Remove a bunch of unneeded constructors.
Differential Revision:  https://reviews.llvm.org/D32305

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300869 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 18:33:40 +00:00
Benjamin Kramer
4b3567dbfc [Recycler] Add asan/msan annotations.
This enables use after free and uninit memory checking for memory
returned by a recycler. SelectionDAG currently relies on the opcode of a
free'd node being ISD::DELETED_NODE, so poke a hole in the asan poison
for SDNode opcodes. This means that we won't find some issues, but only
in SDag.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300868 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 18:29:37 +00:00
Benjamin Kramer
5fc394e871 Fix use-after-frees on memory allocated in a Recycler.
This will become asan errors once the patch lands that poisons the
memory after free. The x86 change is a hack, but I don't see how to
solve this properly at the moment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300867 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 18:29:14 +00:00
Yaxun Liu
1baa360f32 CodeGen: Let frame index value type match alloca addr space
Recently alloca address space has been added to data layout. Due to this
change, pointer returned by alloca may have different size as pointer in
address space 0.

However, currently the value type of frame index is assumed to be of the
same size as pointer in address space 0.

This patch fixes that.

Most targets assume alloca returning pointer in address space 0, which
is the default alloca address space. Therefore it is NFC for them.

AMDGCN target with amdgiz environment requires this change since it
assumes alloca returning pointer to addr space 5 and its size is 32,
which is different from the size of pointer in addr space 0 which is 64.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300864 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 18:15:34 +00:00
Reid Kleckner
4d00a6147f Remove duplicate AttributeList::removeAttributes implementation
Have the AttributeList overload delegate to the AttrBuilder one.
Simplify the AttrBuilder overload by avoiding getSlotAttributes, which
creates temporary AttributeLists.

Simplify `AttrBuilder::removeAttributes(AttributeList, unsigned)` by
using getAttributes instead of manually iterating over slots.

Extracted from https://reviews.llvm.org/D32262

NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300863 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 18:08:36 +00:00
Sanjay Patel
999e03461f [DAGCombiner] use more local variables in isAlias(); NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300860 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 18:02:27 +00:00
Sam Clegg
702bc51679 [WebAssembly] Add known failures for wasm object file backend
Subscribers: jfb, dschuff

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300859 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 17:18:15 +00:00
Craig Topper
54f0462d2b [APInt] Rename getSignBit to getSignMask
getSignBit is a static function that creates an APInt with only the sign bit set. getSignMask seems like a better name to convey its functionality. In fact several places use it and then store in an APInt named SignMask.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300856 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 16:56:25 +00:00
Sanjay Patel
f3c6d22768 [DAGCombiner] fix variable names in isAlias(); NFCI
We started with zero-based params and switched to one-based locals...
Also, variables start with a capital and functions do not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300854 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 16:36:37 +00:00
Craig Topper
b52e0e4247 [APInt] Add isSubsetOf method that can check if one APInt is a subset of another without creating temporary APInts
This question comes up in many places in SimplifyDemandedBits. This makes it easy to ask without allocating additional temporary APInts.

The BitVector class provides a similar functionality through its (IMHO badly named) test(const BitVector&) method. Though its output polarity is reversed.

I've provided one example use case in this patch. I plan to do more as a follow up.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300851 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 16:17:13 +00:00
Sanjay Patel
40c9368f4d [DAGCombiner] give names to repeated calcs in isAlias(); NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300850 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 16:15:08 +00:00
Craig Topper
1772e90779 In SimplifyDemandedUseBits, use computeKnownBits directly to handle Constants
Currently we don't explicitly process ConstantDataSequential, ConstantAggregateZero, or ConstantVector, or Undef before applying the Depth limit. Instead they occur after the depth check in the non-instruction path.

For the constant types that we do handle, the code is replicated from computeKnownBits.

This patch fixes the missing constant handling and the reduces the amount of code by just using computeKnownBits directly for any type of Constant.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300849 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 16:14:58 +00:00
Daniel Sanders
42e519ed10 [globalisel] Enable tracing the legalizer with --debug-only=legalize-mir
Reviewers: t.p.northover, ab, qcolombet, aditya_nandakumar, rovka, kristof.beyls

Reviewed By: kristof.beyls

Subscribers: dberris, igorb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300847 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 15:46:12 +00:00
Amara Emerson
0f69ba8243 [MVT][SVE] Scalable vector MVTs (3/3)
Adds MVT::ElementCount to represent the length of a
vector which may be scalable, then adds helper functions
that work with it.

Patch by Graham Hunter.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300842 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 13:54:09 +00:00
Petar Jovanovic
51d7cb91e6 [mips][msa] Mask vectors holding shift amounts
Masked vectors which hold shift amounts when creating the following nodes:
ISD::SHL, ISD::SRL or ISD::SRA.
Instructions that use said nodes, which have had their arguments altered are
sll, srl, sra, bneg, bclr and bset.

For said instructions, the shift amount or the bit position that is
specified in the corresponding vector elements will be interpreted as the
shift amount/bit position modulo the size of the element in bits.

The problem lies in compiling with -O2 enabled, where the instructions for
formats .w and .d are not generated, but are instead optimized away.
In this case, having shift amounts that are either negative or greater than
the element bit size results in generation of incorrect results when
constant folding.

We remedy this by masking the operands for the nodes mentioned above before
actually creating them, so that the final result is correct before placed
into the constant pool.

Patch by Stefan Maksimovic.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300839 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 13:26:46 +00:00
Amara Emerson
780f89d961 [MVT][SVE] Scalable vector MVTs (1/3)
This patch adds a few helper functions to obtain new vector
value types based on existing ones without needing to care
about whether they are scalable or not.

I've confined their use to a few common locations right now,
and targets that don't have scalable vectors should never
need to care about these.

Patch by Graham Hunter.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300838 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 13:08:17 +00:00
John Brawn
4d16adb187 [ARM] Fix handling of mapping symbols when changing sections
ChangeSection incorrectly registers LastEMSInfo as belonging to the previous
section, not the current section. This happens to work when changing sections
using .section, as the previous section is set to the current section before
the call to ChangeSection, but not when using .popsection.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300831 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 10:18:13 +00:00
John Brawn
82afafa944 [AArch64] Fix handling of zero immediate in fmov instructions
Currently fmov #0 with a vector destination is handle incorrectly and results in
fmov #-1.9375 being emitted but should instead give an error. This is due to the
way we cope with fmov #0 with a scalar destination being an alias of fmov zr, so
fix this by actually doing it through an alias.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300830 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 10:13:54 +00:00
John Brawn
f805a0cc2d [AArch64] Fix handling of integer fp immediates
When an integer is used as an fp immediate we're failing to check the return
value of getFP64Imm, so invalid values are silently permitted. Fix this by
merging together the integer and real handling.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300828 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 10:10:10 +00:00
Diana Picus
6a1c705057 [ARM] Rename HW div feature to HW div Thumb. NFCI.
The hardware div feature refers only to Thumb, but because of its name
it is tempting to use it to check for hardware division in general,
which may cause problems in ARM mode. See https://reviews.llvm.org/D32005.

This patch adds "Thumb" to its name, to make its scope clear. One
notable place where I haven't made the change is in the feature flag
(used with -mattr), which is still hwdiv. Changing it would also require
changes in a lot of tests, including clang tests, and it doesn't seem
like it's worth the effort.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300827 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 09:38:25 +00:00
Craig Topper
524526f783 [SelectionDAG] Fix another place that was passing a large value to APInt::lshrInPlace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300821 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 04:55:01 +00:00
Craig Topper
bb107535ba [SelectionDAG] Use getActiveBits() and countTrailingZeros() to avoid creating temporary APInts with lshr and trunc. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300819 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 04:23:43 +00:00
Craig Topper
5649a8228b Recommit "[APInt] Add back the asserts that check that the APInt shift methods aren't called with values larger than BitWidth."
This includes a fix to clamp a right shift of larger than BitWidth in DAG combining.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300816 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 03:49:18 +00:00
Craig Topper
be583f25e0 [APInt] Implement APInt::intersects without creating a temporary APInt in the multiword case
Summary: This is a simple question we should be able to answer without creating a temporary to hold the AND result. We can also get an early out as soon as we find a word that intersects.

Reviewers: RKSimon, hans, spatel, davide

Reviewed By: hans, davide

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300812 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 02:11:27 +00:00
Serge Pavlov
ff09ea4e98 Do not run frame verification if target does not use frame instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300807 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 01:34:04 +00:00
Ahmed Bougacha
786ac2097e Revert "[libFuzzer] XFAIL fuzzer-oom.test on Darwin."
This reverts commit r300127.

r300759 implemented StopTheWorld for Darwin, so the test passes again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300801 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 00:16:13 +00:00
Kostya Serebryany
7634af30c1 [libFuzzer] extend help for -minimize_crash to cover ASAN_OPTIONS=dedup_token_length=3
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300800 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 23:58:05 +00:00
Craig Topper
ba583aa026 [APInt] Implement operator==(uint64_t) similar to ugt/ult(uint64_t) to remove one of the out of line EqualsSlowCase methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300799 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 23:57:51 +00:00
Reid Kleckner
ae23971d1e [DAE] Simplify attribute list creation, NFC
Removes a use of getSlotAttributes, which I intend to change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300795 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 23:45:45 +00:00
Kuba Mracek
d92618f322 Revert r300789: There are Windows bot failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300794 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 23:44:33 +00:00
Adrian Prantl
ffa4b4378e Fix bug that caused DwarfExpression to drop DW_OP_deref from FI locations
- introduced in r300522 and found via the Swift LLDB testsuite.

The fix is to set the location kind to memory whenever an FrameIndex
location is emitted.

rdar://problem/31707602

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300793 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 23:42:25 +00:00
Adrian Prantl
113bca21d3 Revert "Fix bug that caused DwarfExpression to drop DW_OP_deref from FI locations"
This reverts commit r300790.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300792 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 23:42:17 +00:00
Kannan Narayanan
453ce6b718 Revert earlier change. ds permute operations affect lgkm counter.
Differential Revision: https://reviews.llvm.org/D32254



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300791 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 23:39:19 +00:00
Adrian Prantl
0c5a2b47dc Fix bug that caused DwarfExpression to drop DW_OP_deref from FI locations
- introduced in r300522 and found via the Swift LLDB testsuite.

The fix is to set the location kind to memory whenever an FrameIndex
location is emitted.

rdar://problem/31707602

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300790 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 23:34:14 +00:00
Kuba Mracek
d3e13b9862 [libFuzzer] Always build libFuzzer
There are two reasons why users might want to build libfuzzer:
- To fuzz LLVM itself
- To get the libFuzzer.a archive file, so that they can attach it to their code
This change always builds libfuzzer, and supports the second use case if the specified flag is set.

The point of this patch is to have something that can potentially be shipped with the compiler, and this also ensures that the version of libFuzzer is correct to use with that compiler.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300789 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 23:34:08 +00:00
Reid Kleckner
6a6847fd69 [GlobalOpt] Simplify attribute code stripping nest, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300787 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 23:26:44 +00:00
Reid Kleckner
e7cb3935c6 Simplify test for sret attribute in instcombine
This change is correct because the verifier requires that at most one
argument be marked 'sret'.

NFC, removes a use of AttributeList slot APIs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300784 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 23:17:47 +00:00
Galina Kistanova
6b92d164d6 Temporarily revert r299221 to fix nondeterminism in ThinLTO builder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300783 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 23:16:14 +00:00
Matthias Braun
0749000e14 X86FrameLowering: Fix getFrameIndexReference() for 'fixed' objects
Debug information is calculated with getFrameIndexReference() which was
missing some logic for the fixed object cases (= parameters on the stack).

rdar://24557797

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300781 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 23:10:43 +00:00
Eugene Zelenko
86bfc787f1 [Object] 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@300779 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 23:02:10 +00:00
Kostya Serebryany
d89a81f5c9 [sanitizer-coverage] remove some more stale code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300778 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 22:42:11 +00:00
Evgeniy Stepanov
11bae79f9c Remove two unused variables (-Werror).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300777 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 22:27:23 +00:00
Sanjay Patel
2aa6ae886a [DAG] add splat vector support for 'or' in SimplifyDemandedBits
I've changed one of the tests to not fold away, but we didn't and still don't do the transform
that the comment claims we do (and I don't know why we'd want to do that).

Follow-up to:
https://reviews.llvm.org/rL300725
https://reviews.llvm.org/rL300763


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300772 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 22:00:00 +00:00
Kostya Serebryany
06c0527072 [sanitizer-coverage] remove stale code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300769 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 21:48:09 +00:00
Kostya Serebryany
47ba2c1622 [libFuzzer] remove -output_csv option. It duplicates the default output and got out of sync
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300768 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 21:34:58 +00:00
Sanjay Patel
27b613382c [DAG] add splat vector support for 'xor' in SimplifyDemandedBits
This allows forming more 'not' ops, so we get improvements for ISAs that have and-not.

Follow-up to:
https://reviews.llvm.org/rL300725


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300763 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 21:23:09 +00:00
Matthias Braun
ed95c621a6 ARMFrameLowering: Reserve emergency spill slot for large arguments
Re-commit after revert in r300668. Changed getMaxFPOffset() to a
more conservative heuristic instead of trying to be clever and missing
for some exotic calling conventions.

We need to reserve an emergency spill slot in cases with large argument
types that could overflow immediate offsets for FP relative address
calculations.

rdar://31317893

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300761 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 21:11:44 +00:00
Craig Topper
3bebc1eb2e [APInt] Cast calls to add/sub/mul overflow methods to void if only their overflow bool out param is used.
This is preparation for a clang change to improve the [[nodiscard]] warning to not be ignored on methods that return a class marked [[nodiscard]] that are defined in the class itself. See D32207.

We should consider adding wrapper methods to APInt that return the overflow flag directly and discard the APInt result. This would eliminate the void casts and the need to create a bool before the call to pass to the out param.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300758 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 21:09:45 +00:00
Matt Arsenault
ac9b651ab6 AMDGPU: Custom lower illegal small select types
Promote them to i32 vectors to avoid unpacking and re-packing
the vectors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300754 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 20:53:07 +00:00
Dehao Chen
074b06ad8d Code style change as suggested in https://reviews.llvm.org/D32177 (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300753 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 20:52:21 +00:00
Eli Friedman
3767f141eb [ARM] Remove redundant computeKnownBits helper.
Move the BFI logic to computeKnownBitsForTargetNode, and delete
the redundant CMOV logic.

This is intended as a cleanup, but it's probably possible to construct
a case where moving the BFI logic allows more combines.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300752 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 20:50:57 +00:00
Aditya Nandakumar
4925efae1f [GISEL]: Move getConstantVReg to Utils
NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300751 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 20:48:50 +00:00
Eli Friedman
89e89fb349 [ARM] Use TableGen patterns to select vtbl. NFC.
Differential Revision: https://reviews.llvm.org/D32103



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300749 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 20:39:39 +00:00
Eli Friedman
b4afe9c79f [SCEV] Make SCEV or modeling more aggressive.
Use haveNoCommonBitsSet to figure out whether an "or" instruction
is equivalent to addition. This handles more cases than just
checking for a constant on the RHS.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300746 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 20:19:58 +00:00
Dehao Chen
fd134f768b Using address range map to speedup finding inline stack for address.
Summary:
In the current implementation, to find inline stack for an address incurs expensive linear search in 2 places:

* linear search for the top-level DIE
* recursive linear traverse the DIE tree to find the path to the leaf DIE

In this patch, a map is built from address to its corresponding leaf DIE. The inline stack is built by traversing from the leaf DIE up to the root DIE. This speeds up batch symbolization by ~10X without noticible memory overhead.

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300742 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 20:09:38 +00:00
Dehao Chen
f0c95e1f1a PR32710: Disable using PMADDWD for unsigned short.
Summary: PMADDWD can only handle signed short.

Reviewers: mkuper, wmi

Reviewed By: mkuper

Subscribers: andreadb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300737 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 19:50:34 +00:00
Matt Arsenault
0e1e60b73a AMDGPU: Don't emit amd_kernel_code_t for callable functions
This is inserted directly in the text section. The relocation
for the function ends up resolving to the beginning of the
amd_kernel_code_t header rather than the actual function
entry point.

Also skip some of the comments for initialization
that only makes sense for kernels.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300736 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 19:38:10 +00:00
Matt Arsenault
fe6b2045f8 StructurizeCFG: Directly invert cmp instructions
The most common case for a branch condition is
a single use compare. Directly invert the branch
predicate rather than adding a lot of xor i1 true
which the DAG will have to fold later.

This produces nicer to read structurizer output.

This produces some random changes in codegen
due to the DAG swapping branch conditions itself,
and then does a poor job of dealing with those
inverts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300732 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 18:29:07 +00:00
Sanjoy Das
980a21c306 [GVN] Don't coerce non-integral pointers to integers or vice versa
Summary:
See http://llvm.org/docs/LangRef.html#non-integral-pointer-type

The NewGVN test does not fail without these changes (perhaps it does
try to coerce pointers <-> integers to begin with?), but I added the
test case anyway.

Reviewers: dberlin

Subscribers: mcrosier, llvm-commits, Prazek

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300730 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 18:21:09 +00:00
Tim Northover
8a1f075c93 ARM: TLS calling convention doesn't preserve r9 or r12 on Darwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300726 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 18:07:54 +00:00
Sanjay Patel
14ee3d3d79 [DAG] add splat vector support for 'and' in SimplifyDemandedBits
The patch itself is simple: stop discriminating against vectors in visitAnd() and again in 
SimplifyDemandedBits().

Some notes for reference:

1. We're not consistent about calls to SimplifyDemandedBits in the various visitXXX functions. 
   Sometimes, we check if the RHS is a constant first. Other times (like here), we just dive in.
2. I'd like to break the vector shackles in steps for the sake of risk minimization, but we could
    make similar simultaneous changes in other places if we think that would be better.
3. I don't know what the intent of the changed tests in this patch was supposed to be, but since 
   they wiggled in a positive way, I'm just going with that. :)
4. In the rotate tests, note that we can see through non-splat constants. This is a result of D24253.
5. My motivation for being here now is to make D31944 look better, so this is step 1 of N towards 
   improving the vector codegen in that patch without writing any actual new code.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300725 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 18:05:06 +00:00
Matt Arsenault
902e7e59d1 AMDGPU: Don't align callable functions to 256
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300720 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 17:42:39 +00:00
Matt Arsenault
610621c4ba AMDGPU: Change DivergenceAnalysis for function arguments
Stop assuming all functions are kernels.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300719 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 17:42:34 +00:00
Reid Kleckner
d6b4b10a39 Prefer addAttr(Attribute::AttrKind) over the AttributeList overload
This should simplify the call sites, which typically want to tweak one
attribute at a time. It should also avoid creating ephemeral
AttributeLists that live forever.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300718 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 17:28:52 +00:00
Davide Italiano
8ccdc59458 [InstCombine] Reduce visitLoadInst() code duplication. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300717 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 17:26:57 +00:00
Craig Topper
51a8438801 [APInt] Move the 'return *this' from the slow cases of assignment operators inline. We should let the compiler see that the fast/slow cases both return *this.
I don't think we chain assignments together very often so this shouldn't matter much.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300715 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 17:01:58 +00:00
Sanjay Patel
19e4f8f1d9 [InstSimplify] fold identity shuffles (recursing if needed)
This patch simplifies the examples from D31509 and D31927 (PR30630) and catches 
the basic identity shuffle tests that Zvi recently added.

I'm not sure if we have something like this in DAGCombiner, but we should?

It's worth noting that "MaxRecurse / RecursionLimit" is only 3 on entry at the moment. 
We might want to bump that up if there are longer shuffle chains like this in the wild.

For now, we're ignoring shuffles that have undef mask elements because it's not
clear how those should be handled.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300714 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 16:48:22 +00:00
Sanjay Patel
af30bb9796 use 'auto' with 'dyn_cast' and fix formatting; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300713 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 16:22:19 +00:00
Dehao Chen
815d217552 Revert r300697 which causes buildbot failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300708 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 15:28:58 +00:00
Krzysztof Parzyszek
d9552968c4 [Hexagon] Generate proper offset in opt-addr-mode
Also, make a few changes to allow using the pass in .mir testcases.
Among other things, change the abbreviation from opt-amode to amode-opt,
because otherwise lit would expand the "opt" part to the full path to
the opt binary.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300707 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 15:15:51 +00:00
Krzysztof Parzyszek
f6728e6d7d [Hexagon] Remove RDefMap, use Liveness:getNearestAliasedRef instead
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300706 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 15:14:30 +00:00
Krzysztof Parzyszek
ad6758286a [RDF] Switch NodeList to SmallVector from std::vector
The list has a single element 75+% of the time, reservation of 4 elements
is sufficient in 95% of cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300705 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 15:12:44 +00:00
Krzysztof Parzyszek
1896b7912b [RDF] Use faster version of findBlock
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300704 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 15:11:23 +00:00
Krzysztof Parzyszek
111ac46fe7 [RDF] Cache register units for reg masks instead of recalculating them
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300702 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 15:10:09 +00:00
Krzysztof Parzyszek
cfaa15d905 [Hexagon] Cache reached blocks in bit tracker instead of scanning list
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300701 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 15:08:31 +00:00
Dehao Chen
2d19a45863 Using address range map to speedup finding inline stack for address.
Summary:
In the current implementation, to find inline stack for an address incurs expensive linear search in 2 places:

* linear search for the top-level DIE
* recursive linear traverse the DIE tree to find the path to the leaf DIE

In this patch, a map is built from address to its corresponding leaf DIE. The inline stack is built by traversing from the leaf DIE up to the root DIE. This speeds up batch symbolization by ~10X without noticible memory overhead.

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300697 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 14:50:57 +00:00
Davide Italiano
c99545d60a [InstSimplify] Deduce correct type for vector GEP.
InstSimplify returned the wrong type when simplifying a vector GEP
and we ended up crashing when trying to replace all uses with the
new value. Fixes PR32697.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300693 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 14:23:42 +00:00
Nirav Dave
e874e43854 [DAG] Loop over remaining candidates on successful merge of stores of
extracted vectors types. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300688 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 13:52:38 +00:00
Igor Breger
c0199e4844 [GlobalIsel][X86] support G_TRUNC selection.
Summary:
[GlobalIsel][X86] support G_TRUNC selection.
Add regbank-select and legalizer tests. Currently legalization of trunc i64 on 32bit platform not supported.

Reviewers: ab, zvi, rovka

Reviewed By: zvi

Subscribers: dberris, kristof.beyls, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300678 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 11:34:59 +00:00
Renato Golin
e6eaf3dfe6 Revert "ARMFrameLowering: Reserve emergency spill slot for large arguments"
This reverts commit r300639, as it broke self-hosting on ARM. PR32709.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300668 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 09:02:52 +00:00
Diana Picus
909758a6a6 [ARM] GlobalISel: Add support for G_MUL
Support G_MUL, very similar to G_ADD and G_SUB. The only difference is
in the instruction selector, where we have to select either MUL or MULv5
depending on the target.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300665 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 07:29:46 +00:00
Kristof Beyls
bece65fd18 [GlobalISel] Support vector-of-pointers in LLT
This fixes PR32471.

As comment 10 on that bug report highlights
(https://bugs.llvm.org//show_bug.cgi?id=32471#c10), there are quite a
few different defendable design tradeoffs that could be made, including
not representing pointers at all in LLT.

I decided to go for representing vector-of-pointer as a concept in LLT,
while keeping the size of the LLT type 64 bits (this is an increase from
48 bits before). My rationale for keeping pointers explicit is that on
some targets probably it's very handy to have the distinction between
pointer and non-pointer (e.g. 68K has a different register bank for
pointers IIRC). If we keep a scalar pointer, it probably is easiest to
also have a vector-of-pointers to keep LLT relatively conceptually clean
and orthogonal, while we don't have a very strong reason to break that
orthogonality.  Once we gain more experience on the use of LLT, we can
of course reconsider this direction.

Rejecting vector-of-pointer types in the IRTranslator is also an option
to avoid the crash reported in PR32471, but that is only a very
short-term solution; also needs quite a bit of code tweaks in places,
and is probably fragile. Therefore I didn't consider this the best
option.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300664 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 07:23:57 +00:00
Kristof Beyls
ec70be0eaf [GlobalISel] Remove non-determinism from IRTranslator.
This showed up in r300535/r300537, which were reverted in r300538 due to
some of the introduced tests in there failing on some bots, due to the
non-determinism fixed in this commit.

Re-committing r300535/r300537 will add 2 tests for the change in this
commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300663 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 06:38:37 +00:00
Chandler Carruth
c1b4c393a3 Revert r300657 due to crashes in stage2 of bootstraps:
http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/2476/steps/build-stage2-LLVMgold.so/logs/stdio
http://bb.pgr.jp/builders/clang-3stage-x86_64-linux/builds/15036/steps/build_llvmclang/logs/stdio

I've updated the commit thread, reverting to get the bots back to green.

Original commit summary:
[JumpThread] We want to fold (not thread) when all predecessor go to single BB's successor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300662 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 06:23:20 +00:00
Xin Tong
b9fe533b26 [JumpThread] We want to fold (not thread) when all predecessor go to single BB's successor. .
Summary: In case all predecessor go to a single successor of current BB. We want to fold (not thread).

Reviewers: efriedma, sanjoy

Reviewed By: sanjoy

Subscribers: dberlin, majnemer, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300657 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 05:15:57 +00:00
Serge Pavlov
4b58a5066b ARM: Use methods to access data stored with frame instructions
In r300196 several methods were added to TarfetInstrInfo to access
data stored with call frame setup/destroy instructions. This change
replaces calls to getOperand with calls to such special methods in
ARM target.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300655 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 03:12:05 +00:00
Reid Kleckner
4bc9eb623d Remove buggy 'addAttributes(unsigned, AttrBuilder)' overload
The 'addAttributes(unsigned, AttrBuilder)' overload delegated to 'get'
instead of 'addAttributes'.

Since we can implicitly construct an AttrBuilder from an AttributeSet,
just standardize on AttrBuilder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300651 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 01:51:13 +00:00
Kostya Serebryany
d4cfbc56b1 [libFuzzer] update -help: mention -exact_artifact_path in help for -minimize_crash and -cleanse_crash
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300642 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 01:22:04 +00:00
Leslie Zhai
afe170774a [AVR] Migrate to new MCAsmInfo CodePointerSize
Reviewers: dylanmckay, rengolin, kzhuravl, jroelofs

Reviewed By: kzhuravl, jroelofs

Subscribers: kzhuravl, llvm-commits

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300641 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 01:20:43 +00:00
Matthias Braun
c03abe83a3 ARMFrameLowering: Reserve emergency spill slot for large arguments
We need to reserve an emergency spill slot in cases with large argument
types that could overflow immediate offsets for FP relative address
calculations.

rdar://31317893

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300639 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 01:16:07 +00:00
Craig Topper
fb21a1a779 [DataLayout] Removed default value from a variable that isn't used without being overwritten. Make variable an enum instead of an int to avoid a cast later. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300634 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 00:31:38 +00:00
Xin Tong
35e5e58dc5 Allow suppressing host and target info in VersionPrinter
Summary:
VersionPrinter by default outputs information about the Host CPU
and Default target. Printing this information requires linking in
a large amount of data, such as supported target triples as C
strings, which in turn bloats the binary size.

Enable a new CMake option LLVM_VERSION_PRINTER_SHOW_HOST_TARGET_INFO
which controls printing of the host and target info. This allows
the target triple names to be dead-code stripped. This is a nice
win for LLVM clients that wish to minimize their binary size, such
as graphics drivers.

By default this is ON, so there is no change in the default behavior.
Clients who wish to suppress this printing can do so by setting this
option to off via CMake.

A test app on Linux that uses ParseCommandLineOptions() shows a binary
size reduction of 23KB (from 149K to 126K) for a Release build, and 24KB
(from 135K to 111K) in a MinSizeRel build.

Reviewers: klimek, beanz, bogner, chandlerc, compnerd

Reviewed By: compnerd

Patch by pammon (Peter Ammon) !

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300630 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 00:03:36 +00:00
Dylan McKay
18daf4ef22 [AVR] Fix the build
'PointerSize' was renamed to 'CodePointerSize'.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300629 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 23:53:10 +00:00
Craig Topper
19d17b65bd [ConstantRange] Optimize APInt creation in getSignedMax/getSignedMin.
We were creating an APInt at the top of these methods that isn't always returned. For ranges wider than 64-bits this results in an allocation and deallocation when its not used.

In getSignedMax we were creating Upper-1 to use in a compare and then creating it again for a return value. The compiler is unable to determine that these can be shared. So help it out and create the Upper-1 in a temporary that can be reused.

This provides a little compile time improvement.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300621 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 23:02:39 +00:00
Reid Kleckner
129271c86a Fix crash in AttributeList::addAttributes, add test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300614 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 22:10:18 +00:00
Sanjoy Das
51ccb32245 Add a getPointerOperandType() helper to LoadInst and StoreInst; NFC
I will use this in a later change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300613 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 22:00:54 +00:00
Craig Topper
a8fe21d79a [MemoryBuiltins] Add isMallocOrCallocLikeFn so BasicAA can check for both at the same time
BasicAA wants to know if a function is either a malloc or calloc like function. Currently we have to check both separately. This means both calls check if its an intrinsic, query TLI, check the nobuiltin attribute, scan the AllocationFnData, etc.

This patch adds a isMallocOrCallocLikeFn so we can go through all of the checks once per call.

This also changes the one other location I saw that called both together.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300608 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 21:43:46 +00:00
Davide Italiano
0b4630581a [LoopReroll] Prefer hasNUses/hasNUses or more as they're cheaper. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300607 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 21:42:21 +00:00
Matt Arsenault
663bdf65c5 DAG: Make mayBeEmittedAsTailCall parameter const
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300603 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 21:16:46 +00:00
Matt Arsenault
632c283420 Fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300597 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 20:59:46 +00:00
Matt Arsenault
6adfad1341 AMDGPU: Make MFI fields private
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300596 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 20:59:40 +00:00
Craig Topper
649ee28180 [MemoryBuiltins] Use ImmutableCallSite instead of CallSite to remove a const_cast and const correct. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300585 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 20:17:23 +00:00
Daniel Berlin
f5a8309ea3 NewGVN: Fix memory congruence verification. The return true should be a return false. Merge the appropriate if statements so it doesn't happen again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300584 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 20:15:47 +00:00
Chih-Hung Hsieh
21b4d8e9b9 [X86] Keep EXTRACT_VECTOR_ELT result type as f128 for Android x86_64.
Android x86_64 target uses f128 type and stores f128 values in %xmm* registers.
SoftenFloatRes_EXTRACT_VECTOR_ELT should not convert result value
from f128 to i128.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300583 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 20:15:18 +00:00
Craig Topper
461e0b352d [APInt] Inline the single word case of lshrInPlace similar to what we do for <<=.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300577 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 19:13:27 +00:00
Easwaran Raman
6e087c5152 [SLP vectorizer] Allow phi node reordering in tryToVectorizeList.
In tryToVectorizeList, under a very limited circumstance (when entered
from tryToVectorizePair), the values may be reordered (swapped) and the
SLP tree is built with the new order. This extends that to the case when
starting from phis in vectorizeChainsInBlock when there are exactly two
phis. The textual order of phi nodes shouldn't really matter. Without
this change, the loop body in the accompnaying test case is fully vectorized
when we swap the orde of the phis but not with this order. While this
doesn't solve the phi-ordering problem in a general way (for more than 2
phis), this is simple fix that piggybacks on an existing mechanism and
is useful in cases like multiplying two complex numbers.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300574 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 18:16:57 +00:00
Simon Pilgrim
248df79ddd [X86] Use for-range loop. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300567 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 17:18:54 +00:00
Craig Topper
df22034939 [APInt] Use lshrInPlace to replace lshr where possible
This patch uses lshrInPlace to replace code where the object that lshr is called on is being overwritten with the result.

This adds an lshrInPlace(const APInt &) version as well.

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




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300566 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 17:14:21 +00:00
Daniel Berlin
d80bc42060 NewGVN: Don't waste time value numbering unreachable blocks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300565 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 17:06:11 +00:00
Nirav Dave
e77d07916e [DAG] Improve store merge candidate pruning.
Remove non-consecutive stores from store merge candidate search as
they cannot be merged and will prevent us from finding subsequent
mergeable store cases.

Reviewers: jyknight, bogner, javed.absar, spatel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300561 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 15:36:34 +00:00
Zvi Rackover
fdc4eb0ce7 LoopRerollPass: Prefer Value::hasOneUse() over Value::getNumUses(). NFC.
getNumUses() can be more expensive as it iterates over all list's elements.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300558 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 14:55:43 +00:00
Gil Rapaport
e9d7070f01 [LV] Cache block mask values
This patch is part of D28975's breakdown.

Add caching for block masks similar to the cache already used for edge masks,
replacing generation per user with reusing the first generated value which
dominates all uses.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300557 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 14:43:43 +00:00
Sanjay Patel
ddb79e619d [ConstantRange] fix doxygen comment formatting; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300554 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 14:27:24 +00:00
Nikolai Bozhenov
8bb4e6d185 [GVNHoist] Mark GlobalsAA as preserved by GVNHoist.
Reviewers: sebpop, hiraditya

Reviewed By: sebpop

Subscribers: n.bozhenov, llvm-commits

Differential Revision: https://reviews.llvm.org/D32158
Patch by Andrei Elovikov <andrei.elovikov@intel.com>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300552 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 13:25:49 +00:00
Oliver Stannard
129d6cdefe [ARM] Add hardware build attributes in assembler
In the assembler, we should emit build attributes based on the target
selected with command-line options. This matches the GNU assembler's
behaviour. We only do this for build attributes which describe the
hardware that is expected to be available, not the ones that describe
ABI compatibility.

This is done by moving some of the attribute emission code to
ARMTargetStreamer, so that it can be shared between the assembly and
code-generation code paths. Since the assembler only creates a
MCSubtargetInfo, not an ARMSubtarget, the code had to be changed to
check raw features, and not use the convenience functions in
ARMSubtarget.

If different attributes are later specified using the .eabi_attribute
directive, then they will take precedence, as happens when the same
.eabi_attribute is specified twice.

This must be enabled by an option, because we don't want to do this when
parsing inline assembly. The attributes would match the ones emitted at
the start of the file, so wouldn't actually change the emitted object
file, but the extra directives would be added to every inline assembly
block when emitting assembly, which we'd like to avoid.

The majority of the changes in the build-attributes.ll test are just
re-ordering the directives, because the hardware attributes are now
emitted before the ABI ones. However, I did fix one bug which I spotted:
Tag_CPU_arch_profile was not being emitted for v6M.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300547 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 12:52:35 +00:00
Diana Picus
51238028ab [ARM] GlobalISel: Add support for G_SUB
Support G_SUB throughout the GlobalISel pipeline. It is exactly the same
as G_ADD, nothing fancy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300546 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 12:35:28 +00:00
Andrea Di Biagio
615f6579bd [SampleProfile] Don't assert when printing the DebugLoc of a branch. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300544 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 11:27:58 +00:00
Andrea Di Biagio
c3a1bd43f4 [SampleProfile] Skip intrinsic calls when visiting callsites in InlineHotFunctions.
Before this patch, we always called method 'findCalleeFunctionSamples()' on
intrinsic calls. However, intrinsic calls like llvm.dbg.value() are not viable
candidates for obvious reasons.

No functional change intended.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300541 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 10:08:53 +00:00
Kristof Beyls
0d04c2b2a9 Revert "[GlobalISel] Support vector-of-pointers in LLT"
This reverts r300535 and r300537.
The newly added tests in test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
produces slightly different code between LLVM versions being built with different compilers.
E.g., dependent on the compiler LLVM is built with, either one of the following
can be produced:

remark: <unknown>:0:0: unable to legalize instruction: %vreg0<def>(p0) = G_EXTRACT_VECTOR_ELT %vreg1, %vreg2; (in function: vector_of_pointers_extractelement)
remark: <unknown>:0:0: unable to legalize instruction: %vreg2<def>(p0) = G_EXTRACT_VECTOR_ELT %vreg1, %vreg0; (in function: vector_of_pointers_extractelement)

Non-determinism like this is clearly a bad thing, so reverting this until
I can find and fix the root cause of the non-determinism.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300538 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 09:26:36 +00:00
Kristof Beyls
83bb944fae Fix gcc build after r300535.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300537 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 08:47:55 +00:00
Diana Picus
ed0381e438 [ARM] Check for correct HW div when lowering divmod
For subtargets that use the custom lowering for divmod, e.g. gnueabi,
we used to check if the subtarget has hardware divide and then lower to
a div-mul-sub sequence if true, or to a libcall if false.

However, judging by the usage of hasDivide vs hasDivideInARMMode, it
seems that hasDivide only refers to Thumb. For instance, in the
ARMTargetLowering constructor, the code that specifies whether to use
libcalls for (S|U)DIV looks like this:

bool hasDivide = Subtarget->isThumb() ? Subtarget->hasDivide()
                                      : Subtarget->hasDivideInARMMode();

In the case of divmod for arm-gnueabi, using only hasDivide() to
determine what to do means that instead of lowering to __aeabi_idivmod
to get the remainder, we lower to div-mul-sub and then further lower the
div to __aeabi_idiv. Even worse, if we have hardware divide in ARM but
not in Thumb, we generate a libcall instead of using it (this is not an
issue in practice since AFAICT none of the cores that we support have
hardware divide in ARM but not Thumb).

This patch fixes the code dealing with custom lowering to take into
account the mode (Thumb or ARM) when deciding whether or not hardware
division is available.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300536 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 08:32:27 +00:00
Kristof Beyls
d18725e897 [GlobalISel] Support vector-of-pointers in LLT
This fixes PR32471.

As comment 10 on that bug report highlights
(https://bugs.llvm.org//show_bug.cgi?id=32471#c10), there are quite a
few different defendable design tradeoffs that could be made, including
not representing pointers at all in LLT.

I decided to go for representing vector-of-pointer as a concept in LLT,
while keeping the size of the LLT type 64 bits (this is an increase from
48 bits before). My rationale for keeping pointers explicit is that on
some targets probably it's very handy to have the distinction between
pointer and non-pointer (e.g. 68K has a different register bank for
pointers IIRC). If we keep a scalar pointer, it probably is easiest to
also have a vector-of-pointers to keep LLT relatively conceptually clean
and orthogonal, while we don't have a very strong reason to break that
orthogonality. Once we gain more experience on the use of LLT, we can
of course reconsider this direction.

Rejecting vector-of-pointer types in the IRTranslator is also an option
to avoid the crash reported in PR32471, but that is only a very
short-term solution; also needs quite a bit of code tweaks in places,
and is probably fragile. Therefore I didn't consider this the best
option.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300535 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 08:12:45 +00:00
Leslie Zhai
6aff9c9015 test commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300532 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 07:28:54 +00:00
Craig Topper
0f06c8216f [APInt] Cleanup the reverseBits slow case a little.
Use lshrInPlace. Use single bit extract and operator|=(uint64_t) to avoid a few temporary APInts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300527 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 05:02:21 +00:00
Craig Topper
4bf2830a01 [APInt] Make operator<<= shift in place. Improve the implementation of tcShiftLeft and use it to implement operator<<=.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300526 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 04:39:48 +00:00
Adrian Prantl
b560ea777b PR32382: Fix emitting complex DWARF expressions.
The DWARF specification knows 3 kinds of non-empty simple location
descriptions:
1. Register location descriptions
  - describe a variable in a register
  - consist of only a DW_OP_reg
2. Memory location descriptions
  - describe the address of a variable
3. Implicit location descriptions
  - describe the value of a variable
  - end with DW_OP_stack_value & friends

The existing DwarfExpression code is pretty much ignorant of these
restrictions. This used to not matter because we only emitted very
short expressions that we happened to get right by accident.  This
patch makes DwarfExpression aware of the rules defined by the DWARF
standard and now chooses the right kind of location description for
each expression being emitted.

This would have been an NFC commit (for the existing testsuite) if not
for the way that clang describes captured block variables. Based on
how the previous code in LLVM emitted locations, DW_OP_deref
operations that should have come at the end of the expression are put
at its beginning. Fixing this means changing the semantics of
DIExpression, so this patch bumps the version number of DIExpression
and implements a bitcode upgrade.

There are two major changes in this patch:

I had to fix the semantics of dbg.declare for describing function
arguments. After this patch a dbg.declare always takes the *address*
of a variable as the first argument, even if the argument is not an
alloca.

When lowering a DBG_VALUE, the decision of whether to emit a register
location description or a memory location description depends on the
MachineLocation — register machine locations may get promoted to
memory locations based on their DIExpression. (Future) optimization
passes that want to salvage implicit debug location for variables may
do so by appending a DW_OP_stack_value. For example:
  DBG_VALUE, [RBP-8]                        --> DW_OP_fbreg -8
  DBG_VALUE, RAX                            --> DW_OP_reg0 +0
  DBG_VALUE, RAX, DIExpression(DW_OP_deref) --> DW_OP_reg0 +0

All testcases that were modified were regenerated from clang. I also
added source-based testcases for each of these to the debuginfo-tests
repository over the last week to make sure that no synchronized bugs
slip in. The debuginfo-tests compile from source and run the debugger.

https://bugs.llvm.org/show_bug.cgi?id=32382
<rdar://problem/31205000>

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300522 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 01:21:53 +00:00
George Burgess IV
cc56be2830 Add const to a const method. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300520 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 01:04:05 +00:00
Davide Italiano
540c0392b5 [Target] Use hasOneUse() instead of getNumUses().
The latter does a liner scan over a linked list, therefore is
much more expensive.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300518 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 00:29:54 +00:00
Peter Collingbourne
4df72d14c8 Object: Shrink the size of irsymtab::Symbol by a word. NFCI.
Instead of storing an UncommonIndex on the Symbol, use a flag bit to store
whether the Symbol has an Uncommon. This shrinks Chromium's .bc files (after
D32061) by about 1%.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300514 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 23:43:49 +00:00
Dehao Chen
62b2c39c08 Build SymbolMap in SampleProfileLoader to help matchin function names with suffix.
Summary: If there is suffix added in the function name (e.g. module hash added by thinLTO), we will not be able to find a match in profile as the suffix does not exist in profile. This patch build a map from function name to Function *. The map includes the entry for the stripped function name so that inlineHotFunctions can find the corresponding function to promote/inline.

Reviewers: davidxl, dnovillo, tejohnson

Reviewed By: davidxl

Subscribers: mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300507 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 22:23:05 +00:00
Craig Topper
538a54682a [SimplifyCFG] Use hasNUses instead of comparing getNumUses to a constant."
The use list is a linked list so getNumUses requires a linear scan through the whole list. hasNUses will stop scanning at N and see if that is the end.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300505 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 22:13:00 +00:00
Craig Topper
9128da5831 [APInt] Merge the multiword code from lshrInPlace and tcShiftRight into a single implementation
This merges the two different multiword shift right implementations into a single version located in tcShiftRight. lshrInPlace now calls tcShiftRight for the multiword case.

I retained the memmove fast path from lshrInPlace and used a memset for the zeroing. The for loop is basically tcShiftRight's implementation with the zeroing and the intra-shift of 0 removed.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300503 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 21:43:43 +00:00
Jacob Gravelle
fee2961b5a [WebAssembly] Fix WebAssemblyOptimizeReturned after r300367
Summary:
Refactoring changed paramHasAttr(1 + i) to paramHasAttr(0), fix that to
paramHasAttr(i).
Add more tests to WebAssemblyOptimizeReturned that catch that
regression.

Reviewers: dschuff

Subscribers: jfb, sbc100, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300502 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 21:40:28 +00:00
Benjamin Kramer
2e4163e54d [SCEV] Fix another unused variable warning in release builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300500 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 21:07:26 +00:00
Wei Mi
c2c171286c Fix an unused variable error in rL300494.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300499 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 21:00:45 +00:00
Kostya Serebryany
b662731542 [libFuzzer] experimental option -cleanse_crash: tries to replace all bytes in a crash reproducer with garbage, while still preserving the crash
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300498 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 20:58:21 +00:00
Davide Italiano
61710dfa3a [InstCombine] Matchers work with both ConstExpr and Instructions.
So, `cast<Instruction>` is not guaranteed to succeed. Change the
code so that we create a new constant and use it in the newly
created instruction, as it's done in other places in InstCombine.

OK'ed by Sanjay/Craig. Fixes PR32686.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300495 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 20:49:50 +00:00
Wei Mi
e35a5f5518 [SCEV] Add a local cache for getZeroExtendExpr and getSignExtendExpr to prevent
the exponential behavior.

The patch is to fix PR32043. Functions getZeroExtendExpr and getSignExtendExpr
may call themselves recursively more than once. This is potentially a 2^N
complexity behavior. The exponential behavior was not commonly exposed before
because of existing global cache mechnism like UniqueSCEVs or some early return
mechanism when flags FlagNSW or FlagNUW are seen. However, we still have case
which can expose the exponential behavior, like the case in PR32043, so we add
a local cache in getZeroExtendExpr and getSignExtendExpr. If the input of the
functions -- SCEV and type pair have been seen before, we can find the extended
expression directly in the local cache.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300494 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 20:40:05 +00:00
Derek Schuff
e39a78c951 [WebAssembly] Encode block signatures as SLEB instead of ULEB
Use SLEB (varint) for block_type immediates in accordance with the spec.

Patch by Yury Delendik

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300490 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 20:28:28 +00:00
Dehao Chen
3b1256dc1d Add GNU_discriminator support for inline callsites in llvm-symbolizer.
Summary: LLVM symbolize cannot recognize GNU_discriminator for inline callsites. This patch adds support for it.

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300486 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 20:10:39 +00:00
Matt Arsenault
74ac54ec5b AMDGPU: Use MachineRegisterInfo to find max used register
Avoid looping through program to determine register counts.
This avoids needing to look at regmask operands.

Also fixes some counting errors with flat_scr when there
are no stack objects.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300482 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 19:48:30 +00:00
Matt Arsenault
fc3524b1a2 AMDGPU: Change stack alignment
While the incoming stack for a kernel is 256-byte aligned,
this refers to the base address of the entire wave. This isn't
useful information for most of codegen. Fixes unnecessarily
aligning stack objects in callees.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300481 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 19:48:24 +00:00
Brendon Cahoon
80269962da [CodeGenPrepare] Fix crash due to an invalid CFG
The splitIndirectCriticalEdges function generates and invalid CFG when the
'Target' basic block is a loop to itself. When this occurs, the code that
updates the predecessor terminator needs to update the terminator in the split
basic block.

This occurs when there is an edge from block D back to D. Since D is split in
to D0 and D1, the code needs to update the terminator in D1. But D1 is not in
the OtherPreds vector, so it was not getting updated.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300480 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 19:11:04 +00:00
Benjamin Kramer
3778de4635 Unbreak build of the wasm backend after r300463.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300479 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 19:08:41 +00:00
Peter Collingbourne
c45a5a4d32 Bitcode: Add missing build dep to fix shlib build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300478 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 18:53:27 +00:00
Craig Topper
7b19c164ad [IR] Implement DataLayout::getPointerTypeSizeInBits using getPointerSizeInBits directly
Currently we use getTypeSizeInBits which contains a switch statement to dispatch based on what the Type is. We know we always have a pointer type here, but the compiler isn't able to figure out that out to remove the switch.

This patch changes it to just call handle the pointer type directly by calling getPointerSizeInBits without going through a switch.

getPointerTypeSizeInBits is called pretty often, particularly by getOrEnforceKnownAlignment which is used by InstCombine. This should speed that up a little bit.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300475 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 18:22:36 +00:00
Tim Northover
8f48abe12d AArch64: put nonlazybind special handling behind a flag for now.
It's basically a terrible idea anyway but objc_msgSend gets emitted like that.
We can decide on a better way to deal with it in the unlikely event that anyone
actually uses it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300474 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 18:18:47 +00:00
Konstantin Zhuravlyov
82b3362fea AMDGPU: Set CodePointerSize to 8 for amdgcn
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300470 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 18:02:09 +00:00
Peter Collingbourne
fc84bd3dbe Object: Use offset+size as the irsymtab string representation.
This is consistent with the bitcode string table.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300465 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 17:55:24 +00:00
Peter Collingbourne
6163b4af73 Bitcode: Add a string table to the bitcode format.
Add a top-level STRTAB block containing a string table blob, and start storing
strings for module codes FUNCTION, GLOBALVAR, ALIAS, IFUNC and COMDAT in
the string table.

This change allows us to share names between globals and comdats as well
as between modules, and improves the efficiency of loading bitcode files by
no longer using a bit encoding for symbol names. Once we start writing the
irsymtab to the bitcode file we will also be able to share strings between
it and the module.

On my machine, link time for Chromium for Linux with ThinLTO decreases by
about 7% for no-op incremental builds or about 1% for full builds. Total
bitcode file size decreases by about 3%.

As discussed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2017-April/111732.html

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300464 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 17:51:36 +00:00
Konstantin Zhuravlyov
0c79d1f4e0 Distinguish between code pointer size and DataLayout::getPointerSize() in DWARF info generation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300463 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 17:41:25 +00:00
Tim Northover
a017dc6965 AArch64: support nonlazybind
It's almost certainly not a good idea to actually use it in most cases (there's
a pretty large code size overhead on AArch64), but we can't do those
experiments until it's supported.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300462 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 17:27:56 +00:00
Craig Topper
f1a890db28 Introduce APInt::isSignBitSet/isSignBitClear. Use in place isSignBitSet in place of isNegative in known bits tracking.
This makes statements like KnownZero.isNegative() (which means the value we're tracking is positive) less confusing.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300457 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 16:38:20 +00:00
Matt Arsenault
6d01b81485 AMDGPU: SimplifyDemandedElts for image intrinsics
Causes some VGPR usage improvements in shaderdb, but
introduces some SGPR spilling regressions due to random
scheduling changes later.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300453 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 15:12:44 +00:00