platform/upstream/llvm.git
4 years ago[libFuzzer] Fix compilation error by including missing platform macro definitions.
Dokyung Song [Tue, 14 Jul 2020 22:25:51 +0000 (22:25 +0000)]
[libFuzzer] Fix compilation error by including missing platform macro definitions.

Summary: This patch fixes sanitizer-windows build errors.

Reviewers: morehouse, hctim

Reviewed By: morehouse, hctim

Subscribers: #sanitizers

Tags: #sanitizers

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

4 years ago[flang] Fix a crash when an array constructor contains an unlimited polymorphic value
Pete Steinfeld [Tue, 14 Jul 2020 17:08:34 +0000 (10:08 -0700)]
[flang] Fix a crash when an array constructor contains an unlimited polymorphic value

Summary:
C7113 States that "An ac-value shall not be unlimited polymorphic."  We failed
to detect this situation which resulted in a crash when trying to get the
underlying derived type specification of the unlimited polymorphic value.

I added code to avoid the crash, code to emit an error message, and a test.

Reviewers: klausler, tskeith, DavidTruby

Subscribers: llvm-commits

Tags: #llvm

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

4 years agoRevert "[compiler-rt][Android] Stop using detect_target_arch"
Arthur Eubanks [Tue, 14 Jul 2020 22:04:30 +0000 (15:04 -0700)]
Revert "[compiler-rt][Android] Stop using detect_target_arch"

This reverts commit 9b7e24c2a5b32e25b773bc8b4ca84dbda995d959.

See comments in https://reviews.llvm.org/D82148.

4 years ago[clang] Teach -fembed-bitcode option not to embed W_value Group
Steven Wu [Tue, 14 Jul 2020 21:39:51 +0000 (14:39 -0700)]
[clang] Teach -fembed-bitcode option not to embed W_value Group

Summary:
-fembed-bitcode options doesn't embed warning options since they are
useless to code generation. Make sure it handles the W_value group and
not embed those options in the output.

Reviewers: zixuw, arphaman

Reviewed By: zixuw

Subscribers: jkorous, dexonsmith, ributzka, cfe-commits

Tags: #clang

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

4 years ago[libFuzzer] Separate platform related macros out from FuzzerDefs.h into FuzzerPlatfor...
Dokyung Song [Tue, 14 Jul 2020 21:02:32 +0000 (21:02 +0000)]
[libFuzzer] Separate platform related macros out from FuzzerDefs.h into FuzzerPlatform.h, and adjust includes in other files.

Summary: This patch separates platform related macros in lib/fuzzer/FuzzerDefs.h into lib/fuzzer/FuzzerPlatform.h, and use FuzzerPlatform.h where necessary. This separation helps when compiling libFuzzer's interceptor module (under review); an unnecessary include of standard headers (such as string.h) may produce conflicts/ambiguation with the interceptor's declarations/definitions of library functions, which complicates interceptor implementation.

Reviewers: morehouse, hctim

Reviewed By: morehouse

Subscribers: krytarowski, #sanitizers

Tags: #sanitizers

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

4 years ago[SVE] Make cstfp_pred_ty and cst_pred_ty work with scalable splats
Christopher Tetreault [Tue, 14 Jul 2020 20:36:33 +0000 (13:36 -0700)]
[SVE] Make cstfp_pred_ty and cst_pred_ty work with scalable splats

Reviewers: efriedma, lebedev.ri, fhahn, c-rhodes, david-arm

Reviewed By: efriedma, david-arm

Subscribers: tschuett, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[clang-tidy] OptionsView::store specialized on bool
Nathan James [Tue, 14 Jul 2020 21:19:36 +0000 (22:19 +0100)]
[clang-tidy] OptionsView::store specialized on bool

Following on fcf7cc268fe and 672207c319a which granted checks the ability to read boolean configuration arguments as `true` or `false`.
This enables storing the options back to the configuration file using `true` and `false`.
This is in line with how clang-format dumps boolean options in its style config.

Reviewed By: aaron.ballman

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

4 years agodocument -fpch-instantiate-templates in release notes
Luboš Luňák [Sat, 11 Jul 2020 13:07:27 +0000 (15:07 +0200)]
document -fpch-instantiate-templates in release notes

This should have been included in D69585.

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

4 years ago[flang] Refine CR handling
peter klausler [Tue, 14 Jul 2020 17:16:30 +0000 (10:16 -0700)]
[flang] Refine CR handling

We need to retain carriage return characters in source files
that are not parts of multi-byte line endings; they are
significant in CHARACTER literal constants.

Reviewed By: tskeith

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

4 years ago[llvm][NFC] expose LLVM_HAVE_TF_API through llvm-config.h
Mircea Trofin [Tue, 14 Jul 2020 05:30:25 +0000 (22:30 -0700)]
[llvm][NFC] expose LLVM_HAVE_TF_API through llvm-config.h

Summary:
This allows users of the llvm library discover whether llvm was built
with the tensorflow c API dependency, which helps if using the TFUtils
wrapper, for example.

We don't do the same for the LLVM_HAVE_TF_AOT flag, because that does
not expose any API.

Reviewers: mehdi_amini, davidxl

Subscribers: mgorny, aaron.ballman, llvm-commits

Tags: #llvm

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

4 years ago[lldb/Test] Skip TestProcessConnect.py on Windows
Jonas Devlieghere [Tue, 14 Jul 2020 21:07:06 +0000 (14:07 -0700)]
[lldb/Test] Skip TestProcessConnect.py on Windows

Remote connections are not supported on Windows.

4 years ago[lldb/Test] Always set the cleanupSubprocesses tear down hook
Jonas Devlieghere [Tue, 14 Jul 2020 19:12:05 +0000 (12:12 -0700)]
[lldb/Test] Always set the cleanupSubprocesses tear down hook

Always clean up subprocesses on tear down instead of relying on the
caller to do so. This is not only less error prone but also means the
tests can be more concise.

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

4 years agoFix tests after 16f777f4217cfcdcf6ddce8eb1e3525a65563c43
Tyker [Tue, 14 Jul 2020 20:52:12 +0000 (22:52 +0200)]
Fix tests after 16f777f4217cfcdcf6ddce8eb1e3525a65563c43

4 years ago[libc++] Automatically detect whether RTTI is enabled
Louis Dionne [Tue, 14 Jul 2020 20:28:41 +0000 (16:28 -0400)]
[libc++] Automatically detect whether RTTI is enabled

Instead of detecting it automatically but also allowing for the setting
to be specified explicitly, always detect whether exceptions are enabled
based on whether -fno-rtti (or equivalent) is used. It's less confusing
to have a single way of tweaking that knob.

This change follows the lead of 71d88cebfb42.

4 years ago[MC] Support .reloc sym+constant, *, *
Fangrui Song [Tue, 14 Jul 2020 20:44:00 +0000 (13:44 -0700)]
[MC] Support .reloc sym+constant, *, *

