platform/upstream/llvm.git
4 years ago[WebAssembly] Implement truncating vector stores
Thomas Lively [Wed, 29 Jul 2020 00:46:45 +0000 (17:46 -0700)]
[WebAssembly] Implement truncating vector stores

Rather than expanding truncating stores so that vectors are stored one
lane at a time, lower them to a sequence of instructions using
narrowing operations instead, when possible. Since the narrowing
operations have saturating semantics, but truncating stores require
truncation, mask the stored value to manually truncate it before
narrowing. Also, since narrowing is a binary operation, pass in the
original vector as the unused second argument.

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

4 years agoAMDGPU: Don't assume call targets are registers
Matt Arsenault [Sun, 26 Jul 2020 00:16:15 +0000 (20:16 -0400)]
AMDGPU: Don't assume call targets are registers

GlobalISel let through a call to null, which would then fold into the
source operand like any other inline immediate. The SelectionDAG
lowering deletes calls to null and undef as a workaround from before
calls were supported. We should probably drop the special handling
case in the DAG lowering now, since the middle end optimizers delete
null calls anyway.

4 years ago[OpenMP] Replaced mutex lock/unlock in `target` with `std::lock_guard`
Shilei Tian [Wed, 29 Jul 2020 00:31:34 +0000 (20:31 -0400)]
[OpenMP] Replaced mutex lock/unlock in `target` with `std::lock_guard`

Reviewed By: ye-luo

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

4 years agoRevert "[OpenMP] Implement TR8 `present` motion modifier in Clang (1/2)"
Joel E. Denny [Wed, 29 Jul 2020 00:26:56 +0000 (20:26 -0400)]
Revert "[OpenMP] Implement TR8 `present` motion modifier in Clang (1/2)"

This reverts commit 3c3faae497046be706df29e16c9fbccb7e1fce09.

It breaks a number of bots.

4 years agoRevert "[OpenMP] Implement TR8 `present` motion modifier in runtime (2/2)"
Joel E. Denny [Wed, 29 Jul 2020 00:27:48 +0000 (20:27 -0400)]
Revert "[OpenMP] Implement TR8 `present` motion modifier in runtime (2/2)"

This reverts commit 2cb926a447d22166dac0d6e6dceaf5b3616ef6a1.

It depends on 3c3faae497046be706df29e16c9fbccb7e1fce09, which is being
reverted.

4 years agoAMDGPU: Handle a few missing cases in getAddrModeArguments
Matt Arsenault [Wed, 22 Jul 2020 01:43:52 +0000 (21:43 -0400)]
AMDGPU: Handle a few missing cases in getAddrModeArguments

4 years agoAMDGPU: Don't assume there is only one terminator copy
Matt Arsenault [Thu, 23 Jul 2020 22:05:16 +0000 (18:05 -0400)]
AMDGPU: Don't assume there is only one terminator copy

This would stop on the first in reverse order, failing the verifier if
there were more earlier in the block.

4 years ago[NFC][OpenMP] Renamed all variable and function names in `target` to conform with...
Shilei Tian [Wed, 29 Jul 2020 00:10:59 +0000 (20:10 -0400)]
[NFC][OpenMP] Renamed all variable and function names in `target` to conform with LLVM code standard

This patch only touched variables and functions in `target`.

Reviewed By: ye-luo

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

4 years ago[libc][obvious] Add license headers to APIIndexer.[cpp|h].
Siva Chandra Reddy [Wed, 29 Jul 2020 00:03:16 +0000 (17:03 -0700)]
[libc][obvious] Add license headers to APIIndexer.[cpp|h].

4 years agoAMDGPU: Fix verifier error on spilling partially defined SGPRs
Matt Arsenault [Fri, 24 Jul 2020 01:11:04 +0000 (21:11 -0400)]
AMDGPU: Fix verifier error on spilling partially defined SGPRs

This needs an implicit def of the super-register in case one of the
lanes isn't defined, similar to copyPhysReg (or the not-VGPR spill
case below). This showed up in GlobalISel testing since it currently
doesn't fold out many undef instructions.

4 years agoAMDGPU: Serialize MFI spill fields
Matt Arsenault [Fri, 24 Jul 2020 01:11:46 +0000 (21:11 -0400)]
AMDGPU: Serialize MFI spill fields

These should probably be inferred from the function on parse, but the
target specific infrastructure currently does not give you a way to do
this. SILowerSGPRSpills early exits without this reporting spills,
which makes it difficult to write a MIR test for.

4 years ago[clangd] Use elog instead of llvm::errs, log instead of llvm::outs
Kirill Bobyrev [Tue, 28 Jul 2020 23:40:46 +0000 (01:40 +0200)]
[clangd] Use elog instead of llvm::errs, log instead of llvm::outs

Reviewed By: sammccall

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

4 years ago[libc][obvious] Add the new ctype.h target to the list of x86_64 headers.
Siva Chandra Reddy [Tue, 28 Jul 2020 23:39:44 +0000 (16:39 -0700)]
[libc][obvious] Add the new ctype.h target to the list of x86_64 headers.

This will fix the integration test which is failing currently.

4 years ago[flang][NFC] Extract name resolution for OpenACC & OpenMP into new file
Tim Keith [Tue, 28 Jul 2020 23:38:34 +0000 (16:38 -0700)]
[flang][NFC] Extract name resolution for OpenACC & OpenMP into new file

Move `ResolveAccParts` and `ResolveOmpParts` from resolve-names.cpp to
resolve-directives.{h,cpp}. Move the implementation in the classes
`DirectiveAttributeVisitor`, `AccAttributeVisitor`, and
`OmpAttributeVisitor` to resolve-directives.cpp as well.

To allow this to happen, move `EvaluateIntExpr` and introduce
`EvaluateInt64` to resolve-names-utils.h. The latter is also useful
elsewhere in resolve-names.cpp for converting an Expr to std::int64_t.

