2 years ago[libc] Take 2: Add linux implementations of thrd_create and thrd_join functions.
Siva Chandra Reddy [Fri, 6 Mar 2020 23:05:50 +0000 (15:05 -0800)]
[libc] Take 2: Add linux implementations of thrd_create and thrd_join functions.

The following are the differences from the first version:

1. The kernel does not copy the stack for the new thread (it cannot).
The previous version missed this fact. In this new version, the new
thread's start args are copied on to the new stack in a known location
so that the new thread can sniff them out.
2. A start args sniffer for x86_64 has been added.
2. Default stack size has been increased to 64KB.

Reviewers: abrachet, phosek

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

2 years agoFix MLIR build when NVPTX backend is not configured in
Mehdi Amini [Tue, 10 Mar 2020 04:09:33 +0000 (04:09 +0000)]
Fix MLIR build when NVPTX backend is not configured in

The GPUToCUDA conversion needs to conditionally link it

2 years agoAMDGPU/GlobalISel: Avoid illegal vector exts for add/sub/mul
Matt Arsenault [Wed, 19 Feb 2020 17:54:35 +0000 (12:54 -0500)]
AMDGPU/GlobalISel: Avoid illegal vector exts for add/sub/mul

When expanding scalar packed operations, we should not introduce
illegal vector casts LegalizerHelper introduces. We're not in a
legalizer context, and there's no RegBankSelect apply or legalize

2 years agoAMDGPU/GlobalISel: Fix mishandling SGPR v2s16 add/sub/mul
Matt Arsenault [Wed, 19 Feb 2020 18:23:11 +0000 (13:23 -0500)]
AMDGPU/GlobalISel: Fix mishandling SGPR v2s16 add/sub/mul

We weren't considering the packed case correctly, and this was passing
through to the selector. The selector only checked the size, so this
would incorrectly compile to a single 32-bit scalar add.

As usual, the LegalizerHelper is somewhat awkward to use from
applyMappingImpl. I think this is the first place we've needed
multi-step legalization here though.

2 years ago[MC] Allow Stackmap sections after DWARF in MachO.
Lang Hames [Mon, 9 Mar 2020 04:41:10 +0000 (21:41 -0700)]
[MC] Allow Stackmap sections after DWARF in MachO.

Mixing stackmaps and DWARF in a single file triggers an assertion in
MCMachOStreamer as stackmap sections are emitted in AsmPrinter::emitEndOfAsmFile
after the DWARF sections have already been emitted.

Since it should be safe to emit stackmap sections after DWARF sections this
patch relaxes the assertion to allow that.

Reviewers: aprantl, dblaikie, echristo

Subscribers: hiraditya, ributzka, llvm-commits

Tags: #llvm

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

2 years ago[mlir] NFC: remove IntegerValueSet / MutableIntegerSet
Uday Bondhugula [Tue, 10 Mar 2020 00:48:28 +0000 (20:48 -0400)]
[mlir] NFC: remove IntegerValueSet / MutableIntegerSet

- these are unused and really not needed now given flat affine

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

2 years ago[NFC] use hasAnyOperatorName and hasAnyOverloadedOperatorName functions in clang...
Nathan James [Tue, 10 Mar 2020 00:42:21 +0000 (00:42 +0000)]
[NFC] use hasAnyOperatorName and hasAnyOverloadedOperatorName functions in clang-tidy matchers

2 years ago[WebAssembly] Fixed FrameBaseLocal not being set.
Wouter van Oortmerssen [Tue, 10 Mar 2020 00:24:46 +0000 (17:24 -0700)]
[WebAssembly] Fixed FrameBaseLocal not being set.

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

WebAssemblyRegColoring may merge the vreg that currently represents
the FrameBase with one representing an argument.
WebAssemblyExplicitLocals picks up the corresponding local when
a vreg is first added to the Reg2Local mapping, except when it is
an argument instruction which are handled separately.

Note that this does not change that vregs representing the FrameBase
may get merged, it is not clear to me that this may have other
effects we may want to avoid?

Reviewers: dschuff

Reviewed By: dschuff

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

Tags: #llvm

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

2 years ago[ASTMatchers] Add hasAnyOverloadedOperatorName matcher
Nathan James [Mon, 9 Mar 2020 11:16:50 +0000 (11:16 +0000)]
[ASTMatchers] Add hasAnyOverloadedOperatorName matcher

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

2 years ago[x86][slh] Move isDataInvariant* functions
George Burgess IV [Tue, 10 Mar 2020 00:04:30 +0000 (17:04 -0700)]
[x86][slh] Move isDataInvariant* functions

Patch by Zola Bridges!

From the review:

I moved these functions to X86InstrInfo.cpp, so they are available from
another pass. In addition, this is a step toward resolving the FIXME to
move this metadata to the instruction tables.

This is the final step to make these two data invariance checks
available for non-SLH passes.

The other two steps were here:

- https://reviews.llvm.org/D70283
- https://reviews.llvm.org/D75650

Tested via llvm-lit llvm/test/CodeGen/X86/speculative-load-hardening*

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

2 years ago[x86][slh][NFC] Rm redundant liveness check
George Burgess IV [Tue, 10 Mar 2020 00:02:51 +0000 (17:02 -0700)]
[x86][slh][NFC] Rm redundant liveness check

Patch by Zola Bridges!

From the review:

