OSDN Git Service

android-x86/external-llvm.git
6 years ago[emacs] Indent statement continuation to match clang-format
Andrew Savonichev [Thu, 2 Aug 2018 08:50:41 +0000 (08:50 +0000)]
[emacs] Indent statement continuation to match clang-format

Summary:
Was:

  int LongVariableName =
    veryLongFunctionNameThatExceeds80ColumnsRule(SomeParameter);

  int ShortVar = veryLongFunctionNameThatStillFitsIntoOneLine(SomeParameter)
    .nowThisDoesntFit()
    .andThis()

Now:

  int LongVariableName =
      veryLongFunctionNameThatExceeds80ColumnsRule(SomeParameter);

  int ShortVar = veryLongFunctionNameThatStillFitsIntoOneLine(SomeParameter)
                     .nowThisDoesntFit()
                     .andThis()

Reviewers: espindola, MaskRay

Reviewed By: MaskRay

Subscribers: greened, llvm-commits

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

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

6 years ago[GlobalISel] Rewrite CallLowering::lowerReturn to accept multiple VRegs per Value
Alexander Ivchenko [Thu, 2 Aug 2018 08:33:31 +0000 (08:33 +0000)]
[GlobalISel] Rewrite CallLowering::lowerReturn to accept multiple VRegs per Value

This is logical continuation of https://reviews.llvm.org/D46018 (r332449)

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

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

6 years agoutils/release/tag.sh: add debuginfo-tests to project list
Hans Wennborg [Thu, 2 Aug 2018 08:10:34 +0000 (08:10 +0000)]
utils/release/tag.sh: add debuginfo-tests to project list

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

6 years agolit: bump version number
Hans Wennborg [Thu, 2 Aug 2018 07:48:44 +0000 (07:48 +0000)]
lit: bump version number

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

6 years ago[UnJ] Add debug messages for why loops are not unrolled. NFC
David Green [Thu, 2 Aug 2018 07:30:53 +0000 (07:30 +0000)]
[UnJ] Add debug messages for why loops are not unrolled. NFC

Adds some cleaned up debug messages from back when I was writing this.
Hopefully useful to others (and myself) as to why unroll and jam is not
transforming as expected.

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

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

6 years ago[AArch64] Add support for got relocated LDR's
David Green [Thu, 2 Aug 2018 06:24:40 +0000 (06:24 +0000)]
[AArch64] Add support for got relocated LDR's

As a part of adding the tiny codemodel, we need to support ldr's with :got:
relocations on them. This seems to be mostly already done, just needs the
relocation type support.

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

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

6 years agoTest commit.
Kito Cheng [Thu, 2 Aug 2018 05:38:18 +0000 (05:38 +0000)]
Test commit.

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

6 years ago[LICM] Factor out fault legality from canHoistOrSinkInst [NFC]
Philip Reames [Thu, 2 Aug 2018 04:08:04 +0000 (04:08 +0000)]
[LICM] Factor out fault legality from canHoistOrSinkInst [NFC]

This method has three callers, each of which wanted distinct handling:
1) Sinking into a loop is moving an instruction known to execute before a loop into the loop.  We don't need to worry about introducing a fault at all in this case.
2) Hoisting from a loop into a preheader already duplicated the check in the caller.
3) Sinking from the loop into an exit block was the only true user of the code within the routine.  For the moment, this has just been lifted into the caller, but up next is examining the logic more carefully.  Whitelisting of loads and calls - while consistent with the previous code - is rather suspicious.  Either way, a behavior change is worthy of it's own patch.

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

6 years ago[LICM] Expand tests to highlight an oddity in sinking implementation
Philip Reames [Thu, 2 Aug 2018 03:54:29 +0000 (03:54 +0000)]
[LICM] Expand tests to highlight an oddity in sinking implementation

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

6 years agoFix FCOPYSIGN expansion
Lei Liu [Thu, 2 Aug 2018 01:54:12 +0000 (01:54 +0000)]
Fix FCOPYSIGN expansion

In expansion of FCOPYSIGN, the shift node is missing when the two
operands of FCOPYSIGN are of the same size. We should always generate
shift node (if the required shift bit is not zero) to put the sign
bit into the right position, regardless of the size of underlying
types.

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

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

6 years ago[LICM] hoisting/sinking legality - bail early for unsupported instructions
Philip Reames [Thu, 2 Aug 2018 00:54:14 +0000 (00:54 +0000)]
[LICM] hoisting/sinking legality - bail early for unsupported instructions

Originally, this was part of a larger refactoring I'd planned, but had to abandoned.  I figured the minor improvement in readability was worthwhile.

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

6 years ago[ADT] Add some documentation for GraphTraits.
Tim Shen [Thu, 2 Aug 2018 00:21:12 +0000 (00:21 +0000)]
[ADT] Add some documentation for GraphTraits.

Summary: Add some context for GraphTraits.

Reviewers: dblaikie, asbirlea

Subscribers: sanjoy, jlebar, bixia, dexonsmith, llvm-commits

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

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

6 years ago[PowerPC] Do not round values prior to converting to integer
Nemanja Ivanovic [Thu, 2 Aug 2018 00:03:22 +0000 (00:03 +0000)]
[PowerPC] Do not round values prior to converting to integer

Adding the FP_ROUND nodes when combining FP_TO_[SU]INT of elements
feeding a BUILD_VECTOR into an FP_TO_[SU]INT of the built vector
loses precision. This patch removes the code that adds these nodes
to true f64 operands. It also adds patterns required to ensure
the code is still vectorized rather than converting individual
elements and inserting into a vector.

Fixes https://bugs.llvm.org/show_bug.cgi?id=38342

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

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

6 years ago[AArch64] DWARF: do not generate AT_location for thread local
Lei Liu [Wed, 1 Aug 2018 23:46:49 +0000 (23:46 +0000)]
[AArch64] DWARF: do not generate AT_location for thread local

