]> granicus.if.org Git - llvm/log
llvm
7 years agoMove folding of icmp with zero after checking for min/max idioms.
Nikolai Bozhenov [Mon, 16 Oct 2017 09:19:21 +0000 (09:19 +0000)]
Move folding of icmp with zero after checking for min/max idioms.

Summary:
The following transformation for cmp instruction:

  icmp smin(x, PositiveValue), 0 -> icmp x, 0

should only be done after checking for min/max to prevent infinite
looping caused by a reverse canonicalization. That is why this
transformation was moved to place after the mentioned check.

Reviewers: spatel, efriedma

Subscribers: llvm-commits

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

Patch by: Artur Gainullin <artur.gainullin@intel.com>

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

7 years agoSLPVectorizer.cpp: Try to appease stage2-3 difference. (D38586)
NAKAMURA Takumi [Mon, 16 Oct 2017 09:15:23 +0000 (09:15 +0000)]
SLPVectorizer.cpp: Try to appease stage2-3 difference. (D38586)

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

7 years ago[TableGen] Range loopify DAGISelMatcher. NFC.
Javed Absar [Mon, 16 Oct 2017 06:43:54 +0000 (06:43 +0000)]
[TableGen] Range loopify DAGISelMatcher. NFC.

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

7 years ago[aarch64][globalisel] Fix a crash in selectAddrModeIndexed() caused by incorrect...
Daniel Sanders [Mon, 16 Oct 2017 05:39:30 +0000 (05:39 +0000)]
[aarch64][globalisel] Fix a crash in selectAddrModeIndexed() caused by incorrect G_FRAME_INDEX handling

The wrong operand was being rendered to the result instruction.

The crash was detected by Bitcode/simd_ops/AArch64_halide_runtime.bc

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

7 years agobpf: fix bug on silently truncating 64-bit immediate
Yonghong Song [Mon, 16 Oct 2017 04:14:53 +0000 (04:14 +0000)]
bpf: fix bug on silently truncating 64-bit immediate

We came across an llvm bug when compiling some testcases that 64-bit
immediates are silently truncated into 32-bit and then packed into
BPF_JMP | BPF_K encoding.  This caused comparison with wrong value.

This bug looks to be introduced by r308080.  The Select_Ri pattern is
supposed to be lowered into J*_Ri while the latter only support 32-bit
immediate encoding, therefore Select_Ri should have similar immediate
predicate check as what J*_Ri are doing.

Reported-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315889 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PowerPC] Eliminate sign- and zero-extensions if already sign- or zero-extended
Hiroshi Inoue [Mon, 16 Oct 2017 04:12:57 +0000 (04:12 +0000)]
[PowerPC] Eliminate sign- and zero-extensions if already sign- or zero-extended

This patch enables redundant sign- and zero-extension elimination in PowerPC MI Peephole pass.
If the input value of a sign- or zero-extension is known to be already sign- or zero-extended, the operation is redundant and can be eliminated.
One common case is sign-extensions for a method parameter or for a method return value; they must be sign- or zero-extended as defined in PPC ELF ABI.
For example of the following simple code, two extsw instructions are generated before the invocation of int_func and before the return. With this patch, both extsw are eliminated.

void int_func(int);
void ii_test(int a) {
    if (a & 1) return int_func(a);
}

Such redundant sign- or zero-extensions are quite common in many programs; e.g. I observed about 60,000 occurrences of the elimination while compiling the LLVM+CLANG.

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

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

7 years agoRe-commit r315885: [globalisel][tblgen] Add support for iPTR and implement am_unscale...
Daniel Sanders [Mon, 16 Oct 2017 03:36:29 +0000 (03:36 +0000)]
Re-commit r315885: [globalisel][tblgen] Add support for iPTR and implement am_unscaled* and am_indexed*

Summary:
iPTR is a pointer of subtarget-specific size to any address space. Therefore
type checks on this size derive the SizeInBits from a subtarget hook.

At this point, we can import the simplests G_LOAD rules and select load
instructions using them. Further patches will support for the predicates to
enable additional loads as well as the stores.

The previous commit failed on MSVC due to a failure to convert an
initializer_list to a std::vector. Hopefully, MSVC will accept this version.

Depends on D37457

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

Reviewed By: qcolombet

Subscribers: kristof.beyls, javed.absar, llvm-commits, igorb

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

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

7 years agoRevert r315885: [globalisel][tblgen] Add support for iPTR and implement am_unscaled...
Daniel Sanders [Mon, 16 Oct 2017 02:15:39 +0000 (02:15 +0000)]
Revert r315885: [globalisel][tblgen] Add support for iPTR and implement am_unscaled* and am_indexed*

MSVC doesn't like one of the constructors.

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

7 years ago[globalisel][tblgen] Add support for iPTR and implement am_unscaled* and am_indexed*
Daniel Sanders [Mon, 16 Oct 2017 01:16:35 +0000 (01:16 +0000)]
[globalisel][tblgen] Add support for iPTR and implement am_unscaled* and am_indexed*

Summary:
iPTR is a pointer of subtarget-specific size to any address space. Therefore
type checks on this size derive the SizeInBits from a subtarget hook.

At this point, we can import the simplests G_LOAD rules and select load
instructions using them. Further patches will support for the predicates to
enable additional loads as well as the stores.

Depends on D37457

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

Reviewed By: qcolombet

Subscribers: kristof.beyls, javed.absar, llvm-commits, igorb

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

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

7 years ago[globalisel][tablegen] Implement unindexed load, non-extending load, and MemVT checks
Daniel Sanders [Mon, 16 Oct 2017 00:56:30 +0000 (00:56 +0000)]
[globalisel][tablegen] Implement unindexed load, non-extending load, and MemVT checks

