OSDN Git Service

android-x86/external-llvm.git
6 years ago[Hexagon] Handle truncates in polynomial multiply idiom recognition
Krzysztof Parzyszek [Tue, 30 Jan 2018 22:03:59 +0000 (22:03 +0000)]
[Hexagon] Handle truncates in polynomial multiply idiom recognition

This is in anticipation of https://reviews.llvm.org/D42424, which would
otherwise break one of the pmpy testcases.

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

6 years ago[X86] Remove redundant check for hasAVX512 before calling hasBWI. NFC
Craig Topper [Tue, 30 Jan 2018 21:53:35 +0000 (21:53 +0000)]
[X86] Remove redundant check for hasAVX512 before calling hasBWI. NFC

hasBWI implies hasAVX512.

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

6 years agoTurn two static functions into methods, to simplify calling them.
Paul Robinson [Tue, 30 Jan 2018 21:39:28 +0000 (21:39 +0000)]
Turn two static functions into methods, to simplify calling them.

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

6 years ago[LLVM-C] Add Accessors For A Module's Source File Name
Robert Widmann [Tue, 30 Jan 2018 21:34:29 +0000 (21:34 +0000)]
[LLVM-C] Add Accessors For A Module's Source File Name

Summary: Also unblocks some cleanup in the echo-test.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: harlanhaskins, llvm-commits

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

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

6 years ago[ThinLTO/gold] Write empty imports even for modules with symbols
Vitaly Buka [Tue, 30 Jan 2018 21:19:26 +0000 (21:19 +0000)]
[ThinLTO/gold] Write empty imports even for modules with symbols

Summary: ThinLTO may skip object for other reasons, e.g. if there is no summary.

Reviewers: pcc, eugenis

Subscribers: mehdi_amini, inglorion, eraman, llvm-commits

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

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

6 years ago[AArch64] Expand testing of zero cycle zeroing
Evandro Menezes [Tue, 30 Jan 2018 21:14:11 +0000 (21:14 +0000)]
[AArch64] Expand testing of zero cycle zeroing

Make sure that r321824 doesn't change zeroing.

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

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

6 years ago[SLP] Add extra test for extractelement shuffle, NFC.
Alexey Bataev [Tue, 30 Jan 2018 21:06:06 +0000 (21:06 +0000)]
[SLP] Add extra test for extractelement shuffle, NFC.

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

6 years agoTeach ValueMapper to use ODR uniqued types when available
Teresa Johnson [Tue, 30 Jan 2018 20:16:32 +0000 (20:16 +0000)]
Teach ValueMapper to use ODR uniqued types when available

Summary:
This is exposed during ThinLTO compilation, when we import an alias by
creating a clone of the aliasee. Without this fix the debug type is
unnecessarily cloned and we get a duplicate, undoing the uniquing.

Fixes PR36089.

Reviewers: mehdi_amini, pcc

Subscribers: eraman, JDevlieghere, llvm-commits

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

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

6 years ago[dsymutil] Enable -minimize feature.
Jonas Devlieghere [Tue, 30 Jan 2018 19:54:16 +0000 (19:54 +0000)]
[dsymutil] Enable -minimize feature.

Passing -minimize to dsymutil prevents the emission of .debug_inlines,
.debug_pubnames, and .debug_pubtypes in favor of the Apple accelerator
tables.

The actual check in the DWARF linker was added in r323655. This patch
simply enables it.

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

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

6 years ago[GlobalISel] Bail out on calls to dllimported functions
Martin Storsjo [Tue, 30 Jan 2018 19:50:58 +0000 (19:50 +0000)]
[GlobalISel] Bail out on calls to dllimported functions

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

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

6 years ago[AArch64] Properly handle dllimport of variables when using fast-isel
Martin Storsjo [Tue, 30 Jan 2018 19:50:51 +0000 (19:50 +0000)]
[AArch64] Properly handle dllimport of variables when using fast-isel

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

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

6 years ago[TableGen] Make sure !if is evaluated throughout class inheritance.
Artem Belevich [Tue, 30 Jan 2018 19:29:21 +0000 (19:29 +0000)]
[TableGen] Make sure !if is evaluated throughout class inheritance.

Without the patch !if() is only evaluated if it's used directly.
If it's passed through more than one level of class inheritance,
we end up with a reference to an anonymous record with unresolved
references to the original arguments !if may have used.

The root cause of the problem is that TernOpInit::isComplete()
was always returning false and that prevented use of the folded
value of !if() as an initializer for the record at the next level
of inheritance.

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

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