In this changeset (https://reviews.llvm.org/D70283), I added a liveness
check everywhere the isDataInvariant* functions were used, so that I
could safely delete the checks within the function. I mistakenly left
that deletion out of the patch. The result is that the same condition is
checked twice for some instructions which is functionally fine, but not
good. This change deletes the redundant check that I intended to delete
in the last change.

This is the second of three patches that will make the data invariance
checks available for non-SLH passes and enable the FIXMEs related to
moving this metadata to the instruction tables to be resolved.

Tested via llvm-lit llvm/test/CodeGen/X86/speculative-load-hardening*

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

2 years agoRevert "PR45083: Mark statement expressions as being dependent if they contain"
Richard Smith [Tue, 10 Mar 2020 00:03:56 +0000 (17:03 -0700)]
Revert "PR45083: Mark statement expressions as being dependent if they contain"

This reverts commit 2669e41b7b9c1561a01048d5ed0aba3c62432dfc, which was
pushed by mistake.

2 years agoMark test function as 'weak' to prevent interprocedural CSE.
Richard Smith [Tue, 10 Mar 2020 00:01:07 +0000 (17:01 -0700)]
Mark test function as 'weak' to prevent interprocedural CSE.

A recent change to MemorySSA caused LLVM to start optimizing the call to
'f(x)' into just 'x', despite the 'noinline' attribute. So try harder to
prevent this optimization from firing.

2 years agoPR45083: Mark statement expressions as being dependent if they contain
Richard Smith [Thu, 5 Mar 2020 20:20:02 +0000 (12:20 -0800)]
PR45083: Mark statement expressions as being dependent if they contain
dependent constructs.

We previously assumed they were neither value- nor
instantiation-dependent under any circumstances, which would lead to
crashes and other misbehavior.

This doesn't match GCC's behavior (where statement expressions appear to
be treated as value-dependent if they appear in a dependent context),
but seems to be the best thing we can do in the short term: it turns out
to be remarkably difficult for us to correctly determine whether we are
in a dependent context (and it's not even possible in some cases, such
as in a generic lambda where we might not have seen the 'auto' yet).

This was previously reverted in 8e4a867 for rejecting some code, but that
code was invalid and Clang was previously incorrectly accepting it.

2 years ago[ASan] Enable set_shadow_test.c on Windows.
Matt Morehouse [Mon, 9 Mar 2020 23:07:45 +0000 (16:07 -0700)]
[ASan] Enable set_shadow_test.c on Windows.

It looks like the recent -fno-common is making it pass now.

2 years ago[mlir][SideEffects] Replace the old SideEffects dialect interface with the newly...
River Riddle [Mon, 9 Mar 2020 23:01:41 +0000 (16:01 -0700)]
[mlir][SideEffects] Replace the old SideEffects dialect interface with the newly added op interfaces/traits.

The old interface was a temporary stopgap to allow for implementing simple LICM that took side effects of region operations into account. Now that MLIR has proper support for specifying memory effects, this interface can be deleted.

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

2 years ago[cmake] Strip quotes in compiler-rt/lib/crt; error if checks fail
George Burgess IV [Mon, 9 Mar 2020 22:48:19 +0000 (15:48 -0700)]
[cmake] Strip quotes in compiler-rt/lib/crt; error if checks fail

Patch by Zhizhou Yang!

In his own words:

Similar change to CMakeLists as r372312.

After r372209, compiler command line may include argument with quotes:


And it causes a hidden failure with execute_process later: Could not
read profile "/foo/bar.profdata": No such file or directory.

In this particular case, the check for .init_array will fail silently
and creates a PGO-ed binary with bad .init_array section in compiler-rt.

Bug details can be found in PR45022

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

2 years ago[cmake] By default do not build compiler-rt with PGO
George Burgess IV [Mon, 9 Mar 2020 22:25:41 +0000 (15:25 -0700)]
[cmake] By default do not build compiler-rt with PGO

Patch by Zhizhou Yang!

In his own words:

Currently compiler-rt doesn't officially support either PGO
instrumentation or use PGO profdata to build it.

PGO related flags are passed into compiler-rt since rL372209, and
causing bugs: 45022, crbug:1018840

This patch adds several checks in compiler-rt to disable PGO related
flags and provides a flag to turn on PGO for compiler-rt if needed.

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

2 years ago[clang-tidy][docs] Post-commit feedback on D74669
Jonathan Roelofs [Mon, 9 Mar 2020 22:51:41 +0000 (16:51 -0600)]
[clang-tidy][docs] Post-commit feedback on D74669

2 years agoChange tests to use -S instead of -c to work when an external assembler is used that...
Douglas Yung [Mon, 9 Mar 2020 22:42:20 +0000 (15:42 -0700)]
Change tests to use -S instead of -c to work when an external assembler is used that is not present. NFCI.

Reviewed By: NoQ

Subscribers: Charusso, cfe-commits

Tags: #clang

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

2 years ago[CodeGenObjC] Privatize some ObjC metadata symbols
Erik Pilkington [Mon, 9 Mar 2020 19:17:23 +0000 (12:17 -0700)]
[CodeGenObjC] Privatize some ObjC metadata symbols

Nobody needs these symbols, so there isn't any benefit in including them. This
saves some code-size in Objective-C binaries. Partially reverts:
https://reviews.llvm.org/D61454. rdar://56579760

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

2 years ago[AppleObjCRuntimeV2] Fix a typo. Evalulate -> evaluate.
Davide Italiano [Mon, 9 Mar 2020 22:40:09 +0000 (15:40 -0700)]
[AppleObjCRuntimeV2] Fix a typo. Evalulate -> evaluate.

2 years ago[AppleObjC2RuntimeV2] Remove dead code. NFC.
Davide Italiano [Mon, 9 Mar 2020 22:37:12 +0000 (15:37 -0700)]
[AppleObjC2RuntimeV2] Remove dead code. NFC.

2 years ago[ObjC] Dynamic type resolution logging should go to the types log.
Davide Italiano [Mon, 9 Mar 2020 22:35:24 +0000 (15:35 -0700)]
[ObjC] Dynamic type resolution logging should go to the types log.

2 years ago[tests] Add long nop test coverage for intel platforms
Philip Reames [Mon, 9 Mar 2020 22:28:24 +0000 (15:28 -0700)]
[tests] Add long nop test coverage for intel platforms

2 years agoAdd missing list.rst entry
Jonathan Roelofs [Mon, 9 Mar 2020 22:27:35 +0000 (16:27 -0600)]
Add missing list.rst entry

2 years ago[gn] Use ghash if using clang & LLD together to make PDBs
Reid Kleckner [Fri, 6 Mar 2020 22:41:48 +0000 (14:41 -0800)]
[gn] Use ghash if using clang & LLD together to make PDBs

I noticed my links were a bit slower on Windows than usual.

Reviewed By: thakis

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

2 years agorelease notes: fix new check name
Jonathan Roelofs [Mon, 9 Mar 2020 22:11:35 +0000 (16:11 -0600)]
release notes: fix new check name

2 years ago[gn build] Port 1e0669bfe05
LLVM GN Syncbot [Mon, 9 Mar 2020 21:59:49 +0000 (21:59 +0000)]
[gn build] Port 1e0669bfe05

2 years ago[clang-tidy] New check: bugprone-suspicious-include
Jonathan Roelofs [Wed, 4 Mar 2020 16:55:45 +0000 (09:55 -0700)]
[clang-tidy] New check: bugprone-suspicious-include

Detects and fixes suspicious code like: `#include "foo.cpp"`.

Inspired by: https://twitter.com/lefticus/status/1228458240364687360?s=20


2 years ago[OPENMP50]Codegen for depobj dependency kind.
Alexey Bataev [Mon, 9 Mar 2020 21:18:19 +0000 (17:18 -0400)]
[OPENMP50]Codegen for depobj dependency kind.

Implemented codegen for depobj modifier in depend clauses.

2 years ago[AMDGPU] Fix scheduling info for terminator SALU instructions
Jay Foad [Fri, 6 Mar 2020 15:35:35 +0000 (15:35 +0000)]
[AMDGPU] Fix scheduling info for terminator SALU instructions

Instruction variants like S_MOV_B32_term should have the same SchedRW
class as the base instruction, S_MOV_B32. This probably doesn't make any
difference in practice because as terminators, they'll always be
scheduled at the end of a basic block, but it's simply more correct than
giving them all the default SchedRW class of Write32Bit, which implies a
VALU operation.

Reviewers: rampitec, arsenm, nhaehnle

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

Tags: #llvm

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

2 years agoFix internal links in Kaleidoscope tutorial
Jonathan Roelofs [Mon, 9 Mar 2020 21:07:44 +0000 (15:07 -0600)]
Fix internal links in Kaleidoscope tutorial

2 years agoFollow up of 3d9a0445cce3, clang driver defaulting to -fno-common
Sjoerd Meijer [Mon, 9 Mar 2020 20:39:52 +0000 (20:39 +0000)]
Follow up of 3d9a0445cce3, clang driver defaulting to -fno-common

Attempt to pacify windows bot where this failed:


2 years ago[HIP] Fix device stub name
Yaxun (Sam) Liu [Thu, 5 Mar 2020 17:59:33 +0000 (12:59 -0500)]
[HIP] Fix device stub name

HIP emits a device stub function for each kernel in host code.

The HIP debugger requires device stub function to have a different unmangled name as the kernel.

Currently the name of the device stub function is the mangled name with a postfix .stub. However,
this does not work with the HIP debugger since the unmangled name is the same as the kernel.

This patch adds prefix __device__stub__ to the unmangled name of the device stub before mangling,
therefore the device stub function has a valid mangled name which is different than the device kernel
name. The device side kernel name is kept unchanged. kernels with extern "C" also gets the prefix added
to the corresponding device stub function.

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

2 years agoFix typo in gn files
Arthur Eubanks [Mon, 9 Mar 2020 20:02:14 +0000 (13:02 -0700)]
Fix typo in gn files


2 years agoDon't emit pointer to int cast warnings under -Wmicrosoft-cast
Arthur Eubanks [Wed, 4 Mar 2020 21:18:59 +0000 (13:18 -0800)]
Don't emit pointer to int cast warnings under -Wmicrosoft-cast

MSVC also warns on this:
$ cat /tmp/a.c
int f(void* p) { return (int) p; }

$ cl /c /tmp/a.c
C:/src/tmp/a.c(1): warning C4311: 'type cast': pointer truncation from
'void *' to 'int'

Warnings originally added in https://reviews.llvm.org/D72231.

Subscribers: cfe-commits

Tags: #clang

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

2 years ago[ObjC][ARC] Don't remove autoreleaseRV/retainRV pairs if the call isn't
ahatanak [Mon, 9 Mar 2020 20:20:58 +0000 (13:20 -0700)]
[ObjC][ARC] Don't remove autoreleaseRV/retainRV pairs if the call isn't
a tail call

Previosly ARC optimizer removed the autoreleaseRV/retainRV pair in the
following code, which caused the object returned by @something to be
placed in the autorelease pool because the call to @something isn't a
tail call:

  %call = call i8* @something(...)
  %2 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call)
  %3 = call i8* @objc_autoreleaseReturnValue(i8* %2)
  ret i8* %3