AArch64 ELF ABI does not define a static relocation type for TLS offset within
a module, which makes it impossible for compiler to generate a valid
DW_AT_location content for thread local variables. Currently LLVM generates an
invalid R_AARCH64_ABS64 relocation at the DW_AT_location field for a TLS
variable. That causes trouble for linker because thread local variable does
not have an absolute address at link time. AArch64 GCC solves the problem by
not generating DW_AT_location for thread local variables. We should do the
same in LLVM.

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

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

6 years agoAdd maybe-unused attribute to a variable.
Nick Desaulniers [Wed, 1 Aug 2018 23:46:48 +0000 (23:46 +0000)]
Add maybe-unused attribute to a variable.

Summary:
Mark a variable as maybe-unused to prevent a -Wunused-but-set-variable
warning in optimized builds where asserts are removed.Test/first commit
to check setup and understand patch submission process.

Reviewers: srhines, pirama, dblaikie

Reviewed By: dblaikie

Subscribers: llvm-commits

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

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

6 years agoReland r338431: "Add DebugCounters to DivRemPairs"
George Burgess IV [Wed, 1 Aug 2018 23:14:14 +0000 (23:14 +0000)]
Reland r338431: "Add DebugCounters to DivRemPairs"

(Previously reverted in r338442)

I'm told that the breakage came from us using an x86 triple on configs
that didn't have x86 enabled. This is remedied by moving the
debugcounter test to an x86 directory (where there's also a
opt-bisect-isel.ll test for similar reasons).

I can't repro the reverse-iteration failure mentioned in the revert with
this patch, so I assume that a misconfiguration on my end is what caused
that.

Original commit message:

    Add DebugCounters to DivRemPairs

    For people who don't use DebugCounters, NFCI.

    Patch by Zhizhou Yang!

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

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

6 years ago[InstSimplify] move minnum/maxnum with same arg fold from instcombine
Sanjay Patel [Wed, 1 Aug 2018 23:05:55 +0000 (23:05 +0000)]
[InstSimplify] move minnum/maxnum with same arg fold from instcombine

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

6 years agoLoad from the GOT for external symbols in the large, PIC code model
Reid Kleckner [Wed, 1 Aug 2018 22:56:05 +0000 (22:56 +0000)]
Load from the GOT for external symbols in the large, PIC code model

Do the same handling for external symbols that we do for jump table
symbols and global values.

Fixes one of the cases in PR38385

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

6 years ago[ASAN] Use the correct shadow offset for ASAN on FreeBSD/mips64.
John Baldwin [Wed, 1 Aug 2018 22:51:13 +0000 (22:51 +0000)]
[ASAN] Use the correct shadow offset for ASAN on FreeBSD/mips64.

Reviewed By: atanasyan

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

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

6 years ago[ORC] Add a 'Callable' flag to JITSymbolFlags.
Lang Hames [Wed, 1 Aug 2018 22:42:23 +0000 (22:42 +0000)]
[ORC] Add a 'Callable' flag to JITSymbolFlags.

The callable flag can be used to indicate that a symbol is callable. If present,
the symbol is callable. If absent, the symbol may or may not be callable (the
client must determine this by context, for example by examining the program
representation that will provide the symbol definition).

This flag will be used in the near future to enable creation of lazy compilation
stubs based on SymbolFlagsMap instances only (without having to provide
additional information to determine which symbols need stubs).

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

6 years ago[llvm-objcopy] Add missing -I command line flag alias for --input-target
Jordan Rupprecht [Wed, 1 Aug 2018 20:59:39 +0000 (20:59 +0000)]
[llvm-objcopy] Add missing -I command line flag alias for --input-target

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

6 years ago[DebugInfo/DWARF] [4/4] Unify handling of compile and type units. NFC
Paul Robinson [Wed, 1 Aug 2018 20:54:11 +0000 (20:54 +0000)]
[DebugInfo/DWARF] [4/4] Unify handling of compile and type units. NFC

This is patch 4 of 4 NFC refactorings to handle type units and compile
units more consistently and with less concern about the object-file
section that they came from.

Patch 4 combines separate DWARFUnitVectors for compile and type units
into a single DWARFUnitVector that contains both.  For now the
implementation distinguishes compile units from type units by putting
all compile units at the front of the vector, reflecting the DWARF v4
distinction between .debug_info and .debug_types sections.  A future
patch will change this to allow the free mixing of unit kinds, as is
specified by DWARF v5.

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

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

6 years ago[DebugInfo/DWARF] [3/4] Rename DWARFUnitSection to DWARFUnitVector. NFC
Paul Robinson [Wed, 1 Aug 2018 20:49:44 +0000 (20:49 +0000)]
[DebugInfo/DWARF] [3/4] Rename DWARFUnitSection to DWARFUnitVector. NFC

This is patch 3 of 4 NFC refactorings to handle type units and compile
units more consistently and with less concern about the object-file
section that they came from.

Patch 3 simply renames DWARFUnitSection to DWARFUnitVector, as the
object-file section of a unit is nearly irrelevant now.

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

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

6 years agoAMDGPU: Use SPseudoInst helper
Matt Arsenault [Wed, 1 Aug 2018 20:49:00 +0000 (20:49 +0000)]
AMDGPU: Use SPseudoInst helper

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

6 years ago[DebugInfo/DWARF] [2/4] Type units no longer in a std::deque. NFC
Paul Robinson [Wed, 1 Aug 2018 20:46:46 +0000 (20:46 +0000)]
[DebugInfo/DWARF] [2/4] Type units no longer in a std::deque. NFC

This is patch 2 of 4 NFC refactorings to handle type units and compile
units more consistently and with less concern about the object-file
section that they came from.

Patch 2 takes the existing std::deque<DWARFUnitSection> for type units
and makes it a simple DWARFUnitSection, simplifying the handling of
type units and making it more consistent with compile units.

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

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