For `.reloc offset, *, *`, currently offset can be a constant or symbol.
This patch makes it support any expression which can be folded to sym+constant.

Reviewed By: stefanp

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

4 years ago[flang] Tuning up binary->decimal conversion
peter klausler [Tue, 14 Jul 2020 19:38:03 +0000 (12:38 -0700)]
[flang] Tuning up binary->decimal conversion

Use short division of big-radix values by powers of two when
converting values with negative unbiased exponents rather than
multiplication by smaller powers of five; this reduces the overall
outer iteration count. This change is a win across the entire range
of inputs.

Reviewed By: tskeith

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

4 years ago[mlir] Add support for parsing optional Attribute values.
River Riddle [Tue, 14 Jul 2020 20:14:14 +0000 (13:14 -0700)]
[mlir] Add support for parsing optional Attribute values.

This adds a `parseOptionalAttribute` method to the OpAsmParser that allows for parsing optional attributes, in a similar fashion to how optional types are parsed. This also enables the use of attribute values as the first element of an assembly format optional group.

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

4 years ago[CallGraph] Ignore callback uses
Giorgis Georgakoudis [Wed, 8 Jul 2020 05:43:24 +0000 (22:43 -0700)]
[CallGraph] Ignore callback uses

Summary:
Ignore callback uses when adding a callback function
in the CallGraph. Callback functions are typically
created when outlining, e.g. for OpenMP, so they have
internal scope and linkage. They should not be added
to the ExternalCallingNode since they are only callable
by the specified caller function at creation time.

A CGSCC pass, such as OpenMPOpt, may need to update
the CallGraph by adding a new outlined callback function.
Without ignoring callback uses, adding breaks CGSCC
pass restrictions and results to a broken CallGraph.

Reviewers: jdoerfert

Subscribers: hiraditya, sstefan1, llvm-commits

Tags: #llvm

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

4 years ago[mlir][DialectConversion] Emit an error if an operation marked as erased has live...
River Riddle [Tue, 14 Jul 2020 19:55:58 +0000 (12:55 -0700)]
[mlir][DialectConversion] Emit an error if an operation marked as erased has live users after conversion

Up until now, there has been an implicit agreement that when an operation is marked as
"erased" all uses of that operation's results are guaranteed to be removed during conversion. How this works in practice is that there is either an assert/crash/asan failure/etc. This revision adds support for properly detecting when an erased operation has dangling users, emits and error and fails the conversion.

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

4 years agoCall Frame Information (CFI) Handling for Basic Block Sections
Krzysztof Pszeniczny [Tue, 14 Jul 2020 18:55:41 +0000 (11:55 -0700)]
Call Frame Information (CFI) Handling for Basic Block Sections

This patch handles CFI with basic block sections, which unlike DebugInfo does
not support ranges. The DWARF standard explicitly requires emitting separate
CFI Frame Descriptor Entries for each contiguous fragment of a function. Thus,
the CFI information for all callee-saved registers (possibly including the
frame pointer, if necessary) have to be emitted along with redefining the
Call Frame Address (CFA), viz. where the current frame starts.

CFI directives are emitted in FDE’s in the object file with a low_pc, high_pc
specification. So, a single FDE must point to a contiguous code region unlike
debug info which has the support for ranges. This is what complicates CFI for
basic block sections.

Now, what happens when we start placing individual basic blocks in unique
sections:

* Basic block sections allow the linker to randomly reorder basic blocks in the
address space such that a given basic block can become non-contiguous with the
original function.
* The different basic block sections can no longer share the cfi_startproc and
cfi_endproc directives. So, each basic block section should emit this
independently.
* Each (cfi_startproc, cfi_endproc) directive will result in a new FDE that
caters to that basic block section.
* Now, this basic block section needs to duplicate the information from the
entry block to compute the CFA as it is an independent entity. It cannot refer
to the FDE of the original function and hence must duplicate all the stuff that
is needed to compute the CFA on its own.
* We are working on a de-duplication patch that can share common information in
FDEs in a CIE (Common Information Entry) and we will present this as a follow up
patch. This can significantly reduce the duplication overhead and is
particularly useful when several basic block sections are created.
* The CFI directives are emitted similarly for registers that are pushed onto
the stack, like callee saved registers in the prologue. There are cfi
directives that emit how to retrieve the value of the register at that point
when the push happened. This has to be duplicated too in a basic block that is
floated as a separate section.

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

4 years ago[NFC] Add debug and stat counters to assume queries and assume builder
Tyker [Tue, 14 Jul 2020 19:41:45 +0000 (21:41 +0200)]
[NFC] Add debug and stat counters to assume queries and assume builder

Summary:
Add debug counter and stats counter to assume queries and assume builder
here is the collected stats on a build of check-llvm + check-clang.
  "assume-builder.NumAssumeBuilt": 2720879,
  "assume-builder.NumAssumesMerged": 761396,
  "assume-builder.NumAssumesRemoved": 1576212,
  "assume-builder.NumBundlesInAssumes": 6518809,
  "assume-queries.NumAssumeQueries": 85566380,
  "assume-queries.NumUsefullAssumeQueries": 2727360,
the NumUsefullAssumeQueries stat is actually pessimistic because in a few places queries
ask to keep providing information to try to get better information. and this isn't counted
as a usefull query evem tho it can be usefull

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[clangd] Config: on by default
Sam McCall [Tue, 14 Jul 2020 17:04:55 +0000 (19:04 +0200)]
[clangd] Config: on by default

Summary: (Possible to flip back on the branch if this breaks things)

Reviewers: kadircet

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

Tags: #clang

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

4 years agoFix a -Wunused-variable warning.
Eric Christopher [Tue, 14 Jul 2020 19:33:50 +0000 (12:33 -0700)]
Fix a -Wunused-variable warning.

4 years agollvm-link: Add support for archive files as inputs
Jan Sjodin [Mon, 22 Jun 2020 17:04:12 +0000 (13:04 -0400)]
llvm-link: Add support for archive files as inputs

This patch adds support for archive files as inputs to llvm-link. One
of the use-cases is for OpenMP, where device specific libraries need
to be extracted from libraries containing bundled object files. The
clang-offload-bundler will support extracting these archives, which
will be passed into llvm-link, see https://reviews.llvm.org/D80816.

Reviewed By: jdoerfert

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

4 years agoRestore "[WPD/LowerTypeTests] Delay lowering/removal of type tests until after ICP"
Teresa Johnson [Tue, 17 Mar 2020 18:08:35 +0000 (11:08 -0700)]
Restore "[WPD/LowerTypeTests] Delay lowering/removal of type tests until after ICP"

This restores commit 80d0a137a5aba6998fadb764f1e11cb901aae233, and the
follow on fix in 873c0d0786dcf22f4af39f65df824917f70f2170, with a new
fix for test failures after a 2-stage clang bootstrap, and a more robust
fix for the Chromium build failure that an earlier version partially
fixed. See also discussion on D75201.

