platform/upstream/llvm.git
5 years agoAMDGPU: Avoid code predicates for extload PatFrags
Matt Arsenault [Tue, 16 Jul 2019 02:46:05 +0000 (02:46 +0000)]
AMDGPU: Avoid code predicates for extload PatFrags

Use the MemoryVT field. This will be necessary for tablegen to
automatically handle patterns for GlobalISel.

Doesn't handle the d16 lo/hi patterns. Those are a special case since
it involvess the custom node type.

llvm-svn: 366168

5 years agoChange a lit test to permit vendor specific clang version
Nathan Lanza [Tue, 16 Jul 2019 02:05:52 +0000 (02:05 +0000)]
Change a lit test to permit vendor specific clang version

A test manually checks for the string `__VERSION__ "Clang`. This needs
to permit vendor specific variants.

llvm-svn: 366166

5 years agoreland "add -fthinlto-index= option to clang-cl"
Bob Haarman [Tue, 16 Jul 2019 01:35:49 +0000 (01:35 +0000)]
reland "add -fthinlto-index= option to clang-cl"

Summary:
This is a reland of r366146, adding in the previously missing '--'
flag that prevents filenames from being interpreted as flags.

Original description:
This adds a -fthinlto-index= option to clang-cl, which allows it to
be used to drive ThinLTO backend passes. This allows clang-cl to be
used for distributed ThinLTO.

Tags: #clang
llvm-svn: 366165

5 years agoRe-land "[DebugInfo] Move function from line table to the prologue (NFC)"
Jonas Devlieghere [Tue, 16 Jul 2019 01:21:25 +0000 (01:21 +0000)]
Re-land "[DebugInfo] Move function from line table to the prologue (NFC)"

In LLDB, when parsing type units, we don't need to parse the whole line
table. Instead, we only need to parse the "support files" from the line
table prologue.

To make that possible, this patch moves the respective functions from
the LineTable into the Prologue. Because I don't think users of the
LineTable should have to know that these files come from the Prologue,

I've left the original methods in place, and made them redirect to the
LineTable.

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

llvm-svn: 366164

5 years ago[Sema] Suppress additional warnings for C's zero initializer
Peter Wu [Tue, 16 Jul 2019 01:13:36 +0000 (01:13 +0000)]
[Sema] Suppress additional warnings for C's zero initializer

Summary:
D28148 relaxed some checks for assigning { 0 } to a structure for all C
standards, but it failed to handle structures with non-integer
subobjects. Relax -Wmissing-braces checks for such structures, and add
some additional tests.

This fixes PR39931.

Patch By: al3xtjames

Reviewed By: Lekensteyn

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

llvm-svn: 366163

5 years ago[InstructionSimplify] Apply sext/trunc after pointer stripping
Michael Liao [Tue, 16 Jul 2019 01:03:06 +0000 (01:03 +0000)]
[InstructionSimplify] Apply sext/trunc after pointer stripping

Summary:
- As the pointer stripping could trace through `addrspacecast` now, need
  to sext/trunc the offset to ensure it has the same width as the
  pointer after stripping.

Reviewers: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 366162

5 years ago[Target] Remove unused method Target::GetDefaultClangModuleSearchPaths
Alex Langford [Tue, 16 Jul 2019 01:02:32 +0000 (01:02 +0000)]
[Target] Remove unused method Target::GetDefaultClangModuleSearchPaths

llvm-svn: 366161

5 years agoRevert "[DebugInfo] Move function from line table to the prologue (NFC)"
Jonas Devlieghere [Tue, 16 Jul 2019 00:59:04 +0000 (00:59 +0000)]
Revert "[DebugInfo] Move function from line table to the prologue (NFC)"

This broke LLD, which I didn't have enabled.

llvm-svn: 366160

5 years agoAllow for vendor prefixes in a list test
Nathan Lanza [Tue, 16 Jul 2019 00:57:50 +0000 (00:57 +0000)]
Allow for vendor prefixes in a list test

Summary:
Preprocessor/init.c contains a line that explicitly checks for the
string

__VERSION__ "Clang{{.*}}

It's valid to have a toolchain configured to emit a vendor prefix
before the word Clang. e.g.

__VERSION__ "Vendor Clang{{.*}}

Subscribers: fedor.sergeev, cfe-commits

Tags: #clang

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

llvm-svn: 366159

5 years ago[DebugInfo] Move function from line table to the prologue (NFC)
Jonas Devlieghere [Tue, 16 Jul 2019 00:37:17 +0000 (00:37 +0000)]
[DebugInfo] Move function from line table to the prologue (NFC)

In LLDB, when parsing type units, we don't need to parse the whole line
table. Instead, we only need to parse the "support files" from the line
table prologue.

To make that possible, this patch moves the respective functions from
the LineTable into the Prologue. Because I don't think users of the
LineTable should have to know that these files come from the Prologue,

I've left the original methods in place, and made them redirect to the
LineTable.

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

llvm-svn: 366158

5 years agoTemporarily revert "add -fthinlto-index= option to clang-cl"
Eric Christopher [Tue, 16 Jul 2019 00:02:40 +0000 (00:02 +0000)]
Temporarily revert "add -fthinlto-index= option to clang-cl"

This is causing testsuite failures on (at least) darwin release+asserts.

This reverts commit r366146.

llvm-svn: 366157

5 years agoUpdate some file changes, but there's a dependency loop so
Jason Molenda [Mon, 15 Jul 2019 23:55:22 +0000 (23:55 +0000)]
Update some file changes, but there's a dependency loop so
it doesn't quite work rigtht now.

llvm-svn: 366156