Summary:
This includes some context-sensitivity in the MVT to LLT conversion so that
pointer types are tested correctly.
FIXME: I'm not happy with the way this is done since everything is a
       special-case. I've yet to find a reasonable way to implement it.

select-load.mir fails because <1 x s64> loads in tablegen get priority over s64
loads. This is fixed in the next patch and as such they should be committed
together, I've posted them separately to help with the review.

Depends on D37456

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

Subscribers: kristof.beyls, javed.absar, llvm-commits, igorb

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

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

7 years ago[Hexagon] Add LLVM_ATTRIBUTE_UNUSED to operator<<, NFC
Krzysztof Parzyszek [Mon, 16 Oct 2017 00:29:47 +0000 (00:29 +0000)]
[Hexagon] Add LLVM_ATTRIBUTE_UNUSED to operator<<, NFC

This should silence "unused function" warnings.

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

7 years agoSearch for libxml2 on macOS too.
Nico Weber [Sun, 15 Oct 2017 19:13:57 +0000 (19:13 +0000)]
Search for libxml2 on macOS too.

This allows lld-link to process /manifestinput: flags on macOS too.
Also makes the `REQUIRES: manifesttool` lld tests run on macOS.
Setting LLVM_ENABLE_LIBXML2 to off can suppress this behavior, like on Linux.

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

7 years ago[tablegen] Use hasPredCode()/hasImmCode() instead of getPredCode().empty()/getImmCode...
Daniel Sanders [Sun, 15 Oct 2017 19:01:32 +0000 (19:01 +0000)]
[tablegen] Use hasPredCode()/hasImmCode() instead of getPredCode().empty()/getImmCode().empty(). NFC

These are cheaper ways of testing for the presence of code than generating the C++ code and testing it's empty.

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

7 years agoPhony change to CMakeLists.txt to (hopefully) trigger regeneration
Krzysztof Parzyszek [Sun, 15 Oct 2017 18:23:16 +0000 (18:23 +0000)]
Phony change to CMakeLists.txt to (hopefully) trigger regeneration

Ninja doesn't seem to recognize a change in a CMakeLists.txt in a
subdirectory, so r315861 is not having any effect.

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

7 years agoRe-commit r315863: [globalisel][tablegen] Import ComplexPattern when used as an operator
Daniel Sanders [Sun, 15 Oct 2017 18:22:54 +0000 (18:22 +0000)]
Re-commit r315863: [globalisel][tablegen] Import ComplexPattern when used as an operator

Summary:
It's possible for a ComplexPattern to be used as an operator in a match
pattern. This is used by the load/store patterns in AArch64 to name the
suboperands returned by ComplexPattern predicate so that they can be broken
apart and referenced independently in the result pattern.

This patch adds support for this in order to enable the import of load/store
patterns.

Depends on D37445

Hopefully fixed the ambiguous constructor that a large number of bots reported.

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

Reviewed By: qcolombet

Subscribers: aemerson, javed.absar, igorb, llvm-commits, kristof.beyls

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

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

7 years agoRevert r315863: [globalisel][tablegen] Import ComplexPattern when used as an operator
Daniel Sanders [Sun, 15 Oct 2017 17:51:07 +0000 (17:51 +0000)]
Revert r315863: [globalisel][tablegen] Import ComplexPattern when used as an operator

A large number of bots are failing on an ambiguous constructor call.

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

7 years ago[globalisel][tablegen] Import ComplexPattern when used as an operator
Daniel Sanders [Sun, 15 Oct 2017 17:03:36 +0000 (17:03 +0000)]
[globalisel][tablegen] Import ComplexPattern when used as an operator

Summary:
It's possible for a ComplexPattern to be used as an operator in a match
pattern. This is used by the load/store patterns in AArch64 to name the
suboperands returned by ComplexPattern predicate so that they can be broken
apart and referenced independently in the result pattern.

This patch adds support for this in order to enable the import of load/store
patterns.

Depends on D37445

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

Reviewed By: qcolombet

Subscribers: aemerson, javed.absar, igorb, llvm-commits, kristof.beyls

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

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

7 years ago[X86] Remove the SlowBTMem feature flag entirely
Craig Topper [Sun, 15 Oct 2017 16:57:33 +0000 (16:57 +0000)]
[X86] Remove the SlowBTMem feature flag entirely

Turns out we have no patterns on the instructions that were using this feature flag for other reasons. These instructions are slow on all modern CPUs so it seems unlikely that we will spend any effort supporting these instructions going forward. So we might as well just kill of the feature flag and just fix up the comments.

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

7 years ago[unittests] Only build llvm-cfi-verify if X86 is in LLVM_TARGETS_TO_BUILD
Krzysztof Parzyszek [Sun, 15 Oct 2017 16:55:23 +0000 (16:55 +0000)]
[unittests] Only build llvm-cfi-verify if X86 is in LLVM_TARGETS_TO_BUILD

The test requires a target for triple x86-64, and it fails in builds that
do not have the X86 backend.

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

7 years ago[AVX512] Don't mark EXTLOAD as legal with AVX512. Continue using custom lowering.
Craig Topper [Sun, 15 Oct 2017 16:41:17 +0000 (16:41 +0000)]
[AVX512] Don't mark EXTLOAD as legal with AVX512. Continue using custom lowering.

Summary:
This was impeding our ability to combine the extending shuffles with other shuffles as you can see from the test changes.

There's one special case that needed to be added to use VZEXT directly for v8i8->v8i64 since the custom lowering requires v64i8.

Reviewers: RKSimon, zvi, delena

Reviewed By: delena

Subscribers: llvm-commits

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

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