Reviewers: evgeny777

Subscribers: mehdi_amini, Prazek, hiraditya, steven_wu, dexonsmith, arphaman, davidxl, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[flang] Change the default F18_FC to gfortran
AlexisPerry [Mon, 13 Jul 2020 16:15:00 +0000 (10:15 -0600)]
[flang] Change the default F18_FC to gfortran

Summary: Changed default F18_FC from pgf90 to gfortran. Removed unnecessary references to pgf90 in favor of more generic naming.

Reviewers: sscalpone, richard.barton.arm, DavidTruby, jdoerfert, clementval

Reviewed By: sscalpone, richard.barton.arm, clementval

Subscribers: sstefan1, tskeith, klausler, clementval, flang-commits, llvm-commits

Tags: #llvm, #flang

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

4 years ago[Matrix] Intrinsic descriptions
Sjoerd Meijer [Tue, 14 Jul 2020 10:01:05 +0000 (11:01 +0100)]
[Matrix] Intrinsic descriptions

This changes the matrix load/store intrinsic definitions to load/store from/to
a pointer, and not from/to a pointer to a vector, as discussed in D83477.

This also includes the recommit of "[Matrix] Tighten LangRef definitions and
Verifier checks" which adds improved language reference descriptions of the
matrix intrinsics and verifier checks.

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

4 years ago[MLIR][StdToSPIRV] Fixed a typo in ops conversion tests
George Mitenkov [Tue, 14 Jul 2020 17:02:51 +0000 (20:02 +0300)]
[MLIR][StdToSPIRV] Fixed a typo in ops conversion tests

Fixed a typo in `std-ops-to-spitv.mlir` test.

Reviewed By: rriddle

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

4 years ago[clangd] Make config::Provider::combine non-owning. NFC
Sam McCall [Tue, 14 Jul 2020 18:44:59 +0000 (20:44 +0200)]
[clangd] Make config::Provider::combine non-owning. NFC

This is a prerequisite for having ClangdLSPServer inject its own.

4 years agoDesugar class type for iterator lookup.
Sterling Augustine [Tue, 14 Jul 2020 00:19:01 +0000 (17:19 -0700)]
Desugar class type for iterator lookup.

Summary:
Without this, printing sets and maps hidden behind
using declarations fail.

Reviewers: #libc!

Subscribers: libcxx-commits

Tags: #libc

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

4 years ago[flang][openacc] OpenACC 3.0 parser
Valentin Clement [Tue, 14 Jul 2020 18:28:34 +0000 (14:28 -0400)]
[flang][openacc] OpenACC 3.0 parser

Summary:
This patch introduce the parser for OpenACC 3.0 in Flang. It uses the same TableGen mechanism
than OpenMP.

Reviewers: nvdatian, sscalpone, tskeith, klausler, ichoyjx, jdoerfert, DavidTruby

Reviewed By: klausler

Subscribers: MaskRay, SouraVX, mgorny, hiraditya, jfb, sstefan1, llvm-commits

Tags: #llvm, #flang

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

4 years agoTableGen/GlobalISel: Partially fix nontrivial, custom predicates
Matt Arsenault [Sun, 21 Jun 2020 01:38:43 +0000 (21:38 -0400)]
TableGen/GlobalISel: Partially fix nontrivial, custom predicates

Currently custom code predicates can only really be used for
contextless checks tied to a single instruction (e.g. check the def
for hasOneUse). If you do want to inspect the input instructions in
the source pattern, you cannot without re-verifying the opcode and
type checks implied by the patterns, since this check was emitted
before any operand constraints. Really, these are pattern level
predicates that implicitly depend on the instruction and operand
checks.

Introduce a filtering function so the custom predicate is emitted
last. I'm not sure this is the most elegant solution. It seems like
this is really a different thing from the InstructionMatcher/IPM_
predicate kinds. I initially tried keeping this in a separate
predicate list, but that also seemed awkward.

This only half fixes the problem I'm trying to solve. The AMDGPU
pattern I'm attempting to port also uses the PredicateCodeUsesOperands
feature to allow checks on the source operands when the input pattern
is commuted. Really the emitter should reject the pattern since it
doesn't handle this case, but at this point it would be more
productive to just implement this.

4 years ago[ObjC] Wrap namespace-global structs in an anonymous namespace to avoid ODR violations
Davide Italiano [Tue, 14 Jul 2020 18:25:32 +0000 (11:25 -0700)]
[ObjC] Wrap namespace-global structs in an anonymous namespace to avoid ODR violations

<rdar://problem/65537147>

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

4 years ago[MLIR] [NFC] Buffer placement pass - clang tidy warnings
Uday Bondhugula [Tue, 14 Jul 2020 17:53:11 +0000 (23:23 +0530)]
[MLIR] [NFC] Buffer placement pass - clang tidy warnings

Add missing const - addresses clang tidy warnings.

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

4 years agoUpdate ubsan_interface.inc for D71491 (second try)
Vedant Kumar [Tue, 14 Jul 2020 18:16:09 +0000 (11:16 -0700)]
Update ubsan_interface.inc for D71491 (second try)

I mistyped the ubsan objc_cast handler names on the first try.

Testing:

./bin/llvm-lit projects/compiler-rt/test/asan/X86_64HDarwinConfig/TestCases/Darwin/interface_symbols_darwin.cpp

4 years ago[ORC] Don't take ownership of the trampoline pool in LazyReexportsManager.
Lang Hames [Tue, 14 Jul 2020 16:31:14 +0000 (09:31 -0700)]
[ORC] Don't take ownership of the trampoline pool in LazyReexportsManager.

LazyReexportsManager instances use the trampoline pool, but they don't need to
own it. Keeping TrampolinePool ownership separate allows re-use of the
trampoline pool by other clients.

4 years ago[clang][aarch64] Generate preprocessor macros for -march=armv8.6a+sve.
Francesco Petrogalli [Wed, 1 Jul 2020 21:16:17 +0000 (21:16 +0000)]
[clang][aarch64] Generate preprocessor macros for -march=armv8.6a+sve.

Summary:
The following preprocessor macros are implied when `-march=armv8.6a+sve`:

```
__ARM_FEATURE_SVE 1
__ARM_FEATURE_SVE_BF16 1
__ARM_FEATURE_SVE_MATMUL_FP32 1
__ARM_FEATURE_SVE_MATMUL_INT8 1
```

Reviewers: sdesmalen, efriedma, SjoerdMeijer, rengolin

Subscribers: tschuett, kristof.beyls, danielkiss, cfe-commits

Tags: #clang

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

4 years ago[lldb] Use runBuildCommands from buildGModules
Jonas Devlieghere [Tue, 14 Jul 2020 16:32:36 +0000 (09:32 -0700)]
[lldb] Use runBuildCommands from buildGModules