Fix the bug by checking whether @something is a tail call.


2 years ago[mlir][ods] Fix AnyInteger predicate
Lei Zhang [Mon, 9 Mar 2020 16:29:13 +0000 (16:29 +0000)]
[mlir][ods] Fix AnyInteger predicate

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

2 years agoAMDGPU/GlobalISel: Improve handling of illegal return types
Matt Arsenault [Sat, 22 Feb 2020 15:00:38 +0000 (10:00 -0500)]
AMDGPU/GlobalISel: Improve handling of illegal return types

Most importantly, this fixes ret i8. Also make sure to handle
signext/zeroext for odd types > i32. Some of the corresponding
argument passing fixes also need to be handled.

2 years agoRecommit #2 "[Driver] Default to -fno-common for all targets"
Sjoerd Meijer [Mon, 9 Mar 2020 19:25:24 +0000 (19:25 +0000)]
Recommit #2 "[Driver] Default to -fno-common for all targets"

After a first attempt to fix the test-suite failures, my first recommit
caused the same failures again. I had updated CMakeList.txt files of
tests that needed -fcommon, but it turns out that there are also
Makefiles which are used by some bots, so I've updated these Makefiles
now too.

See the original commit message for more details on this change:

2 years agoAMDGPU: Make signext/zeroext behave more sensibly over > i32
Matt Arsenault [Mon, 24 Feb 2020 20:43:18 +0000 (15:43 -0500)]
AMDGPU: Make signext/zeroext behave more sensibly over > i32