5 years agoTemporarily Revert "fix unnamed fiefield issue and add tests for __builtin_preserve_a...
Eric Christopher [Mon, 15 Jul 2019 23:49:31 +0000 (23:49 +0000)]
Temporarily Revert "fix unnamed fiefield issue and add tests for __builtin_preserve_access_index intrinsic"

The commit had tests that would only work with names in the IR.

This reverts commit r366076.

llvm-svn: 366155

5 years agoTemporarily Revert "[SLP] Recommit: Look-ahead operand reordering heuristic."
Eric Christopher [Mon, 15 Jul 2019 23:36:02 +0000 (23:36 +0000)]
Temporarily Revert "[SLP] Recommit: Look-ahead operand reordering heuristic."

As there are some reported miscompiles with AVX512 and performance regressions
in Eigen. Verified with the original committer and testcases will be forthcoming.

This reverts commit r364964.

llvm-svn: 366154

5 years agoRevert "[NewPM] Port Sancov"
Leonard Chan [Mon, 15 Jul 2019 23:18:31 +0000 (23:18 +0000)]
Revert "[NewPM] Port Sancov"

This reverts commit 5652f35817f07b16f8b3856d594cc42f4d7ee29c.

llvm-svn: 366153

5 years ago[DirectoryWatcher][linux] Fix for older kernels
Jan Korous [Mon, 15 Jul 2019 23:14:00 +0000 (23:14 +0000)]
[DirectoryWatcher][linux] Fix for older kernels

IN_EXCL_UNLINK exists since Linux 2.6.36

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

llvm-svn: 366152

5 years ago[X86] Teach convertToThreeAddress to handle SUB with immediate
Craig Topper [Mon, 15 Jul 2019 23:07:56 +0000 (23:07 +0000)]
[X86] Teach convertToThreeAddress to handle SUB with immediate

We mostly avoid sub with immediate but there are a couple cases that can create them. One is the add 128, %rax -> sub -128, %rax trick in isel. The other is when a SUB immediate gets created for a compare where both the flags and the subtract value is used. If we are unable to linearize the SelectionDAG to satisfy the flag user and the sub result user from the same instruction, we will clone the sub immediate for the two uses. The one that produces flags will eventually become a compare. The other will have its flag output dead, and could then be considered for LEA creation.

I added additional test cases to add.ll to show the the sub -128 trick gets converted to LEA and a case where we don't need to convert it.

This showed up in the current codegen for PR42571.

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

llvm-svn: 366151

5 years ago[TSan] Fix asm token error (again)
Julian Lettner [Mon, 15 Jul 2019 23:05:14 +0000 (23:05 +0000)]
[TSan] Fix asm token error (again)

llvm-svn: 366150

5 years ago[WebAssembly] Add missing utility methods for exnref type
Heejin Ahn [Mon, 15 Jul 2019 23:04:00 +0000 (23:04 +0000)]
[WebAssembly] Add missing utility methods for exnref type

Summary:
This adds missing utility methods and copy instruction handling for
`exnref` type and also adds tests.

`tee` instruction tests are missing because `isTee` is currently only
used in ExplicitLocals pass and testing that pass in mir requires
serialization of stackified registers in mir files, which is a bit
nontrivial because `MachineFunctionInfo` only has info of vreg numbers
(which are large integers) but not the mir's register numbers. But this
change is quite trivial anyway.

Reviewers: tlively

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 366149

5 years ago[LanguageRuntime] Move ObjCLanguageRuntime into a plugin
Alex Langford [Mon, 15 Jul 2019 22:56:12 +0000 (22:56 +0000)]
[LanguageRuntime] Move ObjCLanguageRuntime into a plugin

Summary:
Following up to my CPPLanguageRuntime change, I'm moving
ObjCLanguageRuntime into a plugin as well.

Reviewers: JDevlieghere, compnerd, jingham, clayborg

Subscribers: mgorny, arphaman, lldb-commits

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

llvm-svn: 366148

5 years ago[llvm-readelf] Print "File: lib.a(file.o)" info when dumping archive files.
Yuanfang Chen [Mon, 15 Jul 2019 22:52:01 +0000 (22:52 +0000)]
[llvm-readelf] Print "File: lib.a(file.o)" info when dumping archive files.

Match GNU readelf.

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

Reviewers: jhenderson, grimar, MaskRay, rupprecht

Reviewed by: jhenderson, MaskRay, grimar

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

llvm-svn: 366147

5 years agoadd -fthinlto-index= option to clang-cl
Bob Haarman [Mon, 15 Jul 2019 22:50:04 +0000 (22:50 +0000)]
add -fthinlto-index= option to clang-cl

Summary:
This adds a -fthinlto-index= option to clang-cl, which allows it to
be used to drive ThinLTO backend passes. This allows clang-cl to be
used for distributed ThinLTO.

Reviewers: tejohnson, pcc, rnk

Subscribers: mehdi_amini, steven_wu, dexonsmith, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 366146

5 years ago[WebAssembly] Rename except_ref type to exnref
Heejin Ahn [Mon, 15 Jul 2019 22:49:25 +0000 (22:49 +0000)]
[WebAssembly] Rename except_ref type to exnref

Summary:
We agreed to rename `except_ref` to `exnref` for consistency with other
reference types in
https://github.com/WebAssembly/exception-handling/issues/79. This also
renames WebAssemblyInstrExceptRef.td to WebAssemblyInstrRef.td in order
to use the file for other reference types in future.

Reviewers: dschuff

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

Tags: #llvm

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

llvm-svn: 366145

5 years agoRevert [llvm-lipo] Implement -create (with hardcoded alignments)
Shoaib Meenai [Mon, 15 Jul 2019 22:44:08 +0000 (22:44 +0000)]
Revert [llvm-lipo] Implement -create (with hardcoded alignments)

This reverts r366142 (git commit 67cee1dc7ee285b03372eb818a3894d35efa7394)