The other problem was that `ResolveDesignator` was called from the code
that was moved. At the moment it doesn't seem to be doing anything so I
removed the calls (and no tests failed). If it proves to be needed, we
can either resolve those designators in resolve-names.cpp or pass the
`ResolveDesignator` function in to the code that needs to call it.

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

4 years ago[libc][NFC] Move tablegen indexer class into a util library of its own.
Siva Chandra Reddy [Tue, 28 Jul 2020 23:07:32 +0000 (16:07 -0700)]
[libc][NFC] Move tablegen indexer class into a util library of its own.

This class is currently used by two tools: HdrGen and PrototypeTestGen.
We will be adding more tools based on this class so it is convenient to
keep it in a util library of its own.

4 years ago[scudo][standalone] Add new mallopt options.
Christopher Ferris [Tue, 28 Jul 2020 23:25:49 +0000 (16:25 -0700)]
[scudo][standalone] Add new mallopt options.

This adds the code to support calling mallopt and converting the
options to the internal Option enum.

Reviewed By: cryptoad

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

4 years ago[libc] [Obvious] Delete ctype.h, since ctype.h.def is used.
cgyurgyik [Tue, 28 Jul 2020 23:19:01 +0000 (19:19 -0400)]
[libc] [Obvious] Delete ctype.h, since ctype.h.def is used.

4 years ago[libc] Add scaffolding for ctype and implementation of isalpha
cgyurgyik [Tue, 28 Jul 2020 23:12:17 +0000 (19:12 -0400)]
[libc] Add scaffolding for ctype and implementation of isalpha

Reviewed By: sivachandra

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

4 years ago[lldb] Remove unused option '--platform-path' for 'target create'
Jonas Devlieghere [Tue, 28 Jul 2020 21:21:03 +0000 (14:21 -0700)]
[lldb] Remove unused option '--platform-path' for 'target create'

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

4 years ago[FileCheck] Report captured variables
Joel E. Denny [Tue, 28 Jul 2020 22:09:47 +0000 (18:09 -0400)]
[FileCheck] Report captured variables

Report captured variables in input dumps and traces.  For example:

```
$ cat check
CHECK: hello [[WHAT:[a-z]+]]
CHECK: goodbye [[WHAT]]

$ FileCheck -dump-input=always -vv check < input |& tail -8
<<<<<<
           1: hello world
check:1'0     ^~~~~~~~~~~
check:1'1           ^~~~~ captured var "WHAT"
           2: goodbye world
check:2'0     ^~~~~~~~~~~~~
check:2'1                   with "WHAT" equal to "world"
>>>>>>

$ FileCheck -dump-input=never -vv check < input
check2:1:8: remark: CHECK: expected string found in input
CHECK: hello [[WHAT:[a-z]+]]
       ^
<stdin>:1:1: note: found here
hello world
^~~~~~~~~~~
<stdin>:1:7: note: captured var "WHAT"
hello world
      ^~~~~
check2:2:8: remark: CHECK: expected string found in input
CHECK: goodbye [[WHAT]]
       ^
<stdin>:2:1: note: found here
goodbye world
^~~~~~~~~~~~~
<stdin>:2:1: note: with "WHAT" equal to "world"
goodbye world
^
```

Reviewed By: thopre

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

4 years ago[FileCheck] Extend -dump-input with substitutions
Joel E. Denny [Tue, 28 Jul 2020 22:09:05 +0000 (18:09 -0400)]
[FileCheck] Extend -dump-input with substitutions

Substitutions are already reported in the diagnostics appearing before
the input dump in the case of failed directives, and they're reported
in traces (produced by `-vv -dump-input=never`) in the case of
successful directives.  However, those reports are not always
convenient to view while investigating the input dump, so this patch
adds the substitution report to the input dump too.  For example:

```
$ cat check
CHECK: hello [[WHAT:[a-z]+]]
CHECK: [[VERB]] [[WHAT]]

$ FileCheck -vv -DVERB=goodbye check < input |& tail -8
<<<<<<
           1: hello world
check:1       ^~~~~~~~~~~
           2: goodbye word
check:2'0     X~~~~~~~~~~~ error: no match found
check:2'1                  with "VERB" equal to "goodbye"
check:2'2                  with "WHAT" equal to "world"
>>>>>>
```

Without this patch, the location reported for a substitution for a
directive match is the directive's full match range.  This location is
misleading as it implies the substitution itself matches that range.
This patch changes the reported location to just the match range start
to suggest the substitution is known at the start of the match.  (As
in the above example, input dumps don't mark any range for
substitutions.  The location info in that case simply identifies the
right line for the annotation.)

Reviewed By: mehdi_amini, thopre

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

4 years ago[OpenMP] Implement TR8 `present` motion modifier in runtime (2/2)
Joel E. Denny [Tue, 28 Jul 2020 22:06:42 +0000 (18:06 -0400)]
[OpenMP] Implement TR8 `present` motion modifier in runtime (2/2)

This patch implements OpenMP runtime support for the OpenMP TR8
`present` motion modifier for `omp target update` directives.  The
previous patch in this series implements Clang front end support.

Reviewed By: grokos

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

4 years ago[OpenMP] Implement TR8 `present` motion modifier in Clang (1/2)
Joel E. Denny [Tue, 28 Jul 2020 22:06:24 +0000 (18:06 -0400)]
[OpenMP] Implement TR8 `present` motion modifier in Clang (1/2)

This patch implements Clang front end support for the OpenMP TR8
`present` motion modifier for `omp target update` directives.  The
next patch in this series implements OpenMP runtime support.

Reviewed By: ABataev

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

4 years ago[OpenMP][NFC] Consolidate `to` and `from` clause modifiers
Joel E. Denny [Tue, 28 Jul 2020 22:06:05 +0000 (18:06 -0400)]
[OpenMP][NFC] Consolidate `to` and `from` clause modifiers