Use runBuildCommands, like all other builders, to raise a build-specific
error when the command fails.

4 years ago[lldb] lldbinline and lldbtest gardening (NFC)
Jonas Devlieghere [Tue, 14 Jul 2020 16:26:07 +0000 (09:26 -0700)]
[lldb] lldbinline and lldbtest gardening (NFC)

 - Make the open more Pythonic.
 - Remove the unused `cleanup` Make target.
 - Remove commented-out/obvious/low-value comments.
 - Cleanup the forked process PID list.

4 years ago[lit] Prevent hang when lit sees non-ASCII characters
Richard Barton [Tue, 14 Jul 2020 17:41:05 +0000 (18:41 +0100)]
[lit] Prevent hang when lit sees non-ASCII characters

As per discussion in D69207, have lit ignore UnicodeDecodeErrors
when running with python 2 in an ASCII shell.

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

4 years ago[flang] Turn off FLANG_ENABLE_WERROR by default
Isuru Fernando [Tue, 14 Jul 2020 15:59:26 +0000 (10:59 -0500)]
[flang] Turn off FLANG_ENABLE_WERROR by default

Summary: This is a follow up to https://reviews.llvm.org/D78306

Reviewers: DavidTruby, sscalpone, jdoerfert

Reviewed By: DavidTruby

Subscribers: tskeith, Meinersbur, ChinouneMehdi, richard.barton.arm, mehdi_amini, mgorny, llvm-commits

Tags: #llvm, #flang

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

4 years ago[lldb/Test] Skip TestProcessConnect.py on Windows
Jonas Devlieghere [Tue, 14 Jul 2020 17:11:43 +0000 (10:11 -0700)]
[lldb/Test] Skip TestProcessConnect.py on Windows

Skip TestProcessConnect.py on Windows and Android (the same platforms as
TestPlatformProcessConnect.py) and mark it as a NO_DEBUG_INFO test so we
don't run all the variants.

4 years ago[clangd] Config: Index.Background
Sam McCall [Tue, 14 Jul 2020 13:17:16 +0000 (15:17 +0200)]
[clangd] Config: Index.Background