The test is failing on the Windows buildbots. Reverting while I
investigate.

llvm-svn: 366144

5 years ago[OpenCL] Make TableGen'd builtin tables and helper functions static
Tom Stellard [Mon, 15 Jul 2019 22:34:19 +0000 (22:34 +0000)]
[OpenCL] Make TableGen'd builtin tables and helper functions static

Reviewers: Pierre, Anastasia

Reviewed By: Anastasia

Subscribers: yaxunl, cfe-commits

Tags: #clang

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

llvm-svn: 366143

5 years ago[llvm-lipo] Implement -create (with hardcoded alignments)
Shoaib Meenai [Mon, 15 Jul 2019 22:29:30 +0000 (22:29 +0000)]
[llvm-lipo] Implement -create (with hardcoded alignments)

Creates universal binary output file from input files. Currently uses
hard coded value for alignment.  Want to get the create functionality
approved before implementing the alignment function.

Patch by Anusha Basana <anusha.basana@gmail.com>

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

llvm-svn: 366142

5 years ago[clang-fuzzer] Remove 'setUseOrcMCJITReplacement(false)' call.
Lang Hames [Mon, 15 Jul 2019 22:27:57 +0000 (22:27 +0000)]
[clang-fuzzer] Remove 'setUseOrcMCJITReplacement(false)' call.

The default value for this option (UseMCJITReplacement) is already false, and
OrcMCJITReplacement is going to have deprecation warnings attached in LLVM 9.0.
Removing this call removes a spurious warning.

llvm-svn: 366141

5 years ago[WebAssembly] Simplify regcopy.mir
Heejin Ahn [Mon, 15 Jul 2019 22:22:10 +0000 (22:22 +0000)]
[WebAssembly] Simplify regcopy.mir

Summary:
This deletes the ll templates from the functions because they don't need
them (mir files need ll templates only when they have function calls or
BB names that are not numbers).

This also renames the filename to `reg-copy.mir`, because I'm planning
to add some more `reg-*.mir` soon.

Reviewers: tlively

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

Tags: #llvm

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

llvm-svn: 366140

5 years ago[WebAssembly] Assembler: support special floats: infinity / nan
Wouter van Oortmerssen [Mon, 15 Jul 2019 22:13:39 +0000 (22:13 +0000)]
[WebAssembly] Assembler: support special floats: infinity / nan

Summary:
These are emitted as identifiers by the InstPrinter, so we should
parse them as such. These could potentially clash with symbols of
the same name, but that is out of our (the WebAssembly backend) control.

Reviewers: dschuff

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

Tags: #llvm

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

llvm-svn: 366139

5 years ago[DirectoryWatcher][test] Relax test assumptions
Jan Korous [Mon, 15 Jul 2019 22:11:51 +0000 (22:11 +0000)]
[DirectoryWatcher][test] Relax test assumptions

Workaround for FSEvents sometimes sending notifications for events that happened
before DirectoryWatcher was created.

This caused tests to be flaky on green dragon.

llvm-svn: 366138

5 years ago[DirectoryWatcher][NFC][test] Add typedef for enum
Jan Korous [Mon, 15 Jul 2019 22:11:28 +0000 (22:11 +0000)]
[DirectoryWatcher][NFC][test] Add typedef for enum

llvm-svn: 366137

5 years ago[ASan] Fix >80 character line.
Matt Morehouse [Mon, 15 Jul 2019 22:07:56 +0000 (22:07 +0000)]
[ASan] Fix >80 character line.

llvm-svn: 366136

5 years ago[AMDGPU] Enable merging m0 initializations.
Austin Kerbow [Mon, 15 Jul 2019 22:07:05 +0000 (22:07 +0000)]
[AMDGPU] Enable merging m0 initializations.

Summary:
Enable hoisting and merging m0 defs that are initialized with the same
immediate value. Fixes bug where removed instructions are not considered
to interfere with other inits, and make sure to not hoist inits before block
prologues.

Reviewers: rampitec, arsenm

Reviewed By: rampitec

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

Tags: #llvm

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

llvm-svn: 366135

5 years ago[ScopInfo][NFC] Add dot at the end of comment statement.
Dominik Adamski [Mon, 15 Jul 2019 22:01:55 +0000 (22:01 +0000)]
[ScopInfo][NFC] Add dot at the end of comment statement.

llvm-svn: 366134

5 years ago[mips] Print BEQZL and BNEZL pseudo instructions
Simon Atanasyan [Mon, 15 Jul 2019 21:46:38 +0000 (21:46 +0000)]
[mips] Print BEQZL and BNEZL pseudo instructions

One of the reasons - to be compatible with GNU tools.

llvm-svn: 366133

5 years agoAMDGPU: Use standalone MUBUF load patterns
Matt Arsenault [Mon, 15 Jul 2019 21:41:44 +0000 (21:41 +0000)]
AMDGPU: Use standalone MUBUF load patterns

We already do this for the flat and DS instructions, although it is
certainly uglier and more verbose.

This will allow using separate pattern definitions for extload and
zextload. Currently we get away with using a single PatFrag with
custom predicate code to check if the extension type is a zextload or
anyextload. The generic mechanism the global isel emitter understands
treats these as mutually exclusive. I was considering making the
pattern emitter accept zextload or sextload extensions for anyextload
patterns, but in global isel, the different extending loads have
distinct opcodes, and there is currently no mechanism for an opcode
matcher to try multiple (and there probably is very little need for
one beyond this case).

llvm-svn: 366132

5 years ago[TSan] Fix asm token error
Julian Lettner [Mon, 15 Jul 2019 21:22:57 +0000 (21:22 +0000)]
[TSan] Fix asm token error

llvm-svn: 366131