`to` and `from` clauses take the same modifiers, which are called
"motion modifiers" in TR8, so implement handling of their modifiers
once not twice.  This will make it easier to implement additional
motion modifiers in the future.

Reviewed By: ABataev

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

4 years agoOn Windows build, making the /bigobj flag global , instead of passing it per file.
Zahira Ammarguellat [Tue, 28 Jul 2020 22:59:33 +0000 (17:59 -0500)]
On Windows build, making the /bigobj flag global , instead of passing it per file.

To avoid having this flag be passed in per/file manner, we are instead
passing it globally.

This fixes this bug: https://bugs.llvm.org/show_bug.cgi?id=46733

Reviewed-by: aaron.ballman, beanz, meinersbur
Differential Revision: https://reviews.llvm.org/D84038

4 years agoPR46637: Fix handling of placeholder types in trailing-return-types.
Richard Smith [Tue, 28 Jul 2020 22:51:13 +0000 (15:51 -0700)]
PR46637: Fix handling of placeholder types in trailing-return-types.

Only permit a placeholder type in a trailing-return-type if it would
also have been permitted in the decl-specifier sequence of a
corresponding declaration with no trailing-return-type. The standard
doesn't actually say this, but this is the only thing that makes sense.

Also fix handling of an 'auto' in a trailing-return-type in a parameter
of a generic lambda. We used to crash if we saw such a thing.

4 years ago[DominatorTree] Simplify ChildrenGetter.
Alina Sbirlea [Sat, 25 Jul 2020 01:36:18 +0000 (18:36 -0700)]
[DominatorTree] Simplify ChildrenGetter.

Summary:
Simplify ChildrenGetter to a simple wrapper around a GraphDiff call.
GraphDiff already handles nullptr in children, so the special casing in
clang can also be removed.

Reviewers: kuhar, dblaikie

Subscribers: llvm-commits, cfe-commits

Tags: #clang, #llvm

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

4 years ago[MLIR] Add unit test for tblgen Op build methods
Rahul Joshi [Tue, 28 Jul 2020 17:29:43 +0000 (10:29 -0700)]
[MLIR] Add unit test for tblgen Op build methods

- Initiate the unit test with a test that tests variants of build() methods
  generated for ops with variadic operands and results.
- The intent is to migrate unit .td tests in mlir/test/mlir-tblgen that check for
  generated C++ code to these unit tests which test both that the generated code
  compiles and also is functionally correct.

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

4 years ago[SROA][Mem2Reg] Use efficient droppable use API (after D83976)
Johannes Doerfert [Tue, 28 Jul 2020 14:48:47 +0000 (09:48 -0500)]
[SROA][Mem2Reg] Use efficient droppable use API (after D83976)

Reviewed By: efriedma

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

4 years ago[docs] [lit] Add a more helpful description for lit.py's -s flag.
Varun Gandhi [Tue, 28 Jul 2020 21:35:06 +0000 (14:35 -0700)]
[docs] [lit] Add a more helpful description for lit.py's -s flag.

Reviewed By: yln

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

4 years ago[globalisel][cse] Merge debug locations when CSE'ing
Daniel Sanders [Tue, 28 Jul 2020 20:56:51 +0000 (13:56 -0700)]
[globalisel][cse] Merge debug locations when CSE'ing

Reviewed By: aditya_nandakumar

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

4 years agoGlobalISel: Don't assert on operations with no type indices
Matt Arsenault [Sat, 25 Jul 2020 14:27:16 +0000 (10:27 -0400)]
GlobalISel: Don't assert on operations with no type indices

Fix not marking G_FENCE as legal on AMDGPU This was apparently
defaulting to legal using the "legacy" rules, whatever those are.

4 years agoGlobalISel: Add typeIsNot LegalityPredicate
Matt Arsenault [Sat, 25 Jul 2020 15:12:29 +0000 (11:12 -0400)]
GlobalISel: Add typeIsNot LegalityPredicate

This allows sorting the legal/custom rules first as is recommended

4 years agoAMDGPU/GlobalISel: Add some missing tests for extract selection
Matt Arsenault [Sun, 26 Jul 2020 15:04:07 +0000 (11:04 -0400)]
AMDGPU/GlobalISel: Add some missing tests for extract selection

4 years agoAMDGPU/GlobalISel: Add SReg_96 to SGPRRegBank
Matt Arsenault [Sun, 26 Jul 2020 15:04:37 +0000 (11:04 -0400)]
AMDGPU/GlobalISel: Add SReg_96 to SGPRRegBank

4 years ago[NFC] Sema: use checkArgCount instead of custom checking
JF Bastien [Tue, 28 Jul 2020 20:35:03 +0000 (13:35 -0700)]
[NFC] Sema: use checkArgCount instead of custom checking

 As requested in D79279.

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

4 years agoAMDGPU: Check for other defs when folding conditions into s_andn2_b64
Matt Arsenault [Sat, 25 Jul 2020 00:13:04 +0000 (20:13 -0400)]
AMDGPU: Check for other defs when folding conditions into s_andn2_b64

We can't fold the masked compare value through the select if the
select condition is re-defed after the and instruction. Fixes a
verifier error and trying to use the outgoing value defined in the
block.

I'm not sure why this pass is bothering to handle physregs. It's
making this more complex and forces extra liveness computation.

4 years ago[X86] Remove disabled miscompiling X86CondBrFolding pass
Roman Lebedev [Tue, 28 Jul 2020 20:35:04 +0000 (23:35 +0300)]
[X86] Remove disabled miscompiling X86CondBrFolding pass

As briefly discussed in IRC with @craig.topper,
the pass is disabled basically since it's original introduction (nov 2018)
due to  known correctness issues (miscompilations),
and there hasn't been much work done to fix that.