Interpret these as extending to the next multiple of 32-bits. This had
no effect with i48 for example, which is really split into {i32, i16},
which should extend the high part.

2 years ago[lldb] Add .clang-tidy with customization to disable readability-identifier-naming
Fangrui Song [Sat, 7 Mar 2020 17:21:03 +0000 (09:21 -0800)]
[lldb] Add .clang-tidy with customization to disable readability-identifier-naming

Reviewed By: JDevlieghere

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

2 years ago[Hexagon] Refactor handling of circular load/store builtins, NFC
Krzysztof Parzyszek [Mon, 9 Mar 2020 19:38:33 +0000 (14:38 -0500)]
[Hexagon] Refactor handling of circular load/store builtins, NFC

2 years agoPermit attribute 'used' with 'target' multiversioning.
Erich Keane [Mon, 9 Mar 2020 17:15:45 +0000 (10:15 -0700)]
Permit attribute 'used' with 'target' multiversioning.

This adds infrastructure for a multiversioning whitelist, plus adds
'used' to the allowed list with 'target'.  The behavior here mirrors the
implementation in GCC, where 'used' only applies to the single
declaration and doesn't apply to the ifunc or resolver.

This is not being applied to cpu_dispatch and cpu_specific, since the
rules are more complicated for cpu_specific, which emits multiple
symbols. Additionally, the author isn't currently aware of uses in the
wild of this combination, but is aware of a number of target+used

2 years agoAMDGPU/GlobalISel: Start matching s_lshlN_add_u32 instructions
Matt Arsenault [Fri, 21 Feb 2020 01:26:41 +0000 (20:26 -0500)]
AMDGPU/GlobalISel: Start matching s_lshlN_add_u32 instructions

Use a hack to only enable this for GlobalISel.

Technically this also works with SelectionDAG, but the divergence
selection isn't reliable enough and a few cases fail, but I have no
desire to spend time writing the manual expansion code for it. The DAG
actually does a better job since it catches using v_add_lshl_u32 in
the mixed SGPR/VGPR cases.

2 years agoFix the type of the capture passed to LambdaIntroducer::addCapture in
Akira Hatanaka [Thu, 5 Mar 2020 02:35:07 +0000 (18:35 -0800)]
Fix the type of the capture passed to LambdaIntroducer::addCapture in

Previously the type of the variable was being passed, which was causing
clang to crash when a non-reference variable was captured by reference
or a reference variable was captured by value by a lambda and a block
nested inside the lambda body was referencing the variable.

Original patch by JF Bastien.


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

2 years ago[AArch64][SVE] Add missing fp16 DestructiveInstType tests
Cameron McInally [Mon, 9 Mar 2020 18:29:16 +0000 (13:29 -0500)]
[AArch64][SVE] Add missing fp16 DestructiveInstType tests

These tests should have been added with a5b22b768f5a in D73711.

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

2 years ago[libc++] Enable std::function ABI bug demonstration on Apple Clang too
Louis Dionne [Mon, 9 Mar 2020 19:03:16 +0000 (15:03 -0400)]
[libc++] Enable std::function ABI bug demonstration on Apple Clang too

2 years ago[www] cxx_status: Update Reflection TS to Cologne draft
Hubert Tong [Mon, 9 Mar 2020 18:09:00 +0000 (14:09 -0400)]
[www] cxx_status: Update Reflection TS to Cologne draft

As of the 2019 Cologne meeting, according to its minutes (N4826), N4818
is the draft of the Reflection TS.