6 years ago[DebugInfo/DWARF] [1/4] De-templatize DWARFUnitSection. NFC
Paul Robinson [Wed, 1 Aug 2018 20:43:47 +0000 (20:43 +0000)]
[DebugInfo/DWARF] [1/4] De-templatize DWARFUnitSection. NFC

This is patch 1 of 4 NFC refactorings to handle type units and compile
units more consistently and with less concern about the object-file
section that they came from.

Patch 1 replaces the templated DWARFUnitSection with a non-templated
version. That is, instead of being a SmallVector of pointers to a
specific unit kind, it is not a SmallVector of pointers to the base
class for both type and compile units.  Virtual methods are magic.

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

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

6 years agoAMDGPU: Improve hack for packing conversion ops
Matt Arsenault [Wed, 1 Aug 2018 20:13:58 +0000 (20:13 +0000)]
AMDGPU: Improve hack for packing conversion ops

Mutate the node type during selection when it
doesn't matter. This avoids an intermediate bitcast
node on targets with legal i16/f16.

Also fixes missing output modifiers on v_cvt_pkrtz_f32_f16,
which I assume are OK.

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

6 years agoAMDGPU: Partially fix handling of packed amdgpu_ps arguments
Matt Arsenault [Wed, 1 Aug 2018 19:57:34 +0000 (19:57 +0000)]
AMDGPU: Partially fix handling of packed amdgpu_ps arguments

Fixes annoying limitations when writing tests.
Also remove more leftover code for manually scalarizing arguments
and return values.

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

6 years ago[WebAssembly] Support for a ternary atomic RMW instruction
Heejin Ahn [Wed, 1 Aug 2018 19:40:28 +0000 (19:40 +0000)]
[WebAssembly] Support for a ternary atomic RMW instruction

Summary: This adds support for a ternary atomic RMW instruction: cmpxchg.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

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

6 years ago[DEBUGINFO] Disable emission of the dwarf sections, but allow directives.
Alexey Bataev [Wed, 1 Aug 2018 19:38:20 +0000 (19:38 +0000)]
[DEBUGINFO] Disable emission of the dwarf sections, but allow directives.

Summary:
Added an option that allows to emit only '.loc' and '.file' kind debug
directives, but disables emission of the DWARF sections. Required for
NVPTX target to support profiling. It requires '.loc' and '.file'
directives, but does not require any DWARF sections for the profiler.

Reviewers: probinson, echristo, dblaikie

Subscribers: aprantl, JDevlieghere, llvm-commits

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

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

6 years agoTry to fix FreeBSD build.
Zachary Turner [Wed, 1 Aug 2018 18:44:12 +0000 (18:44 +0000)]
Try to fix FreeBSD build.

It seems like perhaps because cstdio isn't directly included, the
compiler is accidentally picking up wprintf from somewhere else
and trying to call that.  Hopefully this fixes it.

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

6 years ago[X86] Canonicalize the pattern for __builtin_ffs in a similar way to '__builtin_ffs...
Craig Topper [Wed, 1 Aug 2018 18:38:46 +0000 (18:38 +0000)]
[X86] Canonicalize the pattern for __builtin_ffs in a similar way to '__builtin_ffs + 5'

We now emit a move of -1 before the cmov and do the addition after the cmov just like the case with an extra addition.

This may be slightly worse for code size, but is more consistent with other compilers. And we might be able to hoist the mov -1 outside of loops.

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

6 years ago[X86] Add test cases for the patterns used by __builtin_ffs.
Craig Topper [Wed, 1 Aug 2018 18:38:43 +0000 (18:38 +0000)]
[X86] Add test cases for the patterns used by __builtin_ffs.

We previously had tests for "__builtin_ffs + 5", but the SelectinoDAG without an extra addition came out slightly different.

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

6 years agoAMDGPU/R600: Convert kernel param loads to use PARAM_I_ADDRESS
Jan Vesely [Wed, 1 Aug 2018 18:36:07 +0000 (18:36 +0000)]
AMDGPU/R600: Convert kernel param loads to use PARAM_I_ADDRESS

Non ext aligned i32 loads are still optimized to use CONSTANT_BUFFER (AS 8)

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