While i won't promise that i will "fix" the pass,
i have looked at it previously, and i'm sure i won't try to fix it
if that requires actually fixing this existing code.

Reviewed By: craig.topper

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

4 years agoRevert "[gn build] (manually) merge d054c7ee2e9"
Fangrui Song [Tue, 28 Jul 2020 20:30:29 +0000 (13:30 -0700)]
Revert "[gn build] (manually) merge d054c7ee2e9"

This reverts commit ab73b6da95750164daac4cfbd351ca96e1084117.

4 years agoRevert D83834 "Add test utility 'extract'"
Fangrui Song [Tue, 28 Jul 2020 20:26:09 +0000 (13:26 -0700)]
Revert D83834 "Add test utility 'extract'"

This reverts commit d054c7ee2e9f4f98af7f22a5b00a941eb919bd59.

There are discussions about the utility name, its functionality and user interface.
Revert before we reach consensus.

4 years agoPR46377: Fix dependence calculation for function types and typedef
Richard Smith [Tue, 28 Jul 2020 19:09:16 +0000 (12:09 -0700)]
PR46377: Fix dependence calculation for function types and typedef
types.

We previously did not treat a function type as dependent if it had a
parameter pack with a non-dependent type -- such a function type depends
on the arity of the pack so is dependent even though none of the
parameter types is dependent. In order to properly handle this, we now
treat pack expansion types as always being dependent types (depending on
at least the pack arity), and always canonically being pack expansion
types, even in the unusual case when the pattern is not a dependent
type. This does mean that we can have canonical types that are pack
expansions that contain no unexpanded packs, which is unfortunate but
not inaccurate.

We also previously did not treat a typedef type as
instantiation-dependent if its canonical type was not
instantiation-dependent. That's wrong because instantiation-dependence
is a property of the type sugar, not of the type; an
instantiation-dependent type can have a non-instantiation-dependent
canonical type.

4 years agoReland [Coverage] Add comment to skipped regions
Zequan Wu [Thu, 23 Jul 2020 02:04:59 +0000 (19:04 -0700)]
Reland [Coverage] Add comment to skipped regions

Bug filled here: https://bugs.llvm.org/show_bug.cgi?id=45757.
Add comment to skipped regions so we don't track execution count for lines containing only comments.

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

4 years ago[lld][linkerscript] Fix handling of DEFINED.
Hafiz Abid Qadeer [Thu, 16 Jul 2020 20:40:31 +0000 (21:40 +0100)]
[lld][linkerscript] Fix handling of DEFINED.

Current implementation did not check that symbols is actually defined. Only checked for presence.  GNU ld documentation says,

"Return 1 if symbol is in the linker global symbol table and is defined before the statement using DEFINED in the script, otherwise return 0."

https://sourceware.org/binutils/docs/ld/Builtin-Functions.html#Builtin-Functions

Reviewed By: MaskRay

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

4 years ago[llvm][NFC] refactor setBlockFrequency for clarity.
Mircea Trofin [Tue, 28 Jul 2020 20:04:11 +0000 (13:04 -0700)]
[llvm][NFC] refactor setBlockFrequency for clarity.

The refactoring encapsulates frequency calculation in MachineBlockFrequencyInfo,
and renames the API to clarify its motivation. It should clarify
frequencies may not be reset 'freely' by users of the analysis, as the
API serves as a partial update to avoid a full analysis recomputation.

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

4 years ago[MLIR][Linalg] Fixed obsolete examples in the MLIR Linalg Dialect doc
Vincent Zhao [Tue, 28 Jul 2020 19:40:55 +0000 (19:40 +0000)]
[MLIR][Linalg] Fixed obsolete examples in the MLIR Linalg Dialect doc

This diff fixes some obsolete examples in the Linalg dialect documentation: https://mlir.llvm.org/docs/Dialects/Linalg/

These examples are used to explain the basic properties of the Linalg dialect, which are not automatically generated from TableGen and are using out-of-date MLIR/Linalg syntax.

This diff extends each example by adding essential attributes and changing its syntax to make it processible by `mlir-opt`. There is also a command attached to each example that says how the example can be processed.

Reviewed By: ftynse

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

4 years ago[NewGVN] Add test cases for remaining known issues.
Florian Hahn [Tue, 28 Jul 2020 19:31:57 +0000 (20:31 +0100)]
[NewGVN] Add test cases for remaining known issues.

This patch adds IR tests for the known NewGVN issues. The intention is
that adding them now will make it easier to keep track of fixes.

4 years ago[openacc] Add missing newline at end of file
clementval [Tue, 28 Jul 2020 19:26:27 +0000 (15:26 -0400)]
[openacc] Add missing newline at end of file

4 years ago[PowerPC] Mark allocator_oom_test.cpp unsupported on PowerPC
Ahsan Saghir [Tue, 28 Jul 2020 18:29:25 +0000 (13:29 -0500)]
[PowerPC] Mark allocator_oom_test.cpp unsupported on PowerPC

This patch marks compiler-rt/test/asan/TestCases/Linux/allocator_oom_test.cpp
unsupported on PowerPC 64bit-LE architecture since this test fails when run
on a machine with larger system memory.

Reviewed By: #powerpc, nemanjai

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

4 years ago[InstSimplify] allow undefs in icmp with vector constant folds
Sanjay Patel [Tue, 28 Jul 2020 19:13:19 +0000 (15:13 -0400)]
[InstSimplify] allow undefs in icmp with vector constant folds

This is the main icmp simplification shortcoming seen in D84655.

Alive2 agrees that the basic examples are correct at least:

define <2 x i1> @src(<2 x i8> %x) {
%0:
  %r = icmp sle <2 x i8> { undef, 128 }, %x
  ret <2 x i1> %r
}
=>
define <2 x i1> @tgt(<2 x i8> %x) {
%0:
  ret <2 x i1> { 1, 1 }
}
Transformation seems to be correct!

