platform/upstream/llvm.git
4 years ago[MIPS][ELF] Use PC-relative relocations in .eh_frame when possible
Alex Richardson [Sun, 12 Jan 2020 10:55:15 +0000 (10:55 +0000)]
[MIPS][ELF] Use PC-relative relocations in .eh_frame when possible

When compiling position-independent executables, we now use
DW_EH_PE_pcrel | DW_EH_PE_sdata4. However, the MIPS ABI does not define a
64-bit PC-relative ELF relocation so we cannot use sdata8 for the large
code model case. When using the large code model, we fall back to the
previous behaviour of generating absolute relocations.

With this change clang-generated .o files can be linked by LLD without
having to pass -Wl,-z,notext (which creates text relocations).
This is simpler than the approach used by ld.bfd, which rewrites the
.eh_frame section to convert absolute relocations into relative references.

I saw in D13104 that apparently ld.bfd did not accept pc-relative relocations
for MIPS ouput at some point. However, I also checked that recent ld.bfd
can process the clang-generated .o files so this no longer seems true.

Reviewed By: atanasyan
Differential Revision: https://reviews.llvm.org/D72228

4 years ago[InstSimplify] move tests for select from InstCombine; NFC
Sanjay Patel [Mon, 13 Jan 2020 14:10:02 +0000 (09:10 -0500)]
[InstSimplify] move tests for select from InstCombine; NFC

InstCombine has transforms that would enable these simplifications
in an indirect way, but those transforms are unsafe and likely to
be removed.

4 years ago[SelectionDAG] ComputeNumSignBits - Use getValidShiftAmountConstant for shift opcodes
Simon Pilgrim [Mon, 13 Jan 2020 14:11:57 +0000 (14:11 +0000)]
[SelectionDAG] ComputeNumSignBits - Use getValidShiftAmountConstant for shift opcodes

getValidShiftAmountConstant handles out of bounds shift amounts for us, allowing us to remove the local handling.

4 years ago[SelectionDAG] ComputeKnownBits - Add DemandedElts support to getValidShiftAmountCons...
Simon Pilgrim [Mon, 13 Jan 2020 13:35:12 +0000 (13:35 +0000)]
[SelectionDAG] ComputeKnownBits - Add DemandedElts support to getValidShiftAmountConstant/getValidMinimumShiftAmountConstant()

4 years ago[X86] Add knownbits tests showing missing shift amount demanded elts handling.
Simon Pilgrim [Mon, 13 Jan 2020 13:11:46 +0000 (13:11 +0000)]
[X86] Add knownbits tests showing missing shift amount demanded elts handling.

4 years agoRevert "[libc++] Explicitly enumerate std::string external instantiations."
Oliver Stannard [Mon, 13 Jan 2020 13:54:04 +0000 (13:54 +0000)]
Revert "[libc++] Explicitly enumerate std::string external instantiations."

This is causing failures for multiple buildbots and bootstrap builds,
details at https://reviews.llvm.org/rG61bd1920.

This reverts commit 61bd19206f61ace4b007838a2ff8884a13ec0374.

4 years ago[FPEnv] Fix chain handling for fpexcept.strict nodes
Ulrich Weigand [Mon, 13 Jan 2020 13:37:07 +0000 (14:37 +0100)]
[FPEnv] Fix chain handling for fpexcept.strict nodes

We need to ensure that fpexcept.strict nodes are not optimized away even if
the result is unused. To do that, we need to chain them into the block's
terminator nodes, like already done for PendingExcepts.

This patch adds two new lists of pending chains, PendingConstrainedFP and
PendingConstrainedFPStrict to hold constrained FP intrinsic nodes without
and with fpexcept.strict markers. This allows not only to solve the above
problem, but also to relax chains a bit further by no longer flushing all
FP nodes before a store or other memory access. (They are still flushed
before nodes with other side effects.)

Reviewed By: craig.topper

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

4 years agoGlobalISel: Fix assertion on wide G_ZEXT sources
Matt Arsenault [Fri, 10 Jan 2020 22:50:45 +0000 (17:50 -0500)]
GlobalISel: Fix assertion on wide G_ZEXT sources

It's possible to have a type that needs a mask greater than 64-bits.

4 years ago[llvm-exegesis] Remove unneeded std::move()
Miloš Stojanović [Mon, 13 Jan 2020 13:04:56 +0000 (14:04 +0100)]
[llvm-exegesis] Remove unneeded std::move()

Caught by buildbot breakage:

/home/docker/worker_env/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm/llvm/tools/llvm-exegesis/lib/Mips/Target.cpp:89:12: error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move]
    return std::move(Instructions);
           ^
/home/docker/worker_env/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm/llvm/tools/llvm-exegesis/lib/Mips/Target.cpp:89:12: note: remove std::move call here
    return std::move(Instructions);
           ^~~~~~~~~~            ~

4 years ago[lldb][NFC] Remove debug print statement from TestExprDiagnostics.py
Raphael Isemann [Mon, 13 Jan 2020 13:17:55 +0000 (14:17 +0100)]
[lldb][NFC] Remove debug print statement from TestExprDiagnostics.py

4 years ago[clang] Remove raw string literals in macros
Oliver Stannard [Mon, 13 Jan 2020 12:38:39 +0000 (12:38 +0000)]
[clang] Remove raw string literals in macros

Older (but still supported) versions of GCC don't handle C++11 raw
string literals in macro parameters correctly.

4 years ago[SelectionDAG] ComputeKnownBits add getValidMinimumShiftAmountConstant() ISD::SHL...
Simon Pilgrim [Mon, 13 Jan 2020 12:01:56 +0000 (12:01 +0000)]
[SelectionDAG] ComputeKnownBits add getValidMinimumShiftAmountConstant() ISD::SHL support

As mentioned on D72573

