platform/upstream/llvm.git
3 years ago[build] normalize components dependencies
serge-sans-paille [Fri, 13 Nov 2020 21:45:55 +0000 (22:45 +0100)]
[build] normalize components dependencies

Use LINK_COMPONENTS instead of explicit target_link_libraries for components.
This avoids redundancy and potential inconsistencies.

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

3 years ago[PowerPC] Add negated abs test using llvm.abs intrinsic. NFC.
Kai Luo [Tue, 17 Nov 2020 09:28:56 +0000 (09:28 +0000)]
[PowerPC] Add negated abs test using llvm.abs intrinsic. NFC.

3 years ago[clang-tidy] Verify the fixes in abseil-redundant-strcat-calls test, NFC
Haojian Wu [Tue, 17 Nov 2020 09:15:29 +0000 (10:15 +0100)]
[clang-tidy] Verify the fixes in abseil-redundant-strcat-calls test, NFC

3 years ago[mlir][NFC] Remove references to Module.h and Function.h
River Riddle [Tue, 17 Nov 2020 08:38:10 +0000 (00:38 -0800)]
[mlir][NFC] Remove references to Module.h and Function.h

These includes have been deprecated in favor of BuiltinDialect.h, which contains the definitions of ModuleOp and FuncOp.

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

3 years ago[mlir][IR] Use tablegen for the BuiltinDialect and operations
River Riddle [Tue, 17 Nov 2020 08:37:14 +0000 (00:37 -0800)]
[mlir][IR] Use tablegen for the BuiltinDialect and operations

This has been a long standing TODO, and cleans up a bit of IR/. This will also make it easier to move FuncOp out of IR/ at some point in the future. For now, Module.h and Function.h just forward BuiltinDialect.h. These files will be removed in a followup.

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

3 years ago[Driver] Quote executable in reports generated by -fproc-stat-report
Serge Pavlov [Tue, 17 Nov 2020 05:46:13 +0000 (12:46 +0700)]
[Driver] Quote executable in reports generated by -fproc-stat-report

The option -fproc-stat-report=<file> makes driver to generate child
process resource comsumption report. In the report executable name was
not quoted and it made parsing the report more difficult. With this
change the executable name is surrounded by quotation marks.

3 years ago[JumpThreading] Fix branch probabilities in DuplicateCondBranchOnPHIIntoPred()
Yevgeny Rouban [Tue, 17 Nov 2020 07:24:50 +0000 (14:24 +0700)]
[JumpThreading] Fix branch probabilities in DuplicateCondBranchOnPHIIntoPred()

When instructions are cloned from block BB to PredBB in the method
DuplicateCondBranchOnPHIIntoPred() number of successors of PredBB
changes from 1 to number of successors of BB. So we have to copy
branch probabilities from BB to PredBB.

Reviewed By: Kazu Hirata

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

3 years ago[Test] Add one more elaborate test with LCSSA users
Max Kazantsev [Tue, 17 Nov 2020 07:36:51 +0000 (14:36 +0700)]
[Test] Add one more elaborate test with LCSSA users

3 years ago[crashlog] Improve patch-crashlog.py script
Jonas Devlieghere [Tue, 17 Nov 2020 07:26:35 +0000 (23:26 -0800)]
[crashlog] Improve patch-crashlog.py script

Compute the real addresses and offsets for the json crashlog test.

3 years ago[NFC] Collect ext users into vector instead of finding them twice
Max Kazantsev [Tue, 17 Nov 2020 07:00:37 +0000 (14:00 +0700)]
[NFC] Collect ext users into vector instead of finding them twice

3 years ago[NPM] Add remaining test of -slsr
Ta-Wei Tu [Tue, 17 Nov 2020 06:40:44 +0000 (14:40 +0800)]
[NPM] Add remaining test of -slsr

Add RUN lines for NPM of -slsr tests that require -separate-const-offset-from-gep

Reviewed By: aeubanks

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

3 years ago[NFC] Add const qualifier to isEmpty()
Ta-Wei Tu [Tue, 17 Nov 2020 06:39:33 +0000 (14:39 +0800)]
[NFC] Add const qualifier to isEmpty()

Reviewed By: aeubanks

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

3 years ago[Transforms] Use pred_empty (NFC)
Kazu Hirata [Tue, 17 Nov 2020 06:09:14 +0000 (22:09 -0800)]
[Transforms] Use pred_empty (NFC)

3 years ago[Test] One more widening opportunity test
Max Kazantsev [Tue, 17 Nov 2020 05:52:08 +0000 (12:52 +0700)]
[Test] One more widening opportunity test

3 years ago[SanitizerCoverage] Use [&] for lambdas (NFC)
Kazu Hirata [Tue, 17 Nov 2020 05:45:21 +0000 (21:45 -0800)]
[SanitizerCoverage] Use [&] for lambdas (NFC)

3 years ago[NFC][PowerPC] Add testcase of constant-i64.
Esme-Yi [Tue, 17 Nov 2020 04:49:19 +0000 (04:49 +0000)]
[NFC][PowerPC] Add testcase of constant-i64.

3 years ago[Debugify] Skip debugifying on special/immutable passes
Arthur Eubanks [Mon, 16 Nov 2020 19:47:50 +0000 (11:47 -0800)]
[Debugify] Skip debugifying on special/immutable passes

With a function pass manager, it would insert debuginfo metadata before
getting to function passes while processing the pass manager, causing
debugify to skip while running the function passes.