define <2 x i1> @src(<2 x i32> %X) {
%0:
  %A = or <2 x i32> %X, { 63, 63 }
  %B = icmp ult <2 x i32> %A, { undef, 50 }
  ret <2 x i1> %B
}
=>
define <2 x i1> @tgt(<2 x i32> %X) {
%0:
  ret <2 x i1> { 0, 0 }
}
Transformation seems to be correct!

https://alive2.llvm.org/ce/z/omt2ee
https://alive2.llvm.org/ce/z/GW4nP_

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

4 years ago[libc++] Provide std::aligned_alloc and std::timespec_get on Apple platforms
Louis Dionne [Mon, 27 Jul 2020 18:25:03 +0000 (14:25 -0400)]
[libc++] Provide std::aligned_alloc and std::timespec_get on Apple platforms

rdar://66113878

4 years ago[libc++] Clean up tests for "optional" C11 features
Louis Dionne [Tue, 28 Jul 2020 17:41:12 +0000 (13:41 -0400)]
[libc++] Clean up tests for "optional" C11 features

First, add a TEST_HAS_QUICK_EXIT macro to mirror other C11 features like
TEST_HAS_ALIGNED_ALLOC, and update the tests for that.

Second, get rid of TEST_HAS_C11_FEATURES and _LIBCPP_HAS_C11_FEATURES,
which were only used to ensure that feature macros don't get out of
sync between <__config> and "test_macros.h". This is not necessary
anymore, since we have tests for each individual macro now.

4 years ago[X86] Merge the two 'Emit the normal disp32 encoding' cases in SIB byte handling...
Craig Topper [Tue, 28 Jul 2020 19:03:54 +0000 (12:03 -0700)]
[X86] Merge the two 'Emit the normal disp32 encoding' cases in SIB byte handling in emitMemModRMByte. NFCI

By repeating the Disp.isImm() check in a couple spots we can
make the normal case for immediate and for expression the same.
And then always rely on the ForceDisp32 flag to remove a later
non-zero immediate check.

This should make {disp32} pseudo prefix handling
slightly easier as we need the normal disp32 handler to handle a
immediate of 0.

4 years ago[mlir][GPUToSPIRV] Add a test pass to set workgroup size for kernel
MaheshRavishankar [Tue, 28 Jul 2020 18:47:30 +0000 (11:47 -0700)]
[mlir][GPUToSPIRV] Add a test pass to set workgroup size for kernel
functions.

This allows using command line flags to lowere from GPU to SPIR-V. The
pass added is only for testing/example purposes. Most uses cases will
need more fine-grained control on setting workgroup sizes for kernel
functions.

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

4 years ago[InstCombine] avoid crashing on vector constant expression (PR46872)
Sanjay Patel [Tue, 28 Jul 2020 19:02:36 +0000 (15:02 -0400)]
[InstCombine] avoid crashing on vector constant expression (PR46872)

4 years ago[InstSimplify] add tests for icmp with partial undef constant; NFC
Sanjay Patel [Tue, 28 Jul 2020 15:13:05 +0000 (11:13 -0400)]
[InstSimplify] add tests for icmp with partial undef constant; NFC

4 years ago[NFC][XCOFF] Use getFunctionEntryPointSymbol from TLOF to simplify logic
jasonliu [Tue, 28 Jul 2020 17:56:13 +0000 (17:56 +0000)]
[NFC][XCOFF] Use getFunctionEntryPointSymbol from TLOF to simplify logic

Reviewed By: Xiangling_L

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

4 years ago[libc][NFC] Zero out padding bits in the uint form of x86 FPBits<long double>.
Siva Chandra Reddy [Tue, 28 Jul 2020 18:43:04 +0000 (11:43 -0700)]
[libc][NFC] Zero out padding bits in the uint form of x86 FPBits<long double>.

4 years ago[scudo][standalone] mallopt runtime configuration options
Kostya Kortchinsky [Mon, 27 Jul 2020 16:13:42 +0000 (09:13 -0700)]
[scudo][standalone] mallopt runtime configuration options

Summary:
Partners have requested the ability to configure more parts of Scudo
at runtime, notably the Secondary cache options (maximum number of
blocks cached, maximum size) as well as the TSD registry options
(the maximum number of TSDs in use).

This CL adds a few more Scudo specific `mallopt` parameters that are
passed down to the various subcomponents of the Combined allocator.

- `M_CACHE_COUNT_MAX`: sets the maximum number of Secondary cached items
- `M_CACHE_SIZE_MAX`: sets the maximum size of a cacheable item in the Secondary
- `M_TSDS_COUNT_MAX`: sets the maximum number of TSDs that can be used (Shared Registry only)

Regarding the TSDs maximum count, this is a one way option, only
allowing to increase the count.

In order to allow for this, I rearranged the code to have some `setOption`
member function to the relevant classes, using the `scudo::Option` class
enum to determine what is to be set.

This also fixes an issue where a static variable (`Ready`) was used in
templated functions without being set back to `false` every time.

Reviewers: pcc, eugenis, hctim, cferris

Subscribers: jfb, llvm-commits, #sanitizers

Tags: #sanitizers

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

4 years ago[CostModel][X86] Add smax/smin/umin/umax intrinsics cost model tests
Simon Pilgrim [Tue, 28 Jul 2020 18:55:55 +0000 (19:55 +0100)]
[CostModel][X86] Add smax/smin/umin/umax intrinsics cost model tests

Costs currently fall back to scalar generic intrinsic calls

4 years ago[DAG] isSplatValue - add support for TRUNCATE/SIGN_EXTEND/ZERO_EXTEND
Simon Pilgrim [Tue, 28 Jul 2020 18:48:35 +0000 (19:48 +0100)]
[DAG] isSplatValue - add support for TRUNCATE/SIGN_EXTEND/ZERO_EXTEND

These are just pass-throughs to the source operand - we can't assume that ANY_EXTEND(splat) will still be a splat though.