7 years ago[X86] Add FeatureSlowBTMem to Haswell, Broadwell, Skylake, Cannonlake, and Knights...
Craig Topper [Sun, 15 Oct 2017 16:41:15 +0000 (16:41 +0000)]
[X86] Add FeatureSlowBTMem to Haswell, Broadwell, Skylake, Cannonlake, and Knights Landing CPUs.

Summary: I see nothing in Agner Fog's tables to indicate that this improved between Ivy Bridge and Haswell. It's also set for all Atom CPUs so I assume KNL should have it too.

Reviewers: RKSimon, zvi, gadi.haber

Reviewed By: gadi.haber

Subscribers: llvm-commits

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

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

7 years ago[TableGen] Remove error checks incorrectly failing on non-error conditions
Krzysztof Parzyszek [Sun, 15 Oct 2017 15:39:56 +0000 (15:39 +0000)]
[TableGen] Remove error checks incorrectly failing on non-error conditions

In type inference, an empty type set for a specific hw mode is not an
error. In earlier stages of the design it was, but having to use non-
parameterized types with target intrinsics necessarily led to type
contradictions: since the intrinsics used specific types, they were
only valid for a specific hw mode, and the resulting type set for other
modes ended up empty. To accommodate the existence of such intrinsics
individual type sets were allowed to be empty as long as not all sets
were empty.

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

7 years agorevert r314984: revert r314698 - [InstCombine] remove one-use restriction for icmp...
Sanjay Patel [Sun, 15 Oct 2017 15:39:15 +0000 (15:39 +0000)]
revert r314984: revert r314698 - [InstCombine] remove one-use restriction for icmp (shr exact X, C1), C2 --> icmp X, (C2<<C1)

Recommitting r314698. The bug exposed by this change should be fixed with:
https://reviews.llvm.org/rL315579

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

7 years ago[SimplifyCFG] use range-for-loops, tidy; NFCI
Sanjay Patel [Sun, 15 Oct 2017 14:43:39 +0000 (14:43 +0000)]
[SimplifyCFG] use range-for-loops, tidy; NFCI

There seems to be something missing here as shown in PR34471:
https://bugs.llvm.org/show_bug.cgi?id=34471

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

7 years agoReverting r315590; it did not include changes for llvm-tblgen, which is causing link...
Aaron Ballman [Sun, 15 Oct 2017 14:32:27 +0000 (14:32 +0000)]
Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people.

Error LNK2019 unresolved external symbol "public: void __cdecl `anonymous namespace'::MatchableInfo::dump(void)const " (?dump@MatchableInfo@?A0xf4f1c304@@QEBAXXZ) referenced in function "public: void __cdecl `anonymous namespace'::AsmMatcherEmitter::run(class llvm::raw_ostream &)" (?run@AsmMatcherEmitter@?A0xf4f1c304@@QEAAXAEAVraw_ostream@llvm@@@Z) llvm-tblgen D:\llvm\2017\utils\TableGen\AsmMatcherEmitter.obj 1

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

7 years ago[MergeFunctions] Merge small functions if possible without a thunk.
whitequark [Sun, 15 Oct 2017 12:29:09 +0000 (12:29 +0000)]
[MergeFunctions] Merge small functions if possible without a thunk.

This can result in significant code size savings in some cases,
e.g. an interrupt table all filled with the same assembly stub
in a certain Cortex-M BSP results in code blowup by a factor of 2.5.

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

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

7 years ago[MergeFunctions] Replace all uses of unnamed_addr functions.
whitequark [Sun, 15 Oct 2017 12:29:01 +0000 (12:29 +0000)]
[MergeFunctions] Replace all uses of unnamed_addr functions.

This reduces code size for constructs like vtables or interrupt
tables that refer to functions in global initializers.

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

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

7 years ago[X86] Ignore DBG instructions in X86CmovConversion optimization to resolve PR34565
Amjad Aboud [Sun, 15 Oct 2017 11:00:56 +0000 (11:00 +0000)]
[X86] Ignore DBG instructions in X86CmovConversion optimization to resolve PR34565

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

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

7 years ago[LoopInfo][Refactor] Make SetLoopAlreadyUnrolled a member function of the Loop Pass...
Hongbin Zheng [Sun, 15 Oct 2017 07:31:02 +0000 (07:31 +0000)]
[LoopInfo][Refactor] Make SetLoopAlreadyUnrolled a member function of the Loop Pass, NFC.

This avoid code duplication and allow us to add the disable unroll metadata elsewhere.

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

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

7 years ago[X86] Lower vselect with constant condition to vector_shuffle even with AVX512 instru...
Craig Topper [Sun, 15 Oct 2017 06:39:07 +0000 (06:39 +0000)]
[X86] Lower vselect with constant condition to vector_shuffle even with AVX512 instructions.

Summary:
It's better to use our shuffle lowering code to handle these than loading an immediate into a k-register.

It really feels like this should be a DAG combine optimization rather than a lowering operation, but that's a problem for another day.

Reviewers: RKSimon, delena, zvi

Reviewed By: delena

Subscribers: llvm-commits

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

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

7 years ago[X86] Don't use constant condition for select instruction when testing masking ops.
Craig Topper [Sun, 15 Oct 2017 06:05:50 +0000 (06:05 +0000)]
[X86] Don't use constant condition for select instruction when testing masking ops.

We should be able to fold constant conditions by converting to shuffles, but fixing that would break these tests in their current form. Since they are really trying to test masking ops, add a non-constant mask to the selects.

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

7 years agoRemove unused variables
Vitaly Buka [Sun, 15 Oct 2017 05:35:02 +0000 (05:35 +0000)]
Remove unused variables

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