Skip special passes + verifier + printing passes. Compared to the legacy
implementation of -debugify-each, this additionally skips verifier
passes. Probably no need to update the legacy version since it will be
obsolete soon.

This fixes 2 instcombine tests using -debugify-each under NPM.

Reviewed By: MaskRay

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

3 years agoFix python bindings tests after change in visibility requirement for symbol declarations
Mehdi Amini [Tue, 17 Nov 2020 04:08:35 +0000 (04:08 +0000)]
Fix python bindings tests after change in visibility requirement for symbol declarations

3 years agoELFAsmParser: Remove non-SHF_ALLOC or non-executable sections' line info/address...
Fangrui Song [Tue, 17 Nov 2020 04:02:25 +0000 (20:02 -0800)]
ELFAsmParser: Remove non-SHF_ALLOC or non-executable sections' line info/address ranges contribution for -g

I filed the issue https://sourceware.org/bugzilla/show_bug.cgi?id=26850 ,
which was acknowledged and fixed in GNU binutils 2.36

This patch adds the similar behavior to MC.

Reviewed By: #debug-info, dblaikie

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

3 years agoAdd const qualifier to Type's utility functions
Tei Jeong [Tue, 17 Nov 2020 03:56:04 +0000 (03:56 +0000)]
Add const qualifier to Type's utility functions

Reviewed By: rriddle

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

3 years ago[Polly] Add override qualifiers.
Michael Kruse [Tue, 17 Nov 2020 03:26:37 +0000 (21:26 -0600)]
[Polly] Add override qualifiers.

Silence compiler warnings that suggest to add override qualifiers.

3 years ago[CodeGen][X86] Remove some unused check-prefixes and regenerate tests.
Wang, Pengfei [Tue, 17 Nov 2020 02:17:07 +0000 (10:17 +0800)]
[CodeGen][X86] Remove some unused check-prefixes and regenerate tests.

3 years ago[ORC] Include config.h in RegisterEHFrames.cpp.
Lang Hames [Tue, 17 Nov 2020 03:10:53 +0000 (14:10 +1100)]
[ORC] Include config.h in RegisterEHFrames.cpp.

RegisterEHFrames.cpp needs access to the HAVE_REGISTER_FRAME /
HAVE_DEREGISTER_FRAME defines.

rdar://71458921

3 years ago[flang] Duplicate names for ac-implied-do variables erroneously cause errors
Peter Steinfeld [Mon, 16 Nov 2020 20:06:44 +0000 (12:06 -0800)]
[flang] Duplicate names for ac-implied-do variables erroneously cause errors

According to section 19.4, paragraph 5, the scope of an ac-implied-do variable
is the enclosing ac-implied-do.  But we were not creating new scopes upon
entry to an ac-implied-do.  This was causing error messages to be erroneously
emitted.

I fixed, the code, added a test to array-constr-values.f90, added the test
folding15.f90 and corrected the test symbol05.f90.

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

3 years ago[AMDGPU] Add option -munsafe-fp-atomics
Yaxun (Sam) Liu [Mon, 16 Nov 2020 15:58:48 +0000 (10:58 -0500)]
[AMDGPU] Add option -munsafe-fp-atomics

Add an option -munsafe-fp-atomics for AMDGPU target.

When enabled, clang adds function attribute "amdgpu-unsafe-fp-atomics"
to any functions for amdgpu target. This allows amdgpu backend to use
unsafe fp atomic instructions in these functions.

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

3 years ago[CodeGen] Apply 'nonnull' and 'dereferenceable(N)' to 'this' pointer
CJ Johnson [Mon, 16 Nov 2020 23:04:55 +0000 (15:04 -0800)]
[CodeGen] Apply 'nonnull' and 'dereferenceable(N)' to 'this' pointer
arguments.

* Adds 'nonnull' and 'dereferenceable(N)' to 'this' pointer arguments
* Gates 'nonnull' on -f(no-)delete-null-pointer-checks
* Introduces this-nonnull.cpp and microsoft-abi-this-nullable.cpp tests to
  explicitly test the behavior of this change
* Refactors hundreds of over-constrained clang tests to permit these
  attributes, where needed
* Updates Clang12 patch notes mentioning this change

Reviewed-by: rsmith, jdoerfert
Differential Revision: https://reviews.llvm.org/D17993

3 years agoFix flang MLIR unit test verification failures
Rahul Joshi [Tue, 17 Nov 2020 01:31:11 +0000 (17:31 -0800)]
Fix flang MLIR unit test verification failures

- Eliminate public function declarations in these tests

3 years agotest commit for new client
Philip Reames [Tue, 17 Nov 2020 01:26:24 +0000 (17:26 -0800)]
test commit for new client

3 years ago[Polly] Move SimplifyVisitor into polly namespace.
Michael Kruse [Tue, 17 Nov 2020 00:55:05 +0000 (18:55 -0600)]
[Polly] Move SimplifyVisitor into polly namespace.

Declarations in headers should not be in the anonymous
namespace. Compilers also warn about the use of
<anon namespace>::SimplifyVisitor as a public field in
polly::SimplifyPass and polly::SimplifyPrinterPass.

3 years ago[sanitizers-test]add definition for %device_rm on android so it stops complaining
Vy Nguyen [Mon, 16 Nov 2020 22:53:34 +0000 (17:53 -0500)]
[sanitizers-test]add definition for %device_rm on android so it stops complaining

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

3 years ago[MC][test] Strengthen dwarf-asm-multiple-sections.s by adding more CHECK lines
Fangrui Song [Tue, 17 Nov 2020 00:48:19 +0000 (16:48 -0800)]
[MC][test] Strengthen dwarf-asm-multiple-sections.s by adding more CHECK lines