6 years ago[LoopStrengthReduce] add test to show potential macro-fusion-based diff (PR35681...
Sanjay Patel [Tue, 30 Jan 2018 19:17:38 +0000 (19:17 +0000)]
[LoopStrengthReduce] add test to show potential macro-fusion-based diff (PR35681); NFC

This is the baseline output for the test proposed with D42607.

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

6 years ago[DWARF] Recommitting a test that was removed with r323564. Restricted to x86 linux...
Wolfgang Pieb [Tue, 30 Jan 2018 18:41:31 +0000 (18:41 +0000)]
[DWARF] Recommitting a test that was removed with r323564. Restricted to x86 linux target.

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

6 years ago[XRay] fix 99th percentile lookups by sorting the array correctly
Martin Pelikan [Tue, 30 Jan 2018 18:18:51 +0000 (18:18 +0000)]
[XRay] fix 99th percentile lookups by sorting the array correctly

Summary:
It was a copy-paste typo, sorting only to the 90th percentile twice.
Now, it only sorts the array prefix once, and extracts what we need.

Reviewers: dberris, kpw, eizan

Subscribers: llvm-commits

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

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

6 years ago[Hexagon] Handle non-aligned offsets in globals in extender optimization
Krzysztof Parzyszek [Tue, 30 Jan 2018 18:12:37 +0000 (18:12 +0000)]
[Hexagon] Handle non-aligned offsets in globals in extender optimization

Instructions like memd(r0+##global+1) are legal as long as the entire
address is properly aligned. Assuming that "global" is aligned at an
8-byte boundary, the expression "global+1" appears to be misaligned.
Handle such cases in HexagonConstExtenders, and make sure that any non-
extended offsets generated are still aligned accordingly.

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

6 years agoRevert: [Hexagon] Make sure that offset on globals matches alignment requirements
Krzysztof Parzyszek [Tue, 30 Jan 2018 18:10:27 +0000 (18:10 +0000)]
Revert: [Hexagon] Make sure that offset on globals matches alignment requirements

This reverts r323562, since it wasn't actually necessary. Constant-
extended offsets do not need to be aligned, as long as the effective
address is aligned.

Keep the testcase, with a modification which checks that such offsets
are not unnecessarily avoided.

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

6 years ago[X86][XOP] Update isVectorShiftByScalarCheap with cases covered by XOP
Simon Pilgrim [Tue, 30 Jan 2018 18:10:21 +0000 (18:10 +0000)]
[X86][XOP] Update isVectorShiftByScalarCheap with cases covered by XOP

Similar to D42437, XOP supports variable shift for v16i8/v8i16/v4i32/v2i64 types.

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

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

6 years ago[AMDGPU] isRenamable fixes to support copy forwarding
Geoff Berry [Tue, 30 Jan 2018 17:37:39 +0000 (17:37 +0000)]
[AMDGPU] isRenamable fixes to support copy forwarding

Mark more opcodes as hasExtraSrcRegAllocReq so that their operands will
be marked as not renamable, to avoid copy forwarding violating the
constraint that only one operand may use the constant bus.

These changes fix a few mis-compiles when copy forwarding is enabled in
MachineCopyPropagation by D41835 (and were reviewed as part of that change).

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

6 years ago[AMDGPU] Revert "[AMDGPU] Add options for waitcnt pass debugging; add instr count...
Mark Searles [Tue, 30 Jan 2018 17:17:06 +0000 (17:17 +0000)]
[AMDGPU] Revert "[AMDGPU] Add options for waitcnt pass debugging; add instr count in debug output."

Patch caused a buildbot failure; arg; http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/17373/s\
teps/build_Lld/logs/stdio :
        /Users/buildslave/as-bldslv9/lld-x86_64-darwin13/llvm.src/lib/Target/AMDGPU/SIInsertWaitcnts.cpp:1563:18: error: unused variable 'InstCnt' [-Werror,-Wunused-variable]
          static int32_t InstCnt = 0;
                                              "
This reverts commit 4f4a7d61e306b67044d9f16bc2016fee806bc2cc.

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

6 years ago[CodeView] Micro-optimizations to speed up type merging.
Zachary Turner [Tue, 30 Jan 2018 17:12:04 +0000 (17:12 +0000)]
[CodeView] Micro-optimizations to speed up type merging.

Based on a profile, a couple of hot spots were identified in the
main type merging loop.  The code was simplified, a few loops
were re-arranged, and some outlined functions were inlined.  This
speeds up type merging by a decent amount, shaving around 3-4 seconds
off of a 40 second link in my test case.

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

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

6 years ago[AMDGPU] Add options for waitcnt pass debugging; add instr count in debug output.
Mark Searles [Tue, 30 Jan 2018 16:49:38 +0000 (16:49 +0000)]
[AMDGPU] Add options for waitcnt pass debugging; add instr count in debug output.
-amdgpu-waitcnt-forcezero={1|0}  Force all waitcnt instrs to be emitted as s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
-amdgpu-waitcnt-forceexp=<n>  Force emit a s_waitcnt expcnt(0) before the first <n> instrs
-amdgpu-waitcnt-forcelgkm=<n> Force emit a s_waitcnt lgkmcnt(0) before the first <n> instrs
-amdgpu-waitcnt-forcevm=<n>   Force emit a s_waitcnt vmcnt(0) before the first <n> instrs

This patch was pushed ( abb190fd51cd2f9a9eef08c024e109f7f7e909fc ), which caused a buildbot failure, reverted ( 6227480d74da507cf8e1b4bcaffbdb9fb875b4b8 ), and then updated to fix buildbot failures (this patch).

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

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

6 years agoAMDGPU/SI: Add decoding in the GFX80_UNPACKED decoding namespace.
Changpeng Fang [Tue, 30 Jan 2018 16:42:40 +0000 (16:42 +0000)]
AMDGPU/SI: Add decoding in the GFX80_UNPACKED decoding namespace.

Reviewer:
  Dmitry (dp).

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

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

6 years ago[DeadArgumentElimination] Preserve llvm.dbg.values's first argument
Petar Jovanovic [Tue, 30 Jan 2018 16:42:04 +0000 (16:42 +0000)]
[DeadArgumentElimination] Preserve llvm.dbg.values's first argument

When removing return value Dead Argument Elimination pass clobbers first
llvm.dbg.value’s argument for live arguments of that function by replacing
it with nullptr. In the next pass it will be deleted, so debug location
about those arguments are lost. This change fixes it.

Patch by Djordje Todorovic.

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

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

6 years agoCodeGen: support an extension to pass linker options on ELF
Saleem Abdulrasool [Tue, 30 Jan 2018 16:29:29 +0000 (16:29 +0000)]
CodeGen: support an extension to pass linker options on ELF

Introduce an extension to support passing linker options to the linker.
These would be ignored by older linkers, but newer linkers which support
this feature would be able to process the linker.

Emit a special discarded section `.linker-option`.  The content of this
section is a pair of strings (key, value).  The key is a type identifier for
the parameter.  This allows for an argument free parameter that will be
processed by the linker with the value being the parameter.  As an example,
`lib` identifies a library to be linked against, traditionally the `-l`
argument for Unix-based linkers with the parameter being the library name.

Thanks to James Henderson, Cary Coutant, Rafael Espinolda, Sean Silva
for the valuable discussion on the design of this feature.

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

6 years ago[AArch64] Add new target feature to fuse address generation with load or store
Evandro Menezes [Tue, 30 Jan 2018 16:28:01 +0000 (16:28 +0000)]
[AArch64] Add new target feature to fuse address generation with load or store

This feature enables the fusion of the address generation and a
corresponding load or store together.

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

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

6 years ago[mips] Fix incorrect sign extension for fpowi libcall
Simon Dardis [Tue, 30 Jan 2018 16:24:10 +0000 (16:24 +0000)]
[mips] Fix incorrect sign extension for fpowi libcall

PR36061 showed that during the expansion of ISD::FPOWI, that there
was an incorrect zero extension of the integer argument which for
MIPS64 would then give incorrect results. Address this with the
existing mechanism for correcting sign extensions.

This resolves PR36061.

Thanks to James Cowgill for reporting the issue!

Reviewers: atanasyan, hfinkel

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

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

6 years agoRe-commit : [PowerPC] Add handling for ColdCC calling convention and a pass to mark
Zaara Syeda [Tue, 30 Jan 2018 16:17:22 +0000 (16:17 +0000)]
Re-commit : [PowerPC] Add handling for ColdCC calling convention and a pass to mark
candidates with coldcc attribute.

This recommits r322721 reverted due to sanitizer memory leak build bot failures.

Original commit message:
This patch adds support for the coldcc calling convention for Power.
This changes the set of non-volatile registers. It includes a pass to stress
test the implementation by marking all static directly called functions with
the coldcc attribute through the option -enable-coldcc-stress-test. It also
includes an option, -ppc-enable-coldcc, to add the coldcc attribute to
functions which are cold at all call sites based on BlockFrequencyInfo when
the containing function does not call any non cold functions.

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

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

6 years agoAdd more initializers to quiet a clang warning
Daniel Sanders [Tue, 30 Jan 2018 16:02:32 +0000 (16:02 +0000)]
Add more initializers to quiet a clang warning

Summary:
`struct crashreporter_annotations_t` gained one more `uint64_t` field in
`CRASHREPORTER_ANNOTATIONS_VERSION` 5

causing an annoying clang warning:

```
llvm/lib/Support/PrettyStackTrace.cpp:92:65: warning: missing field 'abort_cause' initializer [-Wmissing-field-initializers]
        = { CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0, 0, 0 };
                                                                ^
1 warning generated
```

Let's fix it.

Patch by Roman Tereshin

Reviewers: qcolombet, echristo, beanz, dexonsmith

Reviewed By: echristo

Subscribers: dsanders, dexonsmith, beanz, echristo, qcolombet, llvm-commits

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

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

6 years ago[X86][AVX512] Add VBMI target shuffle-trunc tests
Simon Pilgrim [Tue, 30 Jan 2018 16:01:41 +0000 (16:01 +0000)]
[X86][AVX512] Add VBMI target shuffle-trunc tests

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

6 years ago[AArch64] Update test cases for Exynos M3
Evandro Menezes [Tue, 30 Jan 2018 15:40:27 +0000 (15:40 +0000)]
[AArch64] Update test cases for Exynos M3

Update any test case relevant for Exynos M3.

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

6 years ago[AArch64] Add new target feature to handle cheap as move for Exynos
Evandro Menezes [Tue, 30 Jan 2018 15:40:22 +0000 (15:40 +0000)]
[AArch64] Add new target feature to handle cheap as move for Exynos

This feature enables special handling of cheap as move in the existing
custom handling specifically for Exynos processors.

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

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

6 years ago[AArch64] Add pipeline model for Exynos M3
Evandro Menezes [Tue, 30 Jan 2018 15:40:16 +0000 (15:40 +0000)]
[AArch64] Add pipeline model for Exynos M3

Add the scheduling and cost model for Exynos M3.

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

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

6 years ago[RS4GC] Handle call/invoke instructions as base defining values of vectors
Daniel Neilson [Tue, 30 Jan 2018 14:43:41 +0000 (14:43 +0000)]
[RS4GC] Handle call/invoke instructions as base defining values of vectors

Summary:
 There's an asymmetry in the definitions of findBaseDefiningValueOfVector() and
findBaseDefiningValue() of RS4GC. The later handles call and invoke instructions,
and the former does not. This appears to be simple oversight. This patch remedies
the oversight by adding the call and invoke cases to findBaseDefiningValueOfVector().

Reviewers: DaniilSuchkov, anna

Reviewed By: anna

Subscribers: llvm-commits

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

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

6 years ago[X86FixupBWInsts] mir-simplify fixup-bw-inst.mir test. NFC.
Andrei Elovikov [Tue, 30 Jan 2018 14:25:12 +0000 (14:25 +0000)]
[X86FixupBWInsts] mir-simplify fixup-bw-inst.mir test. NFC.

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

6 years agoRevert "[X86] Avoid using high register trick for test instruction"
Eric Liu [Tue, 30 Jan 2018 14:18:33 +0000 (14:18 +0000)]
Revert "[X86] Avoid using high register trick for test instruction"

This reverts commit r323690. This causes crash in llc. See the original commit thread for details.

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

6 years ago[X86] Add test case for PR32690
Simon Pilgrim [Tue, 30 Jan 2018 14:15:51 +0000 (14:15 +0000)]
[X86] Add test case for PR32690

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

6 years ago[DSE] make sure memory is not modified before partial store merging (PR36129)
Sanjay Patel [Tue, 30 Jan 2018 13:53:59 +0000 (13:53 +0000)]
[DSE] make sure memory is not modified before partial store merging (PR36129)

We missed a critical check in D30703. We must make sure that no intermediate
store is sitting between the stores that we want to merge.

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

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

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

6 years ago[XRay] clarify error messages when parsing broken traces
Martin Pelikan [Tue, 30 Jan 2018 13:41:34 +0000 (13:41 +0000)]
[XRay] clarify error messages when parsing broken traces

Summary:
When there's a mismatch of a function argument being right after the
wrong function, print an offset into the file where that happened, to
ease further debugging.

Reviewers: dberris, eizan, kpw

Subscribers: llvm-commits

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

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

6 years ago[AccelTable] Move print methods to implementation. NFC
Jonas Devlieghere [Tue, 30 Jan 2018 13:36:30 +0000 (13:36 +0000)]
[AccelTable] Move print methods to implementation. NFC

This patch moves the implementation of the print methods from the header
to the cpp file.

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

6 years agoTest commit.
Brock Wyma [Tue, 30 Jan 2018 13:16:50 +0000 (13:16 +0000)]
Test commit.
As per the LLVM Developer Policy under "Obtainiing Commit Access".

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

6 years agoSpelling mistake in comment. NFCI.
Simon Pilgrim [Tue, 30 Jan 2018 12:18:51 +0000 (12:18 +0000)]
Spelling mistake in comment. NFCI.

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

6 years agoChange simple-register-allocation-read-undef.mir so that it doesn't fail if the file...
Amaury Sechet [Tue, 30 Jan 2018 11:07:36 +0000 (11:07 +0000)]
Change simple-register-allocation-read-undef.mir so that it doesn't fail if the file path contains 'dead' . NFC

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

6 years ago[ARM GlobalISel] Add inst selector tests for G_SITOFP and G_UITOFP
Diana Picus [Tue, 30 Jan 2018 09:15:27 +0000 (09:15 +0000)]
[ARM GlobalISel] Add inst selector tests for G_SITOFP and G_UITOFP

These are handled by the TableGen'erated code.

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

6 years ago[ARM GlobalISel] Map G_SITOFP and G_UITOFP
Diana Picus [Tue, 30 Jan 2018 09:15:23 +0000 (09:15 +0000)]
[ARM GlobalISel] Map G_SITOFP and G_UITOFP

Straightforward mapping (integer operand to GPR, floating point operand
to FPR).

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

6 years ago[ARM GlobalISel] Legalize G_SITOFP and G_UITOFP
Diana Picus [Tue, 30 Jan 2018 09:15:17 +0000 (09:15 +0000)]
[ARM GlobalISel] Legalize G_SITOFP and G_UITOFP

Legal if we have hardware support, libcall otherwise.

Also add supporting code to the legalizer helper for libcalls.

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

6 years ago[ARM GlobalISel] Add inst selector tests for G_FPTOSI and G_FPTOUI
Diana Picus [Tue, 30 Jan 2018 07:55:02 +0000 (07:55 +0000)]
[ARM GlobalISel] Add inst selector tests for G_FPTOSI and G_FPTOUI

The work is done by the TableGen'erated code.

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

6 years ago[ARM GlobalISel] Map G_FPTOSI and G_FPTOUI
Diana Picus [Tue, 30 Jan 2018 07:54:58 +0000 (07:54 +0000)]
[ARM GlobalISel] Map G_FPTOSI and G_FPTOUI

Straightforward mapping (integer operand goes to GPR, floating point
operand goes to FPR).

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

6 years ago[ARM GlobalISel] Legalize G_FPTOSI and G_FPTOUI
Diana Picus [Tue, 30 Jan 2018 07:54:52 +0000 (07:54 +0000)]
[ARM GlobalISel] Legalize G_FPTOSI and G_FPTOUI

Legal if we have hardware support for floating point, libcalls
otherwise.

Also add the necessary support for libcalls in the legalizer helper.

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

6 years ago[X86] Auto-generate complete checks. NFC
Craig Topper [Tue, 30 Jan 2018 07:02:29 +0000 (07:02 +0000)]
[X86] Auto-generate complete checks. NFC

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

6 years ago[DWARF] Corrected test committed in r323670 to use llc instead of llc_dwarf to avoid...
Wolfgang Pieb [Tue, 30 Jan 2018 01:11:46 +0000 (01:11 +0000)]
[DWARF] Corrected test committed in r323670 to use llc instead of llc_dwarf to avoid multiple triples.

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

6 years ago[utils] De-duplicate utils/update_{llc_,}test_checks.py
Fangrui Song [Tue, 30 Jan 2018 00:40:05 +0000 (00:40 +0000)]
[utils] De-duplicate utils/update_{llc_,}test_checks.py

Subscribers: llvm-commits

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

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

6 years ago[InstSimplify] (X * Y) / Y --> X for relaxed floating-point ops
Sanjay Patel [Tue, 30 Jan 2018 00:18:37 +0000 (00:18 +0000)]
[InstSimplify] (X * Y) / Y --> X for relaxed floating-point ops

This is the FP counterpart that was mentioned in PR35709:
https://bugs.llvm.org/show_bug.cgi?id=35709

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

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

6 years ago[SelectionDAG]: Ignore "returned" in the presence of an implicit sret.
Dan Gohman [Tue, 30 Jan 2018 00:14:40 +0000 (00:14 +0000)]
[SelectionDAG]: Ignore "returned" in the presence of an implicit sret.

When a function return value can't be directly lowered, such as
returning an i128 on WebAssembly, as indicated by the CanLowerReturn
target hook, SelectionDAGBuilder can translate it to return the
value through a hidden sret-like argument.

If such a function has an argument with the "returned" attribute,
the attribute can't be automatically lowered, because the function
no longer has a normal return value. For now, just discard the
"returned" attribute.

This fixes PR36128.

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

6 years ago[globalisel][legalizer] Fix a fallthrough case in the unittests debug printing
Daniel Sanders [Mon, 29 Jan 2018 23:47:41 +0000 (23:47 +0000)]
[globalisel][legalizer] Fix a fallthrough case in the unittests debug printing

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

6 years ago[RAFast] Don't dereference MBB::end
Quentin Colombet [Mon, 29 Jan 2018 23:42:37 +0000 (23:42 +0000)]
[RAFast] Don't dereference MBB::end

When RAFast sees liveins in on a basic block, it uses that information
to initialize the availability of the registers. The called
method uses an instruction as one of its argument and in the liveins
case, RAFast was dereferencing MBB::begin which can be MBB::end for
empty basic block.

Change the API of definePhysReg to use MachineBasicBlock::iterator
instead of MachineInstr so that we don't dereference an
invalid iterator while making the call.

rdar://problem/36952401

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

6 years agoAMDGPU: Move ADDRIndirect complex pattern into R600Instructions.td
Tom Stellard [Mon, 29 Jan 2018 23:29:26 +0000 (23:29 +0000)]
AMDGPU: Move ADDRIndirect complex pattern into R600Instructions.td

Summary: This is only used by R600.

Reviewers: arsenm

Reviewed By: arsenm

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

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

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

6 years ago[X86] Use VMOVDQA64 for aligned vXi32 stores.
Craig Topper [Mon, 29 Jan 2018 23:27:23 +0000 (23:27 +0000)]
[X86] Use VMOVDQA64 for aligned vXi32 stores.

I meant to do this with the unaligned stores in r322820, but looks like I missed it.

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

6 years agoAMDGPU: Allow a SGPR for the conditional KILL operand
Marek Olsak [Mon, 29 Jan 2018 23:19:10 +0000 (23:19 +0000)]
AMDGPU: Allow a SGPR for the conditional KILL operand

Patch by: Bas Nieuwenhuizen

Just use the _e64 variant if needed. This should be possible as per

def : Pat <
  (int_amdgcn_kill (i1 (setcc f32:$src, InlineFPImm<f32>:$imm, cond:$cond))),
  (SI_KILL_F32_COND_IMM_PSEUDO $src, (bitcast_fpimm_to_i32 $imm), (cond_as_i32imm $cond))
> ;

I don't think we can get an immediate for the other operand for which we
need the second 32-bit word.

https://reviews.llvm.org/D42302

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

6 years agoFix some regular expressions in llvm-mode.el.
Rafael Espindola [Mon, 29 Jan 2018 22:56:41 +0000 (22:56 +0000)]
Fix some regular expressions in llvm-mode.el.

In some cases it was using "\" unnecessarily.  In another case it
needed an additional "\" to properly indicate a numbered sub-match.

Make comment-start buffer-local in llvm-mode.el

llvm-mode was setting comment-start globally.  However, it is better
to only set it locally in the current buffer.

Don't use purecopy in llvm-mode.el

There's no reason to use purecopy in llvm-mode.el.
purecopy is only needed for files that are dumped in emacs.

Add a version header to llvm-mode.el

Adding a version header to llvm-mode.el allows it to be installed by
the Emacs package manager.  There are not many requirements on the
version number; however it is useful to users to bump it when
something significant changes.  Here I've chosen just to start at 1.0.

Patch by Tom Tromey!

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

6 years ago[DSE] add test for PR36129; NFC
Sanjay Patel [Mon, 29 Jan 2018 22:50:08 +0000 (22:50 +0000)]
[DSE] add test for PR36129; NFC

We can miscompile because we're not checking is the memory might
me modified between the seemingly redundant store ops.

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

6 years agoLiveInterval: Print weight in print() function.
Matthias Braun [Mon, 29 Jan 2018 22:03:00 +0000 (22:03 +0000)]
LiveInterval: Print weight in print() function.

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

6 years agoStop tracking .debug_line_str in DWARFUnit. NFC.
Paul Robinson [Mon, 29 Jan 2018 22:02:56 +0000 (22:02 +0000)]
Stop tracking .debug_line_str in DWARFUnit. NFC.

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

6 years ago[X86] Add FeaturePOPCNTFalseDeps to skylake server CPU to match skylake client.
Craig Topper [Mon, 29 Jan 2018 21:56:48 +0000 (21:56 +0000)]
[X86] Add FeaturePOPCNTFalseDeps to skylake server CPU to match skylake client.

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

6 years ago[JumpThreading][NFC] Rename LoadInst variables
Brian M. Rzycki [Mon, 29 Jan 2018 21:29:44 +0000 (21:29 +0000)]
[JumpThreading][NFC] Rename LoadInst variables

Summary:
The JumpThreading pass has several locations where to the variable name LI
refers to a LoadInst type. This is confusing and inhibits the ability to use
LI for LoopInfo as a member of the JumpThreading class. Minor formatting
and comments were also altered to reflect this change.

Reviewers: dberlin, kuba, spop, sebpop

Reviewed by: sebpop

Subscribers: sebpop, hiraditya, llvm-commits

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

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

6 years ago[X86] Emit 11-byte or 15-byte NOPs on recent AMD targets, else default to 10-byte...
Simon Pilgrim [Mon, 29 Jan 2018 21:24:31 +0000 (21:24 +0000)]
[X86] Emit 11-byte or 15-byte NOPs on recent AMD targets, else default to 10-byte NOPs (PR22965)

We currently emit up to 15-byte NOPs on all targets (apart from Silvermont), which stalls performance on some targets with decoders that struggle with 2 or 3 more '66' prefixes.

This patch flags recent AMD targets (btver1/znver1) to still emit 15-byte NOPs and bdver* targets to emit 11-byte NOPs. All other targets now emit 10-byte NOPs apart from SilverMont CPUs which still emit 7-byte NOPS.

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

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

6 years ago[ARM][GISel] PR35965 Constrain RegClasses of nested instructions built from Dst Pattern
Daniel Sanders [Mon, 29 Jan 2018 21:09:12 +0000 (21:09 +0000)]
[ARM][GISel] PR35965 Constrain RegClasses of nested instructions built from Dst Pattern

Summary:
Apparently, we missed on constraining register classes of VReg-operands of all the instructions
built from a destination pattern but the root (top-level) one. The issue exposed itself
while selecting G_FPTOSI for armv7: the corresponding pattern generates VTOSIZS wrapped
into COPY_TO_REGCLASS, so top-level COPY_TO_REGCLASS gets properly constrained,
while nested VTOSIZS (or rather its destination virtual register to be exact) does not.

Fixing this by issuing GIR_ConstrainSelectedInstOperands for every nested GIR_BuildMI.

https://bugs.llvm.org/show_bug.cgi?id=35965
rdar://problem/36886530

Patch by Roman Tereshin

Reviewers: dsanders, qcolombet, rovka, bogner, aditya_nandakumar, volkan

Reviewed By: dsanders, qcolombet, rovka

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

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

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

6 years ago[DWARFv5] Re-enable dumping a line table with no CU.
Paul Robinson [Mon, 29 Jan 2018 20:57:43 +0000 (20:57 +0000)]
[DWARFv5] Re-enable dumping a line table with no CU.

r323476 added support for DW_FORM_line_strp, and incorrectly made that
depend on having a DWARFUnit available.  We shouldn't be tracking
.debug_line_str in DWARFUnit after all.  After this patch, I can do an
NFC follow up and undo a bunch of the "plumbing" part of r323476.

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

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

6 years ago[X86] Avoid using high register trick for test instruction
Amaury Sechet [Mon, 29 Jan 2018 20:54:33 +0000 (20:54 +0000)]
[X86] Avoid using high register trick for test instruction

Summary:
It seems it's main effect is to create addition copies when values are inr register that do not support this trick, which increase register pressure and makes the code bigger.

The main noteworthy regression I was able to observe was pattern of the type (setcc (trunc (and X, C)), 0) where C is such as it would benefit from the hi register trick. To prevent this, a new pattern is added to materialize such pattern using a 32 bits test. This has the added benefit of working with any constant that is materializable as a 32bits immediate, not just the ones that can leverage the high register trick, as demonstrated by the test case in test-shrink.ll using the constant 2049 .

Reviewers: craig.topper, niravd, spatel, hfinkel

Subscribers: llvm-commits

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

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

6 years ago[globalisel][legalizer] Change identity() to changeTo() to clarify that it changes...
Daniel Sanders [Mon, 29 Jan 2018 20:46:16 +0000 (20:46 +0000)]
[globalisel][legalizer] Change identity() to changeTo() to clarify that it changes things. NFC

Prior to committing r323681, we decided to change pick() to identity() since
it wasn't clear from the name what pick() did. However, identity() isn't a very
good name either since it implies that no changes are made. For some reason,
naming it changeTo() didn't occur to me until just after the commit. This
should resolve the lack of clarity that pick() had while still implying that
it changes the MIR.

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

6 years ago[CodeGen] Simplify conditional. NFC
Shoaib Meenai [Mon, 29 Jan 2018 20:28:04 +0000 (20:28 +0000)]
[CodeGen] Simplify conditional. NFC

Rafael pointed out that `hasInternalLinkage() || hasPrivateLinkage()` is
equivalent to `hasLocalLinkage()` in post-commit review.

I'm intentionally not updating the comment, partly because I like it
being explicit, and partly because "global symbols with local linkage"
sounds like an oxymoron.

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

6 years ago[X86] Add test case to ensure testw is generated when optimizing for size. NFC
Amaury Sechet [Mon, 29 Jan 2018 20:22:46 +0000 (20:22 +0000)]
[X86] Add test case to ensure testw is generated when optimizing for size. NFC

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

6 years ago[AArch64] Change the filename of the Exynos M1 scheduling defs
Evandro Menezes [Mon, 29 Jan 2018 20:22:24 +0000 (20:22 +0000)]
[AArch64] Change the filename of the Exynos M1 scheduling defs

After request by Matthias Braun in https://reviews.llvm.org/D42387.

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

6 years agoRevert "AArch64: Omit callframe setup/destroy when not necessary"
Jun Bum Lim [Mon, 29 Jan 2018 19:56:42 +0000 (19:56 +0000)]
Revert "AArch64: Omit callframe setup/destroy when not necessary"

This reverts commit r322917 due to multiple performance regressions in spec2006
and spec2017. XFAILed llvm/test/CodeGen/AArch64/big-callframe.ll which initially
motivated this change.

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

6 years ago[globalisel][legalizer] Adapt LegalizerInfo to support inter-type dependencies and...
Daniel Sanders [Mon, 29 Jan 2018 19:54:49 +0000 (19:54 +0000)]
[globalisel][legalizer] Adapt LegalizerInfo to support inter-type dependencies and other things.

Summary:
As discussed in D42244, we have difficulty describing the legality of some
operations. We're not able to specify relationships between types.
For example, declaring the following
  setAction({..., 0, s32}, Legal)
  setAction({..., 0, s64}, Legal)
  setAction({..., 1, s32}, Legal)
  setAction({..., 1, s64}, Legal)
currently declares these type combinations as legal:
  {s32, s32}
  {s64, s32}
  {s32, s64}
  {s64, s64}
but we currently have no means to say that, for example, {s64, s32} is
not legal. Some operations such as G_INSERT/G_EXTRACT/G_MERGE_VALUES/
G_UNMERGE_VALUES have relationships between the types that are currently
described incorrectly.

Additionally, G_LOAD/G_STORE currently have no means to legalize non-atomics
differently to atomics. The necessary information is in the MMO but we have no
way to use this in the legalizer. Similarly, there is currently no way for the
register type and the memory type to differ so there is no way to cleanly
represent extending-load/truncating-store in a way that can't be broken by
optimizers (resulting in illegal MIR).

It's also difficult to control the legalization strategy. We've added support
for legalizing non-power of 2 types but there's still some hardcoded assumptions
about the strategy. The main one I've noticed is that type0 is always legalized
before type1 which is not a good strategy for `type0 = G_EXTRACT type1, ...` if
you need to widen the container. It will converge on the same result eventually
but it will take a much longer route when legalizing type0 than if you legalize
type1 first.

Lastly, the definition of legality and the legalization strategy is kept
separate which is not ideal. It's helpful to be able to look at a one piece of
code and see both what is legal and the method the legalizer will use to make
illegal MIR more legal.

This patch adds a layer onto the LegalizerInfo (to be removed when all targets
have been migrated) which resolves all these issues.

Here are the rules for shift and division:
  for (unsigned BinOp : {G_LSHR, G_ASHR, G_SDIV, G_UDIV})
    getActionDefinitions(BinOp)
        .legalFor({s32, s64})     // If type0 is s32/s64 then it's Legal
        .clampScalar(0, s32, s64) // If type0 is <s32 then WidenScalar to s32
                                  // If type0 is >s64 then NarrowScalar to s64
        .widenScalarToPow2(0)     // Round type0 scalars up to powers of 2
        .unsupported();           // Otherwise, it's unsupported
This describes everything needed to both define legality and describe how to
make illegal things legal.

Here's an example of a complex rule:
  getActionDefinitions(G_INSERT)
      .unsupportedIf([=](const LegalityQuery &Query) {
        // If type0 is smaller than type1 then it's unsupported
        return Query.Types[0].getSizeInBits() <= Query.Types[1].getSizeInBits();
      })
      .legalIf([=](const LegalityQuery &Query) {
        // If type0 is s32/s64/p0 and type1 is a power of 2 other than 2 or 4 then it's legal
        // We don't need to worry about large type1's because unsupportedIf caught that.
        const LLT &Ty0 = Query.Types[0];
        const LLT &Ty1 = Query.Types[1];
        if (Ty0 != s32 && Ty0 != s64 && Ty0 != p0)
          return false;
        return isPowerOf2_32(Ty1.getSizeInBits()) &&
               (Ty1.getSizeInBits() == 1 || Ty1.getSizeInBits() >= 8);
      })
      .clampScalar(0, s32, s64)
      .widenScalarToPow2(0)
      .maxScalarIf(typeInSet(0, {s32}), 1, s16) // If type0 is s32 and type1 is bigger than s16 then NarrowScalar type1 to s16
      .maxScalarIf(typeInSet(0, {s64}), 1, s32) // If type0 is s64 and type1 is bigger than s32 then NarrowScalar type1 to s32
      .widenScalarToPow2(1)                     // Round type1 scalars up to powers of 2
      .unsupported();
This uses a lambda to say that G_INSERT is unsupported when type0 is bigger than
type1 (in practice, this would be a default rule for G_INSERT). It also uses one
to describe the legal cases. This particular predicate is equivalent to:
  .legalFor({{s32, s1}, {s32, s8}, {s32, s16}, {s64, s1}, {s64, s8}, {s64, s16}, {s64, s32}})

In terms of performance, I saw a slight (~6%) performance improvement when
AArch64 was around 30% ported but it's pretty much break even right now.
I'm going to take a look at constexpr as a means to reduce the initialization
cost.

Future work:
* Make it possible for opcodes to share rulesets. There's no need for
  G_LSHR/G_ASHR/G_SDIV/G_UDIV to have separate rule and ruleset objects. There's
  no technical barrier to this, it just hasn't been done yet.
* Replace the type-index numbers with an enum to get .clampScalar(Type0, s32, s64)
* Better names for things like .maxScalarIf() (clampMaxScalar?) and the vector rules.
* Improve initialization cost using constexpr

Possible future work:
* It's possible to make these rulesets change the MIR directly instead of
  returning a description of how to change the MIR. This should remove a little
  overhead caused by parsing the description and routing to the right code, but
  the real motivation is that it removes the need for LegalizeAction::Custom.
  With Custom removed, there's no longer a requirement that Custom legalization
  change the opcode to something that's considered legal.

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar, volkan, reames, bogner

Reviewed By: bogner

Subscribers: hintonda, bogner, aemerson, mgorny, javed.absar, kristof.beyls, llvm-commits

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

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

6 years agoImprove testcase.
Rafael Espindola [Mon, 29 Jan 2018 19:37:27 +0000 (19:37 +0000)]
Improve testcase.

We now test that pic and static produce different results for bar.
The function names were demangled.
The attributes are written inline.

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

6 years ago[MachineVerifier] Add check that renamable operands aren't reserved registers.
Geoff Berry [Mon, 29 Jan 2018 18:57:07 +0000 (18:57 +0000)]
[MachineVerifier] Add check that renamable operands aren't reserved registers.

Summary:

Reviewers: qcolombet, MatzeB

Subscribers: arsenm, sdardis, nhaehnle, mcrosier, llvm-commits

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

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

6 years ago[AMDGPU][X86][Mips] Make sure renamable bit not set for reserved regs
Geoff Berry [Mon, 29 Jan 2018 18:47:48 +0000 (18:47 +0000)]
[AMDGPU][X86][Mips] Make sure renamable bit not set for reserved regs

Summary:
Fix a few places that were modifying code after register
allocation to set the renamable bit correctly to avoid failing the
validation added in D42449.

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

6 years agoMove getPlatformFlags to ELFObjectFileBase and simplify.
Rafael Espindola [Mon, 29 Jan 2018 18:27:30 +0000 (18:27 +0000)]
Move getPlatformFlags to ELFObjectFileBase and simplify.

This removes a few std::error_code results that were ignored on every
call.

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

6 years ago[X86] Don't create SHRUNKBLEND when the condition is used by the true or false operan...
Craig Topper [Mon, 29 Jan 2018 17:56:57 +0000 (17:56 +0000)]
[X86] Don't create SHRUNKBLEND when the condition is used by the true or false operand of the vselect.

Fixes PR34592.

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

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

6 years ago[X86] Add test case for pr34592
Craig Topper [Mon, 29 Jan 2018 17:56:55 +0000 (17:56 +0000)]
[X86] Add test case for pr34592

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

6 years ago[DWARF] Recommitting a test reverted in r323560. Moved to x86 directory with explicit...
Wolfgang Pieb [Mon, 29 Jan 2018 17:49:10 +0000 (17:49 +0000)]
[DWARF] Recommitting a test reverted in r323560. Moved to x86 directory with explicit triple.
ELF support is required for type units.

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

6 years ago[globalisel] Make LegalizerInfo::LegalizeAction available outside of LegalizerInfo...
Daniel Sanders [Mon, 29 Jan 2018 17:37:29 +0000 (17:37 +0000)]
[globalisel] Make LegalizerInfo::LegalizeAction available outside of LegalizerInfo. NFC

Summary:
The improvements to the LegalizerInfo discussed in D42244 require that
LegalizerInfo::LegalizeAction be available for use in other classes. As such,
it needs to be moved out of LegalizerInfo. This has been done separately to the
next patch to minimize the noise in that patch.

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

6 years ago[AccelTable] Workaround for MSVC bug
Jonas Devlieghere [Mon, 29 Jan 2018 17:28:51 +0000 (17:28 +0000)]
[AccelTable] Workaround for MSVC bug

Microsoft Visual Studio rejects the static constexpr static list of
atoms even though it's valid C++. This provides a workaround to unbreak
the bots.

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

6 years agoAdd myself to CREDITS.txt
Tony Jiang [Mon, 29 Jan 2018 17:02:34 +0000 (17:02 +0000)]
Add myself to CREDITS.txt

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

6 years agoAdd test case for truncated and promotion to test. NFC
Amaury Sechet [Mon, 29 Jan 2018 16:13:01 +0000 (16:13 +0000)]
Add test case for truncated and promotion to test. NFC

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

6 years ago[SLP] Fix for PR32086: Count InsertElementInstr of the same elements as shuffle.
Alexey Bataev [Mon, 29 Jan 2018 16:08:52 +0000 (16:08 +0000)]
[SLP] Fix for PR32086: Count InsertElementInstr of the same elements as shuffle.

Summary:
If the same value is going to be vectorized several times in the same
tree entry, this entry is considered to be a gather entry and cost of
this gather is counter as cost of InsertElementInstrs for each gathered
value. But we can consider these elements as ShuffleInstr with
SK_PermuteSingle shuffle kind.

Reviewers: spatel, RKSimon, mkuper, hfinkel

Subscribers: llvm-commits

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

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

6 years ago[SLP] Add a test with extract for PR32086, NFC.
Alexey Bataev [Mon, 29 Jan 2018 15:56:52 +0000 (15:56 +0000)]
[SLP] Add a test with extract for PR32086, NFC.

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

6 years ago[AccelTable] Try making MSVC happy
Jonas Devlieghere [Mon, 29 Jan 2018 15:23:34 +0000 (15:23 +0000)]
[AccelTable] Try making MSVC happy

MSVC complains that the constexpr "expression did not evaluate to a
constant". Trying to make it happy by adding a `const` specifier as
suggested in https://stackoverflow.com/questions/37574343.

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

6 years ago[AccelTable] Fix undefined reference
Jonas Devlieghere [Mon, 29 Jan 2018 15:07:55 +0000 (15:07 +0000)]
[AccelTable] Fix undefined reference

Fixes the missing reference in AppleAccelTableData by making the method
pure virtual as intended.

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

6 years ago[dsymutil] Generate Apple accelerator tables
Jonas Devlieghere [Mon, 29 Jan 2018 14:52:50 +0000 (14:52 +0000)]
[dsymutil] Generate Apple accelerator tables

This patch adds support for generating accelerator tables in dsymutil.
This feature was already present in our internal repository but not yet
upstreamed because it requires changes to the Apple accelerator table
implementation.

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

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

6 years ago[NFC] Rename DwarfAccelTable and move header.
Jonas Devlieghere [Mon, 29 Jan 2018 14:52:41 +0000 (14:52 +0000)]
[NFC] Rename DwarfAccelTable and move header.

This patch renames DwarfAccelTable.{h,cpp} to AccelTable.{h,cpp} and
moves the header to the include dir so it is accessible by the
dsymutil implementation.

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

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

6 years ago[NFC] Refactor Apple Accelerator Tables
Jonas Devlieghere [Mon, 29 Jan 2018 14:52:34 +0000 (14:52 +0000)]
[NFC] Refactor Apple Accelerator Tables

This patch refactors the way data is stored in the accelerator table and
makes them truly generic. There have been several attempts to do this in
the past:

 - D8215 & D8216: Using a union and partial hardcoding.
 - D11805: Using inheritance.
 - D42246: Using a callback.

In the end I didn't like either of them, because for some reason or
another parts of it felt hacky or decreased runtime performance. I
didn't want to completely rewrite them as I was hoping that we could
reuse parts for the successor in the DWARF standard. However, it seems
less and less likely that there will be a lot of opportunities for
sharing code and/or an interface.

Originally I choose to template the whole class, because it introduces
no performance overhead compared to the original implementation.

We ended up settling on a hybrid between a templated method and a
virtual call to emit the data. The motivation is that we don't want to
increase code size for a feature that should soon be superseded by the
DWARFv5 accelerator tables. While the code will continue to be used for
compatibility, it won't be on the hot path. Furthermore this does not
regress performance compared to Apple's internal implementation that
already uses virtual calls for this.

A quick summary for why these changes are necessary: dsymutil likes to
reuse the current implementation of the Apple accelerator tables.
However, LLDB expects a slightly different interface than what is
currently emitted. Additionally, in dsymutil we only have offsets and no
actual DIEs.

Although the patch suggests a lot of code has changed, this change is
pretty straightforward:

 - We created an abstract class `AppleAccelTableData` to serve as an
   interface for the different data classes.
 - We created two implementations of this class, one for type tables and
   one for everything else. There will be a third one for dsymutil that
   takes just the offset.
 - We use the supplied class to deduct the atoms for the header which
   makes the structure of the table fully self contained, although not
   enforced by the interface as was the case for the fully templated
   approach.
 - We renamed the prefix from DWARF- to Apple- to make space for the
   future implementation of .debug_names.

This change is NFC and relies on the existing tests.

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

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

6 years ago[AMDGPU][MC] Corrected parsing of image opcode modifiers r128 and d16
Dmitry Preobrazhensky [Mon, 29 Jan 2018 14:20:42 +0000 (14:20 +0000)]
[AMDGPU][MC] Corrected parsing of image opcode modifiers r128 and d16

See bugs 36092, 36093:
    https://bugs.llvm.org/show_bug.cgi?id=36092
    https://bugs.llvm.org/show_bug.cgi?id=36093

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

Reviewers: vpykhtin, artem.tamazov, arsenm

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

6 years agoFix windows test failure caused by r323638
Pavel Labath [Mon, 29 Jan 2018 13:53:48 +0000 (13:53 +0000)]
Fix windows test failure caused by r323638

The test was failing because of an incorrect sizeof check in the name
index parsing code. This code was meant to check that we have enough
input to parse the fixed-size part of the dwarf header, which it did by
comparing the input to sizeof(Header). Originally struct Header only
contained the fixed-size part, but during review, we've moved additional
members into it, which rendered the sizeof check invalid.

I resolve this by moving the fixed-size part to a separate struct and
updating the sizeof-expression to use that.

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

6 years ago[AArch64][AsmParser] NFC: Generalize LogicalImm[Not](32|64) code
Sander de Smalen [Mon, 29 Jan 2018 13:05:38 +0000 (13:05 +0000)]
[AArch64][AsmParser] NFC: Generalize LogicalImm[Not](32|64) code

Summary:
All variants of isLogicalImm[Not](32|64) can be combined into a single templated function, same for printLogicalImm(32|64).
By making it use a template instead, further SVE patches can use it for other data types as well (e.g. 8, 16 bits).

Reviewers: fhahn, rengolin, aadg, echristo, kristof.beyls, samparker

Reviewed By: samparker

Subscribers: aemerson, javed.absar, llvm-commits

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

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

6 years ago[DebugInfo] Fix fragment offset emission order for symbol locations
Mikael Holmen [Mon, 29 Jan 2018 12:37:30 +0000 (12:37 +0000)]
[DebugInfo] Fix fragment offset emission order for symbol locations

Summary:
When emitting the location for a global variable with fragmented debug
expressions, make sure that the offset pieces, which represent
optimized-out parts of the variable, are emitted before their succeeding
fragments' expressions. Previously, if the succeeding fragment's
location was a symbol, the offset piece was emitted after, rather than
before, that symbol's expression. This effectively meant that the symbols
were associated with the wrong parts of the variable.

This fixes PR36085.

Patch by: David Stenberg

Reviewers: aprantl, probinson, dblaikie

Reviewed By: aprantl

Subscribers: JDevlieghere, llvm-commits

Tags: #debug-info

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

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

6 years ago[Sparc] Account for bias in stack readjustment
Jonas Devlieghere [Mon, 29 Jan 2018 12:10:32 +0000 (12:10 +0000)]
[Sparc] Account for bias in stack readjustment

Summary: This was broken long ago in D12208, which failed to account for
the fact that 64-bit SPARC uses a stack bias of 2047, and it is the
*unbiased* value which should be aligned, not the biased one. This was
seen to be an issue with Rust.

Patch by: jrtc27 (James Clarke)

Reviewers: jyknight, venkatra

Reviewed By: jyknight

Subscribers: jacob_hansen, JDevlieghere, fhahn, fedor.sergeev, llvm-commits

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

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

6 years agoFix build broken by r323641
Pavel Labath [Mon, 29 Jan 2018 11:53:46 +0000 (11:53 +0000)]
Fix build broken by r323641

The call to ScopedPrinter::printNumber with size_t argument was
ambiguous (I think) on 32-bit builds. Explicitly cast to a 64-bit int to
avoid this.

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

6 years agoRefactor dwarfdump -apple-names output
Pavel Labath [Mon, 29 Jan 2018 11:33:17 +0000 (11:33 +0000)]
Refactor dwarfdump -apple-names output

Summary:
This modifies the dwarfdump output to align it with the new .debug_names
dump. It also renames two header fields to match similar fields in the
dwarf5 header.

A couple of tests needed to be updated to match new output. The changes
were fairly straight-forward, although not really automatable.

Reviewers: JDevlieghere, aprantl

Subscribers: llvm-commits

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

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