7 years ago[globalisel][tablegen] Map ld and st to G_LOAD and G_STORE. NFC
Daniel Sanders [Sun, 15 Oct 2017 02:41:12 +0000 (02:41 +0000)]
[globalisel][tablegen] Map ld and st to G_LOAD and G_STORE. NFC

Summary:
There is an important mismatch between ISD::LOAD and G_LOAD (and likewise for
ISD::STORE and G_STORE). In SelectionDAG, ISD::LOAD is a non-atomic load
and atomic loads are handled by a separate node. However, this is not true of
GlobalISel's G_LOAD. For G_LOAD, the MachineMemOperand indicates the atomicity
of the operation. As a result, this mapping must also add a predicate that
checks for non-atomic MachineMemOperands.

This is NFC since these nodes always have predicates in practice and are
therefore always rejected at the moment.

Depends on D37443

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

Reviewed By: qcolombet

Subscribers: kristof.beyls, llvm-commits, igorb

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

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

7 years ago[tablegen] Handle common load/store predicates inside tablegen. NFC.
Daniel Sanders [Sun, 15 Oct 2017 02:06:44 +0000 (02:06 +0000)]
[tablegen] Handle common load/store predicates inside tablegen. NFC.

Summary:
GlobalISel and SelectionDAG require different code for the common
load/store predicates due to differences in the representation.
For example:
   SelectionDAG: (load<signext,i8>:i32 GPR32:$addr) // The <> denote properties of the SDNode that are not printed in the DAG
   GlobalISel: (G_SEXT:s32 (G_LOAD:s8 GPR32:$addr))
Even without that, differences in the IR (SDNode vs MachineInstr) require
differences in the C++ predicate.

This patch moves the implementation of the common load/store predicates
into tablegen so that it can handle these differences.

It's NFC for SelectionDAG since it emits equivalent code and it's NFC for
GlobalISel since the rules involving the relevant predicates are still
rejected by the importer.

Depends on D36618

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

Subscribers: llvm-commits, igorb

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

Includes a partial revert of r315826 since this patch makes it necessary for
getPredCode() to return a std::string and getImmCode() should have the same
interface as getPredCode().

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

7 years ago[Hexagon] Mark RangeTree::dump() with LLVM_DUMP_METHOD.
Davide Italiano [Sat, 14 Oct 2017 23:46:01 +0000 (23:46 +0000)]
[Hexagon] Mark RangeTree::dump() with LLVM_DUMP_METHOD.

GCC otherwise emits a "defined but not used" warning on the
member function.

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

7 years agoAMDGPU: Temporary disable pal metadata check line in llvm-readobj test
Konstantin Zhuravlyov [Sat, 14 Oct 2017 23:42:11 +0000 (23:42 +0000)]
AMDGPU: Temporary disable pal metadata check line in llvm-readobj test

It fails on mips

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

7 years agoAMDGPU: Don't use TargetStreamer if it has not been initialized
Konstantin Zhuravlyov [Sat, 14 Oct 2017 22:16:26 +0000 (22:16 +0000)]
AMDGPU: Don't use TargetStreamer if it has not been initialized

Fixes cfe/trunk/test/Misc/backend-resource-limit-diagnostics.cl
test after r315808

We may hit few other similar issues, but I want to discuss good
solution offline.

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

7 years ago[X86] Remove a bunch of dead FileCheck lines with the wrong prefix.
Craig Topper [Sat, 14 Oct 2017 21:46:55 +0000 (21:46 +0000)]
[X86] Remove a bunch of dead FileCheck lines with the wrong prefix.

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

7 years ago[TableGen] Avoid unnecessary std::string creations
Simon Pilgrim [Sat, 14 Oct 2017 21:27:53 +0000 (21:27 +0000)]
[TableGen] Avoid unnecessary std::string creations

Avoid unnecessary std::string creations in the TreePredicateFn getters.

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

7 years ago[X86][SSE] Don't attempt to reduce the imul vector width of odd sized vectors (PR34947)
Simon Pilgrim [Sat, 14 Oct 2017 19:57:19 +0000 (19:57 +0000)]
[X86][SSE] Don't attempt to reduce the imul vector width of odd sized vectors (PR34947)

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

7 years ago[X86][SSE] Test vector imul reduction on 32 and 64-bit targets
Simon Pilgrim [Sat, 14 Oct 2017 19:46:08 +0000 (19:46 +0000)]
[X86][SSE] Test vector imul reduction on 32 and 64-bit targets

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

7 years agoRevert "[AArch64][RegisterBankInfo] Use the statically computed mappings for COPY"
Bruno Cardoso Lopes [Sat, 14 Oct 2017 19:31:03 +0000 (19:31 +0000)]
Revert "[AArch64][RegisterBankInfo] Use the statically computed mappings for COPY"

This reverts commit r315781, breaks:
http://green.lab.llvm.org/green/job/Compiler_Verifiers_GlobalISEL/9882

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

7 years agoAMDGPU: Add AMDGPU HSA Kernel Descriptor
Konstantin Zhuravlyov [Sat, 14 Oct 2017 19:17:08 +0000 (19:17 +0000)]
AMDGPU: Add AMDGPU HSA Kernel Descriptor

  - Update docs to match llvm coding style
  - Add missing FP16_OVFL bit for gfx9
  - Fix the size of the kernel descriptor in the docs

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

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

7 years agoAMDGPU: Bring HSA metadata on par with the specification
Konstantin Zhuravlyov [Sat, 14 Oct 2017 19:03:51 +0000 (19:03 +0000)]
AMDGPU: Bring HSA metadata on par with the specification

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

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

7 years agollvm-readobj: Print AMDGPU note contents
Konstantin Zhuravlyov [Sat, 14 Oct 2017 18:21:42 +0000 (18:21 +0000)]
llvm-readobj: Print AMDGPU note contents

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

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

