Commit Graph

344794 Commits

Author SHA1 Message Date
Puyan Lotfi 4b8af31f63 [llvm][MIRVRegNamer] Avoid collisions across constant pool indices.
When hashing on MachineOperand::MO_ConstantPoolIndex, now MIR-Canon and
MIRVRegNamer will no longer result in a hash collision.

Differential Revision: https://reviews.llvm.org/D74449
2020-03-10 01:13:20 -04:00
Siva Chandra Reddy 550be40515 [libc] Add simple implementations of mtx_lock and mtx_unlock.
These functions only support locking and unlocking of plain mutexes.
They will be extended in future changes to handled recursive and timed
mutexes.

Reviewers: phosek

Differential Revision: https://reviews.llvm.org/D74653
2020-03-09 21:56:02 -07:00
Siva Chandra Reddy fd8c133613 [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
2020-03-09 21:28:11 -07:00
Mehdi Amini f80c6d8dec Fix MLIR build when NVPTX backend is not configured in
The GPUToCUDA conversion needs to conditionally link it
in.
2020-03-10 04:11:49 +00:00
Matt Arsenault 627bb31a28 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
worklist.
2020-03-09 23:42:17 -04:00
Matt Arsenault ed72bcae34 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.
2020-03-09 22:51:54 -04:00
Lang Hames 3f981cdde9 [MC] Allow Stackmap sections after DWARF in MachO.
Summary:
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
2020-03-09 18:33:32 -07:00
Uday Bondhugula e241573d59 [mlir] NFC: remove IntegerValueSet / MutableIntegerSet
Summary:
- these are unused and really not needed now given flat affine
  constraints

Differential Revision: https://reviews.llvm.org/D75792
2020-03-09 20:55:55 -04:00
Nathan James 97572fa6e9 [NFC] use hasAnyOperatorName and hasAnyOverloadedOperatorName functions in clang-tidy matchers 2020-03-10 00:42:21 +00:00
Wouter van Oortmerssen a7a3751775 [WebAssembly] Fixed FrameBaseLocal not being set.
Summary:
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
2020-03-09 17:29:36 -07:00
Nathan James 77eec38626 [ASTMatchers] Add hasAnyOverloadedOperatorName matcher
Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75841
2020-03-10 00:11:27 +00:00
George Burgess IV 174c3eb69f [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
2020-03-09 17:07:44 -07:00
George Burgess IV bb0ec1daff [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
2020-03-09 17:07:44 -07:00
Richard Smith 6333cc2a12 Revert "PR45083: Mark statement expressions as being dependent if they contain"
This reverts commit 2669e41b7b, which was
pushed by mistake.
2020-03-09 17:03:56 -07:00
Richard Smith 51fab8f36f 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.
2020-03-09 17:01:07 -07:00
Richard Smith 2669e41b7b 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.
2020-03-09 16:57:07 -07:00
Matt Morehouse d93303b783 [ASan] Enable set_shadow_test.c on Windows.
It looks like the recent -fno-common is making it pass now.
2020-03-09 16:09:28 -07:00
River Riddle b10c662514 [mlir][SideEffects] Replace the old SideEffects dialect interface with the newly added op interfaces/traits.
Summary:
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
2020-03-09 16:02:21 -07:00
George Burgess IV cfc3e7f458 [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:

```
-fprofile-instr-use="/foo/bar.profdata"
```

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
2020-03-09 15:52:39 -07:00
George Burgess IV 20dfcf189d [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
2020-03-09 15:52:38 -07:00
Jonathan Roelofs 52bbdad7d6 [clang-tidy][docs] Post-commit feedback on D74669 2020-03-09 16:51:41 -06:00
Douglas Yung 54d82255fd 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
2020-03-09 15:45:00 -07:00
Erik Pilkington 7fbf15a8f2 [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
2020-03-09 15:40:24 -07:00
Davide Italiano 9d389f7858 [AppleObjCRuntimeV2] Fix a typo. Evalulate -> evaluate. 2020-03-09 15:40:09 -07:00
Davide Italiano a3c4e6b44a [AppleObjC2RuntimeV2] Remove dead code. NFC. 2020-03-09 15:37:12 -07:00
Davide Italiano 3cabd173a1 [ObjC] Dynamic type resolution logging should go to the types log. 2020-03-09 15:35:51 -07:00
Philip Reames 56a32fb648 [tests] Add long nop test coverage for intel platforms 2020-03-09 15:29:04 -07:00
Jonathan Roelofs 2e9d33bccd Add missing list.rst entry 2020-03-09 16:27:35 -06:00
Reid Kleckner d75be4c06a [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
2020-03-09 15:23:54 -07:00
Jonathan Roelofs 698a127129 release notes: fix new check name 2020-03-09 16:11:35 -06:00
LLVM GN Syncbot 78ad24bff6 [gn build] Port 1e0669bfe0 2020-03-09 21:59:49 +00:00
Jonathan Roelofs 1e0669bfe0 [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

https://reviews.llvm.org/D74669
2020-03-09 15:54:32 -06:00
Alexey Bataev 6309334b95 [OPENMP50]Codegen for depobj dependency kind.
Implemented codegen for depobj modifier in depend clauses.
2020-03-09 17:46:06 -04:00
Jay Foad c7b2e7f527 [AMDGPU] Fix scheduling info for terminator SALU instructions
Summary:
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
2020-03-09 21:39:52 +00:00
Jonathan Roelofs 6bfd10ff80 Fix internal links in Kaleidoscope tutorial 2020-03-09 15:07:44 -06:00
Sjoerd Meijer e32f8ef927 Follow up of 3d9a0445cc, clang driver defaulting to -fno-common
Attempt to pacify windows bot where this failed:

clang/test/CodeGen/vlt_to_pointer.c
2020-03-09 20:43:05 +00:00
Yaxun (Sam) Liu 22c457a869 [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
2020-03-09 16:40:05 -04:00
Arthur Eubanks 3262319806 Fix typo in gn files
SKD -> SDK
2020-03-09 13:33:13 -07:00
Arthur Eubanks 51d7f64544 Don't emit pointer to int cast warnings under -Wmicrosoft-cast
Summary:
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
2020-03-09 13:27:46 -07:00
ahatanak 1f5b471b8b [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.

rdar://problem/59275894
2020-03-09 13:21:38 -07:00
Lei Zhang a50c031fab [mlir][ods] Fix AnyInteger predicate
Differential Revision: https://reviews.llvm.org/D75854
2020-03-09 20:12:15 +00:00
Matt Arsenault eb41627799 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.
2020-03-09 13:11:30 -07:00
Sjoerd Meijer 3d9a0445cc 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:
0a9fc9233e
2020-03-09 19:57:03 +00:00
Matt Arsenault 156a1b59df 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.
2020-03-09 12:56:10 -07:00
Fangrui Song 71269a1f17 [lldb] Add .clang-tidy with customization to disable readability-identifier-naming
Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D75810
2020-03-09 12:50:28 -07:00
Krzysztof Parzyszek d0ca1041ba [Hexagon] Refactor handling of circular load/store builtins, NFC 2020-03-09 14:40:08 -05:00
Erich Keane cc8390bfe3 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
combinations.
2020-03-09 12:38:03 -07:00
Matt Arsenault 209094eeb6 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.
2020-03-09 12:36:51 -07:00
Akira Hatanaka e4dfc9f5bd Fix the type of the capture passed to LambdaIntroducer::addCapture in
RebuildLambdaScopeInfo

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.

rdar://problem/47550338

Differential Revision: https://reviews.llvm.org/D58164
2020-03-09 12:25:28 -07:00
Cameron McInally 2ab8065df6 [AArch64][SVE] Add missing fp16 DestructiveInstType tests
These tests should have been added with a5b22b768f in D73711.

Differential Revision: https://reviews.llvm.org/D75767
2020-03-09 14:09:23 -05:00