5 years ago[LoopUnroll+LoopUnswitch] do not transform loops containing callbr
Nick Desaulniers [Mon, 15 Jul 2019 21:16:29 +0000 (21:16 +0000)]
[LoopUnroll+LoopUnswitch] do not transform loops containing callbr

Summary:
There is currently a correctness issue when unrolling loops containing
callbr's where their indirect targets are being updated correctly to the
newly created labels, but their operands are not.  This manifests in
unrolled loops where the second and subsequent copies of callbr
instructions have blockaddresses of the label from the first instance of
the unrolled loop, which would result in nonsensical runtime control
flow.

For now, conservatively do not unroll the loop.  In the future, I think
we can pursue unrolling such loops provided we transform the cloned
callbr's operands correctly.

Such a transform and its legalities are being discussed in:
https://reviews.llvm.org/D64101

Link: https://bugs.llvm.org/show_bug.cgi?id=42489
Link: https://groups.google.com/forum/#!topic/clang-built-linux/z-hRWP9KqPI
Reviewers: fhahn, hfinkel, efriedma

Reviewed By: fhahn, hfinkel, efriedma

Subscribers: efriedma, hiraditya, zzheng, dmgreen, llvm-commits, pirama, kees, nathanchance, E5ten, craig.topper, chandlerc, glider, void, srhines

Tags: #llvm

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

llvm-svn: 366130

5 years agoTableGen/GlobalISel: Fix handling of truncstore patterns
Matt Arsenault [Mon, 15 Jul 2019 21:15:20 +0000 (21:15 +0000)]
TableGen/GlobalISel: Fix handling of truncstore patterns

This was failing to import the AMDGPU truncstore patterns. The
truncating stores from 32-bit to 8/16 were then somehow being
incorrectly selected to a 4-byte store.

A separate check is emitted for the LLT size in comparison to the
specific memory VT, which looks strange to me but makes sense based on
the hierarchy of PatFrags used for the default truncstore PatFrags.

llvm-svn: 366129

5 years agoTableGen: Add address space to matchers
Matt Arsenault [Mon, 15 Jul 2019 20:59:42 +0000 (20:59 +0000)]
TableGen: Add address space to matchers

Currently AMDGPU uses a CodePatPred to check address spaces from the
MachineMemOperand. Introduce a new first class property so that the
existing patterns can be easily modified to uses the new generated
predicate, which will also be handled for GlobalISel.

I would prefer these to match against the pointer type of the
instruction, but that would be difficult to get working with
SelectionDAG compatbility. This is much easier for now and will avoid
a painful tablegen rewrite for all the loads and stores.

I'm also not sure if there's a better way to encode multiple address
spaces in the table, rather than putting the number to expect.

llvm-svn: 366128

5 years ago[clang] allow -fthinlto-index= without -x ir
Bob Haarman [Mon, 15 Jul 2019 20:51:44 +0000 (20:51 +0000)]
[clang] allow -fthinlto-index= without -x ir

Summary:
Previously, passing -fthinlto-index= to clang required that bitcode
files be explicitly marked by -x ir. This change makes us detect files
with object file extensions as bitcode files when -fthinlto-index= is
present, so that explicitly marking them is no longer necessary.
Explicitly specifying -x ir is still accepted and continues to be part
of the test case to ensure we continue to support it.

Reviewers: tejohnson, rnk, pcc

Subscribers: mehdi_amini, steven_wu, dexonsmith, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 366127