4 years ago[X86][SSE] Add knownbits test showing missing getValidMinimumShiftAmountConstant...
Simon Pilgrim [Mon, 13 Jan 2020 11:51:12 +0000 (11:51 +0000)]
[X86][SSE] Add knownbits test showing missing getValidMinimumShiftAmountConstant() ISD::SHL support

As mentioned on D72573

4 years ago[clangd] Remove raw string literals in macros
Oliver Stannard [Mon, 13 Jan 2020 11:44:14 +0000 (11:44 +0000)]
[clangd] Remove raw string literals in macros

Older (but still supported) versions of GCC don't handle C++11 raw
string literals in macro parameters correctly.

4 years ago[llvm-exegesis][mips] Expand loadImmediate()
Miloš Stojanović [Wed, 25 Dec 2019 10:23:01 +0000 (11:23 +0100)]
[llvm-exegesis][mips] Expand loadImmediate()

Add support for loading 32-bit immediates and enable the use of GPR64
registers.

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

4 years ago[SelectionDAG] ComputeKnownBits - minimum leading/trailing zero bits in LSHR/SHL...
Simon Pilgrim [Mon, 13 Jan 2020 11:07:53 +0000 (11:07 +0000)]
[SelectionDAG] ComputeKnownBits - minimum leading/trailing zero bits in LSHR/SHL (PR44526)

As detailed in https://blog.regehr.org/archives/1709 we don't make use of the known leading/trailing zeros for shifted values in cases where we don't know the shift amount value.

This patch adds support to SelectionDAG::ComputeKnownBits to use KnownBits::countMinTrailingZeros and countMinLeadingZeros to set the minimum guaranteed leading/trailing known zero bits.

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

4 years ago[X86] Fix MSVC "truncation from 'int' to 'bool'" warning. NFCI.
Simon Pilgrim [Mon, 13 Jan 2020 10:52:22 +0000 (10:52 +0000)]
[X86] Fix MSVC "truncation from 'int' to 'bool'" warning. NFCI.

4 years ago[lldb] Fix lookup of symbols with the same address range but different binding
Jan Kratochvil [Mon, 13 Jan 2020 11:03:14 +0000 (12:03 +0100)]
[lldb] Fix lookup of symbols with the same address range but different binding

This fixes a failing testcase on Fedora 30 x86_64 (regression Fedora 29->30):

PASS:
./bin/lldb ./lldb-test-build.noindex/functionalities/unwind/noreturn/TestNoreturnUnwind.test_dwarf/a.out -o 'settings set symbols.enable-external-lookup false' -o r -o bt -o quit
  * frame #0: 0x00007ffff7aa6e75 libc.so.6`__GI_raise + 325
    frame #1: 0x00007ffff7a91895 libc.so.6`__GI_abort + 295
    frame #2: 0x0000000000401140 a.out`func_c at main.c:12:2
    frame #3: 0x000000000040113a a.out`func_b at main.c:18:2
    frame #4: 0x0000000000401134 a.out`func_a at main.c:26:2
    frame #5: 0x000000000040112e a.out`main(argc=<unavailable>, argv=<unavailable>) at main.c:32:2
    frame #6: 0x00007ffff7a92f33 libc.so.6`__libc_start_main + 243
    frame #7: 0x000000000040106e a.out`_start + 46

vs.

FAIL - unrecognized abort() function:
./bin/lldb ./lldb-test-build.noindex/functionalities/unwind/noreturn/TestNoreturnUnwind.test_dwarf/a.out -o 'settings set symbols.enable-external-lookup false' -o r -o bt -o quit
  * frame #0: 0x00007ffff7aa6e75 libc.so.6`.annobin_raise.c + 325
    frame #1: 0x00007ffff7a91895 libc.so.6`.annobin_loadmsgcat.c_end.unlikely + 295
    frame #2: 0x0000000000401140 a.out`func_c at main.c:12:2
    frame #3: 0x000000000040113a a.out`func_b at main.c:18:2
    frame #4: 0x0000000000401134 a.out`func_a at main.c:26:2
    frame #5: 0x000000000040112e a.out`main(argc=<unavailable>, argv=<unavailable>) at main.c:32:2
    frame #6: 0x00007ffff7a92f33 libc.so.6`.annobin_libc_start.c + 243
    frame #7: 0x000000000040106e a.out`.annobin_init.c.hot + 46

The extra ELF symbols are there due to Annobin (I did not investigate why this
problem happened specifically since F-30 and not since F-28).

It is due to:

Symbol table '.dynsym' contains 2361 entries:
Valu e          Size Type   Bind   Vis     Name
0000000000022769   5 FUNC   LOCAL  DEFAULT _nl_load_domain.cold
000000000002276e   0 NOTYPE LOCAL  HIDDEN  .annobin_abort.c.unlikely
...
000000000002276e   0 NOTYPE LOCAL  HIDDEN  .annobin_loadmsgcat.c_end.unlikely
...
000000000002276e   0 NOTYPE LOCAL  HIDDEN  .annobin_textdomain.c_end.unlikely
000000000002276e 548 FUNC   GLOBAL DEFAULT abort
000000000002276e 548 FUNC   GLOBAL DEFAULT abort@@GLIBC_2.2.5
000000000002276e 548 FUNC   LOCAL  DEFAULT __GI_abort
0000000000022992   0 NOTYPE LOCAL  HIDDEN  .annobin_abort.c_end.unlikely

GDB has some more complicated preferences between overlapping and/or sharing
address symbols, I have made here so far the most simple fix for this case.

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

4 years ago[lldb][NFC] Use range-based for loops in IRInterpreter
Raphael Isemann [Mon, 13 Jan 2020 10:05:53 +0000 (11:05 +0100)]
[lldb][NFC] Use range-based for loops in IRInterpreter