And change DWARF-DL-4 to DWARF-DL-3 since DWARF v3/DWARF v4 have same
output and using DWARF-DL-3 makes it clear that the lowest standard
having the behavior is version 3.

3 years ago[MLIR] Extend Symbol verification to reject public symbol declarations.
Rahul Joshi [Fri, 13 Nov 2020 21:04:53 +0000 (13:04 -0800)]
[MLIR] Extend Symbol verification to reject public symbol declarations.

- Extend the Symbol interface with `isDeclaration` to identify operations that declare
  a symbol as opposed to define it.
- Extend verification to disallow public declarations as per the discussion in
   https://llvm.discourse.group/t/rfc-symbol-definition-declaration-x-visibility-checks/2140
- Adopt the new interface for `FuncOp` and fix test and code to not have/create public
  function declarations.

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

3 years agoAdd an optional argument for pattern rewriter max iteration count (NFC)
Lex Augusteijn [Mon, 16 Nov 2020 22:47:42 +0000 (22:47 +0000)]
Add an optional argument for pattern rewriter max iteration count (NFC)

Some rewriters take more iterations to converge, add a parameter to overwrite
the built-in maximum iteration count.

Fix PR48073.

Reviewed By: mehdi_amini

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

3 years agoRevert "Revert "[analyzer] NFC: Separate PathDiagnosticConsumer options from Analyzer...
Artem Dergachev [Tue, 10 Nov 2020 22:03:57 +0000 (14:03 -0800)]
Revert "Revert "[analyzer] NFC: Separate PathDiagnosticConsumer options from AnalyzerOptions.""

This reverts commit 10f1ca99b498347186ec74b01046ad292bde9a4c.

(cherry picked from commit c599fc738a70e482976c6cc0ea31bef561641279)

3 years ago[LoopFlatten] Disable IV widening
Sjoerd Meijer [Mon, 16 Nov 2020 22:30:52 +0000 (22:30 +0000)]
[LoopFlatten] Disable IV widening

Disable widening of the IV in LoopFlatten while I investigate an assertion
failures. Please note that the pass is also not yet enabled by default.

3 years ago[AArch64][GlobalISel] Fold G_XOR x, -1 into G_SELECT and select CSINV
Jessica Paquette [Fri, 13 Nov 2020 22:09:08 +0000 (14:09 -0800)]
[AArch64][GlobalISel] Fold G_XOR x, -1 into G_SELECT and select CSINV

When we see

```
xor = G_XOR xor_lhs, -1
select = G_SELECT cc, tval, xor
```

Fold this into

```
select = CSINV tval, xor_lhs, cc
```

Update select-select.mir to reflect the changes.

For now, only handle the case where the G_XOR is the false-value for the
G_SELECT. It may make more sense to handle the true-value case in post-legalizer
lowering.

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

3 years ago[clang-tidy] performance-unnecessary-copy-initialization: Check for const reference...
Felix Berger [Thu, 22 Oct 2020 18:38:38 +0000 (14:38 -0400)]
[clang-tidy] performance-unnecessary-copy-initialization: Check for const reference arguments that are replaced template parameter type.

This fixes false positive cases where a non-const reference is passed to a
std::function but interpreted as a const reference.

Fix the definition of the fake std::function added in the test to match
std::function and make the bug reproducible.

Reviewed-by: aaron.ballman
Differential Revision: https://reviews.llvm.org/D90042

3 years ago[InferAddrSpace] Teach to handle assumed address space.
Michael Liao [Sat, 7 Nov 2020 11:47:57 +0000 (06:47 -0500)]
[InferAddrSpace] Teach to handle assumed address space.

- In certain cases, a generic pointer could be assumed as a pointer to
  the global memory space or other spaces. With a dedicated target hook
  to query that address space from a given value, infer-address-space
  pass could infer and propagate that to all its users.

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

3 years ago[VE] Add lvm/svm intrinsic instructions
Kazushi (Jam) Marukawa [Sat, 14 Nov 2020 14:37:46 +0000 (23:37 +0900)]
[VE] Add lvm/svm intrinsic instructions

Add lvm/svm intrinsic instructions and a regression test.  Change
RegisterInfo to specify that VM0/VMP0 are constant and reserved
registers.  This modifies a vst regression test, so update it.
Also add pseudo instructions for VM512 register classes
and mechanism to expand them after register allocation.

Reviewed By: simoll

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

3 years ago[crashlog] Implement parser for JSON encoded crashlogs
Jonas Devlieghere [Mon, 16 Nov 2020 21:46:44 +0000 (13:46 -0800)]
[crashlog] Implement parser for JSON encoded crashlogs

Add a parser for JSON crashlogs. The CrashLogParser now defers to either
the JSONCrashLogParser or the TextCrashLogParser. It first tries to
interpret the input as JSON, and if that fails falling back to the
textual parser.

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

3 years ago[ConstraintElimination] Add support for Or.
Florian Hahn [Mon, 16 Nov 2020 21:44:13 +0000 (21:44 +0000)]
[ConstraintElimination] Add support for Or.

When processing conditional branches, if the condition is an OR of 2 compares
and the false successor only has the current block as predecessor, queue both
negated conditions for the false successor

3 years ago[LoopVec] Introduce an api for detecting uniform memory ops
Philip Reames [Mon, 16 Nov 2020 21:29:45 +0000 (13:29 -0800)]
[LoopVec] Introduce an api for detecting uniform memory ops