5 years ago[TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.9
Julian Lettner [Mon, 15 Jul 2019 20:22:27 +0000 (20:22 +0000)]
[TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.9

Switch over to computing the xor key in C, instead of assembly for
Linux/AArch64.

llvm-svn: 366126

5 years agoAMDGPU/GlobalISel: Allow scalar s1 and/or/xor
Matt Arsenault [Mon, 15 Jul 2019 20:20:18 +0000 (20:20 +0000)]
AMDGPU/GlobalISel: Allow scalar s1 and/or/xor

If a 1-bit value is in a 32-bit VGPR, the scalar opcodes set SCC to
whether the result is 0. If the inputs are SCC, these can be copied to
a 32-bit SGPR to produce an SCC result.

llvm-svn: 366125

5 years ago[libc++] Implement P0433: deduction guides for <unordered_map>
Louis Dionne [Mon, 15 Jul 2019 20:06:01 +0000 (20:06 +0000)]
[libc++] Implement P0433: deduction guides for <unordered_map>

Thanks to Arthur O'Dwyer for the patch.

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

llvm-svn: 366124

5 years agoARM MTE stack sanitizer.
Evgeniy Stepanov [Mon, 15 Jul 2019 20:02:23 +0000 (20:02 +0000)]
ARM MTE stack sanitizer.

Add "memtag" sanitizer that detects and mitigates stack memory issues
using armv8.5 Memory Tagging Extension.

It is similar in principle to HWASan, which is a software implementation
of the same idea, but there are enough differencies to warrant a new
sanitizer type IMHO. It is also expected to have very different
performance properties.

The new sanitizer does not have a runtime library (it may grow one
later, along with a "debugging" mode). Similar to SafeStack and
StackProtector, the instrumentation pass (in a follow up change) will be
inserted in all cases, but will only affect functions marked with the
new sanitize_memtag attribute.

Reviewers: pcc, hctim, vitalybuka, ostannard

Subscribers: srhines, mehdi_amini, javed.absar, kristof.beyls, hiraditya, cryptoad, steven_wu, dexonsmith, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 366123

5 years agoConstrain workaround to avoid affecting other buildbots
Eric Fiselier [Mon, 15 Jul 2019 19:53:42 +0000 (19:53 +0000)]
Constrain workaround to avoid affecting other buildbots

llvm-svn: 366122

5 years agoAMDGPU/GlobalISel: Select G_AND/G_OR/G_XOR
Matt Arsenault [Mon, 15 Jul 2019 19:50:07 +0000 (19:50 +0000)]
AMDGPU/GlobalISel: Select G_AND/G_OR/G_XOR

llvm-svn: 366121

5 years agoAMDGPU/GlobalISel: Don't constrain source register of VCC copies
Matt Arsenault [Mon, 15 Jul 2019 19:48:36 +0000 (19:48 +0000)]
AMDGPU/GlobalISel: Don't constrain source register of VCC copies

This is a hack until I come up with a better way of dealing with the
pseudo-register banks used for boolean values. If the use instruction
constrains the register, the selector for the def instruction won't
see that the bank was VCC. A 1-bit SReg_32 is could ambiguously have
been SCCRegBank or VCCRegBank in wave32.

This is necessary to successfully select branches with and and/or/xor
condition.

llvm-svn: 366120

5 years agoAMDGPU/GlobalISel: Fix selecting vcc->vcc bank copies
Matt Arsenault [Mon, 15 Jul 2019 19:46:48 +0000 (19:46 +0000)]
AMDGPU/GlobalISel: Fix selecting vcc->vcc bank copies

The extra test change is correct, although how it arrives there is a
bug that needs work. With wave32, the test for isVCC ambiguously
reports true for an SCC or VCC source. A new allocatable pseudo
register class for SCC may be necesssary.

llvm-svn: 366119

5 years agoAMDGPU/GlobalISel: Fix not constraining result reg of copies to VCC
Matt Arsenault [Mon, 15 Jul 2019 19:45:49 +0000 (19:45 +0000)]
AMDGPU/GlobalISel: Fix not constraining result reg of copies to VCC

llvm-svn: 366118

5 years agoAMDGPU/GlobalISel: Fix handling of sgpr (not scc bank) s1 to VCC
Matt Arsenault [Mon, 15 Jul 2019 19:44:07 +0000 (19:44 +0000)]
AMDGPU/GlobalISel: Fix handling of sgpr (not scc bank) s1 to VCC

This was emitting a copy from a 32-bit register to a 64-bit.

llvm-svn: 366117

5 years agoAMDGPU/GlobalISel: Custom legalize G_INSERT_VECTOR_ELT
Matt Arsenault [Mon, 15 Jul 2019 19:43:04 +0000 (19:43 +0000)]
AMDGPU/GlobalISel: Custom legalize G_INSERT_VECTOR_ELT

llvm-svn: 366116

5 years agoAMDGPU/GlobalISel: Custom legalize G_EXTRACT_VECTOR_ELT
Matt Arsenault [Mon, 15 Jul 2019 19:40:59 +0000 (19:40 +0000)]
AMDGPU/GlobalISel: Custom legalize G_EXTRACT_VECTOR_ELT

Turn the constant cases into G_EXTRACTs.

llvm-svn: 366115

5 years agoAMDGPU/GlobalISel: Fix G_ICMP for wave32
Matt Arsenault [Mon, 15 Jul 2019 19:39:31 +0000 (19:39 +0000)]
AMDGPU/GlobalISel: Fix G_ICMP for wave32

llvm-svn: 366114

5 years agoGlobalISel: Implement narrowScalar for vector extract/insert indexes
Matt Arsenault [Mon, 15 Jul 2019 19:37:34 +0000 (19:37 +0000)]
GlobalISel: Implement narrowScalar for vector extract/insert indexes

llvm-svn: 366113

5 years agoAMDGPU: Fix missing immarg from interp intrinsics
Matt Arsenault [Mon, 15 Jul 2019 19:12:00 +0000 (19:12 +0000)]
AMDGPU: Fix missing immarg from interp intrinsics

llvm-svn: 366110

5 years ago[FileCheck] Store line numbers as optional values
Thomas Preud'homme [Mon, 15 Jul 2019 19:04:56 +0000 (19:04 +0000)]
[FileCheck] Store line numbers as optional values

Summary:
Processing of command-line definition of variable and logic around
implicit not directives both reuse parsing code that expects a line
number to be defined. So far, a special line number of 0 was used for
those users of the parsing code where a line number does not make sense.
This commit instead represents line numbers as Optional values so that
they can be None for those cases.

Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson, rnk

Subscribers: JonChesterfield, rogfer01, hfinkel, kristina, rnk, tra, arichardson, grimar, dblaikie, probinson, llvm-commits, hiraditya

Tags: #llvm

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

llvm-svn: 366109

5 years ago[cmake] Don't set install rules for tblgen if building utils is disabled
Keno Fischer [Mon, 15 Jul 2019 19:04:04 +0000 (19:04 +0000)]
[cmake] Don't set install rules for tblgen if building utils is disabled

Summary:
This is a follow up to D64032. Afterwards if building utils is disabled
and cross compilation is attempted, CMake will complain that adding
`install()` directives to targets with EXCLUDE_FROM_ALL set is "undefined".
Indeed, it appears depending on the CMake version and the selected
Generator, the install rule will error because the underlying target isn't
built. Fix that by not adding the install rule if building utils is not
requested. Note that this doesn't prevent building tblgen as a
dependency in not cross-build, even if building tools is disabled.

Reviewed By: smeenai
Differential Revision: https://reviews.llvm.org/D64225

llvm-svn: 366108

5 years agoExpand comment about how StringsToBuckets was computed, and add more entries
Nico Weber [Mon, 15 Jul 2019 18:56:56 +0000 (18:56 +0000)]
Expand comment about how StringsToBuckets was computed, and add more entries

The construction was explained in
https://reviews.llvm.org/D44810?id=139526#inline-391999 but reading the code
shouldn't require hunting down old reviews to understand it.

The precomputed list was missing an entry for the empty list case, and
one entry at the very end. (The current last entry is the last one where
3 * BucketCount fits in a signed int, but the reference implementation
uses unsigneds as far as I can tell, so there's room for one more entry.)

No behavior change for inputs seen in practice.

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

llvm-svn: 366107

5 years ago[ARM] MVE vector for 64bit types
David Green [Mon, 15 Jul 2019 18:42:54 +0000 (18:42 +0000)]
[ARM] MVE vector for 64bit types

We need to make sure that we are sensibly dealing with vectors of types v2i64
and v2f64, even if most of the time we cannot generate native operations for
them. This mostly adds a lot of testing, plus fixes up a couple of the issues
found. And, or and xor can be legal for v2i64, and shifts combining needs a
slight fixup.

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

llvm-svn: 366106

5 years ago[sanitizers][windows][mingw32] Mingw32 RTL fixes
Matthew G McGovern [Mon, 15 Jul 2019 18:42:14 +0000 (18:42 +0000)]
[sanitizers][windows][mingw32] Mingw32 RTL fixes
RTL interception broke mingw32, this should fix those builds by
removing dependency on windows.h

reviewed in https://reviews.llvm.org/D64694

llvm-svn: 366105

5 years ago[WebAssembly] Assembler: recognize .init_array as data section.
Wouter van Oortmerssen [Mon, 15 Jul 2019 18:36:07 +0000 (18:36 +0000)]
[WebAssembly] Assembler: recognize .init_array as data section.

Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

Tags: #llvm

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

llvm-svn: 366104

5 years agoAMDGPU/GlobalISel: Widen vector extracts
Matt Arsenault [Mon, 15 Jul 2019 18:31:10 +0000 (18:31 +0000)]
AMDGPU/GlobalISel: Widen vector extracts

llvm-svn: 366103

5 years agoAMDGPU/GlobalISel: Handle llvm.amdgcn.if.break
Matt Arsenault [Mon, 15 Jul 2019 18:25:24 +0000 (18:25 +0000)]
AMDGPU/GlobalISel: Handle llvm.amdgcn.if.break

llvm-svn: 366102

5 years agoAMDGPU: Remove reserved value accidentally left in for gfx908
Konstantin Zhuravlyov [Mon, 15 Jul 2019 18:22:06 +0000 (18:22 +0000)]
AMDGPU: Remove reserved value accidentally left in for gfx908

llvm-svn: 366101

5 years agoAMDGPU/GlobalISel: Select llvm.amdgcn.end.cf
Matt Arsenault [Mon, 15 Jul 2019 18:18:46 +0000 (18:18 +0000)]
AMDGPU/GlobalISel: Select llvm.amdgcn.end.cf

llvm-svn: 366099

5 years ago[x86] try to keep FP casted+truncated+extracted vector element out of GPRs
Sanjay Patel [Mon, 15 Jul 2019 18:17:23 +0000 (18:17 +0000)]
[x86] try to keep FP casted+truncated+extracted vector element out of GPRs

inttofp (trunc (extelt X, 0)) --> inttofp (extelt (bitcast X), 0)

We have pseudo-vectorization of scalar int to FP casts, so this tries to
make that more likely by replacing a truncate with a bitcast. I didn't see
any test diffs starting from 'uitofp', so I left that as a TODO. We can't
only match the shorter trunc+extract pattern because there's an opposing
transform somewhere, so we infinite loop. Waiting to try this during
lowering is another possibility.

A motivating case is shown in PR39975 and included in the test diffs here:
https://bugs.llvm.org/show_bug.cgi?id=39975

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

llvm-svn: 366098

5 years ago[llvm-lib] Add a dependency to intrinsics_gen to the LLVMLibDriver build
Stella Stamenova [Mon, 15 Jul 2019 18:15:12 +0000 (18:15 +0000)]
[llvm-lib] Add a dependency to intrinsics_gen to the LLVMLibDriver build

Summary:
Occasionally the build of LLVMLibDriver will fail because Attributes.inc has not been generated yet. Add an explicit dependency, so that we can guarantee that the file has been generated before LLVMLibDriver is build.

##[error]llvm\include\llvm\IR\Attributes.h(73,0): Error C1083: Cannot open include file: 'llvm/IR/Attributes.inc': No such file or directory
llvm\include\llvm/IR/Attributes.h(73): fatal error C1083: Cannot open include file: 'llvm/IR/Attributes.inc': No such file or directory [LLVMLibDriver.vcxproj]

Reviewers: asmith

Subscribers: mgorny, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 366097

5 years ago[X86] Return UNDEF from LowerScalarImmediateShift when the shift amount is out of...
Craig Topper [Mon, 15 Jul 2019 17:56:57 +0000 (17:56 +0000)]
[X86] Return UNDEF from LowerScalarImmediateShift when the shift amount is out of range.

I think we only turn out of range shiftss to undef when
all elements are out of range or the shift amount is a splat out
of range. I'm not sure which, I didn't check.

During lowering we can split a shift where some elements
are out of range into multiple shifts. This can create a
new shift with a splat shift amount that is out of range.

This patch returns undef for this case.

Fixes PR42615.

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

llvm-svn: 366096

5 years agoReland "[COFF] Add null check in case of symbols defined in LTO blobs"
Reid Kleckner [Mon, 15 Jul 2019 17:51:02 +0000 (17:51 +0000)]
Reland "[COFF] Add null check in case of symbols defined in LTO blobs"

This reverts r365990 (git commit 1a6053ebc61cb0b8146f5ca27b74859a9a91e0a3)

The test no longer depends on the Visual C++ libraries. I confirmed that
the crash still reproduces with the new test case if I remove the null
check.

llvm-svn: 366095

5 years agoAMDGPU: Add 24-bit mul intrinsics
Matt Arsenault [Mon, 15 Jul 2019 17:50:31 +0000 (17:50 +0000)]
AMDGPU: Add 24-bit mul intrinsics

Insert these during codegenprepare.

This works around a DAG issue where generic combines eliminate the and
asserting the high bits are zero, which then exposes an unknown read
source to the mul combine. It doesn't worth the hassle of trying to
insert an AssertZext or something to try to deal with it.

llvm-svn: 366094

5 years agoAdd some release notes for 9.0 release
Matt Arsenault [Mon, 15 Jul 2019 17:50:28 +0000 (17:50 +0000)]
Add some release notes for 9.0 release

llvm-svn: 366093

5 years ago[AMDGPU] Copy missing predicate from pseudo to real
Stanislav Mekhanoshin [Mon, 15 Jul 2019 17:49:25 +0000 (17:49 +0000)]
[AMDGPU] Copy missing predicate from pseudo to real

NFC at the momemnt, needed for future commit.

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

llvm-svn: 366092

5 years agoUpdate __VERSION__ to remove the hardcoded 4.2.1 version
Sylvestre Ledru [Mon, 15 Jul 2019 17:47:22 +0000 (17:47 +0000)]
Update __VERSION__ to remove the hardcoded 4.2.1 version

Summary:
Just like in https://reviews.llvm.org/D56803
for -dumpversion

Reviewers: rnk

Reviewed By: rnk

Subscribers: dexonsmith, lebedev.ri, hubert.reinterpretcast, xbolva00, fedor.sergeev, cfe-commits

Tags: #clang

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

llvm-svn: 366091

5 years ago[FunctionAttrs] Remove readonly and writeonly assertion
Johannes Doerfert [Mon, 15 Jul 2019 17:31:26 +0000 (17:31 +0000)]
[FunctionAttrs] Remove readonly and writeonly assertion

There are scenarios where mutually recursive functions may cause the SCC
to contain both read only and write only functions. This removes an
assertion when adding read attributes which caused a crash with a the
provided test case, and instead just doesn't add the attributes.

Patch by Luke Lau <luke.lau@intel.com>

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

llvm-svn: 366090

5 years ago[ARM] Minor formatting in ARMInstrMVE.td. NFC
David Green [Mon, 15 Jul 2019 17:29:06 +0000 (17:29 +0000)]
[ARM] Minor formatting in ARMInstrMVE.td. NFC

llvm-svn: 366089

5 years agoUse a unique_ptr instead of manual memory management for LineTable
Nico Weber [Mon, 15 Jul 2019 17:27:46 +0000 (17:27 +0000)]
Use a unique_ptr instead of manual memory management for LineTable

llvm-svn: 366088

5 years agoAMDGPU/GlobalISel: Select easy cases for G_BUILD_VECTOR
Matt Arsenault [Mon, 15 Jul 2019 17:26:43 +0000 (17:26 +0000)]
AMDGPU/GlobalISel: Select easy cases for G_BUILD_VECTOR

llvm-svn: 366087

5 years agoAMDGPU/GlobalISel: RegBankSelect for G_CONCAT_VECTORS
Matt Arsenault [Mon, 15 Jul 2019 17:20:40 +0000 (17:20 +0000)]
AMDGPU/GlobalISel: RegBankSelect for G_CONCAT_VECTORS

llvm-svn: 366086

5 years agoUse a unique_ptr instead of manual memory management for CustomDiagInfo
Nico Weber [Mon, 15 Jul 2019 17:20:34 +0000 (17:20 +0000)]
Use a unique_ptr instead of manual memory management for CustomDiagInfo

llvm-svn: 366085

5 years agoUse unique_ptr instead of manual delete in one place. No behavior change.
Nico Weber [Mon, 15 Jul 2019 17:12:08 +0000 (17:12 +0000)]
Use unique_ptr instead of manual delete in one place. No behavior change.

llvm-svn: 366084

5 years ago[lldb][doc] Document how our LLDB table gen initialized options
Raphael Isemann [Mon, 15 Jul 2019 17:10:44 +0000 (17:10 +0000)]
[lldb][doc] Document how our LLDB table gen initialized options

Summary: This patch adds documentation that should make it easier to migrate from using the old initializers to the table gen format.

Reviewers: jingham

Reviewed By: jingham

Subscribers: abidh, lldb-commits, JDevlieghere

Tags: #lldb

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

llvm-svn: 366083

5 years ago[x86] add tests for reductions that might be better with more horizontal ops; NFC
Sanjay Patel [Mon, 15 Jul 2019 16:59:38 +0000 (16:59 +0000)]
[x86] add tests for reductions that might be better with more horizontal ops; NFC

llvm-svn: 366082

5 years agoRevert "r366069: [PatternMatch] Implement matching code for LibFunc"
Ilya Biryukov [Mon, 15 Jul 2019 16:43:36 +0000 (16:43 +0000)]
Revert "r366069: [PatternMatch] Implement matching code for LibFunc"

Reason: the change introduced a layering violation by adding a
dependency on IR to Analysis.

llvm-svn: 366081

5 years ago[docs][llvm-nm] Fix inconsistent grammar
James Henderson [Mon, 15 Jul 2019 16:40:34 +0000 (16:40 +0000)]
[docs][llvm-nm] Fix inconsistent grammar

llvm-svn: 366080

5 years ago[X86][SSE] Regenerated packss.ll test file.
Simon Pilgrim [Mon, 15 Jul 2019 16:23:42 +0000 (16:23 +0000)]
[X86][SSE] Regenerated packss.ll test file.

Not sure what went wrong in rL366077....

llvm-svn: 366079

5 years ago[X86][SSE] Add PACKSS with zero shuffle masks.
Simon Pilgrim [Mon, 15 Jul 2019 15:43:04 +0000 (15:43 +0000)]
[X86][SSE] Add PACKSS with zero shuffle masks.

This is an example of expansion due to D61129 - it should combine back to a PACKSS with a zero operand.

llvm-svn: 366077

5 years agofix unnamed fiefield issue and add tests for __builtin_preserve_access_index intrinsic
Yonghong Song [Mon, 15 Jul 2019 15:42:41 +0000 (15:42 +0000)]
fix unnamed fiefield issue and add tests for __builtin_preserve_access_index intrinsic

This is a followup patch for https://reviews.llvm.org/D61809.
Handle unnamed bitfield properly and add more test cases.

Fixed the unnamed bitfield issue. The unnamed bitfield is ignored
by debug info, so we need to ignore such a struct/union member
when we try to get the member index in the debug info.

D61809 contains two test cases but not enough as it does
not checking generated IRs in the fine grain level, and also
it does not have semantics checking tests.
This patch added unit tests for both code gen and semantics checking for
the new intrinsic.

Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 366076

5 years ago[ORC] Start adding ORCv1 to ORCv2 transition tips to the ORCv2 doc.
Lang Hames [Mon, 15 Jul 2019 15:36:37 +0000 (15:36 +0000)]
[ORC] Start adding ORCv1 to ORCv2 transition tips to the ORCv2 doc.

llvm-svn: 366075

5 years ago[AMDGPU] fixed scheduler crash in gfx908
Stanislav Mekhanoshin [Mon, 15 Jul 2019 15:34:05 +0000 (15:34 +0000)]
[AMDGPU] fixed scheduler crash in gfx908

For some reason scheduler can send down an SUnit without an
instruction.

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

llvm-svn: 366074

5 years ago[clangd] Fix doc
Kadir Cetinkaya [Mon, 15 Jul 2019 15:16:57 +0000 (15:16 +0000)]
[clangd] Fix doc

llvm-svn: 366073

5 years agogn build: Add a note on how to locally tell git to ignore build dir
Nico Weber [Mon, 15 Jul 2019 15:14:09 +0000 (15:14 +0000)]
gn build: Add a note on how to locally tell git to ignore build dir

llvm-svn: 366072

5 years ago[AMDGPU][MC][GFX9][GFX10] Added support of GET_DOORBELL message
Dmitry Preobrazhensky [Mon, 15 Jul 2019 15:12:16 +0000 (15:12 +0000)]
[AMDGPU][MC][GFX9][GFX10] Added support of GET_DOORBELL message

Reviewers: artem.tamazov, arsenm

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

llvm-svn: 366071

5 years ago[clangd] Fix duplicate highlighting tokens appearing in initializer lists.
Johan Vikstrom [Mon, 15 Jul 2019 15:08:27 +0000 (15:08 +0000)]
[clangd] Fix duplicate highlighting tokens appearing in initializer lists.

Summary: The RecursiveASTVisitor sometimes visits exprs in initializer lists twice. Added deduplication to prevent duplicate highlighting tokens from appearing. Done by sorting and a linear search.

Reviewers: hokein, sammccall, ilya-biryukov

Subscribers: MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 366070

5 years ago[PatternMatch] Implement matching code for LibFunc
Dmitry Venikov [Mon, 15 Jul 2019 14:47:45 +0000 (14:47 +0000)]
[PatternMatch] Implement matching code for LibFunc

Summary: Provides m_LibFunc pattern that can be used to match LibFuncs.

Reviewers: spatel, hfinkel, efriedma, lebedev.ri

Reviewed By: lebedev.ri

Subscribers: lebedev.ri, llvm-commits

Tags: #llvm

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

llvm-svn: 366069

5 years ago[OPENMP]Add support for analysis of if clauses.
Alexey Bataev [Mon, 15 Jul 2019 14:46:23 +0000 (14:46 +0000)]
[OPENMP]Add support for analysis of if clauses.

Summary:
Added support for analysis of if clauses in the OpenMP directives to be
able to check for the use of uninitialized variables.

Reviewers: NoQ

Subscribers: guansong, jfb, jdoerfert, caomhin, kkwli0, cfe-commits

Tags: #clang

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

llvm-svn: 366068

5 years ago[AMDGPU][MC] Corrected encoding of src0 for DS_GWS_* instructions
Dmitry Preobrazhensky [Mon, 15 Jul 2019 14:37:57 +0000 (14:37 +0000)]
[AMDGPU][MC] Corrected encoding of src0 for DS_GWS_* instructions

See bug 42599: https://bugs.llvm.org/show_bug.cgi?id=42599

Reviewers: artem.tamazov, arsenm

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

llvm-svn: 366067

5 years ago[X86] isTargetShuffleEquivalent - assert the expected mask is correctly formed. NFCI.
Simon Pilgrim [Mon, 15 Jul 2019 14:29:14 +0000 (14:29 +0000)]
[X86] isTargetShuffleEquivalent - assert the expected mask is correctly formed. NFCI.

While we don't make any assumptions about the actual mask, assert that the expected mask only contains valid mask element values.

llvm-svn: 366066

5 years ago[Testing] Add missing "REQUIRES: asserts"
David Zarzycki [Mon, 15 Jul 2019 14:12:35 +0000 (14:12 +0000)]
[Testing] Add missing "REQUIRES: asserts"

This broke after r366048 / https://reviews.llvm.org/D63923

llvm-svn: 366065

5 years ago[mips] Remove "else-after-return". NFC
Simon Atanasyan [Mon, 15 Jul 2019 13:12:36 +0000 (13:12 +0000)]
[mips] Remove "else-after-return". NFC

llvm-svn: 366064