Reviewers: rsmith, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

2 years ago[www] cxx_status: Update title to mention C++20
Hubert Tong [Mon, 9 Mar 2020 18:17:34 +0000 (14:17 -0400)]
[www] cxx_status: Update title to mention C++20

The document covers the Clang implementation status of the "upcoming
C++20 standard". Update the title to match.

Reviewers: rsmith, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

2 years ago[X86][SSE] SimplifyDemandedVectorEltsForTargetNode - reduce vector width of X86ISD...
Simon Pilgrim [Mon, 9 Mar 2020 17:35:37 +0000 (17:35 +0000)]
[X86][SSE] SimplifyDemandedVectorEltsForTargetNode - reduce vector width of X86ISD::BLENDI

If we don't need the upper subvector elements of the BLENDI node then use a smaller vector size.

This causes a couple of minor regressions in insertelement-ones.ll which are more examples of PR26018; given how cheap allones generation is I don't consider that a showstopper, just an annoyance (and there's plenty of other poor codegen cases in that file).

2 years ago[X86] Teach combineToExtendBoolVectorInReg to create opportunities for using broadcas...
Craig Topper [Mon, 9 Mar 2020 17:35:31 +0000 (10:35 -0700)]
[X86] Teach combineToExtendBoolVectorInReg to create opportunities for using broadcast load instructions.

If we're inserting a scalar that is smaller than the element
size of the final VT, the value of the extra bits doesn't matter.

Previously we any_extended in the scalar domain before inserting.

This patch changes this to use a broadcast of the original
scalar type and then a bitcast to the final type. This might
enable the use of a broadcast load.

This recovers regressions from 07d68c24aa19483e44db4336b0935b00a5d69949
and 9fcd212e2f678fdbdf304399a1e58ca490dc54d1 without relying on
alignment of the load.

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

2 years agoTest that volatile load type isn't changed
JF Bastien [Wed, 4 Mar 2020 21:51:35 +0000 (13:51 -0800)]
Test that volatile load type isn't changed

Summary: As discussed in D75505, it's not particularly useful to change the type of a load to/from floating-point/integer because it's followed by a bitcast, and it might lead to surprising code generation. Check that this doesn't generally happen.

Reviewers: lebedev.ri

Subscribers: jkorous, dexonsmith, ributzka, llvm-commits

Tags: #llvm

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

2 years agoDrop HEADER_ per review feedback on D74669
Jonathan Roelofs [Mon, 9 Mar 2020 17:56:10 +0000 (11:56 -0600)]
Drop HEADER_ per review feedback on D74669

2 years ago[clang-format] Correct indentation for `[key] = value,` entries in C++ object initial...
Jonathan Coe [Mon, 9 Mar 2020 18:00:03 +0000 (18:00 +0000)]
[clang-format] Correct indentation for `[key] = value,` entries in C++ object initialisers

Summary: Do not use continuation indent for '[' in blocks in C# code.

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang-format, #clang

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

2 years ago[gn build] Port 3486cc014b2
LLVM GN Syncbot [Mon, 9 Mar 2020 17:56:57 +0000 (17:56 +0000)]
[gn build] Port 3486cc014b2

2 years agoAdd test missed in r843a9778fcd5
Jeremy Stenglein [Mon, 9 Mar 2020 17:50:05 +0000 (10:50 -0700)]
Add test missed in r843a9778fcd5

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

2 years ago[InstSimplify] Simplify calls with "returned" attribute
Nikita Popov [Sat, 7 Mar 2020 15:34:34 +0000 (16:34 +0100)]
[InstSimplify] Simplify calls with "returned" attribute

If a call argument has the "returned" attribute, we can simplify
the call to the value of that argument. The "-inst-simplify" pass
already handled this for the constant integer argument case via
known bits, which is invoked in SimplifyInstruction. However,
non-constant (or non-int) arguments are not handled at all right now.

This addresses one of the regressions from D75801.

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

2 years agoFix indentation using clang-format for Spiller.h. NFC
Marcello Maggioni [Sun, 8 Mar 2020 17:55:21 +0000 (10:55 -0700)]
Fix indentation using clang-format for Spiller.h. NFC
Spiller.h had indentation that doesn't match LLVM guidelines. Fixing it

Reviewers: qcolombet, arsenm

Subscribers: MatzeB, wdng, hiraditya, llvm-commits, qcolombet

Tags: #llvm

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

2 years agoMove Spiller.h from lib/ directory path to include/CodeGen. NFC
Marcello Maggioni [Sun, 8 Mar 2020 16:36:29 +0000 (09:36 -0700)]
Move Spiller.h from lib/ directory path to include/CodeGen. NFC

This allows Spiller.h to be used and included outside of
the lib/CodeGen directory. For example to be used in the
lib/Target directory or other places.

2 years ago[InstCombine] Don't simplify calls without uses
Nikita Popov [Sat, 7 Mar 2020 19:21:09 +0000 (20:21 +0100)]
[InstCombine] Don't simplify calls without uses

When simplifying a call without uses, replaceInstUsesWith() is
going to do nothing, but we'll skip all following folds. We can
only run into this problem with calls that both simplify and are
not trivially dead if unused, which currently seems to happen only
with calls to undef, as the test diff shows. When extending
SimplifyCall() to handle "returned" attributes, this becomes a much
bigger problem, so I'm fixing this first.

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