4 years ago[CostModel][X86] Add abs intrinsics cost model tests
Simon Pilgrim [Tue, 28 Jul 2020 18:37:40 +0000 (19:37 +0100)]
[CostModel][X86] Add abs intrinsics cost model tests

abs costs currently falls back in scalar generic intrinsic calls

4 years ago[X86][XOP] Shuffle v16i8 using VPPERM(X,Y) instead of OR(PSHUFB(X),PSHUFB(Y))
Simon Pilgrim [Tue, 28 Jul 2020 12:08:22 +0000 (13:08 +0100)]
[X86][XOP] Shuffle v16i8 using VPPERM(X,Y) instead of OR(PSHUFB(X),PSHUFB(Y))

4 years ago[AMDGPU] Spill CSR VGPR which is reserved for SGPR spills
Austin Kerbow [Mon, 13 Jul 2020 22:38:29 +0000 (15:38 -0700)]
[AMDGPU] Spill CSR VGPR which is reserved for SGPR spills

Update logic for reserving VGPR for SGPR spills. A CSR VGPR being reserved for
SGPR spills could be clobbered if there were no free lower VGPR's available.
Create a stack object so that it will be spilled in the prologue. Also
adds more tests.

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

4 years ago[MLIR] Vector store to load forwarding
Anand Kodnani [Tue, 28 Jul 2020 17:37:16 +0000 (10:37 -0700)]
[MLIR] Vector store to load forwarding

The MemRefDataFlow pass does store to load forwarding
only for affine store/loads. This patch updates the pass
to use affine read/write interface which enables vector
forwarding.

Reviewed By: dcaballe, bondhugula, ftynse

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

4 years agoRevert "Switch to using -debug-info-kind=constructor as default (from =limited)"
Amy Huang [Tue, 28 Jul 2020 18:23:59 +0000 (11:23 -0700)]
Revert "Switch to using -debug-info-kind=constructor as default (from =limited)"

This reverts commit 227db86a1b7dd6f96f7df14890fcd071bc4fe1f5.

Causing debug info errors in google3 LTO builds; also causes a
debuginfo-test failure.

4 years ago[JumpThreading] Add a basic support for freeze instruction
Juneyoung Lee [Tue, 28 Jul 2020 18:11:57 +0000 (03:11 +0900)]
[JumpThreading] Add a basic support for freeze instruction

This patch adds a basic support for freeze instruction to JumpThreading
by making ComputeValueKnownInPredecessorsImpl look into its operand.

Reviewed By: efriedma, nikic

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

4 years ago[LLD] [MinGW] Implement the --no-seh flag
Martin Storsjö [Mon, 27 Jul 2020 20:44:41 +0000 (23:44 +0300)]
[LLD] [MinGW] Implement the --no-seh flag

Previously this flag was just ignored. If set, set the
IMAGE_DLL_CHARACTERISTICS_NO_SEH bit, regardless of the normal safeSEH
machinery.

In mingw configurations, the safeSEH bit might not be set in e.g. object
files built from handwritten assembly, making it impossible to use the
normal safeseh flag. As mingw setups don't generally use SEH on 32 bit
x86 at all, it should be fine to set that flag bit though - hook up
the existing GNU ld flag for controlling that.

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

4 years ago[lldb] Change the definition of ANSI_UNFAINT
Shu Anzai [Tue, 28 Jul 2020 18:05:44 +0000 (11:05 -0700)]
[lldb] Change the definition of ANSI_UNFAINT

Change the definition of ANSI_UNFAINT in Editline.cpp.

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

4 years ago[libc][obvious] Move ErrnoSetterMatcher to test/ErrnoSetterMetcher.h.
Siva Chandra Reddy [Tue, 28 Jul 2020 17:57:00 +0000 (10:57 -0700)]
[libc][obvious] Move ErrnoSetterMatcher to test/ErrnoSetterMetcher.h.

4 years ago[lld-macho] Fix no-filelist test on Windows
Jez Ng [Tue, 28 Jul 2020 18:04:43 +0000 (11:04 -0700)]
[lld-macho] Fix no-filelist test on Windows

4 years ago[X86] Simplify some code in emitMemModRMByte. NFCI
Craig Topper [Tue, 28 Jul 2020 17:46:04 +0000 (10:46 -0700)]
[X86] Simplify some code in emitMemModRMByte. NFCI

4 years ago[X86] Merge disp8 and cdisp8 handling into a single helper function to reduce some...
Craig Topper [Tue, 28 Jul 2020 16:53:42 +0000 (09:53 -0700)]
[X86] Merge disp8 and cdisp8 handling into a single helper function to reduce some code.

We currently handle EVEX and non-EVEX separately in two places. By sinking the EVEX
check into the existing helper for CDisp8 we can simplify these two places.

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

4 years ago[libTooling] Add a `between` range-selector combinator.
Yitzhak Mandelbaum [Tue, 28 Jul 2020 17:26:12 +0000 (17:26 +0000)]
[libTooling] Add a `between` range-selector combinator.

Adds the `between` combinator and registers it with the parser. As a driveby, updates some deprecated names to their current versions.

Reviewed By: gribozavr2

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

4 years ago[JumpThreading] Add tests that have a cast of freeze and vice versa
Juneyoung Lee [Tue, 28 Jul 2020 17:16:34 +0000 (02:16 +0900)]
[JumpThreading] Add tests that have a cast of freeze and vice versa

4 years ago[mlir][Vector] Drop declarative transforms
Nicolas Vasilache [Tue, 28 Jul 2020 13:58:44 +0000 (09:58 -0400)]
[mlir][Vector] Drop declarative transforms

For the purpose of vector transforms, the Tablegen-based infra is subsumed by simple C++ pattern application. Deprecate declarative transforms whose complexity does not pay for itself.

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