Split off D91398 at request of reviewer.

3 years ago[libc++] Move the GDB pretty printer tests to the DSL
Louis Dionne [Fri, 13 Nov 2020 16:24:20 +0000 (11:24 -0500)]
[libc++] Move the GDB pretty printer tests to the DSL

Also, enable them whenever we detect that gdb is available. Previously,
these tests would basically never run because they relied on a CMake
configuration option that defaulted to OFF.

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

3 years ago[scudo][standalone] Correct min/max region indices
Kostya Kortchinsky [Mon, 9 Nov 2020 23:14:49 +0000 (15:14 -0800)]
[scudo][standalone] Correct min/max region indices

The original code to keep track of the minimum and maximum indices
of allocated 32-bit primary regions was sketchy at best.

`MinRegionIndex` & `MaxRegionIndex` were shared between all size
classes, and could (theoretically) have been updated concurrently. This
didn't materialize anywhere I could see, but still it's not proper.

This changes those min/max indices by making them class specific rather
than global: classes are locked when growing, so there is no
concurrency there. This also allows to simplify some of the 32-bit
release code, that now doesn't have to go through all the regions to
get the proper min/max. Iterate and unmap will no longer have access to
the global min/max, but they aren't used as much so this is fine.

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

3 years ago[mlir] Add DecomposeCallGraphTypes pass.
Sean Silva [Fri, 6 Nov 2020 03:35:15 +0000 (19:35 -0800)]
[mlir] Add DecomposeCallGraphTypes pass.

This replaces the old type decomposition logic that was previously mixed
into bufferization, and makes it easily accessible.

This also deletes TestFinalizingBufferize, because after we remove the type
decomposition, it doesn't do anything that is not already provided by
func-bufferize.

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

3 years agolld/mach-o: Infer darwinnew from filename ld64.lld.darwinnew too
Nico Weber [Mon, 16 Nov 2020 20:23:02 +0000 (15:23 -0500)]
lld/mach-o: Infer darwinnew from filename ld64.lld.darwinnew too

`-flavor` is difficult to use through the clang driver since it
must be the first argument.