Summary:
We only support Build/Skip for now, but with 'Load' or similar as an
option for future (load existing shards but don't build new ones).

This requires creating the config for each TU on startup. In LLVM, this
is 4000 occurrences for a total of 800ms on my machine.
But together with caching from D83755 it is only 25ms.

Reviewers: kadircet

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

Tags: #clang

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

4 years agoFix merging of two arity-only pack deductions.
Richard Smith [Tue, 14 Jul 2020 16:59:46 +0000 (09:59 -0700)]
Fix merging of two arity-only pack deductions.

If we deduced the arity of a pack in two different ways, but didn't
deduce an element of the pack in either of those deductions, we'd merge
that element to produce a null template argument, which we'd incorrectly
interpret as the merge having failed.

Testcase based on one supplied by Hubert Tong.

4 years ago[NFC] Add 'override' keyword where missing in include/ and lib/.
Logan Smith [Tue, 14 Jul 2020 16:47:29 +0000 (09:47 -0700)]
[NFC] Add 'override' keyword where missing in include/ and lib/.

This fixes warnings raised by Clang's new -Wsuggest-override, in preparation for enabling that warning in the LLVM build. This patch also removes the virtual keyword where redundant, but only in places where doing so improves consistency within a given file. It also removes a couple unnecessary virtual destructor declarations in derived classes where the destructor inherited from the base class is already virtual.

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

4 years ago[clang] Add 'override' to virtual function overrides generated by ClangAttrEmitter
Logan Smith [Tue, 14 Jul 2020 16:36:43 +0000 (09:36 -0700)]
[clang] Add 'override' to virtual function overrides generated by ClangAttrEmitter

ClangAttrEmitter.cpp generates ParsedAttr derived classes with virtual overrides in them (which end up in AttrParsedAttrImpl.inc); this patch ensures these generated functions are marked override, and not (redundantly) virtual.

I hesitate to say NFC since this does of course affect the behavior of the generator code, but the generated code behaves the same as it did before, so it's NFC in that sense.

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

4 years ago[MLIR] Add argument related API to Region
Rahul Joshi [Sat, 11 Jul 2020 00:07:29 +0000 (17:07 -0700)]
[MLIR] Add argument related API to Region

- Arguments of the first block of a region are considered region arguments.
- Add API on Region class to deal with these arguments directly instead of
  using the front() block.
- Changed several instances of existing code that can use this API
- Fixes https://bugs.llvm.org/show_bug.cgi?id=46535

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

4 years ago[AIX] Remove diff -a option on llvm-cov.test
Shuhong Liu [Tue, 14 Jul 2020 16:23:39 +0000 (12:23 -0400)]
[AIX] Remove diff -a option on llvm-cov.test

Summary:
llvm-cov.test generates .gcov files and compared with target
sample files. Since the files do not contain any binary data
(files are plain ASCII texts), remove -a from diff. And this
fix will the error on AIX since the default diff tool on AIX
does not support -a option.

Reviewers: hubert.reinterpretcast, daltenty, stevewan

Subscribers: llvm-commits

Tags: #LLVM

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

4 years ago[MLIR] [TableGen] Avoid generating an assert which is always true.
Rahul Joshi [Tue, 14 Jul 2020 01:53:50 +0000 (18:53 -0700)]
[MLIR] [TableGen] Avoid generating an assert which is always true.

- Avoid generating "assert(resultTypes.size() >= 0u)" which is always true

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

4 years ago[docs] Update llvm.loop metadata documentation.
Michael Kruse [Tue, 14 Jul 2020 15:58:49 +0000 (10:58 -0500)]
[docs] Update llvm.loop metadata documentation.

Loop metadata nodes do not adhere to the documented property:

(a) LoopIDs are not unique: Any pass that duplicates IR will do it
    including its metadata (e.g. LoopVersioning) such that multiple
    loops are linked with the same LoopID. There is even a test case
    (Transforms/LoopUnroll/unroll-pragmas-disabled.ll) for multiple
    loops with the same LoopID.

(b) LoopIDs are not persistent: Adding or removing an item from a LoopID
    can only be done by creating a new MDNode and assigning it to the
    loop's branch(es). Passes such as LoopUnroll (llvm.loop.unroll.disable)
    and LoopVectorize (llvm.loop.isvectorized) use this to mark loops to
    not be transformed multiple times or to avoid that a LoopVersioned
    original loop is transformed.

Update the documentation according to how llvm.loop is used in practice.

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

4 years ago[clang][NFC] Add 'override' keyword to virtual function overrides
Logan Smith [Tue, 14 Jul 2020 15:53:59 +0000 (08:53 -0700)]
[clang][NFC] Add 'override' keyword to virtual function overrides

This patch adds override to several overriding virtual functions that were missing the keyword within the clang/ directory. These were found by the new -Wsuggest-override.

4 years ago[libc++] Fix building the benchmarks after introducing a target for cxx-headers
Louis Dionne [Tue, 14 Jul 2020 15:49:18 +0000 (11:49 -0400)]
[libc++] Fix building the benchmarks after introducing a target for cxx-headers

The libc++ headers were included twice, which broke the #include_next
logic.

4 years ago[lldb/Module] Allow for the creation of memory-only modules
Fred Riss [Thu, 9 Jul 2020 21:14:36 +0000 (14:14 -0700)]
[lldb/Module] Allow for the creation of memory-only modules

Summary:
This patch extends the ModuleSpec class to include a
DataBufferSP which contains the module data. If this
data is provided, LLDB won't try to hit the filesystem
to create the Module, but use only the data stored in
the ModuleSpec.

Reviewers: labath, espindola

Subscribers: emaste, MaskRay, lldb-commits

Tags: #lldb

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

4 years ago[lldb] Make `process connect` blocking in synchronous mode.
Jonas Devlieghere [Tue, 14 Jul 2020 15:44:40 +0000 (08:44 -0700)]
[lldb] Make `process connect` blocking in synchronous mode.

In synchronous mode, the process connect command and its aliases should
wait for the stop event before claiming the command is complete.
Currently, the stop event is always handled asynchronously by the
debugger.

The implementation takes the same approach as Process::ResumeSynchronous
which hijacks the event and handles it on the current thread. Similarly,
after this patch, the stop event is part of the command return object,
which is the property used by the test case.

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

4 years ago[clangd] Add missing link dep after 8eb8c92eb46908e
Sam McCall [Tue, 14 Jul 2020 15:03:45 +0000 (17:03 +0200)]
[clangd] Add missing link dep after 8eb8c92eb46908e

4 years ago[clangd] Cache config files for 5 seconds, without revalidating with stat.
Sam McCall [Tue, 14 Jul 2020 08:45:06 +0000 (10:45 +0200)]
[clangd] Cache config files for 5 seconds, without revalidating with stat.

Summary:
This is motivated by:
 - code completion: nice to do no i/o on the request path
 - background index: deciding whether to enqueue each file would stat the config
   file thousands of times in quick succession.

Currently it's applied uniformly to all requests though.

This gives up on performing stat() outside the lock, all this achieves is
letting multiple threads stat concurrently (and thus finish without contention
for nonexistent files).
The ability to finish without IO (just mutex lock + integer check) should
outweigh this, and is less sensitive to platform IO characteristics.

Reviewers: kadircet

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

Tags: #clang

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

4 years ago[ValueTracking] fix library to intrinsic mapping to respect 'nobuiltin' attribute
Sanjay Patel [Tue, 14 Jul 2020 14:02:50 +0000 (10:02 -0400)]
[ValueTracking] fix library to intrinsic mapping to respect 'nobuiltin' attribute

This is another problem raised in:
http://bugs.llvm.org/PR46627

4 years ago[InstSimplify] add test with nobuiltin attribute (PR46627); NFC
Sanjay Patel [Tue, 14 Jul 2020 13:28:57 +0000 (09:28 -0400)]
[InstSimplify] add test with nobuiltin attribute (PR46627); NFC

4 years ago[clangd] Config: CompileFlags.Remove
Sam McCall [Mon, 13 Jul 2020 18:37:54 +0000 (20:37 +0200)]
[clangd] Config: CompileFlags.Remove

Summary: While here, add documentation to CompileFlags and CompileFlags.Add.

Reviewers: hokein

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

Tags: #clang

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

4 years ago[utils] New script `check_ninja_deps.py`
Simon Tatham [Tue, 14 Jul 2020 13:54:05 +0000 (14:54 +0100)]
[utils] New script `check_ninja_deps.py`

Summary:
This can be run after a ninja-based build, and analyzes the ninja
build files and dependency database to spot any missing dependencies
in the build scripts.

I wrote it in the course of investigating D82659, and it seems likely
to be useful again.

Reviewers: thakis, chandlerc, theraven

Reviewed By: thakis

Subscribers: riccibruno, llvm-commits

Tags: #llvm

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

4 years ago[libc++] Use a proper CMake target to represent libc++ headers
Louis Dionne [Fri, 26 Jun 2020 20:05:55 +0000 (16:05 -0400)]
[libc++] Use a proper CMake target to represent libc++ headers

Instead of having complex logic around how to include the libc++ headers
and __config_site, handle that by defining cxx-headers as an INTERFACE
library and linking against it. After this patch, linking against cxx-headers
is sufficient to get the right __config_site include and include paths
for libc++.

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

4 years ago[ods] Enable getting forward decls allow
Jacques Pienaar [Tue, 14 Jul 2020 13:52:32 +0000 (06:52 -0700)]
[ods] Enable getting forward decls allow

Summary: Currently forward decls are included with all the op classes. But there are cases (say when splitting up headers) where one wants the forward decls but not all the classes. Add an option to enable this. This does not change any current behavior (some further refactoring is probably due here).

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

4 years agoFix test for the hasExternalFormalLinkage matcher
Dmitri Gribenko [Tue, 14 Jul 2020 13:30:21 +0000 (15:30 +0200)]
Fix test for the hasExternalFormalLinkage matcher

Summary:
Names of local variables have no linkage (see C++20 [basic.link] p8).

Names of variables in unnamed namespace have internal linkage (see C++20
[basic.link] p4).

Reviewers: aaron.ballman, rsmith, ymandel

Reviewed By: ymandel

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[clangd] Add library to semantically strip flags by name.
Sam McCall [Tue, 16 Jun 2020 19:21:32 +0000 (21:21 +0200)]
[clangd] Add library to semantically strip flags by name.

Summary:
This is designed for tweaking compile commands by specifying flags to add/remove
in a config file. Something like:
  CompileFlags: { Remove: -fcolor-diagnostics }

Having users tweak raw argv (e.g. with a regex) is going to end in tears: bugs
around clang-cl, xclang, aliases, joined-vs-separate args etc are inevitable.

This isn't in tooling because of the performance choices: build a big table
up-front to make subsequent actions fast. Maybe it should be though.

Reviewers: adamcz, hokein

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

Tags: #clang

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

4 years ago[AMDGPU] Simplify AMDGPUSubtarget::getWavesPerEU. NFC.
Jay Foad [Tue, 14 Jul 2020 13:18:15 +0000 (14:18 +0100)]
[AMDGPU] Simplify AMDGPUSubtarget::getWavesPerEU. NFC.

4 years agoProhibit use of _ExtInt in atomic intrinsic
Mott, Jeffrey T [Tue, 14 Jul 2020 13:09:06 +0000 (06:09 -0700)]
Prohibit use of _ExtInt in atomic intrinsic

The _ExtInt type allows custom width integers, but the atomic memory
access's operand must have a power-of-two size. _ExtInts with
non-power-of-two size should not be allowed for atomic intrinsic.

Before this change:

$ cat test.c

typedef unsigned _ExtInt(42) dtype;
void verify_binary_op_nand(dtype* pval1, dtype val2)
{    __sync_nand_and_fetch(pval1, val2); }

$ clang test.c

clang-11:
/home/ubuntu/llvm_workspace/llvm/clang/lib/CodeGen/CGBuiltin.cpp:117:
llvm::Value*
EmitToInt(clang::CodeGen::CodeGenFunction&, llvm::Value*,
clang::QualType, llvm::IntegerType*): Assertion `V->getType() ==
IntType' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the
crash backtrace, preprocessed source, and associated run script.

After this change:

$ clang test.c

test.c:3:30: error: Atomic memory operand must have a power-of-two size
{    __sync_nand_and_fetch(pval1, val2); }
^

List of the atomic intrinsics that have this
problem:

__sync_fetch_and_add
__sync_fetch_and_sub
__sync_fetch_and_or
__sync_fetch_and_and
__sync_fetch_and_xor
__sync_fetch_and_nand
__sync_nand_and_fetch
__sync_and_and_fetch
__sync_add_and_fetch
__sync_sub_and_fetch
__sync_or_and_fetch
__sync_xor_and_fetch
__sync_fetch_and_min
__sync_fetch_and_max
__sync_fetch_and_umin
__sync_fetch_and_umax
__sync_val_compare_and_swap
__sync_bool_compare_and_swap

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

4 years ago[RISCV] Fix isStoreToStackSlot
Roger Ferrer Ibanez [Tue, 14 Jul 2020 07:26:01 +0000 (07:26 +0000)]
[RISCV] Fix isStoreToStackSlot

Because of the layout of stores (that don't have a destination operand)
this check is exactly the same as the one in
RISCVInstrInfo::isLoadFromStackSlot.

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

4 years ago[NFC][RISCV] Test for D81805
Roger Ferrer Ibanez [Tue, 14 Jul 2020 07:18:07 +0000 (07:18 +0000)]
[NFC][RISCV] Test for D81805

New test to show the changes after D81805 is committed.

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

4 years ago[flang][OpenMP] upstream OpenMP lowering
Sourabh Singh Tomar [Mon, 13 Jul 2020 07:01:52 +0000 (12:31 +0530)]
[flang][OpenMP] upstream OpenMP lowering

Summary:
This patch implements lowering of OpenMP barrier construct from
pft to OpenMPDialect.

Patch is carved out of following merged PR's from fir-dev branch
of https://github.com/flang-compiler/f18-llvm-project/

PR's:
https://github.com/flang-compiler/f18-llvm-project/pull/248
https://github.com/flang-compiler/f18-llvm-project/pull/251

Unfortunately primary tool `bbc` for functional validation is not
yet upstreamed. So this patch includes a unittest for lowering
`!OMP barrier` construct.

Some part of the these PR's still remains downstream(functional test
and dialect registration to legalizer) for obvious reasons.
Will upstream them when the dependencies are upstreamed.

Reviewed By: schweitz, kiranchandramohan

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

4 years agoRevert "[SCEV][IndVarSimplify] insert point should not be block front."
serge-sans-paille [Tue, 14 Jul 2020 12:23:14 +0000 (14:23 +0200)]
Revert "[SCEV][IndVarSimplify] insert point should not be block front."

This reverts commit f1efb8bb4ba0584a9b994f3404a2c62920ce6652.

Reverted because it doesn't correctly update the pass return status, see

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-debian/builds/9441/steps/test-check-all/logs/FAIL%3A%20LLVM%3A%3Awiden-i32-i8ptr.ll

4 years ago[lldb] Refactor character printing in DumpDataExtractor
Raphael Isemann [Tue, 14 Jul 2020 11:49:28 +0000 (13:49 +0200)]
[lldb] Refactor character printing in DumpDataExtractor

Summary: Just unifying all that copy-pasted code.

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

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

4 years ago[yaml2obj] - Refine handling of the NoHeaders key.
Georgii Rymar [Mon, 13 Jul 2020 12:09:55 +0000 (15:09 +0300)]
[yaml2obj] - Refine handling of the NoHeaders key.

Imagine we have an YAML description for some object and we want to
produce 2 outputs: with and without the section header.
A natural way to do it would look like:

```
--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_X86_64
Sections:
...
SectionHeaderTable:
  NoHeaders: [[NOHEADERS]]

```
But currently, we do not distinguish between no `NoHeaders` key case
and `NoHeaders == false`. Because of this we can't simply specify
`NOHEADERS = false`, as tool starts to complain.

With this patch the behavior changed. When we have:

```
SectionHeaderTable:
  NoHeaders: false

```
it is the same as we have no `SectionHeaderTable` at all.
(`NoHeaders` key still can't be used with `Sections/Excluded` keys)

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

4 years ago[ValueTracking] fix miscompile in maxnum case of cannotBeOrderedLessThanZeroImpl...
Sanjay Patel [Tue, 14 Jul 2020 11:42:43 +0000 (07:42 -0400)]
[ValueTracking] fix miscompile in maxnum case of cannotBeOrderedLessThanZeroImpl (PR46627)

A miscompile with -0.0 is shown in:
http://bugs.llvm.org/PR46627

This is because maxnum(-0.0, +0.0) does not specify a fixed result:
http://llvm.org/docs/LangRef.html#llvm-maxnum-intrinsic

So we need to tighten the constraints for when it is ok to say the
result of maxnum is positive (including +0.0).

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

4 years ago[InstCombine][InstSimplify] add tests for sign of maxnum; NFC
Sanjay Patel [Mon, 13 Jul 2020 20:02:10 +0000 (16:02 -0400)]
[InstCombine][InstSimplify] add tests for sign of maxnum; NFC

More coverage for D83601.

4 years ago[test/Object][llvm-objdump] - llvm-objdump: don't abort() when the e_phoff field...
Georgii Rymar [Fri, 10 Jul 2020 14:33:55 +0000 (17:33 +0300)]
[test/Object][llvm-objdump] - llvm-objdump: don't abort() when the e_phoff field is invalid and refine testing.

llvm-objdump currently calls report_fatal_error() when the e_phoff field is invalid.

This is tested by elf-invalid-phdr.test which has the following issues:
1) It uses a precompiled object.
2) it could be a part of invalid.test.
3) It tests the Object lib, but we have no separate test for llvm-objdump.

This patch addresses issues mentioned.

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

4 years ago[llvm-readobj] - Stop using unwrapOrError() for all program_headers() calls.
Georgii Rymar [Fri, 10 Jul 2020 12:54:00 +0000 (15:54 +0300)]
[llvm-readobj] - Stop using unwrapOrError() for all program_headers() calls.

program_headers() returns the list of program headers. This change allows
to continue attempt of dumping when something is wrong with program headers.

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

4 years ago[SelectionDAG] Prevent warnings when extracting fixed length vector from scalable.
Paul Walker [Tue, 14 Jul 2020 10:18:01 +0000 (10:18 +0000)]
[SelectionDAG] Prevent warnings when extracting fixed length vector from scalable.

ComputeNumSignBits and computeKnownBits both trigger "Scalable flag
may be dropped" warnings when a fixed length vector is extracted
from a scalable vector.  This patch assumes nothing about the
demanded elements thus matching the behaviour when extracting a
scalable vector from a scalable vector.

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

4 years ago[lldb/test] Avoid globbing in log file handling code
Pavel Labath [Tue, 14 Jul 2020 11:08:52 +0000 (13:08 +0200)]
[lldb/test] Avoid globbing in log file handling code

The glob expression for a test called "test" could match a log file for
a the test "test_foo". Instead of globbing, maintain an explicit list of
log files relevant to the current test.

4 years ago[DWARFYAML] Add support for emitting value forms of strx, addrx, etc.
Xing GUO [Tue, 14 Jul 2020 11:09:58 +0000 (19:09 +0800)]
[DWARFYAML] Add support for emitting value forms of strx, addrx, etc.

This patch adds support for emitting value forms of DW_FORM_strx,
DW_FORM_addrx, DW_FORM_loclistx and DW_FORM_rnglistx.

Reviewed By: jhenderson

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

4 years ago[compiler-rt][sanitizers] Fix GetPcSpBp determination of SP on 32-bit Solaris/x86
Rainer Orth [Tue, 14 Jul 2020 10:56:18 +0000 (12:56 +0200)]
[compiler-rt][sanitizers] Fix GetPcSpBp determination of SP on 32-bit Solaris/x86

A dozen 32-bit `AddressSanitizer` testcases FAIL on the latest beta of Solaris 11.4/x86, e.g.
`AddressSanitizer-i386-sunos :: TestCases/null_deref.cpp` produces

  AddressSanitizer:DEADLYSIGNAL
  =================================================================
  ==29274==ERROR: AddressSanitizer: stack-overflow on address 0x00000028 (pc 0x08135efd bp 0xfeffdfd8 sp 0x00000000 T0)
      #0 0x8135efd in NullDeref(int*) /vol/llvm/src/llvm-project/dist/compiler-rt/test/asan/TestCases/null_deref.cpp:15:10
      #1 0x8135ea6 in main /vol/llvm/src/llvm-project/dist/compiler-rt/test/asan/TestCases/null_deref.cpp:21:3
      #2 0x8084b85 in _start (null_deref.cpp.tmp+0x8084b85)

   SUMMARY: AddressSanitizer: stack-overflow /vol/llvm/src/llvm-project/dist/compiler-rt/test/asan/TestCases/null_deref.cpp:15:10 in NullDeref(int*)
  ==29274==ABORTING

instead of the expected

  AddressSanitizer:DEADLYSIGNAL
  =================================================================
  ==29276==ERROR: AddressSanitizer: SEGV on unknown address 0x00000028 (pc 0x08135f1f bp 0xfeffdf48 sp 0xfeffdf40 T0)
  ==29276==The signal is caused by a WRITE memory access.
  ==29276==Hint: address points to the zero page.
      #0 0x8135f1f in NullDeref(int*) /vol/llvm/src/llvm-project/local/compiler-rt/test/asan/TestCases/null_deref.cpp:15:10
      #1 0x8135efa in main /vol/llvm/src/llvm-project/local/compiler-rt/test/asan/TestCases/null_deref.cpp:21:3
      #2 0x8084be5 in _start (null_deref.cpp.tmp+0x8084be5)

  AddressSanitizer can not provide additional info.
   SUMMARY: AddressSanitizer: SEGV /vol/llvm/src/llvm-project/local/compiler-rt/test/asan/TestCases/null_deref.cpp:15:10 in NullDeref(int*)
  ==29276==ABORTING

I managed to trace this to a change in `<sys/regset.h>`: previously the header would
primarily define the short register indices (like `UESP`). While they are required by the
i386 psABI, they are only required in `<ucontext.h>` and could previously leak into
unsuspecting user code, polluting the namespace and requiring elaborate workarounds
like that in `llvm/include/llvm/Support/Solaris/sys/regset.h`. The change fixed that by restricting
the definition of the short forms appropriately, at the same time defining all `REG_` prefixed
forms for compatiblity with other systems.  This exposed a bug in `compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp`, however:
Previously, the index for the user stack pointer would be hardcoded if `REG_ESP`
wasn't defined. Now with that definition present, it turned out that `REG_ESP` was the wrong index to use: the previous value 17 (and `REG_SP`) corresponds to `REG_UESP`
instead.

With that change, the failures are all gone.

Tested on `amd-pc-solaris2.11`.

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

4 years ago[yaml2obj] - Add a syntax to override e_phoff, e_phentsize and e_phnum fields.
Georgii Rymar [Thu, 9 Jul 2020 07:55:44 +0000 (10:55 +0300)]
[yaml2obj] - Add a syntax to override e_phoff, e_phentsize and e_phnum fields.

This adds `EPhOff`, `EPhEntSize` and `EPhNum` keys.
Will be useful for creating broken objects for testing llvm-readelf.

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

4 years agoRevert "[RISCV] Avoid Splitting MBB in RISCVExpandPseudo"
Sam Elliott [Tue, 14 Jul 2020 10:15:01 +0000 (11:15 +0100)]
Revert "[RISCV] Avoid Splitting MBB in RISCVExpandPseudo"

This reverts commit 97106f9d80f6ba1bf5eafbd5a6f88d72913ec5a1.

This is based on feedback from https://reviews.llvm.org/D82988#2147105

4 years ago[NFC][ARM] Add SimplifyCFG tests
Sam Parker [Tue, 14 Jul 2020 10:09:50 +0000 (11:09 +0100)]
[NFC][ARM] Add SimplifyCFG tests

4 years ago[MLIR][Standard] Erase redundant assertions `std.assert`
Frederik Gossen [Tue, 14 Jul 2020 10:08:04 +0000 (10:08 +0000)]
[MLIR][Standard] Erase redundant assertions `std.assert`

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

4 years ago[MLIR][Standard] Add `assert` operation to the standard dialect
Frederik Gossen [Tue, 14 Jul 2020 09:57:50 +0000 (09:57 +0000)]
[MLIR][Standard] Add `assert` operation to the standard dialect

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

4 years ago[AArch64][AsmParser] Add rcpc support in .arch_extension
Victor Campos [Mon, 13 Jul 2020 13:50:36 +0000 (14:50 +0100)]
[AArch64][AsmParser] Add rcpc support in .arch_extension

AArch64 does not support enabling rcpc via .arch_extension in assembly.
GCC, on the other hand, does.

This patch adds 'rcpc' as a valid value to .arch_extension handling.

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

4 years ago[gn build] Port dd6faf13d8e
LLVM GN Syncbot [Tue, 14 Jul 2020 09:36:07 +0000 (09:36 +0000)]
[gn build] Port dd6faf13d8e

4 years ago[DebugInfo] Fix a possible crash when reading a malformed .debug_*lists section.
Igor Kudrin [Tue, 14 Jul 2020 08:55:31 +0000 (15:55 +0700)]
[DebugInfo] Fix a possible crash when reading a malformed .debug_*lists section.

DWARFListTableHeader::length() handles the zero value of HeaderData.Length
in a special way, which makes the result different from the calculated
value of FullLength, which leads to triggering an assertion. The patch
moves the assertion a bit later when `FullLength` is already checked for
minimal allowed value.

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

4 years ago[DebugInfo] Add unit tests for DWARFListTableHeader::length().
Igor Kudrin [Tue, 14 Jul 2020 08:54:59 +0000 (15:54 +0700)]
[DebugInfo] Add unit tests for DWARFListTableHeader::length().

This adds unit tests to check the expected behavior of the method in
case the unit length field is truncated.

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

4 years ago[ELF] Do not leave undefined symbols (specified by -init and -fini) if they are defin...
Igor Kudrin [Tue, 14 Jul 2020 08:54:35 +0000 (15:54 +0700)]
[ELF] Do not leave undefined symbols (specified by -init and -fini) if they are defined in non-fetched archive members

After D69985, symbols for "-init" and "-fini" were unconditionally
marked as used even if they were just lazy symbols seen when scanning
archives. That resulted in exposing them in the symbol table of an
output file, as Undefined, which added unwanted dependencies. The patch
fixes the issue by checking the kind of the symbols before the marking.

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

4 years ago[gn build] Port c15e04ee5e4
LLVM GN Syncbot [Tue, 14 Jul 2020 09:31:18 +0000 (09:31 +0000)]
[gn build] Port c15e04ee5e4

4 years ago[llvm][unittests] Fix ProgramEnvTest.TestExecuteAndWaitStatistics on Solaris
Rainer Orth [Tue, 14 Jul 2020 09:29:47 +0000 (11:29 +0200)]
[llvm][unittests] Fix ProgramEnvTest.TestExecuteAndWaitStatistics on Solaris

The new `LLVM-Unit :: Support/./SupportTests/ProgramEnvTest.TestExecuteAndWaitStatistics` test currently FAILs on Solaris:

  [ RUN      ] ProgramEnvTest.TestExecuteAndWaitStatistics
  /vol/llvm/src/llvm-project/local/llvm/unittests/Support/ProgramTest.cpp:360: Failure
  Expected: (ProcStat->PeakMemory) > (0U), actual: 0 vs 0
  [  FAILED  ] ProgramEnvTest.TestExecuteAndWaitStatistics (22 ms)

According to `llvm/lib/Support/Unix/Program.inc (llvm::sys::Wait)`, `PeakMemory`
corresponds to `struct rusage.ru_maxrss`.

However, Solaris `getrusage(3C)` documents

  NOTES
         The ru_maxrss, ru_ixrss, ru_idrss, and ru_isrss members of  the  rusage
         structure are set to 0 in this implementation.

Since changing the test to check for `PeakMemory >= 0` instead is pointless
and would generate a warning on targets where `ru_maxrss` is unsigned, this
patch removes the check.

Tested on `amd64-pc-solaris2.11`.

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

4 years ago[llvm-objdump] Add entry_value and stack_value opcodes
Oliver Stannard [Wed, 19 Feb 2020 12:34:12 +0000 (12:34 +0000)]
[llvm-objdump] Add entry_value and stack_value opcodes

Add the DW_OP_entry_value and DW_OP_stack_value opcodes to the DWARF
expression printer.

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

4 years ago[llvm-objdump] Add simple memory expressions to variable display
Oliver Stannard [Wed, 19 Feb 2020 12:24:19 +0000 (12:24 +0000)]
[llvm-objdump] Add simple memory expressions to variable display

Add the DW_OP_breg0..DW_OP_breg31 and DW_OP_bregx opcodes to the DWARF
expression printer.

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

4 years ago[DebugInfo] Add unit test for compact expression printer
Oliver Stannard [Thu, 27 Feb 2020 10:39:14 +0000 (10:39 +0000)]
[DebugInfo] Add unit test for compact expression printer

Add a unit test for the compact DWARF expression printer which will be
used by the llvm-objdump --debug-vars option.

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

4 years ago[AMDGPU] Fix typos in performCtlz_CttzCombine()
Jay Foad [Tue, 14 Jul 2020 09:12:30 +0000 (10:12 +0100)]
[AMDGPU] Fix typos in performCtlz_CttzCombine()

Fix two obvious errors in the code and also update the test check.
Also add one test to catch the failure.

Patch by Ruiling Song!

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

4 years ago[ARM][MVE] Only tail-fold integer add reductions
Sjoerd Meijer [Mon, 13 Jul 2020 16:16:52 +0000 (17:16 +0100)]
[ARM][MVE] Only tail-fold integer add reductions

If a vector body has live-out values, it is probably a reduction, which needs a
final reduction step after the loop. MVE has a VADDV instruction to reduce
integer vectors, but doesn't have an equivalent one for float vectors. A
live-out value that is not recognised as reduction later in the optimisation
pipeline will result in the tail-predicated loop to be reverted to a
non-predicated loop and this is very expensive, i.e. it has a significant
performance impact, which is what we hope to avoid with fine tuning the ARM TTI
hook preferPredicateOverEpilogue implementation.

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

4 years ago[analyzer][tests] Add 5 more projects for testing
Valeriy Savchenko [Mon, 13 Jul 2020 12:48:07 +0000 (15:48 +0300)]
[analyzer][tests] Add 5 more projects for testing

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

4 years ago[analyzer][tests] Introduce analyzer benchmarking framework
Valeriy Savchenko [Fri, 10 Jul 2020 07:52:25 +0000 (10:52 +0300)]
[analyzer][tests] Introduce analyzer benchmarking framework

Summary:
This commit includes a couple of changes:
  * Benchmark selected projects by analyzing them multiple times
  * Compare two benchmarking results and visualizing them on one chart
  * Organize project build logging, so we can use the same code
    in benchmarks

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

4 years agoRevert "Revert "[compiler-rt] [test] Use the parent process env as base env in tests""
Sergej Jaskiewicz [Fri, 10 Jul 2020 17:35:24 +0000 (20:35 +0300)]
Revert "Revert "[compiler-rt] [test] Use the parent process env as base env in tests""

This reverts commit 979c5023d3f0656cf51bd645936f52acd62b0333.

The underlying issue has been fixed in https://reviews.llvm.org/D83719.