4 years agoNFC: Add whitespace changing revisions to .git-blame-ignore-revs
Louis Dionne [Tue, 28 Jul 2020 17:09:32 +0000 (13:09 -0400)]
NFC: Add whitespace changing revisions to .git-blame-ignore-revs

4 years ago[lld-macho] Fix segment filesize calculation
Jez Ng [Tue, 28 Jul 2020 16:56:55 +0000 (09:56 -0700)]
[lld-macho] Fix segment filesize calculation

The previous approach of adding up the file sizes of the
component sections ignored the fact that the sections did not have to be
contiguous in the file. As such, it was underestimating the true size.

I discovered this issue because `codesign` checks whether `__LINKEDIT`
extends to the end of the file. Since we were underestimating segment
sizes, this check failed.

Reviewed By: #lld-macho, compnerd

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

4 years ago[lld-macho] Support -filelist
Jez Ng [Tue, 28 Jul 2020 16:56:50 +0000 (09:56 -0700)]
[lld-macho] Support -filelist

XCode passes files in using this flag

Reviewed By: #lld-macho, compnerd

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

4 years ago[ASTImporter] Add Visitor for TypedefNameDecl's
Vince Bridgers [Thu, 16 Jul 2020 22:46:48 +0000 (17:46 -0500)]
[ASTImporter] Add Visitor for TypedefNameDecl's

We found a case where Typedef Name Declarations were not being added
correctly when importing builtin types. This exposed the need for a
TypedefNameDecl visitor so these types can be added by RecordDecl and
fields.

This code is covered by the ASTImporterTest cases that use the implicit
struct __NSConstantString_tag definitions.

Thanks to @martong for the debugging assist!

Depends on D83970.

Reviewed By: martong

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

4 years ago[Darwin] Cleanup code via improved GetMacosAlignedVersion()
Julian Lettner [Tue, 28 Jul 2020 16:44:02 +0000 (09:44 -0700)]
[Darwin] Cleanup code via improved GetMacosAlignedVersion()

Checking the OS version via `GetMacosAlignedVersion()` now works in
simulators [1].  Let's use it to simplify `DyldNeedsEnvVariable()`.

[1] 3fb0de820796cc6e322c8378713d375d9870a353

Reviewed By: delcypher

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

4 years ago[ELF] --reproduce should include lto sample profile
Christy Lee [Tue, 28 Jul 2020 16:41:27 +0000 (09:41 -0700)]
[ELF] --reproduce should include lto sample profile

Reviewed By: MaskRay

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

4 years ago[ARM][MVE] Teach MVEGatherScatterLowering to merge successive getelementpointers
Anna Welker [Tue, 28 Jul 2020 16:28:19 +0000 (17:28 +0100)]
[ARM][MVE] Teach MVEGatherScatterLowering to merge successive getelementpointers

A patch following up on the introduction of pointer induction variables, adding
a preprocessing step to the address optimisation in the MVEGatherScatterLowering
pass. If the getelementpointer that is the address is itself using a
getelementpointer as base, they will be merged into one by summing up the
offsets, after checking that this will not cause an overflow (this can be
repeated recursively).

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

4 years ago[Darwin] Fix OS version checks inside simulators
Julian Lettner [Fri, 24 Jul 2020 18:24:34 +0000 (11:24 -0700)]
[Darwin] Fix OS version checks inside simulators

compiler-rt checks OS versions by querying the Darwin kernel version.
This is not necessarily correct inside the simulators if the simulator
runtime is not aligned with the host macOS.  Let's instead check the
`SIMULATOR_RUNTIME_VERSION` env var.

rdar://63031937

Reviewed By: delcypher

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

4 years ago[CompilerRT] Don't pass global compile test flags in non-standalone build
Arthur Eubanks [Thu, 23 Jul 2020 21:17:37 +0000 (14:17 -0700)]
[CompilerRT] Don't pass global compile test flags in non-standalone build

In a build with -DLLVM_ENABLE_LTO=Thin:

$ ninja TSanitizer-x86_64-Test-Nolibc
[1/1] Generating Sanitizer-x86_64-Test-Nolibc
FAILED: projects/compiler-rt/lib/sanitizer_common/tests/Sanitizer-x86_64-Test-Nolibc
sanitizer_nolibc_test_main.x86_64.o: file not recognized: file format not recognized

because -flto=thin is getting passed to the clang_compile step.

For non-standalone builds, global compilation flags shouldn't be passed to compiler-rt tests, only the flags the test specifies.

Reviewed By: vitalybuka

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

4 years ago[FIX] Resolve test failure in polly/test/ScopInfo/memcpy-raw-source.ll
Wei Wang [Tue, 28 Jul 2020 16:12:31 +0000 (09:12 -0700)]
[FIX] Resolve test failure in polly/test/ScopInfo/memcpy-raw-source.ll

scoped-noalias -> scoped-noalias-aa

reference: https://reviews.llvm.org/D84542

Reviewed By: aeubanks

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

4 years ago[NewPM][Sancov] Pin RUN lines with -sancov to legacy PM
Arthur Eubanks [Mon, 27 Jul 2020 18:31:34 +0000 (11:31 -0700)]
[NewPM][Sancov] Pin RUN lines with -sancov to legacy PM

Since the NPM pass is named sancov-module, not sancov.
This makes all tests under Instrumentation/SanitizerCoverage pass when
-enable-new-pm is on by default.

Reviewed By: vitalybuka

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

4 years ago[FunctionAttrs] Rename functionattrs -> function-attrs
Arthur Eubanks [Tue, 28 Jul 2020 16:08:08 +0000 (09:08 -0700)]
[FunctionAttrs] Rename functionattrs -> function-attrs

To match NewPM pass name, and also for readability.
Also rename rpo-functionattrs -> rpo-function-attrs while we're here.

Reviewed By: arsenm

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