4 years ago[DebugInfo][Support] Replace DWARFDataExtractor size function
James Henderson [Mon, 13 Jan 2020 09:30:52 +0000 (09:30 +0000)]
[DebugInfo][Support] Replace DWARFDataExtractor size function

This patch adds a new size function to the base DataExtractor class,
which removes the need for the DWARFDataExtractor size function.

It is unclear why DWARFDataExtractor's size function returned zero in
some circumstances (i.e. when it is constructed without a section, and
with a different data source instead), so that behaviour has changed.
The old behaviour could cause an assertion in the debug line parser, as
the size did not reflect the actual data available, and could be lower
than the current offset being parsed.

Reviewed by: dblaikie

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

4 years agoARMLowOverheadLoops: return earlier to avoid printing irrelevant dbg msg. NFC
Sjoerd Meijer [Mon, 13 Jan 2020 10:20:04 +0000 (10:20 +0000)]
ARMLowOverheadLoops: return earlier to avoid printing irrelevant dbg msg. NFC

4 years agoThis option allows selecting the TLS size in the local exec TLS model,
KAWASHIMA Takahiro [Mon, 13 Jan 2020 09:28:02 +0000 (09:28 +0000)]
This option allows selecting the TLS size in the local exec TLS model,
which is the default TLS model for non-PIC objects. This allows large/
many thread local variables or a compact/fast code in an executable.

Specification is same as that of GCC. For example, the code model
option precedes the TLS size option.

TLS access models other than local-exec are not changed. It means
supoort of the large code model is only in the local exec TLS model.

Patch By KAWASHIMA Takahiro (kawashima-fj <t-kawashima@fujitsu.com>)
Reviewers: dmgreen, mstorsjo, t.p.northover, peter.smith, ostannard
Reviewd By: peter.smith
Committed by: peter.smith

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

4 years ago[lldb] Fix eh-frame-small-fde test for changes in lld
Pavel Labath [Mon, 13 Jan 2020 10:09:47 +0000 (11:09 +0100)]
[lldb] Fix eh-frame-small-fde test for changes in lld

lld in 2bfee35 started emitting relocations for some intra-section jumps
between global symbols. This shifted the code around a bit, invalidating
text expectations.

Change the symbols to local to keep the previous behavior.

4 years agoRevert "[DWARF5][clang]: Added support for DebugInfo generation for auto return type...
Sam McCall [Mon, 13 Jan 2020 10:12:51 +0000 (11:12 +0100)]
Revert "[DWARF5][clang]: Added support for DebugInfo generation for auto return type for C++ member functions."

This reverts commit 6d6a4590c5d4c7fc7445d72fe685f966b0a8cafb, which
introduces a crash.

See https://reviews.llvm.org/D70524 for details.

4 years ago[clangd] Publish xref for macros from Index and AST.
Utkarsh Saxena [Wed, 8 Jan 2020 12:57:00 +0000 (13:57 +0100)]
[clangd] Publish xref for macros from Index and AST.