6 years ago[llvm-undname Add an option to dump back references.
Zachary Turner [Wed, 1 Aug 2018 18:33:04 +0000 (18:33 +0000)]
[llvm-undname Add an option to dump back references.

This is useful for understanding how our demangler processes
back references and for investigating issues related to
back references.  But it's a feature only useful for debugging
the demangling process itself, so I'm marking it hidden.

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

6 years ago[MS Demangler] Properly demangle templated operators.
Zachary Turner [Wed, 1 Aug 2018 18:32:47 +0000 (18:32 +0000)]
[MS Demangler] Properly demangle templated operators.

After we detected the presence of a template via ?$ we would proceed by
only demangling a simple unqualified name. This means we would fail on
templated operators (and perhaps other yet-to-be-determined things)

This was discovered while doing some refactoring to store richer
semantic information about the demangled types to pave the way for
overhauling the way we handle backreferences. (Specifically, we need to
defer recording or resolving back-references until a symbol has been
completely demangled, because we need to use information that only
occurs later in the mangled string to decide whether a back-reference
should be recorded.)

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

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

6 years ago[MS Demangler] Don't crash as often when demangling.
Zachary Turner [Wed, 1 Aug 2018 18:32:28 +0000 (18:32 +0000)]
[MS Demangler] Don't crash as often when demangling.

We crash a lot on unrecognized inputs.  This adds some error
handling so we early out when we get unrecognized names.

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

6 years ago[NFC] small addendum to r334242, FMF propagation
Michael Berg [Wed, 1 Aug 2018 18:06:49 +0000 (18:06 +0000)]
[NFC] small addendum to r334242, FMF propagation

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

6 years ago[X86] FastISel fall back on !absolute_symbol GVs
Vlad Tsyrklevich [Wed, 1 Aug 2018 17:44:37 +0000 (17:44 +0000)]
[X86] FastISel fall back on !absolute_symbol GVs

Summary:
D25878, which added support for !absolute_symbol for normal X86 ISel,
did not add support for materializing references to absolute symbols for
X86 FastISel. This causes build failures because FastISel generates
PC-relative relocations for absolute symbols. Fall back to normal ISel
for references to !absolute_symbol GVs. Fix for PR38200.

Reviewers: pcc, craig.topper

Reviewed By: pcc

Subscribers: hiraditya, llvm-commits, kcc

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

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

6 years ago[X86] Assign from a brace initializer to match style guide. NFCI.
Simon Pilgrim [Wed, 1 Aug 2018 17:43:38 +0000 (17:43 +0000)]
[X86] Assign from a brace initializer to match style guide. NFCI.

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

6 years ago[llvm-mca][x86] Add CMPXCHG instruction resource tests
Simon Pilgrim [Wed, 1 Aug 2018 17:25:11 +0000 (17:25 +0000)]
[llvm-mca][x86] Add CMPXCHG instruction resource tests

I've put CMPXCHG8B/CMPXCHG16B in the same file, even though technically they are under separate CPUID bits all targets seem to support both (or neither).

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

6 years ago[x86] remove stale FIXME note from test; NFC
Sanjay Patel [Wed, 1 Aug 2018 17:18:50 +0000 (17:18 +0000)]
[x86] remove stale FIXME note from test; NFC

This was fixed with rL338592.

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

6 years ago[SelectionDAG] fix bug in translating funnel shift with non-power-of-2 type
Sanjay Patel [Wed, 1 Aug 2018 17:17:08 +0000 (17:17 +0000)]
[SelectionDAG] fix bug in translating funnel shift with non-power-of-2 type

The bug is visible in the constant-folded x86 tests. We can't use the
negated shift amount when the type is not power-of-2:
https://rise4fun.com/Alive/US1r

...so in that case, use the regular lowering that includes a select
to guard against a shift-by-bitwidth. This path is improved by only
calculating the modulo shift amount once now.

Also, improve the rotate (with power-of-2 size) lowering to use
a negate rather than subtract from bitwidth. This improves the
codegen whether we have a rotate instruction or not (although
we can still see that we're not matching to a legal rotate in
all cases).

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

6 years ago[x86] add tests to show miscompile for funnel shift with weird size; NFC
Sanjay Patel [Wed, 1 Aug 2018 16:59:54 +0000 (16:59 +0000)]
[x86] add tests to show miscompile for funnel shift with weird size; NFC

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

6 years ago[SelectionDAG] Make binop reduction matcher available to all targets
Simon Pilgrim [Wed, 1 Aug 2018 16:52:28 +0000 (16:52 +0000)]
[SelectionDAG] Make binop reduction matcher available to all targets

There is nothing x86-specific about this code, so it'd be nice to make this available for other targets to use in the future (and get it out of X86ISelLowering!).

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

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

6 years ago[NFC][FunctionAttrs] Remove duplication in old/new PM pipeline
Johannes Doerfert [Wed, 1 Aug 2018 16:37:51 +0000 (16:37 +0000)]
[NFC][FunctionAttrs] Remove duplication in old/new PM pipeline

This patch just extract code into a separate function to remove some
duplication between the old and new pass manager pipeline. Due to the
different CGSCC iterators used, not all code duplication was eliminated.

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

6 years ago[llvm-mca][x86] Add PREFETCHW instruction resource tests
Simon Pilgrim [Wed, 1 Aug 2018 16:34:39 +0000 (16:34 +0000)]
[llvm-mca][x86] Add PREFETCHW instruction resource tests

These aren't just available via 3DNow! so test for them separately as well.

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

6 years ago[llvm-mca][x86] Add PCLMUL instruction resource tests
Simon Pilgrim [Wed, 1 Aug 2018 16:25:50 +0000 (16:25 +0000)]
[llvm-mca][x86] Add PCLMUL instruction resource tests

Renamed the btver2 file that already contained them - the other targets were only testing the AVX versions

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

6 years ago[llvm-objcopy] Add support for --rename-section flags from gnu objcopy
Jordan Rupprecht [Wed, 1 Aug 2018 16:23:22 +0000 (16:23 +0000)]
[llvm-objcopy] Add support for --rename-section flags from gnu objcopy

Summary:
Add support for --rename-section flags from gnu objcopy.

Not all flags appear to have an effect for ELF objects, but allowing them would allow easier drop-in replacement. Other unrecognized flags are rejected.

This was only tested by comparing flags printed by "readelf -e <.o>" against the output of gnu vs llvm objcopy, it hasn't been tested to be valid beyond that.

Reviewers: jakehehrlich, alexshap

Subscribers: llvm-commits, paulsemel, alexshap

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

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

6 years ago[llvm-mca] Correctly update the rank in `Scheduler::select()`.
Andrea Di Biagio [Wed, 1 Aug 2018 16:06:33 +0000 (16:06 +0000)]
[llvm-mca] Correctly update the rank in `Scheduler::select()`.

Found by inspection.

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

6 years ago[llvm-mca][x86] Add SET/TEST instruction resource tests
Simon Pilgrim [Wed, 1 Aug 2018 15:29:47 +0000 (15:29 +0000)]
[llvm-mca][x86] Add SET/TEST instruction resource tests

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

6 years agoAMDGPU: Allow fp32-denormals feature for r600 targets
Jan Vesely [Wed, 1 Aug 2018 15:04:36 +0000 (15:04 +0000)]
AMDGPU: Allow fp32-denormals feature for r600 targets

This was accidentally removed in r335942.

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

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

6 years ago[ARM] Armv8.2-A FP16 vector intrinsics tests
Sjoerd Meijer [Wed, 1 Aug 2018 14:43:59 +0000 (14:43 +0000)]
[ARM] Armv8.2-A FP16 vector intrinsics tests

Clang support for the Armv8.2-A FP16 vector intrinsic was committed in
rC328277, but this was never followed up, i.e. the LLVM part is missing.

I've raised PR38404, and this is the first step to address this. I.e.,
this adds tests for the Armv8.2-A FP16 vector intrinsic, and thus shows
which intrinsics already work, and which need further work.

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

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

6 years ago[llvm-exegesis] Provide a way to handle memory instructions.
Guillaume Chatelet [Wed, 1 Aug 2018 14:41:45 +0000 (14:41 +0000)]
[llvm-exegesis] Provide a way to handle memory instructions.

Summary:
And implement memory instructions on X86.

This fixes PR36906.

Reviewers: gchatelet

Reviewed By: gchatelet

Subscribers: lebedev.ri, filcab, mgorny, tschuett, RKSimon, llvm-commits

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

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

6 years ago[llvm-mca][x86] Add LEA instruction resource tests
Simon Pilgrim [Wed, 1 Aug 2018 14:25:33 +0000 (14:25 +0000)]
[llvm-mca][x86] Add LEA instruction resource tests

We already added these to btver2, now add them to other targets, even though none of their models treat them specially (yet).

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

6 years ago[llvm-mca][x86] Add more x86-64 system instruction resource tests
Simon Pilgrim [Wed, 1 Aug 2018 14:18:09 +0000 (14:18 +0000)]
[llvm-mca][x86] Add more x86-64 system instruction resource tests

CPUID, IN/OUT, INS/OUTS, INT, PAUSE, SCAS, UD2, XLAT

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

6 years ago[FPEnv] Widen illegal width StrictFP vector operations as needed
Cameron McInally [Wed, 1 Aug 2018 14:17:19 +0000 (14:17 +0000)]
[FPEnv] Widen illegal width StrictFP vector operations as needed

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

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

6 years agoClear release notes and update version
Hans Wennborg [Wed, 1 Aug 2018 13:58:00 +0000 (13:58 +0000)]
Clear release notes and update version

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

6 years ago[AArch64] Fix FCCMP with FP16 operands
Bryan Chan [Wed, 1 Aug 2018 13:50:29 +0000 (13:50 +0000)]
[AArch64] Fix FCCMP with FP16 operands

Summary: This patch adds support for FCCMP instruction with FP16 operands, avoiding an assertion during instruction selection.

Reviewers: olista01, SjoerdMeijer, t.p.northover, javed.absar

Reviewed By: SjoerdMeijer

Subscribers: kristof.beyls, llvm-commits

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

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

6 years ago[llvm-mca][x86] Add CLFLUSHOPT instruction resource tests
Simon Pilgrim [Wed, 1 Aug 2018 13:34:17 +0000 (13:34 +0000)]
[llvm-mca][x86] Add CLFLUSHOPT instruction resource tests

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

6 years agoBump the trunk version to 8.0.0svn
Hans Wennborg [Wed, 1 Aug 2018 13:25:30 +0000 (13:25 +0000)]
Bump the trunk version to 8.0.0svn

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

6 years ago[dsymutil] Convert recursion in lookForDIEsToKeep into worklist.
Jonas Devlieghere [Wed, 1 Aug 2018 13:24:39 +0000 (13:24 +0000)]
[dsymutil] Convert recursion in lookForDIEsToKeep into worklist.

The functions `lookForDIEsToKeep` and `keepDIEAndDependencies` can have
some very deep recursion. This tackles part of this problem by removing
the recursion from `lookForDIEsToKeep` by turning it into a worklist.

The difficulty in doing so is the computation of incompleteness, which
depends on the incompleteness of its children. To compute this, we
insert "continuation markers" into the worklist. This informs the work
loop to (re)compute the incompleteness property of the DIE associated
with it (i.e. the parent of the previously processed DIE).

This patch should generate byte-identical output. Unfortunately it also
has some impact of performance, regressing by about 4% when processing
clang on my machine.

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

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

6 years ago[llvm-mca][x86] Add CMPS/LODS/MOVS/STOS string instruction resource tests
Simon Pilgrim [Wed, 1 Aug 2018 13:14:45 +0000 (13:14 +0000)]
[llvm-mca][x86] Add CMPS/LODS/MOVS/STOS string instruction resource tests

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

6 years ago[X86] Use isNullConstant helper. NFCI.
Simon Pilgrim [Wed, 1 Aug 2018 13:06:14 +0000 (13:06 +0000)]
[X86] Use isNullConstant helper. NFCI.

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

6 years agoFix "not all control paths return a value" MSVC warning.
Simon Pilgrim [Wed, 1 Aug 2018 13:00:11 +0000 (13:00 +0000)]
Fix "not all control paths return a value" MSVC warning.

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

6 years ago[MC] Report fatal error for DWARF types for non-ELF object files
Jonas Devlieghere [Wed, 1 Aug 2018 12:53:06 +0000 (12:53 +0000)]
[MC] Report fatal error for DWARF types for non-ELF object files

Getting the DWARF types section is only implemented for ELF object
files. We already disabled emitting debug types in clang (r337717), but
now we also report an fatal error (rather than crashing) when trying to
obtain this section in MC. Additionally we ignore the generate debug
types flag for unsupported target triples.

See PR38190 for more information.

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

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

6 years ago[AMDGPU] Optimize _L image intrinsic to _LZ when lod is zero
Ryan Taylor [Wed, 1 Aug 2018 12:12:01 +0000 (12:12 +0000)]
[AMDGPU] Optimize _L image intrinsic to _LZ when lod is zero

Summary:
Add _L to _LZ image intrinsic table mapping to table gen.
In ISelLowering check if image intrinsic has lod and if it's equal
to zero, if so remove lod and change opcode to equivalent mapped _LZ.

Change-Id: Ie24cd7e788e2195d846c7bd256151178cbb9ec71

Subscribers: arsenm, mehdi_amini, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, steven_wu, dexonsmith, llvm-commits

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

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

6 years agoFix build bot after r338521
Ulrich Weigand [Wed, 1 Aug 2018 12:07:32 +0000 (12:07 +0000)]
Fix build bot after r338521

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

6 years ago[SystemZ, TableGen] Fix shift count handling
Ulrich Weigand [Wed, 1 Aug 2018 11:57:58 +0000 (11:57 +0000)]
[SystemZ, TableGen] Fix shift count handling

The DAG combiner logic to simplify AND masks in shift counts is invalid.
While it is true that the SystemZ shift instructions ignore all but the
low 6 bits of the shift count, it is still invalid to simplify the AND
masks while the DAG still uses the standard shift operators (which are
*not* defined to match the SystemZ instruction behavior).

Instead, this patch performs equivalent operations during instruction
selection. For completely removing the AND, this now happens via
additional DAG match patterns implemented by a multi-alternative
PatFrags. For simplifying a 32-bit AND to a 16-bit AND, the existing DAG
patterns were already mostly OK, they just needed an output XForm to
actually truncate the immediate value.

Unfortunately, the latter change also exposed a bug in TableGen: it
seems XForms are currently only handled correctly for direct operands of
the outermost operation node. This patch also fixes that bug by simply
recurring through the whole pattern. This should be NFC for all other
targets.

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

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

6 years ago[X86] Use isNullConstant helper. NFCI.
Simon Pilgrim [Wed, 1 Aug 2018 11:24:11 +0000 (11:24 +0000)]
[X86] Use isNullConstant helper. NFCI.

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

6 years ago[llvm-mca][x86] Add STC + STD instruction resource tests
Simon Pilgrim [Wed, 1 Aug 2018 11:00:11 +0000 (11:00 +0000)]
[llvm-mca][x86] Add STC + STD instruction resource tests

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

6 years ago[llvm-mca] Improve code comments. NFC.
Andrea Di Biagio [Wed, 1 Aug 2018 10:49:01 +0000 (10:49 +0000)]
[llvm-mca] Improve code comments. NFC.

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

6 years ago[DebugInfo] Remove ambiguity to fix Windows bots
Jonas Devlieghere [Wed, 1 Aug 2018 10:40:08 +0000 (10:40 +0000)]
[DebugInfo] Remove ambiguity to fix Windows bots

Should fix the MSVC bots by explicitly invoking
llvm::make_reverse_iterator to remove ambiguity with
std::make_reverse_iterator.

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

6 years ago[DebugInfo] Improve consistency in DWARFDie.h (NFC)
Jonas Devlieghere [Wed, 1 Aug 2018 10:30:34 +0000 (10:30 +0000)]
[DebugInfo] Improve consistency in DWARFDie.h (NFC)

Follow-up for r338506 with some unrelated changes in formatting and
consistency.

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

6 years ago[X86] Improved sched models for X86 BT*rr instructions.
Andrew V. Tischenko [Wed, 1 Aug 2018 10:24:27 +0000 (10:24 +0000)]
[X86] Improved sched models for X86 BT*rr instructions.
Differential Revision: https://reviews.llvm.org/D49243

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

6 years ago[DebugInfo] Have custom std::reverse_iterator<DWARFDie>
Jonas Devlieghere [Wed, 1 Aug 2018 10:24:17 +0000 (10:24 +0000)]
[DebugInfo] Have custom std::reverse_iterator<DWARFDie>

The DWARFDie is a lightweight utility wrapper that stores a pointer to a
compile unit and a debug info entry. Currently, its iterator (used for
walking over its children) stores a DWARFDie and returns a const
reference when dereferencing it.

When the iterator is modified (by incrementing or decrementing it), this
reference becomes invalid. This was happening when calling reverse on
it, because the std::reverse_iterator is keeping a temporary copy of the
iterator (see
https://en.cppreference.com/w/cpp/iterator/reverse_iterator for a good
illustration).

The relevant code in libcxx:

  reference operator*() const {_Iter __tmp = current; return *--__tmp;}

When dereferencing the reverse iterator, we decrement and return a
reference to a DWARFDie stored in the stack frame of this function,
resulting in UB at runtime.

This patch specifies the std::reverse_iterator for DWARFDie to do the
right thing.

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

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

6 years ago[MIPS GlobalISel] Select global address
Petar Jovanovic [Wed, 1 Aug 2018 09:03:23 +0000 (09:03 +0000)]
[MIPS GlobalISel] Select global address

Select G_GLOBAL_VALUE for position dependent code.

Patch by Petar Avramovic.

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

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

6 years agoRevert "Enrich inline messages", tests fail
David Bolvansky [Wed, 1 Aug 2018 08:02:40 +0000 (08:02 +0000)]
Revert "Enrich inline messages", tests fail

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

6 years agoAdd llvm-rc to LLVM_TOOLCHAIN_TOOLS (PR38386)
Hans Wennborg [Wed, 1 Aug 2018 07:51:55 +0000 (07:51 +0000)]
Add llvm-rc to LLVM_TOOLCHAIN_TOOLS (PR38386)

This means it will be installed also in builds configured with
LLVM_INSTALL_TOOLCHAIN_ONLY, such as the Windows packages.

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

6 years agoEnrich inline messages
David Bolvansky [Wed, 1 Aug 2018 07:37:16 +0000 (07:37 +0000)]
Enrich inline messages

Summary:
This patch improves Inliner to provide causes/reasons for negative inline decisions.
1. It adds one new message field to InlineCost to report causes for Always and Never instances. All Never and Always instantiations must provide a simple message.
2. Several functions that used to return the inlining results as boolean are changed to return InlineResult which carries the cause for negative decision.
3. Changed remark priniting and debug output messages to provide the additional messages and related inline cost.
4. Adjusted tests for changed printing.

Patch by: yrouban (Yevgeny Rouban)

Reviewers: craig.topper, sammccall, sgraenitz, NutshellySima, shchenz, chandlerc, apilipenko, javed.absar, tejohnson, dblaikie, sanjoy, eraman, xbolva00

Reviewed By: tejohnson, xbolva00

Subscribers: xbolva00, llvm-commits, arsenm, mehdi_amini, eraman, haicheng, steven_wu, dexonsmith

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

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

6 years ago[AArch64] Disallow the MachO specific .loh directive for windows
Martin Storsjo [Wed, 1 Aug 2018 06:50:18 +0000 (06:50 +0000)]
[AArch64] Disallow the MachO specific .loh directive for windows

Also add a test for it being unsupported for linux.

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

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

6 years ago[X86] When looking for (CMOV C-1, (ADD (CTTZ X), C), (X != 0)) -> (ADD (CMOV (CTTZ...
Craig Topper [Wed, 1 Aug 2018 06:36:20 +0000 (06:36 +0000)]
[X86] When looking for (CMOV C-1, (ADD (CTTZ X), C), (X != 0)) -> (ADD (CMOV (CTTZ X), -1, (X != 0)), C), make sure we really have a compare with 0.

It's not strictly required by the transform of the cmov and the add, but it makes sure we restrict it to the cases we know we want to match.

While there canonicalize the operand order of the cmov to simplify the matching and emitting code.

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

6 years ago[DWARF] Basic support for producing DWARFv5 .debug_addr section
Victor Leschuk [Wed, 1 Aug 2018 05:48:06 +0000 (05:48 +0000)]
[DWARF] Basic support for producing DWARFv5 .debug_addr section

This revision implements support for generating DWARFv5 .debug_addr section.
The implementation is pretty straight-forward: we just check the dwarf version
and emit section header if needed.

Reviewers: aprantl, dblaikie, probinson

Reviewed by: dblaikie

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

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

6 years ago[InstSimplify] fold extracting from std::pair (1/2)
Hiroshi Inoue [Wed, 1 Aug 2018 04:40:32 +0000 (04:40 +0000)]
[InstSimplify] fold extracting from std::pair (1/2)

This patch intends to enable jump threading when a method whose return type is std::pair<int, bool> or std::pair<bool, int> is inlined.
For example, jump threading does not happen for the if statement in func.

std::pair<int, bool> callee(int v) {
  int a = dummy(v);
  if (a) return std::make_pair(dummy(v), true);
  else return std::make_pair(v, v < 0);
}

int func(int v) {
  std::pair<int, bool> rc = callee(v);
  if (rc.second) {
    // do something
  }

SROA executed before the method inlining replaces std::pair by i64 without splitting in both callee and func since at this point no access to the individual fields is seen to SROA.
After inlining, jump threading fails to identify that the incoming value is a constant due to additional instructions (like or, and, trunc).

This series of patch add patterns in InstructionSimplify to fold extraction of members of std::pair. To help jump threading, actually we need to optimize the code sequence spanning multiple BBs.
These patches does not handle phi by itself, but these additional patterns help NewGVN pass, which calls instsimplify to check opportunities for simplifying instructions over phi, apply phi-of-ops optimization to result in successful jump threading.
SimplifyDemandedBits in InstCombine, can do more general optimization but this patch aims to provide opportunities for other optimizers by supporting a simple but common case in InstSimplify.

This first patch in the series handles code sequences that merges two values using shl and or and then extracts one value using lshr.

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

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

6 years ago[DebugInfo] Fix build failed in clang-x86_64-linux-selfhost-modules.
Hsiangkai Wang [Wed, 1 Aug 2018 04:17:41 +0000 (04:17 +0000)]
[DebugInfo] Fix build failed in clang-x86_64-linux-selfhost-modules.

Only generate symbol difference expression if needed.

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

6 years ago[X86] Adding more test patterns for lea-opt (PR37939)
Jatin Bhateja [Wed, 1 Aug 2018 03:53:27 +0000 (03:53 +0000)]
[X86] Adding more test patterns for lea-opt (PR37939)

Subscribers: llvm-commits

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

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

6 years ago[x86] Fix a really subtle miscompile due to a somewhat glaring bug in
Chandler Carruth [Wed, 1 Aug 2018 03:01:58 +0000 (03:01 +0000)]
[x86] Fix a really subtle miscompile due to a somewhat glaring bug in
EFLAGS copy lowering.

If you have a branch of LLVM, you may want to cherrypick this. It is
extremely unlikely to hit this case empirically, but it will likely
manifest as an "impossible" branch being taken somewhere, and will be
... very hard to debug.

Hitting this requires complex conditions living across complex control
flow combined with some interesting memory (non-stack) initialized with
the results of a comparison. Also, because you have to arrange for an
EFLAGS copy to be in *just* the right place, almost anything you do to
the code will hide the bug. I was unable to reduce anything remotely
resembling a "good" test case from the place where I hit it, and so
instead I have constructed synthetic MIR testing that directly exercises
the bug in question (as well as the good behavior for completeness).

The issue is that we would mistakenly assume any SETcc with a valid
condition and an initial operand that was a register and a virtual
register at that to be a register *defining* SETcc...

It isn't though....

This would in turn cause us to test some other bizarre register,
typically the base pointer of some memory. Now, testing this register
and using that to branch on doesn't make any sense. It even fails the
machine verifier (if you are running it) due to the wrong register
class. But it will make it through LLVM, assemble, and it *looks*
fine... But wow do you get a very unsual and surprising branch taken in
your actual code.

The fix is to actually check what kind of SETcc instruction we're
dealing with. Because there are a bunch of them, I just test the
may-store bit in the instruction. I've also added an assert for sanity
that ensure we are, in fact, *defining* the register operand. =D

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

6 years ago[x86/slh] Add unwind info to several tests to make it more obvious that
Chandler Carruth [Wed, 1 Aug 2018 03:01:10 +0000 (03:01 +0000)]
[x86/slh] Add unwind info to several tests to make it more obvious that
we aren't incorrectly generating any of it when doing SLH.

There was a bug that only occured with SLH that very much looked like it
could be caused by bad unwind info, and so this was a prime suspect.
Turns out that everything is fine, but this way we'll *see* if we end
up, for example, putting things we shouldn't inside the prolog.

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

6 years ago[DebugInfo] Generate fixups as emitting DWARF .debug_line.
Hsiangkai Wang [Wed, 1 Aug 2018 02:18:06 +0000 (02:18 +0000)]
[DebugInfo] Generate fixups as emitting DWARF .debug_line.

It is necessary to generate fixups in .debug_line as relaxation is
enabled due to the address delta may be changed after relaxation.

DWARF will record the mappings of lines and addresses in
.debug_line section. It will encode the information using special
opcodes, standard opcodes and extended opcodes in Line Number
Program. I use DW_LNS_fixed_advance_pc to encode fixed length
address delta and DW_LNE_set_address to encode absolute address
to make it possible to generate fixups in .debug_line section.

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

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

6 years ago[GlobalISel][IRTranslator] Use RPO traversal when visiting blocks to translate.
Amara Emerson [Wed, 1 Aug 2018 02:17:42 +0000 (02:17 +0000)]
[GlobalISel][IRTranslator] Use RPO traversal when visiting blocks to translate.

Previously we were just visiting the blocks in the function in IR order, which
is rather arbitrary. Therefore we wouldn't always visit defs before uses, but
the translation code relies on this assumption in some places.

Only codegen change seen in tests is an elision of a redundant copy.

Fixes PR38396

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

6 years agoAMDGPU: Add clamp bit to dot intrinsics
Konstantin Zhuravlyov [Wed, 1 Aug 2018 01:31:30 +0000 (01:31 +0000)]
AMDGPU: Add clamp bit to dot intrinsics

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

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

6 years agoSimplify selectELFSectionForGlobal by pulling out the entry size
Eric Christopher [Wed, 1 Aug 2018 01:29:30 +0000 (01:29 +0000)]
Simplify selectELFSectionForGlobal by pulling out the entry size
determination for mergeable sections into a small static function.

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

6 years agoTidy up logic around unique section name creation and remove a
Eric Christopher [Wed, 1 Aug 2018 01:03:34 +0000 (01:03 +0000)]
Tidy up logic around unique section name creation and remove a
mostly unused variable.

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

6 years ago[MachineOutliner] Clean up subtarget handling.
Eli Friedman [Wed, 1 Aug 2018 00:37:20 +0000 (00:37 +0000)]
[MachineOutliner] Clean up subtarget handling.

Call shouldOutlineFromFunctionByDefault, isFunctionSafeToOutlineFrom,
getOutliningType, and getMachineOutlinerMBBFlags using the correct
TargetInstrInfo. And don't create a MachineFunction for a function
declaration.

The call to getOutliningCandidateInfo is still a little weird, but at
least the weirdness is explicitly called out.

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

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

6 years ago[PATCH] [SLC] Test simplification of pow() for vector types (NFC)
Evandro Menezes [Wed, 1 Aug 2018 00:30:43 +0000 (00:30 +0000)]
[PATCH] [SLC] Test simplification of pow() for vector types (NFC)

Add test case for the simplification of `pow()` for vector types that D50035
enables.

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

6 years agoRevert r338354 "[ARM] Revert r337821"
Reid Kleckner [Tue, 31 Jul 2018 23:09:42 +0000 (23:09 +0000)]
Revert r338354 "[ARM] Revert r337821"

Disable ARMCodeGenPrepare by default again. It is causing verifier
failues in V8 that look like:

  Duplicate integer as switch case
  switch i32 %trunc, label %if.end13 [
    i32 0, label %cleanup36
    i32 0, label %if.then8
  ], !dbg !4981
  i32 0
  fatal error: error in backend: Broken function found, compilation aborted!

I will continue reducing the test case and send it along.

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

6 years ago[WebAssembly] Fix debug info tests after r338437.
David L. Jones [Tue, 31 Jul 2018 22:24:14 +0000 (22:24 +0000)]
[WebAssembly] Fix debug info tests after r338437.

After r338437, debug_ranges are no longer emitted. Previously, this was only
done for DWARF version 5 and above.

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

6 years ago[DWARF] Support for .debug_addr (consumer)
Victor Leschuk [Tue, 31 Jul 2018 22:19:19 +0000 (22:19 +0000)]
[DWARF] Support for .debug_addr (consumer)

  This patch implements basic support for parsing
  and dumping DWARFv5 .debug_addr section.

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

6 years ago[SLC] Refactor the simplication of pow() (NFC)
Evandro Menezes [Tue, 31 Jul 2018 22:11:02 +0000 (22:11 +0000)]
[SLC] Refactor the simplication of pow() (NFC)

Reword comments and minor code reformatting.

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

6 years ago[llvm-objcopy] Make --strip-debug strip .gdb_index
Fangrui Song [Tue, 31 Jul 2018 21:26:35 +0000 (21:26 +0000)]
[llvm-objcopy] Make --strip-debug strip .gdb_index

Summary:
See binutils-gdb/bfd/elf.c, GNU objcopy also strips .stab* (STABS)
.line* (DWARF 1) .gnu.linkonce.wi.* (linkonce section for .debug_info) but
I'm not sure we need to be compatible with it.

Reviewers: dblaikie, alexshap, jakehehrlich, jhenderson

Reviewed By: alexshap, jakehehrlich

Subscribers: aprantl, JDevlieghere, jakehehrlich, llvm-commits

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

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