7 years agoPull out repeated calls to VT.getVectorNumElements(). NFCI.
Simon Pilgrim [Sat, 14 Oct 2017 17:37:42 +0000 (17:37 +0000)]
Pull out repeated calls to VT.getVectorNumElements(). NFCI.

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

7 years agoCleanup update_llc_test_checks.py notes.
Simon Pilgrim [Sat, 14 Oct 2017 17:37:03 +0000 (17:37 +0000)]
Cleanup update_llc_test_checks.py notes.

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

7 years agoAMDGPU: Cleanup elf-notes.ll test
Konstantin Zhuravlyov [Sat, 14 Oct 2017 17:36:53 +0000 (17:36 +0000)]
AMDGPU: Cleanup elf-notes.ll test

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

7 years agoUse DAG::getBitcast() helper. NFCI.
Simon Pilgrim [Sat, 14 Oct 2017 17:14:42 +0000 (17:14 +0000)]
Use DAG::getBitcast() helper. NFCI.

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

7 years agollvm-readobj: Print AMDGPU note type names
Konstantin Zhuravlyov [Sat, 14 Oct 2017 16:43:46 +0000 (16:43 +0000)]
llvm-readobj: Print AMDGPU note type names

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

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

7 years agoAMDGPU: Improve note directive verification in assembler
Konstantin Zhuravlyov [Sat, 14 Oct 2017 16:15:28 +0000 (16:15 +0000)]
AMDGPU: Improve note directive verification in assembler

  - Do not allow amd_amdgpu_isa directives on non-amdgcn architectures
  - Do not allow amd_amdgpu_hsa_metadata on non-amdhsa OSes
  - Do not allow amd_amdgpu_pal_metadata on non-amdpal OSes

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

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

7 years agoAMDGPU: Do not emit deprecated notes for code object v3
Konstantin Zhuravlyov [Sat, 14 Oct 2017 15:59:07 +0000 (15:59 +0000)]
AMDGPU: Do not emit deprecated notes for code object v3

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

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

7 years agoAMDGPU: Add support for isa version note
Konstantin Zhuravlyov [Sat, 14 Oct 2017 15:40:33 +0000 (15:40 +0000)]
AMDGPU: Add support for isa version note

  - Emit NT_AMD_AMDGPU_ISA
  - Add assembler parsing for isa version directive
    - If isa version directive does not match command line arguments, then return error

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

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

7 years ago[X86][SSE] Support combining AND(EXTRACT(SHUF(X)), C) -> EXTRACT(SHUF(X))
Simon Pilgrim [Sat, 14 Oct 2017 15:01:36 +0000 (15:01 +0000)]
[X86][SSE] Support combining AND(EXTRACT(SHUF(X)), C) -> EXTRACT(SHUF(X))

If we are applying a byte mask to a value extracted from a shuffle, see if we can combine the mask into shuffle.

Fixes the last issue with PR22415

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

7 years ago[X86] Add patterns for vzmovl+cvtpd2dq/cvttpd2dq with a load.
Craig Topper [Sat, 14 Oct 2017 07:04:48 +0000 (07:04 +0000)]
[X86] Add patterns for vzmovl+cvtpd2dq/cvttpd2dq with a load.

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

7 years ago[X86] Add AVX512 versions of VCVTPD2PS to load folding tables.
Craig Topper [Sat, 14 Oct 2017 05:55:43 +0000 (05:55 +0000)]
[X86] Add AVX512 versions of VCVTPD2PS to load folding tables.

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

7 years ago[X86] Add patterns for vzmovl+cvtpd2ps with a load.
Craig Topper [Sat, 14 Oct 2017 05:55:42 +0000 (05:55 +0000)]
[X86] Add patterns for vzmovl+cvtpd2ps with a load.

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

7 years ago[X86] Remove some patterns for bitcasted alignednonedtemporalloads.
Craig Topper [Sat, 14 Oct 2017 04:18:11 +0000 (04:18 +0000)]
[X86] Remove some patterns for bitcasted alignednonedtemporalloads.

These select the same instruction as the non-bitcasted pattern. So this provides no additional value.

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

7 years ago[X86] Remove unnecessary bitconverts as the root of patterns for zero extended VCVTPD...
Craig Topper [Sat, 14 Oct 2017 04:18:10 +0000 (04:18 +0000)]
[X86] Remove unnecessary bitconverts as the root of patterns for zero extended VCVTPD2UDQZ128rr and VCVTTPD2UDQZ128rr.

We don't need a bitconvert as a root pattern in these cases. The types in the other parts of the pattern are sufficient to express the behavior of these instructions.

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

7 years ago[X86] Add additional patterns for folding loads with 128-bit VCVTDQ2PD and VCVTUDQ2PD.
Craig Topper [Sat, 14 Oct 2017 04:18:09 +0000 (04:18 +0000)]
[X86] Add additional patterns for folding loads with 128-bit VCVTDQ2PD and VCVTUDQ2PD.

This matches the patterns we have for the SSE/AVX version.

This is a prerequisite for D38714.

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

7 years ago[X86] Add AVX512 flavors of VCVTDQ2PD plus VCVTUDQ2PD to the load folding tables.
Craig Topper [Sat, 14 Oct 2017 04:18:08 +0000 (04:18 +0000)]
[X86] Add AVX512 flavors of VCVTDQ2PD plus VCVTUDQ2PD to the load folding tables.

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

7 years ago[X86] Remove TB_NO_REVERSE from VCVTDQ2PDYrr and VCVTPS2PDYrr in the load folding...
Craig Topper [Sat, 14 Oct 2017 04:18:07 +0000 (04:18 +0000)]
[X86] Remove TB_NO_REVERSE from VCVTDQ2PDYrr and VCVTPS2PDYrr in the load folding tables.