Summary:
With this patch the `findReferences` API will return Xref for macros.
If the symbol under the cursor is a macro then we collect the references to it from:
1. Main file by looking at the ParsedAST. (These were added to the ParsedAST in https://reviews.llvm.org/D70008)
2. Files other than the mainfile by looking at the:
* static index (Added in https://reviews.llvm.org/D70489)
* file index (Added in https://reviews.llvm.org/D71406)
This patch collects all the xref from the above places and outputs it in `findReferences` API.

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

4 years ago[RISCV] Collect Statistics on Compressed Instructions
Sam Elliott [Mon, 13 Jan 2020 10:03:33 +0000 (10:03 +0000)]
[RISCV] Collect Statistics on Compressed Instructions

Summary:
It is useful to keep statistics on how many instructions we have
compressed, so we can see if future changes are increasing or decreasing this
number.

Reviewers: asb, luismarques

Reviewed By: asb, luismarques

Subscribers: xbolva00, sameer.abuasal, hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, s.egerton, pzheng, llvm-commits

Tags: #llvm

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

4 years ago[lldb] Mark several tests as not dependent on debug info
Raphael Isemann [Mon, 13 Jan 2020 09:00:06 +0000 (10:00 +0100)]
[lldb] Mark several tests as not dependent on debug info

Summary:
This just adds `NO_DEBUG_INFO_TESTCASE` to tests that don't really exercise anything debug information specific
and therefore don't need to be rerun for all debug information variants.

Reviewers: labath, jingham, aprantl, mib, jfb

Reviewed By: aprantl

Subscribers: dexonsmith, JDevlieghere, lldb-commits

Tags: #lldb

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

4 years agoAdd zero_extendi and sign_extendi to intrinsic namespace
Pruthvi [Mon, 13 Jan 2020 09:16:44 +0000 (10:16 +0100)]
Add zero_extendi and sign_extendi to intrinsic namespace

Summary:
- update zero_extendi and sign_extendi in edsc/intrinsic namespace
- Builder API test for zero_extendi and sign_extendi

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

4 years ago[NFC] Update loop.decrement.reg intrinsic comment
Sam Parker [Mon, 13 Jan 2020 09:18:57 +0000 (09:18 +0000)]
[NFC] Update loop.decrement.reg intrinsic comment

Note that the intrinsic is now understood by SCEV and that other
optimisations can treat it as a sub.

4 years ago[SCEV] Follow up of D71563: addressing post commit comment. NFC.
Sjoerd Meijer [Mon, 13 Jan 2020 08:54:38 +0000 (08:54 +0000)]
[SCEV] Follow up of D71563: addressing post commit comment. NFC.

4 years ago[DWARF5][clang]: Added support for DebugInfo generation for auto return type for...
Awanish Pandey [Mon, 13 Jan 2020 07:08:00 +0000 (12:38 +0530)]
[DWARF5][clang]: Added support for DebugInfo generation for auto return type for C++ member functions.

Summary:
This patch will provide support for auto return type for the C++ member
functions.

This patch includes clang side implementation of this feature.

Patch by: Awanish Pandey <Awanish.Pandey@amd.com>

Reviewers: dblaikie, aprantl, shafik, alok, SouraVX, jini.susan.george
Reviewed by: dblaikie

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

4 years ago[DWARF5][DebugInfo]: Added support for DebugInfo generation for auto return type...
Awanish Pandey [Mon, 13 Jan 2020 06:26:18 +0000 (11:56 +0530)]
[DWARF5][DebugInfo]: Added support for DebugInfo generation for auto return type for C++ member functions.

Summary:
This patch will provide support for auto return type for the C++ member
functions. Before this return type of the member function is deduced and
stored in the DIE.
This patch includes llvm side implementation of this feature.

Patch by: Awanish Pandey <Awanish.Pandey@amd.com>

Reviewers: dblaikie, aprantl, shafik, alok, SouraVX, jini.susan.george

Reviewed by: dblaikie

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

4 years ago[X86] Use SDNPOptInGlue instead of SDNPInGlue on a couple SDNodes.
Craig Topper [Mon, 13 Jan 2020 05:10:37 +0000 (21:10 -0800)]
[X86] Use SDNPOptInGlue instead of SDNPInGlue on a couple SDNodes.

At least one of these is used without a Glue. This doesn't seem
to change the X86GenDAGISel.inc output so maybe it doesn't matter?

4 years agoAMDGPU: Split test function
Matt Arsenault [Sun, 12 Jan 2020 23:08:41 +0000 (18:08 -0500)]
AMDGPU: Split test function

This avoids slightly different scheduling/regalloc behavior, and
avoids a test diff between GlobalISel and SelectionDAG.

4 years agoAMDGPU/GlobalISel: Don't use XEXEC class for SGPRs
Matt Arsenault [Sun, 12 Jan 2020 22:10:18 +0000 (17:10 -0500)]
AMDGPU/GlobalISel: Don't use XEXEC class for SGPRs

We don't use the xexec register classes for arbitrary values
anymore. Avoids a test variance beween GlobalISel and SelectionDAG>

4 years agoAMDGPU/GlobalISel: Copy type when inserting readfirstlane
Matt Arsenault [Mon, 13 Jan 2020 00:12:59 +0000 (19:12 -0500)]
AMDGPU/GlobalISel: Copy type when inserting readfirstlane

getDefIgnoringCopies will fail to find any def if no type is set if we
try to use it on the use's operand, so propagate the type.

4 years ago[clangd] Show template arguments in type hierarchy when possible
Nathan Ridge [Thu, 19 Dec 2019 21:22:23 +0000 (16:22 -0500)]
[clangd] Show template arguments in type hierarchy when possible

Summary: Fixes https://github.com/clangd/clangd/issues/31

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[clangd] Assert that the testcases in FindExplicitReferencesTest.All have no diagnostics
Nathan Ridge [Tue, 7 Jan 2020 19:44:50 +0000 (14:44 -0500)]
[clangd] Assert that the testcases in FindExplicitReferencesTest.All have no diagnostics

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[SCEV] accurate range for addrecexpr with nuw flag
Zheng Chen [Mon, 13 Jan 2020 01:22:37 +0000 (20:22 -0500)]
[SCEV] accurate range for addrecexpr with nuw flag

If addrecexpr has nuw flag, the value should never be less than its
start value and start value does not required to be SCEVConstant.

Reviewed By: nikic, sanjoy

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

4 years ago[RISCV] Check register class for AMO memory operands
James Clarke [Mon, 13 Jan 2020 00:50:37 +0000 (00:50 +0000)]
[RISCV] Check register class for AMO memory operands

Summary:
AMO memory operands use a custom parser in order to accept both (reg)
and 0(reg). However, the validation predicate used for these operands
was only checking that they were registers, and not the register class,
so non-GPRs (such as FPRs) were also accepted. Thus, fix this by making
the predicate check that they are GPRs.

Reviewers: asb, lenary

Reviewed By: asb, lenary

Subscribers: hiraditya, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, llvm-commits

Tags: #llvm

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

4 years agoFix "pointer is null" static analyzer warnings. NFCI.
Simon Pilgrim [Sun, 12 Jan 2020 22:08:56 +0000 (22:08 +0000)]
Fix "pointer is null" static analyzer warnings. NFCI.

Use castAs<> instead of getAs<> since the pointers are dereferenced immediately and castAs will perform the null assertion for us.

4 years agoFix "pointer is null" static analyzer warning. NFCI.
Simon Pilgrim [Sun, 12 Jan 2020 21:43:11 +0000 (21:43 +0000)]
Fix "pointer is null" static analyzer warning. NFCI.

4 years ago[MC][ELF] Emit a relocation if target is defined in the same section and is non-local
Fangrui Song [Sat, 4 Jan 2020 05:44:57 +0000 (21:44 -0800)]
[MC][ELF] Emit a relocation if target is defined in the same section and is non-local

For a target symbol defined in the same section, currently we don't emit
a relocation if VariantKind is VK_None (with few exceptions like RISC-V
relaxation), while GNU as emits one. This causes program behavior
differences with and without -ffunction-sections, and can break intended
symbol interposition in a -shared link.

```
.globl foo
foo:
  call foo      # no relocation. On other targets, may be written as b foo, etc
  call bar      # a relocation if bar is in another section (e.g. -ffunction-sections)
  call foo@plt  # a relocation
```

Unify these cases by always emitting a relocation. If we ever want to
optimize `call foo` in -shared links, we should emit a STB_LOCAL alias
and call via the alias.

ARM/thumb2-beq-fixup.s: we now emit a relocation to global_thumb_fn as GNU as does.
X86/Inputs/align-branch-64-2.s: we now emit R_X86_64_PLT32 to foo as GNU does.

ELF/relax.s: rewrite the test as target-in-same-section.s .
We omitted relocations to `global` and now emit R_X86_64_PLT32.
Note, GNU as does not emit a relocation for `jmp global` (maybe its own
bug). Our new behavior is compatible except `jmp global`.

Reviewed By: peter.smith

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

4 years ago[AMDGPU] Add gfx8 assembler and disassembler test cases
Jay Foad [Sat, 11 Jan 2020 20:48:29 +0000 (20:48 +0000)]
[AMDGPU] Add gfx8 assembler and disassembler test cases

Summary:
This adds assembler tests for cases that were previously only in the
disassembler tests, and vice versa.

Reviewers: rampitec, arsenm, nhaehnle

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, jfb, llvm-commits

Tags: #llvm

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

4 years ago__patchable_function_entries: don't use linkage field 'unique' with -no-integrated-as
Fangrui Song [Sun, 12 Jan 2020 20:23:16 +0000 (12:23 -0800)]
__patchable_function_entries: don't use linkage field 'unique' with -no-integrated-as

.section name, "flags"G, @type, GroupName[, linkage]

As of binutils 2.33, linkage cannot be 'unique'.  For integrated
assembler, we use both 'o' flag and 'unique' linkage to support
--gc-sections and COMDAT with lld.

https://sourceware.org/ml/binutils/2019-11/msg00266.html

4 years ago[NFC] Fix compilation of CrashRecoveryContext.cpp on mingw
Markus Böck [Sun, 12 Jan 2020 19:24:35 +0000 (14:24 -0500)]
[NFC] Fix compilation of CrashRecoveryContext.cpp on mingw

Patch by Markus Böck.

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

4 years ago[PowerPC] Delete PPCDarwinAsmPrinter and PPCMCAsmInfoDarwin
Fangrui Song [Thu, 2 Jan 2020 03:27:55 +0000 (19:27 -0800)]
[PowerPC] Delete PPCDarwinAsmPrinter and PPCMCAsmInfoDarwin

Darwin support has been removed.

Reviewed By: nemanjai

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

4 years agoFix "pointer is null" static analyzer warnings. NFCI.
Simon Pilgrim [Sun, 12 Jan 2020 12:57:01 +0000 (12:57 +0000)]
Fix "pointer is null" static analyzer warnings. NFCI.

Use cast<> instead of dyn_cast<> and move into its users where its dereferenced immediately.

4 years ago[MIPS] Regenerate shl/lshr shift tests
Simon Pilgrim [Sun, 12 Jan 2020 14:35:34 +0000 (14:35 +0000)]
[MIPS] Regenerate shl/lshr shift tests

4 years ago[AMDGPU] Regenerate shl shift tests
Simon Pilgrim [Sun, 12 Jan 2020 14:34:36 +0000 (14:34 +0000)]
[AMDGPU] Regenerate shl shift tests

4 years ago[X86][AVX] Use lowerShuffleAsLanePermuteAndSHUFP to lower binary v4f64 shuffles.
Simon Pilgrim [Sun, 12 Jan 2020 12:29:41 +0000 (12:29 +0000)]
[X86][AVX] Use lowerShuffleAsLanePermuteAndSHUFP to lower binary v4f64 shuffles.

Only perform this if we are shuffling lower and upper lane elements across the lanes (otherwise splitting to lower xmm shuffles would be better).

This is a regression if we shuffle build_vectors due to getVectorShuffle canonicalizing 'blend of splat' build vectors, for now I've set this not to shuffle build_vector nodes at all to avoid this.

4 years ago[X86][AVX] lowerShuffleAsLanePermuteAndSHUFP - only set the demanded elements of...
Simon Pilgrim [Sun, 12 Jan 2020 09:41:40 +0000 (09:41 +0000)]
[X86][AVX] lowerShuffleAsLanePermuteAndSHUFP - only set the demanded elements of the lane mask.

Fixes an cyclic dependency issue with an upcoming patch where getVectorShuffle canonicalizes masks with splat build vector sources.

4 years ago[X86][Disassembler] Merge X86DisassemblerDecoder.cpp into X86Disassembler.cpp and...
Fangrui Song [Sun, 12 Jan 2020 02:27:13 +0000 (18:27 -0800)]
[X86][Disassembler] Merge X86DisassemblerDecoder.cpp into X86Disassembler.cpp and refactor

4 years ago[X86][Disassembler] Simplify
Fangrui Song [Sun, 12 Jan 2020 02:08:06 +0000 (18:08 -0800)]
[X86][Disassembler] Simplify

4 years ago[profile] Support merge pool size >= 10
Fangrui Song [Sun, 12 Jan 2020 08:24:10 +0000 (00:24 -0800)]
[profile] Support merge pool size >= 10

The executable acquires an advisory record lock (`fcntl(fd, F_SETLKW, *)`) on a profile file.
Merge pool size >= 10 may be beneficial when the concurrency is large.

Also fix a small problem about snprintf. It can cause the filename to be truncated after %m.

Reviewed By: davidxl

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

4 years ago[NFC] Refactor memory ops cluster method
Qiu Chaofan [Sun, 12 Jan 2020 05:10:04 +0000 (13:10 +0800)]
[NFC] Refactor memory ops cluster method

Current implementation of BaseMemOpsClusterMutation is a little bit
obscure. This patch directly uses a map from store chain ID to set of
memory instrs to make it simpler, so that future improvements are easier
to read, update and review.

Reviewed By: evandro

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

4 years ago[X86] Don't call LowerSETCC from LowerSELECT for STRICT_FSETCC/STRICT_FSETCCS nodes.
Craig Topper [Sun, 12 Jan 2020 02:10:11 +0000 (18:10 -0800)]
[X86] Don't call LowerSETCC from LowerSELECT for STRICT_FSETCC/STRICT_FSETCCS nodes.

This causes the STRICT_FSETCC/STRICT_FSETCCS nodes to lowered
early while lowering SELECT, but the output chain doesn't get
connected. Then we visit the node again when it is its turn
because we haven't replaced the use of the chain result. In the
case of the fp128 libcall lowering, after D72341 this will cause
the libcall to be emitted twice.

4 years ago[SCEV] more accurate range for addrecexpr with nsw flag.
Zheng Chen [Sat, 11 Jan 2020 03:50:39 +0000 (22:50 -0500)]
[SCEV] more accurate range for addrecexpr with nsw flag.

Reviewed By: nikic

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

4 years ago[LegalizeVectorOps] Parallelize the lo/hi part of STRICT_UINT_TO_FLOAT legalization.
Craig Topper [Sun, 12 Jan 2020 01:43:22 +0000 (17:43 -0800)]
[LegalizeVectorOps] Parallelize the lo/hi part of STRICT_UINT_TO_FLOAT legalization.

The lo and hi computation are independent. Give them the same input
chain and TokenFactor the results together.

4 years ago[TargetLowering][X86] Connect the chain from STRICT_FSETCC in TargetLowering::expandF...
Craig Topper [Sun, 12 Jan 2020 01:27:55 +0000 (17:27 -0800)]
[TargetLowering][X86] Connect the chain from STRICT_FSETCC in TargetLowering::expandFP_TO_UINT and X86TargetLowering::FP_TO_INTHelper.

4 years ago[LegalizeVectorOps] Expand vector MERGE_VALUES immediately.
Craig Topper [Sun, 12 Jan 2020 00:04:28 +0000 (16:04 -0800)]
[LegalizeVectorOps] Expand vector MERGE_VALUES immediately.

Custom legalization can produce MERGE_VALUES to return multiple
results. We can expand them immediately instead of leaving them
around for DAG combine to clean up.

4 years ago[X86][Disassembler] Shrink X86GenDisassemblerTables.inc from 36M to 6.1M
Fangrui Song [Sun, 12 Jan 2020 00:27:25 +0000 (16:27 -0800)]
[X86][Disassembler] Shrink X86GenDisassemblerTables.inc from 36M to 6.1M

In x86Disassembler{OneByte,TwoByte,...}Codes,
"/* EmptyTable */" is very common. Omitting it saves lots of space.
Also, there is no need to display a table entry in multiple lines.

It is also common that the whole OpcodeDecision is { MODRM_ONEENTRY, 0}.
Make use of zero-initialization.

4 years ago[X86][Disassembler] Optimize argument passing and immediate reading
Fangrui Song [Sat, 11 Jan 2020 23:06:02 +0000 (15:06 -0800)]
[X86][Disassembler] Optimize argument passing and immediate reading

4 years ago[Disassembler] Delete the VStream parameter of MCDisassembler::getInstruction()
Fangrui Song [Sat, 11 Jan 2020 20:36:13 +0000 (12:36 -0800)]
[Disassembler] Delete the VStream parameter of MCDisassembler::getInstruction()

The argument is llvm::null() everywhere except llvm::errs() in
llvm-objdump in -DLLVM_ENABLE_ASSERTIONS=On builds. It is used by no
target but X86 in -DLLVM_ENABLE_ASSERTIONS=On builds.

If we ever have the needs to add verbose log to disassemblers, we can
record log with a member function, instead of passing it around as an
argument.

4 years ago[ORC] Fix argv handling in runAsMain / lli.
Lang Hames [Sat, 11 Jan 2020 20:58:38 +0000 (12:58 -0800)]
[ORC] Fix argv handling in runAsMain / lli.

This fixes an off-by-one error in the argc value computed by runAsMain, and
switches lli back to using the input bitcode (rather than the string "lli") as
the effective program name.

Thanks to Stefan Graenitz for spotting the bug.

4 years ago[Support] Optionally call signal handlers when a function wrapped by the the CrashRec...
Alexandre Ganea [Sat, 11 Jan 2020 20:27:07 +0000 (15:27 -0500)]
[Support] Optionally call signal handlers when a function wrapped by the the CrashRecoveryContext fails

This patch allows for handling a failure inside a CrashRecoveryContext in the same way as the global exception/signal handler. A failure will have the same side-effect, such as cleanup of temporarty file, printing callstack, calling relevant signal handlers, and finally returning an exception code. This is an optional feature, disabled by default.
This is a support patch for D69825.

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

4 years ago[X86][Disassembler] Replace custom logger with LLVM_DEBUG
Fangrui Song [Sat, 11 Jan 2020 20:03:57 +0000 (12:03 -0800)]
[X86][Disassembler] Replace custom logger with LLVM_DEBUG

llvm-objdump -d on clang is decreased from 7.8s to 7.4s.

The improvement is likely due to the elimination of logger setup and
dbgprintf(), which has a large overhead.

4 years ago[LegalizeVectorOps] Remove some of the simpler Expand methods. Pass Results vector...
Craig Topper [Sat, 11 Jan 2020 20:12:53 +0000 (12:12 -0800)]
[LegalizeVectorOps] Remove some of the simpler Expand methods. Pass Results vector to a couple. NFCI

Some of the simplest handlers just call TLI and if that fails,
they fall back to unrolling. For those just inline the TLI call
and share the unrolling call with the default case of Expand.

For ExpandFSUB and ExpandBITREVERSE so that its obvious they
don't return results sometimes and want to defer to LegalizeDAG.

4 years ago[LegalizeVectorOps] Only pass SDNode* instead SDValue to all of the Expand* and Promo...
Craig Topper [Sat, 11 Jan 2020 19:36:50 +0000 (11:36 -0800)]
[LegalizeVectorOps] Only pass SDNode* instead SDValue to all of the Expand* and Promote* methods.

All the Expand* and Promote* function assume they are being
called with result 0 anyway. Just hardcode result 0 into them.

4 years ago[X86][Disassembler] Simplify and optimize reader functions
Fangrui Song [Sat, 11 Jan 2020 07:43:44 +0000 (23:43 -0800)]
[X86][Disassembler] Simplify and optimize reader functions

llvm-objdump -d on clang is decreased from 8.2s to 7.8s.

4 years ago[X86] Turn FP_ROUND/STRICT_FP_ROUND into X86ISD::VFPROUND/STRICT_VFPROUND during...
Craig Topper [Sat, 11 Jan 2020 19:06:52 +0000 (11:06 -0800)]
[X86] Turn FP_ROUND/STRICT_FP_ROUND into X86ISD::VFPROUND/STRICT_VFPROUND during PreprocessISelDAG to remove some duplicate isel patterns.

4 years agoAdd -Wrange-loop-analysis changes to ReleaseNotes
Mark de Wever [Sat, 11 Jan 2020 18:03:22 +0000 (19:03 +0100)]
Add -Wrange-loop-analysis changes to ReleaseNotes

This reflects the recent changes done.

4 years ago[ExecutionEngine] Re-enable FastISel for non-iOS arm targets.
Lang Hames [Sat, 11 Jan 2020 17:59:33 +0000 (09:59 -0800)]
[ExecutionEngine] Re-enable FastISel for non-iOS arm targets.

Patch by Nicolas Capens. Thanks Nicolas!

https://reviews.llvm.org/D65015

4 years agoRevert "[ASTMatchers] extract public matchers from const-analysis into own patch"
Jonas Toth [Sat, 11 Jan 2020 18:41:27 +0000 (19:41 +0100)]
Revert "[ASTMatchers] extract public matchers from const-analysis into own patch"

This reverts commit 4c48ea68e491cb42f1b5d43ffba89f6a7f0dadc4.
The powerpc buildbots had an internal compiler error after this patch.
This requires some inspection.

4 years ago[ASTMatchers] extract public matchers from const-analysis into own patch
Jonas Toth [Sat, 11 Jan 2020 18:21:03 +0000 (19:21 +0100)]
[ASTMatchers] extract public matchers from const-analysis into own patch

Summary:
The analysis for const-ness of local variables required a view generally useful
matchers that are extracted into its own patch.

They are `decompositionDecl` and `forEachArgumentWithParamType`, that works
for calls through function pointers as well.

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[mlir] NFC: Remove Value::operator* and Value::operator-> now that Value is properly...
River Riddle [Sat, 11 Jan 2020 16:54:04 +0000 (08:54 -0800)]
[mlir] NFC: Remove Value::operator* and Value::operator-> now that Value is properly value-typed.

Summary: These were temporary methods used to simplify the transition.

Reviewed By: antiagainst

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

4 years ago[X86] Adjust nop emission by compiler to consider target decode limitations
Philip Reames [Sat, 11 Jan 2020 16:41:35 +0000 (08:41 -0800)]
[X86] Adjust nop emission by compiler to consider target decode limitations

The primary motivation of this change is to bring the code more closely in sync behavior wise with the assembler's version of nop emission.  I'd like to eventually factor them into one, but that's hard to do when one has features the other doesn't.

The longest encodeable nop on x86 is 15 bytes, but many processors - for instance all intel chips - can't decode the 15 byte form efficiently.  On those processors, it's better to use either a 10 byte or 11 byte sequence depending.

4 years ago[X86AsmBackend] Move static function before sole use [NFC]
Philip Reames [Fri, 10 Jan 2020 23:22:17 +0000 (15:22 -0800)]
[X86AsmBackend] Move static function before sole use [NFC]

4 years ago[X86AsmBackend] Be consistent about placing definitions out of line [NFC]
Philip Reames [Fri, 10 Jan 2020 23:19:09 +0000 (15:19 -0800)]
[X86AsmBackend] Be consistent about placing definitions out of line [NFC]

4 years agoGlobalModuleIndex - Fix use-after-move clang static analyzer warning.
Simon Pilgrim [Sat, 11 Jan 2020 16:42:41 +0000 (16:42 +0000)]
GlobalModuleIndex - Fix use-after-move clang static analyzer warning.

Shadow variable names meant we were referencing the Buffer input argument, not the GlobalModuleIndex member that its std::move()'d it.

4 years agoFix "pointer is null" static analyzer warnings. NFCI.
Simon Pilgrim [Sat, 11 Jan 2020 16:01:46 +0000 (16:01 +0000)]
Fix "pointer is null" static analyzer warnings. NFCI.

Use castAs<> instead of getAs<> since the pointers are dereferenced immediately and castAs will perform the null assertion for us.

4 years agoFix "pointer is null" static analyzer warning. NFCI.
Simon Pilgrim [Sat, 11 Jan 2020 16:00:17 +0000 (16:00 +0000)]
Fix "pointer is null" static analyzer warning. NFCI.

Use cast<> instead of dyn_cast<> since we know that the pointer should be valid (and is dereferenced immediately).

4 years agoFix "pointer is null" static analyzer warning. NFCI.
Simon Pilgrim [Sat, 11 Jan 2020 15:41:31 +0000 (15:41 +0000)]
Fix "pointer is null" static analyzer warning. NFCI.

Use castAs<> instead of getAs<> since the pointer is dereferenced immediately within mangleCallingConvention and castAs will perform the null assertion for us.

4 years agoFix "pointer is null" static analyzer warnings. NFCI.
Simon Pilgrim [Sat, 11 Jan 2020 15:33:25 +0000 (15:33 +0000)]
Fix "pointer is null" static analyzer warnings. NFCI.

Use castAs<> instead of getAs<> since the pointer is dereferenced immediately below and castAs will perform the null assertion for us.

4 years agoFix "pointer is null" static analyzer warning. NFCI.
Simon Pilgrim [Sat, 11 Jan 2020 14:47:17 +0000 (14:47 +0000)]
Fix "pointer is null" static analyzer warning. NFCI.

Use castAs<> instead of getAs<> since the pointer is dereferenced immediately below and castAs will perform the null assertion for us.

4 years agoFix uninitialized value clang static analyzer warning. NFC.
Simon Pilgrim [Sat, 11 Jan 2020 14:44:25 +0000 (14:44 +0000)]
Fix uninitialized value clang static analyzer warning. NFC.

4 years agoRemove copy ctors identical to the default one. NFC.
Benjamin Kramer [Sat, 11 Jan 2020 15:50:55 +0000 (16:50 +0100)]
Remove copy ctors identical to the default one. NFC.

Those do nothing but make the type no longer trivial to the compiler.

4 years agomoveOperands - assert Src/Dst MachineOperands are non-null.
Simon Pilgrim [Sat, 11 Jan 2020 14:36:46 +0000 (14:36 +0000)]
moveOperands - assert Src/Dst MachineOperands are non-null.

Fixes static-analyzer warnings.

4 years ago[X86] Fix outdated comment
Simon Pilgrim [Sat, 11 Jan 2020 12:57:21 +0000 (12:57 +0000)]
[X86] Fix outdated comment

The generic saturated math opcodes are no longer widened inside X86TargetLowering

4 years ago[Sema] Improve -Wrange-loop-analysis warnings.
Mark de Wever [Sat, 11 Jan 2020 09:16:40 +0000 (10:16 +0100)]
[Sema] Improve -Wrange-loop-analysis warnings.

No longer generate a diagnostic when a small trivially copyable type is
used without a reference. Before the test looked for a POD type and had no
size restriction. Since the range-based for loop is only available in
C++11 and POD types are trivially copyable in C++11 it's not required to
test for a POD type.

Since copying a large object will be expensive its size has been
restricted. 64 bytes is a common size of a cache line and if the object is
aligned the copy will be cheap. No performance impact testing has been
done.

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

4 years agoFix copy+paste typo in shuffle test name
Simon Pilgrim [Sat, 11 Jan 2020 12:35:33 +0000 (12:35 +0000)]
Fix copy+paste typo in shuffle test name

4 years ago[X86][AVX] Add lowerShuffleAsLanePermuteAndSHUFP lowering
Simon Pilgrim [Sat, 11 Jan 2020 12:28:27 +0000 (12:28 +0000)]
[X86][AVX] Add lowerShuffleAsLanePermuteAndSHUFP lowering

Add initial support for lowering v4f64 shuffles to SHUFPD(VPERM2F128(V1, V2), VPERM2F128(V1, V2)), eventually this could be used for v8f32 (and maybe v8f64/v16f32) but I'm being conservative for the initial implementation as only v4f64 can always succeed.

This currently is only called from lowerShuffleAsLanePermuteAndShuffle so only gets used for unary shuffles, and we limit this to cases where we use upper elements as otherwise concating 2 xmm shuffles is probably the better case.

Helps with poor shuffles mentioned in D66004.

4 years ago[X86] Add more complex tests for vector masks used with AND/OR/XOR.
Florian Hahn [Fri, 10 Jan 2020 18:08:56 +0000 (18:08 +0000)]
[X86] Add more complex tests for vector masks used with AND/OR/XOR.

Additional test cases for D72524.

4 years agoDSE: fix bug where we would only check libcalls for name rather than whole decl
Nuno Lopes [Sat, 11 Jan 2020 11:57:29 +0000 (11:57 +0000)]
DSE: fix bug where we would only check libcalls for name rather than whole decl

4 years ago[LoopRotate] Add tests for rotate with switch; NFC
Nikita Popov [Thu, 9 Jan 2020 21:17:37 +0000 (22:17 +0100)]
[LoopRotate] Add tests for rotate with switch; NFC

For D72420.

4 years ago[LoopSimplify] Regenerate test checks; NFC
Nikita Popov [Fri, 10 Jan 2020 17:20:32 +0000 (18:20 +0100)]
[LoopSimplify] Regenerate test checks; NFC

For D72519.

4 years ago[InstCombine] Preserve nuw on sub of geps (PR44419)
Nikita Popov [Wed, 1 Jan 2020 10:11:05 +0000 (11:11 +0100)]
[InstCombine] Preserve nuw on sub of geps (PR44419)

Fix https://bugs.llvm.org/show_bug.cgi?id=44419 by preserving the
nuw on sub of geps. We only do this if the offset has a multiplication
as the final operation, as we can't be sure the operations is nuw
in the other cases without more thorough analysis.

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

4 years ago[X86] Remove dead code from X86DAGToDAGISel::Select that is no longer needed now...
Craig Topper [Sat, 11 Jan 2020 08:27:06 +0000 (00:27 -0800)]
[X86] Remove dead code from X86DAGToDAGISel::Select that is no longer needed now that we don't mutate strict fp nodes. NFC

4 years agoAdd test for GDB pretty printers.
Christian Sigg [Sat, 11 Jan 2020 07:47:41 +0000 (08:47 +0100)]
Add test for GDB pretty printers.

Reviewers: dblaikie, aprantl, davide, JDevlieghere

Reviewed By: aprantl

Subscribers: jmorse, aprantl, merge_guards_bot, mgorny, llvm-commits

Tags: #llvm

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

4 years ago[X86] Simplify code by removing an unreachable condition. NFCI
Craig Topper [Sat, 11 Jan 2020 07:28:31 +0000 (23:28 -0800)]
[X86] Simplify code by removing an unreachable condition. NFCI

For X87<->SSE conversions, the SSE type is always smaller than
the X87 type. So we can always use the smallest type for the
memory type.