2 years ago[InstSimplify] Don't simplify musttail calls
Nikita Popov [Sun, 8 Mar 2020 12:11:46 +0000 (13:11 +0100)]
[InstSimplify] Don't simplify musttail calls

As pointed out by jdoerfert on D75815, we must be careful when
simplifying musttail calls: We can only replace the return value
if we can eliminate the call entirely. As we can't make this
guarantee for all consumers of InstSimplify, this patch disables
simplification of musttail calls. Without this patch, musttail
simplification currently results in module verification errors.

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

2 years agoAdd a warning for builtin_return_address/frame_address with > 0 argument
Jeremy Stenglein [Mon, 9 Mar 2020 17:17:15 +0000 (10:17 -0700)]
Add a warning for builtin_return_address/frame_address with > 0 argument

Clang is missing a warning for
builtin_return_address/builtin_frame_address called with > 0 argument.
Gcc provides a warning for this via -Wframe-address:


As calling these functions with argument > 0 has caused several crashes
for us, we would like to have the same warning as gcc here. This diff
adds the warning and makes it part of -Wmost.

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

2 years ago[clang-format] C# does not indent braced initializers as continuations
Jonathan Coe [Mon, 9 Mar 2020 17:33:53 +0000 (17:33 +0000)]
[clang-format] C# does not indent braced initializers as continuations

Summary: C# treats object initializers as braced init blocks. Braced init blocks are no longer indented as continuations.

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang-format, #clang

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

2 years ago[mlir][Vector] Add a vector.matrix_multiply op on 1-D vectors
Nicolas Vasilache [Mon, 9 Mar 2020 17:29:13 +0000 (13:29 -0400)]
[mlir][Vector] Add a vector.matrix_multiply op on 1-D vectors

Summary: This op mirrors the llvm.intr counterpart and allows lowering + type conversions in a progressive fashion.

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

2 years ago[clang-tidy] Use ; as separator for HeaderFileExtensions
Jonathan Roelofs [Wed, 4 Mar 2020 16:55:03 +0000 (09:55 -0700)]
[clang-tidy] Use ; as separator for HeaderFileExtensions

... and deprecate use of ',' for the same.


2 years ago[clang-tidy] Generalize HeaderFileExtensions.{h,cpp}. NFC
Jonathan Roelofs [Tue, 25 Feb 2020 17:41:32 +0000 (10:41 -0700)]
[clang-tidy] Generalize HeaderFileExtensions.{h,cpp}. NFC


2 years ago[clang-format] cleanup from D75517
Jonathan Coe [Mon, 9 Mar 2020 17:10:09 +0000 (17:10 +0000)]
[clang-format] cleanup from D75517

Fix typo in comment.

Add closing brace to test text.

Reviewers: krasimir

Subscribers: cfe-commits

Tags: #clang-format, #clang

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

2 years ago[mlir][Vector] Allow lowering of vector.shape_cast 2D <-> 1D
Nicolas Vasilache [Mon, 9 Mar 2020 17:13:56 +0000 (13:13 -0400)]
[mlir][Vector] Allow lowering of vector.shape_cast 2D <-> 1D

This will support the progressive lowering of:
vector.contract ->
  downcast + vector.matrix_multiply + upcast ->

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

2 years ago[mlir][LLVM] Add remaining llvm.matrix intrinsics
Nicolas Vasilache [Mon, 9 Mar 2020 17:00:45 +0000 (13:00 -0400)]
[mlir][LLVM] Add remaining llvm.matrix intrinsics

This revision adds intrinsics for transpose, columnwise.load and columnwise.store
achieving full coverage of the llvm.matrix intrinsics.

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

2 years ago[lldb/Process] Update ThreadKDP for API change
Jonas Devlieghere [Mon, 9 Mar 2020 16:59:06 +0000 (09:59 -0700)]
[lldb/Process] Update ThreadKDP for API change

GetUnwinder now returns a reference instead of a pointer.

2 years ago[mlir] NFC - Add predicates and types for VectorOfRank
Nicolas Vasilache [Mon, 9 Mar 2020 16:53:04 +0000 (12:53 -0400)]
[mlir] NFC - Add predicates and types for VectorOfRank

This is the counterpart of VectorOfLength for ranks.
This will be used in lowering vector.contract operations to llvm.matrix

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

2 years ago[Polly] Replace use of std::stringstream. NFC.
Michael Kruse [Mon, 9 Mar 2020 16:15:14 +0000 (11:15 -0500)]
[Polly] Replace use of std::stringstream. NFC.

Use of std::-style (io)streams is discouraged in the LLVM coding style
Replace with a use of llvm::Twine (which uses llvm::raw_ostream behind
the scenes).

2 years ago[mlir] [ExecutionEngine] add option to enable/disable GDB notification listener
aartbik [Sat, 7 Mar 2020 01:01:18 +0000 (17:01 -0800)]
[mlir] [ExecutionEngine] add option to enable/disable GDB notification listener

This way, clients can opt-out of the GDB notification listener. Also, this
changes the semantics of enabling the object cache, which seemed the wrong
way around.

Reviewers: rriddle, nicolasvasilache, ftynse, andydavis1

Reviewed By: nicolasvasilache

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

2 years ago[ARM,CDE] Implement CDE feature test macros
Mikhail Maltsev [Mon, 9 Mar 2020 16:13:02 +0000 (16:13 +0000)]
[ARM,CDE] Implement CDE feature test macros