I believe these were added incorrectly under the belief that the load size was smaller than the input register size, but that's not true.

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

7 years ago[X86] Add an additional isel pattern to CVTDQ2PDrm/VCVTDQ2PDrm to enable load folding...
Craig Topper [Sat, 14 Oct 2017 04:18:06 +0000 (04:18 +0000)]
[X86] Add an additional isel pattern to CVTDQ2PDrm/VCVTDQ2PDrm to enable load folding without the peephole pass.

This pattern is already used in AVX512VL version of these instructions. Though AVX512VL version is missing other patterns.

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

7 years agoRevert "lit.py: Add new %{shared_output(LABEL)} substitution"
Jordan Rose [Sat, 14 Oct 2017 04:01:27 +0000 (04:01 +0000)]
Revert "lit.py: Add new %{shared_output(LABEL)} substitution"

This reverts r315697 and my ill-fated attempts to fix it on Windows.
I'll try again when I get access to a Windows machine.

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

7 years agolit.py: Give up and disable the new shared-output.py test on Windows
Jordan Rose [Sat, 14 Oct 2017 03:33:46 +0000 (03:33 +0000)]
lit.py: Give up and disable the new shared-output.py test on Windows

"No such file or directory: C:\\...\\tests\\Output\\shared-output.py.tmp/Output/Shared/SHARED.tmp"

And yet other forward-slashes don't seem to be causing the same
problem. I'll see if I can get ahold of a Windows machine to poke at
this directly later.

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

7 years agoFix assembler for alloca of multiple elements in non-zero addr space
Yaxun Liu [Sat, 14 Oct 2017 03:23:18 +0000 (03:23 +0000)]
Fix assembler for alloca of multiple elements in non-zero addr space

Currently llvm assembler emits parsing error for valid IR assembly

alloca i32, i32 9, addrspace(5)
when alloca addr space is 5.

This patch fixes that.

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

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

7 years ago[Dominators] Remove the NCA check
Jakub Kuderski [Sat, 14 Oct 2017 03:00:56 +0000 (03:00 +0000)]
[Dominators] Remove the NCA check

Summary:
This patch removes the `verifyNCD` check.

The reason for this is that the other checks are sufficient to prove or disprove correctness of any DominatorTree, and that `verifyNCD` doesn't provide (in my option) better error messages then the other ones.
Additionally, this should give a (small) improvement to the total verification time, as the check is O(n), and checking the sibling property takes O(n^3).

Reviewers: dberlin, grosser, davide, brzycki

Reviewed By: brzycki

Subscribers: llvm-commits

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

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

7 years ago[llvm-cov] Factor out logic to iterate over line coverage stats (NFC)
Vedant Kumar [Sat, 14 Oct 2017 02:27:29 +0000 (02:27 +0000)]
[llvm-cov] Factor out logic to iterate over line coverage stats (NFC)

There were two copies of the logic needed to construct a line stats
object for each line in a range: this patch brings it down to one. In
the future, this will make it easier for IDE clients to display coverage
in-line in source editors. To do that, we just need to move the new
LineCoverageIterator class to libCoverage.

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