clang's `-fuse-ld=foo` looks for `ld64.foo` when targeting darwin,
so it's easiest if darwinnew accepts some `ld64.foo`. Let's go with
`ld64.lld.darwinnew`, so that `clang -fuse-ld=lld.darwinnew` does
the right thing (assuming a symlink with the name `ld64.ld.darwinnew
exists in the right place).

This is temporary until darwinnew replaces ld64.lld, and it only
exists to make testing the new lld port easier.

3 years ago[SCEV] Factor out part of wrap flag detection logic [NFC](try 2)
Philip Reames [Mon, 16 Nov 2020 18:51:31 +0000 (10:51 -0800)]
[SCEV] Factor out part of wrap flag detection logic [NFC](try 2)

This is a cut down version of 1ec6e1 which was reverted due to a compile time issue.  The key changes made from that patch: 1) only infer the flags needed along each path, 2) be careful to preserve order of checks, and 3) avoid computing NW flags at all since we need to prove the stronger property (does not cross 0) in the caller anyways.

Assuming this doesn't trip regressions, I'm going to try weakening (1).  My end objective is to move flag inference into addrec construction.  If I can't weaken (1) without compile time impact, I'll have a problem.

3 years ago[coro] Async coroutines: Make sure we can handle control flow in suspend point dispat...
Arnold Schwaighofer [Mon, 16 Nov 2020 15:51:20 +0000 (07:51 -0800)]
[coro] Async coroutines: Make sure we can handle control flow in suspend point dispatch function

Create a valid basic block with a terminator before we call
InlineFunction.

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

3 years ago[ConstraintElimination] Add complex test cases.
Florian Hahn [Mon, 16 Nov 2020 16:03:05 +0000 (16:03 +0000)]
[ConstraintElimination] Add complex test cases.

3 years agoRevert "[InstCombine] add multi-use demanded bits fold for add with low-bit mask"
Sanjay Patel [Mon, 16 Nov 2020 19:20:46 +0000 (14:20 -0500)]
Revert "[InstCombine] add multi-use demanded bits fold for add with low-bit mask"

This reverts commit e56103d25016c9ce4e98f652ac1a09379793ccf5.
There is a stage2 msan failure blamed on this commit:
http://lab.llvm.org:8011/#/builders/74/builds/888/steps/9/logs/stdio

3 years agoAnother speculative fix for lldb related to ConstexprSpecKind
Aaron Ballman [Mon, 16 Nov 2020 19:39:34 +0000 (14:39 -0500)]
Another speculative fix for lldb related to ConstexprSpecKind

3 years agoSpeculatively fix the lldb build
Aaron Ballman [Mon, 16 Nov 2020 19:23:04 +0000 (14:23 -0500)]
Speculatively fix the lldb build

Pick up the changes from 41b65f166b51760f77d0f9e465b3858f46e101f0.

3 years agoConvert ConstexprKind from Specifiers.h to a scoped enum; NFC
Thorsten [Mon, 16 Nov 2020 19:08:33 +0000 (14:08 -0500)]
Convert ConstexprKind from Specifiers.h to a scoped enum; NFC

3 years ago[dsymutil] Generalize handling of aliases external symbols
Jonas Devlieghere [Mon, 16 Nov 2020 19:02:40 +0000 (11:02 -0800)]
[dsymutil] Generalize handling of aliases external symbols

In f9fb9da36c34d2745b74dc30e6c26f7d3f48466c we fixed spurious warnings
caused by aliases to private extern symbols. This patch generalizes that
to regular external symbols as well.

3 years ago[AArch64][GlobalISel] Look through a G_ZEXT when trying to match shift-extended regis...
Amara Emerson [Sat, 14 Nov 2020 07:08:47 +0000 (23:08 -0800)]
[AArch64][GlobalISel] Look through a G_ZEXT when trying to match shift-extended register offsets.

The G_ZEXT in these cases seems to actually come from a combine that we do but
SelectionDAG doesn't. Looking through it allows us to match "uxtw #2" addressing
modes.

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

3 years ago[YAMLIO] Correctly diagnose empty alias/anchor
Scott Linder [Mon, 16 Nov 2020 18:41:25 +0000 (18:41 +0000)]
[YAMLIO] Correctly diagnose empty alias/anchor

The `Range` of an alias/anchor token includes the leading `&` or `*`,
but it is skipped while parsing the name. The check for an empty name
fails to account for the skipped leading character and so the error is
never hit.

Fix the off-by-one and add a couple regression tests.

Reviewed By: dexonsmith

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

3 years ago[RISCV] Add MC tests for the User Vector CSRs
Craig Topper [Mon, 16 Nov 2020 18:12:45 +0000 (10:12 -0800)]
[RISCV] Add MC tests for the User Vector CSRs

Make sure we can parse and print the user CSR names

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

3 years ago[libc++] Remove transitional #error message
Louis Dionne [Mon, 16 Nov 2020 18:35:14 +0000 (13:35 -0500)]
[libc++] Remove transitional #error message

It's been more than 4 years now, so anyone that was defining
_LIBCPP_TRIVIAL_PAIR_COPY_CTOR has had ample time to see that
error and fix their code.

3 years agoReland "[AsmPrinter] fix -disable-debug-info option"
Jameson Nash [Mon, 16 Nov 2020 17:34:43 +0000 (12:34 -0500)]
Reland "[AsmPrinter] fix -disable-debug-info option"

This reverts commit 105ed27ed80dd47a9d32e72bbdd2a776a3318f38, and
removes the offending line from the tests.

3 years ago[Flang][OpenMP] Add semantic checks for OpenMP Depend clause.
Praveen G [Mon, 16 Nov 2020 17:56:04 +0000 (12:56 -0500)]
[Flang][OpenMP] Add semantic checks for OpenMP Depend clause.

Add the semantic checks for the OpenMP 4.5 - 2.13.9 Depend clause.

1. List items in depend clause should not be zero length array sections.
2. A variable that is part of another variable like structure component
   should not be specified on a depend clause.

Test cases : omp-depend01.f90, omp-depend02.f90, omp-depend03.f90

Reviewed By: kiranchandramohan

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

3 years ago[RISCV] When matching SROIW, check all 64 bits of the OR mask
Craig Topper [Mon, 16 Nov 2020 17:22:42 +0000 (09:22 -0800)]
[RISCV] When matching SROIW, check all 64 bits of the OR mask

We need to make sure the upper 32 bits are all ones to ensure the result is properly sign extended. Previously we only checked the lower 32 bits of the mask. I've also added a check that the shift amount is less than 32. Without that the original code asserts inside maskLeadingOnes if the SROI check is removed or the SROIW pattern is checked first. I've refactored the code to use early outs to reduce nesting.

I've also updated SLOIW matching with the same changes, but I couldn't find a broken test case with the existing code.

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

3 years ago[SimplifyCFG] Respect optforfuzzing in NPM pass
Arthur Eubanks [Sat, 14 Nov 2020 02:34:34 +0000 (18:34 -0800)]
[SimplifyCFG] Respect optforfuzzing in NPM pass

Regression caused by refactoring in
cdd006eec9409923f9a56b9026ce2cb72e7b71dc.

See discussion in https://reviews.llvm.org/D89917.

Reviewed By: arsenm, morehouse

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

3 years ago[lldb] Skip TestCppKeywordsAsCIdentifiers on Windows
Raphael Isemann [Mon, 16 Nov 2020 17:41:00 +0000 (18:41 +0100)]
[lldb] Skip TestCppKeywordsAsCIdentifiers on Windows

Somehow static_assert is a keyword with C on Windows (maybe the Windows
default is C11?). Skipping the test for now.

3 years ago[flang] Unsplit COMPLEX operations
peter klausler [Fri, 13 Nov 2020 17:40:59 +0000 (09:40 -0800)]
[flang] Unsplit COMPLEX operations

COMPLEX negation, addition, subtraction, conversions of kind, and
equality/inequality were represented as component-wise REAL
operations.  It turns out to be easier for lowering if we
do not split and recombine these COMPLEX operations, and it
avoids a potential problem with COMPLEX valued function calls
in these contexts.  So add this suite of operations to the
typed expression representation in place of the component-wise
transformations, and support them in folding.

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

3 years ago[fuzzer] Disable uncaught-exception on non-Win+undo bad fix
Jonathan Metzman [Mon, 16 Nov 2020 17:35:35 +0000 (09:35 -0800)]
[fuzzer] Disable uncaught-exception on non-Win+undo bad fix

Test is failing on non-Windows platforms. Also undo speculative
fix since it causes failures on Windows.

3 years ago[Coroutine] Allocas used by StoreInst does not always escape
Xun Li [Mon, 16 Nov 2020 17:14:44 +0000 (09:14 -0800)]
[Coroutine] Allocas used by StoreInst does not always escape

In the existing logic, for a given alloca, as long as its pointer value is stored into another location, it's considered as escaped.
This is a bit too conservative. Specifically, in non-optimized build mode, it's often to have patterns of code that first store an alloca somewhere and then load it right away.
These used should be handled without conservatively marking them escaped.

This patch tracks how the memory location where an alloca pointer is stored into is being used. As long as we only try to load from that location and nothing else, we can still
consider the original alloca not escaping and keep it on the stack instead of putting it on the frame.

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

3 years ago[fuzzer] Add allocator_may_return_null to uncaught-exception.test.
Jonathan Metzman [Mon, 16 Nov 2020 17:04:54 +0000 (09:04 -0800)]
[fuzzer] Add allocator_may_return_null to uncaught-exception.test.

Speculative fix for failing unittest.

3 years agoAMDGPU: Select global saddr mode from SGPR pointer
Matt Arsenault [Tue, 10 Nov 2020 16:06:59 +0000 (11:06 -0500)]
AMDGPU: Select global saddr mode from SGPR pointer

Use the 64-bit SGPR base with a 0 offset, since it's 1 fewer
instruction to materialize the 0 vs. the 64-bit copy.

3 years ago[AMDGPU][GlobalISel] Fix lowerShlSat
Mirko Brkusanin [Mon, 16 Nov 2020 16:43:15 +0000 (17:43 +0100)]
[AMDGPU][GlobalISel] Fix lowerShlSat

RegBankSelect would crash on G_SELECT when type is not s1.

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

3 years agoAMDGPU: Split large offsets when selecting global saddr mode
Matt Arsenault [Mon, 9 Nov 2020 23:01:29 +0000 (18:01 -0500)]
AMDGPU: Split large offsets when selecting global saddr mode

When the offset doesn't fit in the immediate field, move some to
voffset.

3 years agoFix the compilation assertion due to unreachable BB pruning not deleting the associat...
Victor Huang [Mon, 16 Nov 2020 16:33:06 +0000 (10:33 -0600)]
Fix the compilation assertion due to unreachable BB pruning not deleting the associated BB from the jump tables

This patch is added to remove the unreachable MBBs reference in the jump table.

Differential Revisien: https://reviews.llvm.org/D90498
Reviewed by: amyk, bsaleil

3 years ago[AMDGPU] Add comments. NFC.
Jay Foad [Mon, 16 Nov 2020 15:52:18 +0000 (15:52 +0000)]
[AMDGPU] Add comments. NFC.

3 years ago[mlir] Require std.alloc() ops to have canonical layout during LLVM lowering.
Christian Sigg [Mon, 16 Nov 2020 10:41:59 +0000 (11:41 +0100)]
[mlir] Require std.alloc() ops to have canonical layout during LLVM lowering.

The current code allows strided layouts, but the number of elements allocated is ambiguous. It could be either the number of elements in the shape (the current implementation), or the amount of elements required to not index out-of-bounds with the given maps (which would require evaluating the layout map).

If we require the canonical layouts, the two will be the same.

Reviewed By: nicolasvasilache, ftynse

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

3 years ago[flang][f18] Remove "-fdebug-resolve-names"
Andrzej Warzynski [Mon, 16 Nov 2020 10:58:04 +0000 (10:58 +0000)]
[flang][f18] Remove "-fdebug-resolve-names"

This option doesn't enable any unique feature/code-patch. Also, it is
neither tested nor documented.

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

3 years ago[VE] Optimize leaf functions
Kazushi (Jam) Marukawa [Sun, 15 Nov 2020 01:08:10 +0000 (10:08 +0900)]
[VE] Optimize leaf functions

Optimize leaf functions by not generating save/restore for callee saved
registers.  Update regression tests also.

Reviewed By: simoll

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

3 years ago[MLIR][OpenMP] Add omp.wsloop operation
David Truby [Mon, 16 Nov 2020 13:39:11 +0000 (13:39 +0000)]
[MLIR][OpenMP] Add omp.wsloop operation

This adds a simple definition of a "workshare loop" operation for
the OpenMP MLIR dialect, excluding the "reduction" and "allocate"
clauses and without a custom parser and pretty printer.

The schedule clause also does not yet accept the modifiers that are
permitted in OpenMP 5.0.

Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
Reviewed By: ftynse, clementval

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

3 years ago[VE] fastcc and vreg-to-vreg copy
Simon Moll [Mon, 16 Nov 2020 15:24:05 +0000 (16:24 +0100)]
[VE] fastcc and vreg-to-vreg copy

This defines a 'fastcc' for the VE target and implements vreg-to-vreg
copy for parameter passing.  The 'fastcc' extends the standard CC for
SX-Aurora with register passing of vector-typed parameters and return
values.

Reviewed By: kaz7

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

3 years agoBPF: make __builtin_btf_type_id() return 64bit int
Yonghong Song [Sat, 14 Nov 2020 19:06:23 +0000 (11:06 -0800)]
BPF: make __builtin_btf_type_id() return 64bit int

Linux kernel recently added support for kernel modules
  https://lore.kernel.org/bpf/20201110011932.3201430-5-andrii@kernel.org/

In such cases, a type id in the kernel needs to be presented
as (btf id for modules, btf type id for this module).
Change __builtin_btf_type_id() to return 64bit value
so libbpf can do the above encoding.

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

3 years ago[AIX][driver] Include crti[_64].o and -bcdtors also for C language link invocations...
Xiangling Liao [Mon, 16 Nov 2020 14:42:39 +0000 (09:42 -0500)]
[AIX][driver] Include crti[_64].o and -bcdtors also for C language link invocations by default

In order to support attribute((constructor)) and attribute((destructor)),
which is used by various LLVM non-C++ runtime components, AIX will include
crti[_64].o and -bcdtors for C language link invocations by default.

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

3 years ago[lldb] Add support for using variables with C++ keywords names in non-C++ expressions
Raphael Isemann [Mon, 16 Nov 2020 07:15:42 +0000 (08:15 +0100)]
[lldb] Add support for using variables with C++ keywords names in non-C++ expressions

LLDB is currently always activating C++ when parsing expressions as LLDB itself
is using C++ features when creating the final AST that will be codegen'd
(specifically, references to variables, namespaces and using declarations are
used).

This is causing problems for users that have variables in non-C++ programs (e.g.
plain C or Objective-C) that have names which are keywords in C++. Expressions
referencing those variables fail to parse as LLDB's Clang parser thinks those
identifiers are C++ keywords and not identifiers that may belong to a
declaration.

We can't just disable C++ in the expression parser for those situations as
replacing the functionality of the injected C++ code isn't trivial. So this
patch is just disabling most keywords that are exclusive to C++ in LLDB's Clang
parser when we are in a non-C++ expression. There are a few keywords we can't
disable for now:

* `using` as that's currently used in some situations to inject variables into the expression function.
* `__null` as that's used by LLDB to define `NULL`/`Nil`/`nil`.

Getting rid of these last two keywords is possible but is a large enough change
that this will be handled in follow up patches.

Note that this only changes the keyword status of those tokens but this patch
does not remove any C++ functionality from the expression parser. The type
system still follows C++ rules and so does the rest of the expression parser.

There is another small change that gives the hardcoded macro definitions in LLDB
a higher precedence than the macros imported from the Objective-C modules. The
reason for this is that the Objective-C modules in LLDB are actually parsed in
Objective-C++ mode and they end up providing the C++ definitions of certain
system macros (like `NULL` being defined as `nullptr`). So we have to move the
LLDB definition forward and surround the definition from the module with an
`#ifdef` to make sure that we use the correct LLDB definition that doesn't
reference C++ keywords. Or to give an example, this is how the expression source
code changes:

Before:
```
 #define NULL (nullptr) // injected module definition
 #ifndef NULL
 #define NULL (__null) // hardcoded LLDB definition
 #endif
```

After:
```
 #ifndef NULL
 #define NULL (__null) // hardcoded LLDB definition
 #endif
 #ifndef NULL
 #define NULL (nullptr) // injected module definition
 #endif
```

Fixes rdar://10356912

Reviewed By: shafik

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

3 years ago[gn build] Port 8dbe44cb293
LLVM GN Syncbot [Mon, 16 Nov 2020 14:58:16 +0000 (14:58 +0000)]
[gn build] Port 8dbe44cb293

3 years agoAdd pass to add !annotate metadata from @llvm.global.annotations.
Florian Hahn [Mon, 16 Nov 2020 09:49:04 +0000 (09:49 +0000)]
Add pass to add !annotate metadata from @llvm.global.annotations.

This patch adds a new pass to add !annotation metadata for entries in
@llvm.global.anotations, which is generated  using
__attribute__((annotate("_name"))) on functions in Clang.

This has been discussed on llvm-dev as part of
    RFC: Combining Annotation Metadata and Remarks
    http://lists.llvm.org/pipermail/llvm-dev/2020-November/146393.html

Reviewed By: thegameg

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

3 years ago[mlir][StandardToSPIRV] Extend support for lowering cmpi to SPIRV.
Hanhan Wang [Mon, 16 Nov 2020 14:50:45 +0000 (06:50 -0800)]
[mlir][StandardToSPIRV] Extend support for lowering cmpi to SPIRV.

The logic of vector on boolean was missed. This patch adds the logic and test on
it.

Reviewed By: mravishankar

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

3 years ago[clang][SveEmitter] Fix enum declarations. [NFCI]
Francesco Petrogalli [Mon, 16 Nov 2020 14:49:28 +0000 (14:49 +0000)]
[clang][SveEmitter] Fix enum declarations. [NFCI]

Adapt the declarations of `svpattern` and `svprfop` to the most recent
one defined in section "5. Enum declarations" of the SVE ACLE
specifications [1].

The signature of the intrinsics using these enums have been changed
accordingly.

A test has been added to make sure that `svpattern` and `svprfop` are
not typedefs.

[1] https://developer.arm.com/documentation/100987/latest, version
00bet6

Reviewed By: joechrisellis

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

3 years ago[VE] Add lsv/lvs intrinsic instructions
Kazushi (Jam) Marukawa [Sat, 14 Nov 2020 12:16:33 +0000 (21:16 +0900)]
[VE] Add lsv/lvs intrinsic instructions

Add lsv/lvs intrinsic instructions and a regression test.

Reviewed By: simoll

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

3 years agoFix bots that are running with assertions enabled; NFC.
Aaron Ballman [Mon, 16 Nov 2020 14:23:10 +0000 (09:23 -0500)]
Fix bots that are running with assertions enabled; NFC.

3 years agoAdding some explicit casts to appease build bots; NFC
Aaron Ballman [Mon, 16 Nov 2020 14:13:24 +0000 (09:13 -0500)]
Adding some explicit casts to appease build bots; NFC

3 years agoConvert TypeSpecifierSign from Specifiers.h to a scoped enum; NFC
Thorsten [Mon, 16 Nov 2020 14:08:08 +0000 (09:08 -0500)]
Convert TypeSpecifierSign from Specifiers.h to a scoped enum; NFC

3 years agoConvert TypeSpecifiersPipe from Specifiers.h to a scoped enum; NFC
Thorsten [Mon, 16 Nov 2020 13:28:21 +0000 (08:28 -0500)]
Convert TypeSpecifiersPipe from Specifiers.h to a scoped enum; NFC

3 years agoReland "Move the test compiler setup in a common place. NFCI"
Vassil Vassilev [Mon, 16 Nov 2020 12:56:11 +0000 (12:56 +0000)]
Reland "Move the test compiler setup in a common place. NFCI"

Original commit message: "
Move the test compiler setup in a common place. NFCI

This patch reduces the copy paste in the unittest/CodeGen folder by moving the
common compiler setup phase in a header file.

Differential revision: https://reviews.llvm.org/D91061
"

This patch includes a fix for the memory leaks pointed out by @vitalybuka

3 years ago[AMDGPU][MC] Corrected error position for some operands and modifiers
Dmitry Preobrazhensky [Mon, 16 Nov 2020 13:02:32 +0000 (16:02 +0300)]
[AMDGPU][MC] Corrected error position for some operands and modifiers

Partially fixes bug 47518 (https://bugs.llvm.org/show_bug.cgi?id=47518)

Reviewers: rampitec

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

3 years ago[Test] More tests on range checks
Max Kazantsev [Mon, 16 Nov 2020 13:09:20 +0000 (20:09 +0700)]
[Test] More tests on range checks

3 years ago[AArch64] Add check for widening instruction for SVE.
Caroline Concatto [Wed, 11 Nov 2020 14:41:01 +0000 (14:41 +0000)]
[AArch64] Add check for widening instruction for SVE.

This patch fixes the function isWideningInstruction for scalable vectors.
Now the cost model can check the widening pattern for SVE.

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

3 years agoHwasan reporting check for dladdr failing
Matthew Malcomson [Thu, 12 Nov 2020 12:37:36 +0000 (12:37 +0000)]
Hwasan reporting check for dladdr failing

In `GetGlobalSizeFromDescriptor` we use `dladdr` to get info on the the
current address.  `dladdr` returns 0 if it failed.
During testing on Linux this returned 0 to indicate failure, and
populated the `info` structure with a NULL pointer which was
dereferenced later.

This patch checks for `dladdr` returning 0, and in that case returns 0
from `GetGlobalSizeFromDescriptor` to indicate failure of identifying
the address.

This occurs when `GetModuleNameAndOffsetForPC` succeeds for some address
not in a dynamically loaded library.  One example is when the found
"module" is '[stack]' having come from parsing /proc/self/maps.

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

3 years agoRevert "Move the test compiler setup in a common place. NFCI"
Vitaly Buka [Mon, 16 Nov 2020 12:19:29 +0000 (04:19 -0800)]
Revert "Move the test compiler setup in a common place. NFCI"

There is memory leaks

This reverts commit 23cc838099e10b13a32e54105f4db0f1b7e3a842.
This reverts commit 888d06dfb8b55c4fd41fa4febe22c6fc4111c118.

3 years ago[NFC][tsan] Simplify call_pthread_cancel_with_cleanup
Vitaly Buka [Mon, 16 Nov 2020 11:00:30 +0000 (03:00 -0800)]
[NFC][tsan] Simplify call_pthread_cancel_with_cleanup

3 years ago[Test] More tests on range check elimination
Max Kazantsev [Mon, 16 Nov 2020 12:18:01 +0000 (19:18 +0700)]
[Test] More tests on range check elimination

3 years ago[lldb] [Process/FreeBSDRemote] Optimize regset pointer logic
Michał Górny [Fri, 13 Nov 2020 09:48:29 +0000 (10:48 +0100)]
[lldb] [Process/FreeBSDRemote] Optimize regset pointer logic

Create a helper GetOffsetRegSetData() method to get pointer
to the regset data accounting for the necessary offset.  Establish
the offsets in the constructor and store them in the structure.  This
avoids having to add new Get*Offset() methods and combines some common
code.

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

3 years ago[lldb] [Process/FreeBSDRemote] Modernize and simplify YMM logic
Michał Górny [Wed, 11 Nov 2020 20:20:50 +0000 (21:20 +0100)]
[lldb] [Process/FreeBSDRemote] Modernize and simplify YMM logic

Eliminate the remaining swith-case code for register getters,
and migrate YMM registers to regset-oriented model.  Since these
registers are recombined from XMM and YMM_Hi128 XSAVE blocks, while LLDB
gdb-server protocol transmits YMM registers whole, the offset-based
model will not work here.  Nevertheless, some improvement was possible.

Replace generic 'XSaveRegSet' along with sub-sets for XSAVE components
with 'YMMRegSet' (and more regsets in the future as further components
are implemented).  Create a helper GetYMMSplitReg() method that obtains
pointers to the appropriate XMM and YMM_Hi128 blocks to reduce code
duplication.

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

3 years ago[lldb] [Process/FreeBSDRemote] Access debug registers via offsets
Michał Górny [Wed, 11 Nov 2020 14:20:59 +0000 (15:20 +0100)]
[lldb] [Process/FreeBSDRemote] Access debug registers via offsets

Use offset-based method to access x86 debug registers.  This also
involves adding a test for the correctness of these offsets, and making
GetDR() method of NativeRegisterContextWatchpoint_x86 public to avoid
duplicate code.

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