This patch implements feature test macros for the CDE extension
according to the upcoming ACLE specification.

The following 2 macros are being added:
- __ARM_FEATURE_CDE - defined as '1' when any coprocessor is
  configured as a CDE coprocessor
- __ARM_FEATURE_CDE_COPROC - defined as an 8-bit mask, each bit of the
  mask corresponds to a coprocessor and is set when the corresponding
  coprocessor is configured as CDE (and cleared otherwise).

The patch also exposes the value of __ARM_FEATURE_CDE_COPROC in the
target-independent method TargetInfo::getARMCDECorpocMask, the method
will be used in follow-up patches implementing semantic checks of CDE
intrinsics (we want to diagnose the cases when CDE intrinsics are used
with coprocessors that are not configured as CDE).

Reviewers: simon_tatham, dmgreen, ostannard, MarkMurrayARM

Reviewed By: simon_tatham

Subscribers: kristof.beyls, danielkiss, cfe-commits

Tags: #clang

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

2 years ago[RISCV] Add new SchedRead SchedWrite
Shiva Chen [Mon, 24 Feb 2020 06:21:26 +0000 (14:21 +0800)]
[RISCV] Add new SchedRead SchedWrite

The patch fixes some typos and introduces ReadFMemBase, ReadFSGNJ32,
ReadFSGNJ64, WriteFSGNJ32, WriteFSGNJ64, ReadFMinMax32, ReadFMinMax64,
WriteFMinMax32, WriteFMinMax64, so the target CPU with different pipeline model
could use them to describe latency.

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

2 years ago[AMDGPU] Remove unused SchedWrite class
Jay Foad [Mon, 9 Mar 2020 16:08:28 +0000 (16:08 +0000)]
[AMDGPU] Remove unused SchedWrite class

2 years ago[gn build] Port 882f589e20d
LLVM GN Syncbot [Mon, 9 Mar 2020 16:03:39 +0000 (16:03 +0000)]
[gn build] Port 882f589e20d

2 years agoRevert "[AssumeBundles] Move to IR so it can be used by Analysis"
Jonas Devlieghere [Mon, 9 Mar 2020 15:56:03 +0000 (08:56 -0700)]
Revert "[AssumeBundles] Move to IR so it can be used by Analysis"

This breaks the modules build:


This reverts commit 57c964aaa76bfaa908398fbd9d8c9d6d19856859.

2 years ago[analyzer][NFC] Refactor the checker registration unit test file
Kirstóf Umann [Thu, 12 Sep 2019 20:20:58 +0000 (22:20 +0200)]
[analyzer][NFC] Refactor the checker registration unit test file

Nothing exciting to see here! The new interface allows for more fine tuning
(register but disable a checker, add custom checker registry functions, etc),
that was basically the point.

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

2 years ago[lldb/test] Fix arch arm for 32-bit armv7l/armv8l
Muhammad Omair Javaid [Mon, 9 Mar 2020 15:28:13 +0000 (20:28 +0500)]
[lldb/test] Fix arch arm for 32-bit armv7l/armv8l

This patch forces architecture "arm" if underlying os reports core
armv7l or armv8l. On linux systems 32 bit sysroot running on 64bit
AArch64 hardware reports armv7l or armv8l which is essently arm
32bit mode. This fixes 5 testcases on 32bit arm.

2 years ago[ELF] Postpone evaluation of ORIGIN/LENGTH in a MEMORY command
Fangrui Song [Fri, 6 Mar 2020 19:49:58 +0000 (11:49 -0800)]
[ELF] Postpone evaluation of ORIGIN/LENGTH in a MEMORY command

    readMemoryAssignment("ORIGIN", "org", "o") // eagerly evaluated
target = getTarget();
     addSymbol(cmd) // with this patch, evaluated here

readMemoryAssignment eagerly evaluates ORIGIN/LENGTH and returns an uint64_t.
This patch postpones the evaluation to make

* --defsym and symbol assignments
* `CONSTANT(COMMONPAGESIZE)` (requires a non-null `lld::elf::target`)

work. If the expression somehow requires interaction with memory
regions, the circular dependency may cause the expression to evaluate to
a strange value. See the new test added to memory-err.s

Reviewed By: grimar

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

2 years agoFix Target Multiversioning renaming.
Erich Keane [Mon, 9 Mar 2020 15:06:58 +0000 (08:06 -0700)]
Fix Target Multiversioning renaming.

The initial implementation only did 'first declaration renaming' when
a default version came after. This is insufficient in cases where a
default does not exist, so this patch makes sure that we do the renaming
in all cases.

This renaming is necessary because we emit the first declaration before
knowing that it IS a target multiversion function, which would change
its name. The second declaration (the one that caused the
multiversioning) then needs to make sure that the first one has its name
changed to be consistent with the resolver usage.