7 years ago[globalisel][tablegen] Fix an unused variable warning caused by a typo (corrected...
Daniel Sanders [Sat, 14 Oct 2017 01:51:46 +0000 (01:51 +0000)]
[globalisel][tablegen] Fix an unused variable warning caused by a typo (corrected OtherInsnID->OtherOpIdx).

The tests were passing by luck since the instruction ID and operand index happened to be the same.

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

7 years ago[globalisel][tablegen] Fix undefined references to dump()
Daniel Sanders [Sat, 14 Oct 2017 00:56:01 +0000 (00:56 +0000)]
[globalisel][tablegen] Fix undefined references to dump()

Two debugging statements snuck into the commit.

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

7 years agolit.py: Previous test fix was a red herring; backslashes are escapes
Jordan Rose [Sat, 14 Oct 2017 00:49:19 +0000 (00:49 +0000)]
lit.py: Previous test fix was a red herring; backslashes are escapes

I don't have access to a Windows machine at the moment, so if this
doesn't fix it I'll just revert for now.

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

7 years ago[AArch64][RegisterBankInfo] Use the statically computed mappings for COPY
Quentin Colombet [Sat, 14 Oct 2017 00:43:48 +0000 (00:43 +0000)]
[AArch64][RegisterBankInfo] Use the statically computed mappings for COPY

We use to resort on the generic implementation to get the mappings for
COPYs. The generic implementation resorts on table lookup and
dynamically allocated objects to get the valid mappings.

Given we already know how to map G_BITCAST and have the static mappings
for them, use that code path for COPY as well. This is much more
efficient.

Improve the compile time of RegBankSelect by up to 20%.

Note: When we eventually generate all the mappings via TableGen, we
wouldn't have to do that dance to shave compile time. The intent of this
change was to make sure that moving to static structure really pays off.

NFC.

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

7 years ago[globalisel][tablegen] Simplify named operand/operator lookups and fix a wrong-code...
Daniel Sanders [Sat, 14 Oct 2017 00:31:58 +0000 (00:31 +0000)]
[globalisel][tablegen] Simplify named operand/operator lookups and fix a wrong-code bug this revealed.

Summary:
Operand variable lookups are now performed by the RuleMatcher rather than
searching the whole matcher hierarchy for a match. This revealed a wrong-code
bug that currently affects ARM and X86 where patterns that use a variable more
than once in the match pattern will be imported but won't check that the
operands are identical. This can cause the tablegen-erated matcher to
accept matches that should be rejected.

Depends on D36569

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

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

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

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

7 years agolit.py: Fix new test harder for systems that don't use / as os.path.sep
Jordan Rose [Sat, 14 Oct 2017 00:26:48 +0000 (00:26 +0000)]
lit.py: Fix new test harder for systems that don't use / as os.path.sep

I didn't think about '%{inputs}' having the same problem. This one
should be a fully Windows path name.

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

7 years agolit.py: Fix new test for systems that don't use / as os.path.sep
Jordan Rose [Fri, 13 Oct 2017 22:46:40 +0000 (22:46 +0000)]
lit.py: Fix new test for systems that don't use / as os.path.sep

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

7 years agoRevert r315763: "[Hexagon] Rangify some loops, NFC"
Krzysztof Parzyszek [Fri, 13 Oct 2017 21:57:11 +0000 (21:57 +0000)]
Revert r315763: "[Hexagon] Rangify some loops, NFC"

Broke some builds (using libstdc++).

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

7 years ago[X86] Use X86ISD::VBROADCAST in place of v2f64 X86ISD::MOVDDUP when AVX2 is available
Craig Topper [Fri, 13 Oct 2017 21:56:48 +0000 (21:56 +0000)]
[X86] Use X86ISD::VBROADCAST in place of v2f64 X86ISD::MOVDDUP when AVX2 is available

This is particularly important for AVX512VL where we are better able to recognize the VBROADCAST loads to fold with other operations.

For AVX512VL we now use X86ISD::VBROADCAST for all of the patterns and remove the 128-bit X86ISD::VMOVDDUP.

We may be able to use this for AVX1 as well which would allow us to remove more isel patterns.

I also had to add X86ISD::VBROADCAST as a node to call combineShuffle for so that we treat it similar to X86ISD::MOVDDUP.

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

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

7 years ago[X86] Use fsub in the movddup scheduling tests to prevent a future patch from folding...
Craig Topper [Fri, 13 Oct 2017 21:56:45 +0000 (21:56 +0000)]
[X86] Use fsub in the movddup scheduling tests to prevent a future patch from folding movddup as a broadcast load.

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

7 years ago[globalisel][tablegen] Fix a use-after free bug that manifests on non-macOS machines.
Daniel Sanders [Fri, 13 Oct 2017 21:51:20 +0000 (21:51 +0000)]
[globalisel][tablegen] Fix a use-after free bug that manifests on non-macOS machines.

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

7 years ago[Hexagon] Rangify some loops, NFC
Krzysztof Parzyszek [Fri, 13 Oct 2017 21:43:00 +0000 (21:43 +0000)]
[Hexagon] Rangify some loops, NFC

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

7 years ago[InstCombine] use m_Neg() to reduce code; NFCI
Sanjay Patel [Fri, 13 Oct 2017 21:28:50 +0000 (21:28 +0000)]
[InstCombine] use m_Neg() to reduce code; NFCI

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

7 years ago[globalisel][tablegen] Add support for fpimm and import of APInt/APFloat based ImmLeaf.
Daniel Sanders [Fri, 13 Oct 2017 21:28:03 +0000 (21:28 +0000)]
[globalisel][tablegen] Add support for fpimm and import of APInt/APFloat based ImmLeaf.

Summary:
There's only a tablegen testcase for IntImmLeaf and not a CodeGen one
because the relevant rules are rejected for other reasons at the moment.
On AArch64, it's because there's an SDNodeXForm attached to the operand.
On X86, it's because the rule either emits multiple instructions or has
another predicate using PatFrag which cannot easily be supported at the
same time.

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

Reviewed By: qcolombet

Subscribers: aemerson, javed.absar, igorb, llvm-commits, kristof.beyls

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

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

7 years ago[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Fri, 13 Oct 2017 21:17:07 +0000 (21:17 +0000)]
[Transforms] 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@315760 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RegisterBankInfo] Cache the getMinimalPhysRegClass information
Quentin Colombet [Fri, 13 Oct 2017 21:16:15 +0000 (21:16 +0000)]
[RegisterBankInfo] Cache the getMinimalPhysRegClass information

TargetRegisterInfo::getMinimalPhysRegClass is actually pretty expensive
because it has to iterate over all the register classes.
Cache this information as we need and get it so that we limit its usage.
Right now, we heavily rely on it, because this is how we get the mapping
for vregs defined by copies from physreg (i.e., the one that are ABI
related).

Improve compile time by up to 10% for that pass.

NFC

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

7 years ago[Legalizer] Use SmallSetVector instead of SetVector.
Quentin Colombet [Fri, 13 Oct 2017 21:16:14 +0000 (21:16 +0000)]
[Legalizer] Use SmallSetVector instead of SetVector.

NFC

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

7 years ago[LegalizerInfo] Don't evaluate end boundary every time through the loop
Quentin Colombet [Fri, 13 Oct 2017 21:16:13 +0000 (21:16 +0000)]
[LegalizerInfo] Don't evaluate end boundary every time through the loop

Match the LLVM coding standard for loop conditions.

NFC.

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

7 years ago[Legalizer] Only allocate the SetVectors once per function.
Quentin Colombet [Fri, 13 Oct 2017 21:16:05 +0000 (21:16 +0000)]
[Legalizer] Only allocate the SetVectors once per function.

Prior to this patch we used to create SetVectors in temporaries that
were created and destroyed for each instruction. Now, instead we create
and destroyed them only once, but clear the content for each
instruction.
This speeds up the pass by ~25%.

NFC.

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

7 years agoAMDGPU: Implement hasBitPreservingFPLogic
Matt Arsenault [Fri, 13 Oct 2017 21:10:22 +0000 (21:10 +0000)]
AMDGPU: Implement hasBitPreservingFPLogic

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