4 years ago[OldPM] Print out a bit more when passes lie about changing IR
Jon Roelofs [Mon, 27 Jul 2020 18:34:36 +0000 (12:34 -0600)]
[OldPM] Print out a bit more when passes lie about changing IR

https://reviews.llvm.org/D84686

4 years agoGlobalISel: Translate llvm.convert.{to|from}.fp16 intrinsics
Matt Arsenault [Sat, 25 Jul 2020 20:58:15 +0000 (16:58 -0400)]
GlobalISel: Translate llvm.convert.{to|from}.fp16 intrinsics

I think these were added as a workaround for SelectionDAG lacking half
legalization support in the past. I think they should probably be
removed from the IR, but clang does still have a target control to
emit these instead of the native half fpext/fptrunc.

4 years agoAMDGPU/GlobalISel: Mark GlobalISel classes as final
Matt Arsenault [Sun, 26 Jul 2020 14:52:51 +0000 (10:52 -0400)]
AMDGPU/GlobalISel: Mark GlobalISel classes as final

4 years agoAMDGPU/GlobalISel: Merge identical select cases
Matt Arsenault [Sun, 26 Jul 2020 16:20:29 +0000 (12:20 -0400)]
AMDGPU/GlobalISel: Merge identical select cases

4 years ago[MLIR][Shape] Lower `shape.const_shape` to `tensor_from_elements`
Frederik Gossen [Tue, 28 Jul 2020 15:39:49 +0000 (15:39 +0000)]
[MLIR][Shape] Lower `shape.const_shape` to `tensor_from_elements`

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

4 years agoAMDGPU/GlobalISel: Use clamp modifier for [us]addsat/[us]subsat
Matt Arsenault [Sun, 12 Jul 2020 18:16:36 +0000 (14:16 -0400)]
AMDGPU/GlobalISel: Use clamp modifier for [us]addsat/[us]subsat

We also have never handled this for SelectionDAG, which needs
additional work.

4 years ago[SCEV] Add additional tests.
Florian Hahn [Sun, 12 Jul 2020 22:05:43 +0000 (23:05 +0100)]
[SCEV] Add additional tests.

Increase test coverage for upcoming changes to how SCEV deals with LCSSA
phis.

4 years agoOrder of libraries and source files in the f18 frontend
Camille Coti [Mon, 27 Jul 2020 22:58:39 +0000 (16:58 -0600)]
Order of libraries and source files in the f18 frontend

When the f18 frontend calls the link editor, put the libraries and object files in the correct order.

Fixes the issues reported here https://github.com/flang-compiler/flang/issues/897

Reviewed By: sscalpone, AlexisPerry

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

4 years ago[DWARFYAML] Rename checkListEntryOperands() to checkOperandCount(). NFC.
Xing GUO [Tue, 28 Jul 2020 14:20:10 +0000 (22:20 +0800)]
[DWARFYAML] Rename checkListEntryOperands() to checkOperandCount(). NFC.

This patch renames checkListEntryOperands() to checkOperandCount(), so
that we are able to check DWARF expression operands using the same
function.

Reviewed By: jhenderson, labath

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

4 years ago[AArch64][SVE] Fix epilogue for SVE when the stack is realigned.
Sander de Smalen [Tue, 28 Jul 2020 11:11:09 +0000 (12:11 +0100)]
[AArch64][SVE] Fix epilogue for SVE when the stack is realigned.

While deallocating the stackframe, the offset used to reload the
callee-saved registers was not pointing to the SVE callee-saves,
but rather to the whole SVE area.

   +--------------+
   | GRP callee   |
   |     saves    |
   +--------------+ <- FP
   | SVE callee   |
   |     saves    |
   +--------------+ <- Should restore SVE callee saves from here
   |  SVE Spills  |
   |  and Locals  |
   +--------------+ <- instead of from here.
   |              |
   :              :
   |              |
   +--------------+ <- SP

Reviewed By: paulwalker-arm

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

4 years ago[AArch64][SVE] Don't align the last SVE callee save.
Sander de Smalen [Mon, 27 Jul 2020 13:16:55 +0000 (14:16 +0100)]
[AArch64][SVE] Don't align the last SVE callee save.

Instead of aligning the last callee-saved-register slot to the stack
alignment (16 bytes), just align the SVE callee-saved block. This also
simplifies the code that allocates space for the callee-saves.

This change is needed to make sure the offset to which the callee-saved
register is spilled, corresponds to the offset used for e.g. unwind call
frame instructions.

Reviewers: efriedma, paulwalker-arm, david-arm, rengolin

Reviewed By: efriedma

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

4 years ago[AArch64][SVE] Don't support fixedStack for SVE objects.
Sander de Smalen [Mon, 27 Jul 2020 11:57:41 +0000 (12:57 +0100)]
[AArch64][SVE] Don't support fixedStack for SVE objects.

Fixed stack objects are preallocated and defined to be allocated before
any of the regular stack objects. These are normally used to model stack
arguments.

The AAPCS does not support passing SVE registers on the stack by value
(only by reference). The current layout also doesn't place them before
all stack objects, but rather before all SVE objects. Removing this
simplifies the code that emits the allocation/deallocation
around callee-saved registers (D84042).

This patch also removes all uses of fixedStack from from
framelayout-sve.mir, where this was used purely for testing purposes.

Reviewers: paulwalker-arm, efriedma, rengolin

Reviewed By: paulwalker-arm

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

4 years ago[clang][NFC] Add some documentation about the use of NamedDecl::getDeclName in diagno...
Bruno Ricci [Tue, 28 Jul 2020 14:39:17 +0000 (15:39 +0100)]
[clang][NFC] Add some documentation about the use of NamedDecl::getDeclName in diagnostics.

As explained in eb10b065f2a870b425dcc2040b9955e0eee464b4, sending a NamedDecl*
in a diagnostic should generally be preferred over sending the DeclarationName
from getDeclName(). Let's document that.