2 years ago[lld] Add .clang-tidy to customize readability-identifier-naming.{Member,Parameter...
Fangrui Song [Sat, 7 Mar 2020 17:10:50 +0000 (09:10 -0800)]
[lld] Add .clang-tidy to customize readability-identifier-naming.{Member,Parameter,Variable}Case => camelBack

lld/.clang-tidy is almost identical to the top-level .clang-tidy, with the aforementioned customization.

Reviewed By: ruiu

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

2 years ago[llvm-objdump] Rename --disassemble-functions to --disassemble-symbols
Fangrui Song [Sat, 7 Mar 2020 20:55:44 +0000 (12:55 -0800)]
[llvm-objdump] Rename --disassemble-functions to --disassemble-symbols


The feature can disassemble data and the new option name reflects its
more generic usage.

Reviewed By: jhenderson

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

2 years ago[lldb] Fix windows build, second attempt
Pavel Labath [Mon, 9 Mar 2020 15:24:34 +0000 (16:24 +0100)]
[lldb] Fix windows build, second attempt

2 years ago[llvm-objdump][test] Move binary format specific tests under COFF/ ELF/ MachO/ XCOFF...
Fangrui Song [Sat, 7 Mar 2020 05:49:40 +0000 (21:49 -0800)]
[llvm-objdump][test] Move binary format specific tests under COFF/ ELF/ MachO/ XCOFF/ wasm/

Reviewed By: grimar

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

2 years ago[clangd] Bump vscode-clangd v0.0.21.
Haojian Wu [Mon, 9 Mar 2020 14:36:49 +0000 (15:36 +0100)]
[clangd] Bump vscode-clangd v0.0.21.

- better ranking for completions
- enable dot-to-arrow fix in code completion

2 years ago[MLIR] Change custom printer/parser for loop.parallel and loop.reduce.
Alexander Belyaev [Mon, 9 Mar 2020 14:03:33 +0000 (15:03 +0100)]
[MLIR] Change custom printer/parser for loop.parallel and loop.reduce.

2 years ago[Hexagon] Fix match pattern in a testcase
Krzysztof Parzyszek [Mon, 9 Mar 2020 14:08:02 +0000 (09:08 -0500)]
[Hexagon] Fix match pattern in a testcase

2 years ago[lldb] Fix windows&freebsd builds for c0b1af68
Pavel Labath [Mon, 9 Mar 2020 13:55:43 +0000 (14:55 +0100)]
[lldb] Fix windows&freebsd builds for c0b1af68

2 years ago[Analyzer] Mark constant member functions const in CheckerManager
Adam Balogh [Mon, 9 Mar 2020 09:48:56 +0000 (10:48 +0100)]
[Analyzer] Mark constant member functions const in CheckerManager

Most of the getter functions (and a reporter function) in
`CheckerManager` are constant but not marked as `const`. This prevents
functions having only a constant reference to `CheckerManager` using
these member functions. This patch fixes this issue.

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

2 years ago[pstl] Clean up parameter uglifications
Thomas Rodgers [Mon, 9 Mar 2020 13:15:45 +0000 (09:15 -0400)]
[pstl] Clean up parameter uglifications

Summary: These were overlooked on an earlier uglification pass.

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

2 years ago[lldb] Return Unwinder& from Thread::GetUnwinder
Pavel Labath [Mon, 9 Mar 2020 13:10:41 +0000 (14:10 +0100)]
[lldb] Return Unwinder& from Thread::GetUnwinder

The function always returns a valid object. Let the return type reflect
that, and remove some null checks.

2 years ago[clangd][vscode] Enable dot-to-arrow fixes in clangd completion.
Haojian Wu [Fri, 6 Mar 2020 14:08:23 +0000 (15:08 +0100)]
[clangd][vscode] Enable dot-to-arrow fixes in clangd completion.

The previous issue is that the item was filtered out by vscode, because
the prefix (which contains ".") are not matched against the filterText.

This patch works around it by adjusting the item filterText, inspired by

Reviewers: sammccall

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

Tags: #clang

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

2 years ago[DebugInfo] Add check for .debug_line minimum_instruction_length of 0
James Henderson [Tue, 25 Feb 2020 16:07:16 +0000 (16:07 +0000)]
[DebugInfo] Add check for .debug_line minimum_instruction_length of 0

If the minimum_instruction_length of a debug line program is 0, no
address advancing via special opcodes, DW_LNS_const_add_pc, and
DW_LNS_advance_pc can occur, since the minimum_instruction_length is
used in a multiplication. This patch adds a warning reporting when this
issue occurs.

Reviewed by: probinson

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

2 years ago[DebugInfo] Prevent crash when .debug_line line_range is zero
James Henderson [Tue, 25 Feb 2020 15:08:07 +0000 (15:08 +0000)]
[DebugInfo] Prevent crash when .debug_line line_range is zero

The line_range value of a debug line program header is used in divisions
related to special opcodes and DW_LNS_const_add_pc opcodes. As such, a
value of 0 cannot be used. This change introduces a new warning, if such
a situation is identified, and does not perform the relevant

Reviewed by: probinson, aprantl

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

2 years ago[DebugInfo] Report unsupported maximum_operations_per_instruction values
James Henderson [Wed, 19 Feb 2020 15:03:01 +0000 (15:03 +0000)]
[DebugInfo] Report unsupported maximum_operations_per_instruction values

This patch adds a check which reports an unsupported value of the
maximum_operations_per_instruction field in a debug line table header.
This is reported once per line table, at most, and only if the tablet
would otherwise need to use it (i.e. never for tables with version 3 or
less, or for tables which don't use DW_LNS_const_add_pc or special
opcodes). Unsupported values are currently any apart from 1.

Reviewed by: probinson, MaskRay

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

2 years ago[NFC][DebugInfo] Refactor address advancing operations to share code
James Henderson [Wed, 19 Feb 2020 14:03:02 +0000 (14:03 +0000)]
[NFC][DebugInfo] Refactor address advancing operations to share code

This change is a preparatory change for subsequent commits.

Reviewed by: probinson

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