7 years agoLowerTypeTests: Give imported symbols a type with size 0 so that they are not assumed...
Peter Collingbourne [Fri, 13 Oct 2017 21:02:16 +0000 (21:02 +0000)]
LowerTypeTests: Give imported symbols a type with size 0 so that they are not assumed not to alias.

It is possible for both a base and a derived class to be satisfied
with a unique vtable. If a program contains casts of the same pointer
to both of those types, the CFI checks will be lowered to this
(with ThinLTO):

if (p != &__typeid_base_global_addr)
  trap();
if (p != &__typeid_derived_global_addr)
  trap();

The optimizer may then use the first condition combined
with the assumption that __typeid_base_global_addr and
__typeid_derived_global_addr may not alias to optimize away the second
comparison, resulting in an unconditional trap.

This patch fixes the bug by giving imported globals the type [0 x i8]*,
which prevents the optimizer from assuming that they do not alias.

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

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

7 years ago[Reassociate] auto-generate better checks; NFC
Sanjay Patel [Fri, 13 Oct 2017 20:56:35 +0000 (20:56 +0000)]
[Reassociate] auto-generate better checks; NFC

These would fail if the created variable names changed.

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

7 years ago[Hexagon] Avoid unused variable warnings in release builds.
Benjamin Kramer [Fri, 13 Oct 2017 20:46:14 +0000 (20:46 +0000)]
[Hexagon] Avoid unused variable warnings in release builds.

No functionality change intended.

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

7 years agoAMDGPU: Look for src mods before fp_extend
Matt Arsenault [Fri, 13 Oct 2017 20:45:49 +0000 (20:45 +0000)]
AMDGPU: Look for src mods before fp_extend

When selecting modifiers for mad_mix instructions,
look at fneg/fabs that occur before the conversion.

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

7 years ago[aarch64] Support APInt and APFloat in ImmLeaf subclasses and make AArch64 use them.
Daniel Sanders [Fri, 13 Oct 2017 20:42:18 +0000 (20:42 +0000)]
[aarch64] Support APInt and APFloat in ImmLeaf subclasses and make AArch64 use them.

Summary:
The purpose of this patch is to expose more information about ImmLeaf-like
PatLeaf's so that GlobalISel can learn to import them. Previously, ImmLeaf
could only be used to test int64_t's produced by sign-extending an APInt.
Other tests on immediates had to use the generic PatLeaf and extract the
constant using C++.

With this patch, tablegen will know how to generate predicates for APInt,
and APFloat. This will allow it to 'do the right thing' for both SelectionDAG
and GlobalISel which require different methods of extracting the immediate
from the IR.

This is NFC for SelectionDAG since the new code is equivalent to the
previous code. It's also NFC for FastISel because FastIselShouldIgnore is 1
for the ImmLeaf subclasses. Enabling FastIselShouldIgnore == 0 for these new
subclasses will require a significant re-factor of FastISel.

For GlobalISel, it's currently NFC because the relevant code to import the
affected rules is not yet present. This will be added in a later patch.

Depends on D36086

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

Reviewed By: qcolombet

Subscribers: bjope, aemerson, rengolin, javed.absar, igorb, llvm-commits, kristof.beyls

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

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

7 years ago[SmallPtrSet] Add iterator epoch tracking.
Benjamin Kramer [Fri, 13 Oct 2017 20:37:52 +0000 (20:37 +0000)]
[SmallPtrSet] Add iterator epoch tracking.

This will detect invalid iterators when ABI breaking checks are enabled.

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

7 years ago[InstCombine] move code to remove repeated constant check; NFCI
Sanjay Patel [Fri, 13 Oct 2017 20:29:11 +0000 (20:29 +0000)]
[InstCombine] move code to remove repeated constant check; NFCI

Also, consolidate tests for this fold in one place.

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

7 years agoAMDGPU: Implement isFPExtFoldable
Matt Arsenault [Fri, 13 Oct 2017 20:18:59 +0000 (20:18 +0000)]
AMDGPU: Implement isFPExtFoldable

This helps match v_mad_mix* in some cases.

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

7 years ago[InstCombine] recycle adds for better efficiency
Sanjay Patel [Fri, 13 Oct 2017 20:12:21 +0000 (20:12 +0000)]
[InstCombine] recycle adds for better efficiency

Also, clean up unnecessary matcher capture variable initializations.

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

7 years agoDAG: Add opcode and source type to isFPExtFree
Matt Arsenault [Fri, 13 Oct 2017 19:55:45 +0000 (19:55 +0000)]
DAG: Add opcode and source type to isFPExtFree

This is only currently used for mad/fma transforms.
This is the only case where it should be used for AMDGPU,
so add an opcode to be sure.

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

7 years ago[Hexagon] Minimize number of repeated constant extenders
Krzysztof Parzyszek [Fri, 13 Oct 2017 19:02:59 +0000 (19:02 +0000)]
[Hexagon] Minimize number of repeated constant extenders

Each constant extender requires an extra instruction, which adds to the
code size and also reduces the number of available slots in an instruction
packet. In most cases, the value of a repeated constant extender could be
loaded into a register, and the instructions using the extender could be
replaced with their counterparts that use that register instead.

This patch adds a pass that tries to reduce the number of constant
extenders, including extenders which differ only in an immediate offset
known at compile time, e.g. @global and @global+12.

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

7 years agoRevert r315148 [TableGen] Avoid unnecessary std::string creations
Daniel Sanders [Fri, 13 Oct 2017 19:00:01 +0000 (19:00 +0000)]
Revert r315148 [TableGen] Avoid unnecessary std::string creations

I'm about to commit a patch that makes them necessary for getPredCode() and
it would be strange for getPredCode() and getImmCode() to require different
usage.

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