platform/upstream/llvm.git
3 years ago[HeapProf] Address post-review comments in instrumentation code
Teresa Johnson [Fri, 4 Sep 2020 06:29:21 +0000 (23:29 -0700)]
[HeapProf] Address post-review comments in instrumentation code

Addresses post-review comments from D85948, which can be found here:
https://reviews.llvm.org/rG7ed8124d46f9.

3 years agoFormatTest: Provide real line number in failure messages
Alex Richardson [Fri, 4 Sep 2020 15:13:29 +0000 (16:13 +0100)]
FormatTest: Provide real line number in failure messages

Currently a test failure always reports a line number inside verifyFormat()
which is not very helpful to see which test failed. With this change we now
emit the line number where the verify function was called. When using an
IDE such as CLion, the output now includes a clickable link that points to
the call site.

Reviewed By: MyDeveloperDay

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

3 years ago[clang-format] Add a test showing the current config file list parsing
Alex Richardson [Fri, 4 Sep 2020 15:11:48 +0000 (16:11 +0100)]
[clang-format] Add a test showing the current config file list parsing

Currently clang-format starts overriding the default values at index 0
(keeping the existing values) instead of appending or replacing all values.
This patch simply checks the current (IMO surprising) behaviour and does
not attempt to change it.

Reviewed By: MyDeveloperDay

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

3 years ago[clang-format] Parse __ptr32/__ptr64 as a pointer qualifier
Alex Richardson [Fri, 4 Sep 2020 15:02:26 +0000 (16:02 +0100)]
[clang-format] Parse __ptr32/__ptr64 as a pointer qualifier

Before:
x = (foo *__ptr32) * v;
MACRO(A * __ptr32 a);
x = (foo *__ptr64) * v;
MACRO(A * __ptr64 a);

After:
x = (foo *__ptr32)*v;
MACRO(A *__ptr32 a);
x = (foo *__ptr64)*v;
MACRO(A *__ptr64 a);

Depends on D86721 (to apply cleanly)

Reviewed By: MyDeveloperDay

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

3 years ago[AArch64][SVE] Add lowering for rounding operations
Muhammad Asif Manzoor [Fri, 4 Sep 2020 15:11:34 +0000 (11:11 -0400)]
[AArch64][SVE] Add lowering for rounding operations

Add the functionality to lower SVE rounding operations for passthru variant.
Created a new test case file for all rounding operations.

Reviewed By: paulwalker-arm

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

3 years agosanitizer_common: Implement COMPILER_CHECK using static_assert
Nico Weber [Fri, 4 Sep 2020 15:05:52 +0000 (11:05 -0400)]
sanitizer_common: Implement COMPILER_CHECK using static_assert

Since this is an internal header, we can just assume static_assert
exists.

If this doesn't upset any bots, I'll replace all uses of
COMPILER_CHECK in a follow-up.

3 years agoRevert "[Asan] Cleanup atomic usage in allocator"
Nico Weber [Fri, 4 Sep 2020 14:47:20 +0000 (10:47 -0400)]
Revert "[Asan] Cleanup atomic usage in allocator"

This reverts commit 8b8be6f38ab568d40869205389a002f32f6558a2
and follow-ups 99a93c3a223e3bfc9a9781bfbf98d2fd4551f923,
a9c0bf04043462d43013bc5616aa48f6d3e16b88,
48ac5b4833b60f00f0923db11ea31e7316bc78c6.

It breaks building on Windows, see https://reviews.llvm.org/D86917#2255872

3 years ago[MachOYAML] Allow handcrafting custom contents for DWARF sections.
Xing GUO [Fri, 4 Sep 2020 14:41:25 +0000 (22:41 +0800)]
[MachOYAML] Allow handcrafting custom contents for DWARF sections.

This patch enables users to handcraft custom contents for DWARF
sections. If we specify the contents of DWARF sections both in the
'DWARF' entry and the 'content', yaml2obj will emit an error message.
In addition, this patch helps remove the restriction that only the
content of sections whose segname are __DWARF can be specified in the
"DWARF" entry.

Reviewed By: jhenderson

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

3 years ago[EarlyCSE] Verify hash code in regression tests
Bryan Chan [Sun, 30 Aug 2020 23:17:43 +0000 (19:17 -0400)]
[EarlyCSE] Verify hash code in regression tests

As discussed in D86843, -earlycse-debug-hash should be used in more regression
tests to catch inconsistency between the hashing and the equivalence check.

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

3 years agoclang: Add test for -Wunreachable-code + weak redeclaration
Nico Weber [Fri, 4 Sep 2020 14:26:46 +0000 (10:26 -0400)]
clang: Add test for -Wunreachable-code + weak redeclaration

This tests what caused the revert in 7b033238.

3 years ago[spirv] Add more target and resource limit fields
Lei Zhang [Fri, 4 Sep 2020 00:55:20 +0000 (20:55 -0400)]
[spirv] Add more target and resource limit fields

These fields will be used to choose/influence patterns for
SPIR-V code generation.

Reviewed By: mravishankar

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

3 years ago[gn build] fix llvm-lit after d23b15cc16077
Nico Weber [Fri, 4 Sep 2020 14:23:16 +0000 (10:23 -0400)]
[gn build] fix llvm-lit after d23b15cc16077

3 years agoRevert "Canonicalize declaration pointers when forming APValues."
Nico Weber [Fri, 4 Sep 2020 14:13:28 +0000 (10:13 -0400)]
Revert "Canonicalize declaration pointers when forming APValues."

This reverts commit e6393ee813178e9d3306b8e3c6949a4f32f8a2cb.
It breaks Wunreachable for weak attributes, see
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20200831/336645.html

3 years ago[DSE] Move legacy tests to DeadStoreElimination/MemDepAnalysis.
Florian Hahn [Fri, 4 Sep 2020 08:48:04 +0000 (09:48 +0100)]
[DSE] Move legacy tests to DeadStoreElimination/MemDepAnalysis.

This patch moves the tests for the old MemDepAnalysis based DSE
implementation to the MemDepAnalysis subdirectory and updates them to
pass -enable-dse-memoryssa=false.

This is in preparation for the switch to MemorySSA-backed DSE.

3 years ago[mlir] Refactor standalone-translate to use mlirTranslateMain()
Marius Brehler [Fri, 4 Sep 2020 08:52:25 +0000 (10:52 +0200)]
[mlir] Refactor standalone-translate to use mlirTranslateMain()

This refactors the standalone-translate executable to use mlirTranslateMain() declared in Translation.h and further applies D87129.

Reviewed By: jpienaar

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

3 years ago[mlir] Fix includes in mlir-translate
Marius Brehler [Fri, 4 Sep 2020 08:39:30 +0000 (10:39 +0200)]
[mlir] Fix includes in mlir-translate

Drops the include on InitAllDialects.h, as dialects are now initialized in the translation passes.

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

3 years ago[MemCpyOpt] Account for case that MemInsertPoint == BI.
Florian Hahn [Fri, 4 Sep 2020 12:58:59 +0000 (13:58 +0100)]
[MemCpyOpt] Account for case that MemInsertPoint == BI.

In that case, the new MemoryDef needs to be inserted *before*
MemInsertPoint.

3 years ago[x86] add tests for store merging; NFC
Sanjay Patel [Thu, 3 Sep 2020 20:26:59 +0000 (16:26 -0400)]
[x86] add tests for store merging; NFC

3 years ago[Test] Range fix in test
Max Kazantsev [Fri, 4 Sep 2020 12:06:14 +0000 (19:06 +0700)]
[Test] Range fix in test

test02_neg is not testing what it claims to test because its starting
value -1 lies outside of specified range.

3 years agoFix typos in doc LangRef.rst
Yang Zhihui [Fri, 4 Sep 2020 12:15:59 +0000 (05:15 -0700)]
Fix typos in doc LangRef.rst

Reviewed By: vitalybuka

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

3 years ago[lldb][NFC] Rewrite CPP11EnumTypes test to make it faster
Raphael Isemann [Fri, 4 Sep 2020 10:29:40 +0000 (12:29 +0200)]
[lldb][NFC] Rewrite CPP11EnumTypes test to make it faster

TestCPP11EnumTypes is one of the most expensive tests on my system and takes
around 35 seconds to run. A relatively large amount of that time is actually
doing CPU intensive work it seems (and not waiting on timeouts like other
slow tests).

The main issue is that this test repeatedly compiles the same source files
with different compiler defines. The test is also including standard library
headers, so it will also build all system modules with the gmodules debug
info variant. This leads to the problem that this test ends up compiling all
system Clang modules 8 times (one for each subtest with a unique define). As
the system modules are quite large, this causes that this test spends most
of its runtime just recompiling all system modules on macOS.

There is also the small issue that this test is starting and start-stopping
the test process a few hundred times.

This rewrites the test to instead just use a macro to instantiate all the
enum types in a single source and uses global variables to test the values
(which means there is no more need to continue/stop or even start a process).

I kept running all the debug info variants (event though it doesn't seem really
relevant) to keep this as NFC as possible.

This reduced the test runtime by around 1.5 seconds on my system (or in relative
numbers, the runtime of this test decreases by 95%).

3 years ago[modules] Correctly parse LateParsedTemplates in case of dependent modules.
Vaibhav Garg [Fri, 4 Sep 2020 10:49:11 +0000 (10:49 +0000)]
[modules] Correctly parse LateParsedTemplates in case of dependent modules.

While parsing LateParsedTemplates, Clang assumes that the Global DeclID matches
with the Local DeclID of a Decl. This is not the case when we have multiple
dependent modules , each having their own LateParsedTemplate section. In such a
case, a Local/Global DeclID confusion occurs which leads to improper casting of
FunctionDecl's.

This commit creates a Vector to map the LateParsedTemplate section of each
Module with their module file and therefore resolving the Global/Local DeclID
confusion.

Reviewed By: rsmith

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

3 years agoCallingConvLower.h - remove unnecessary MachineFunction.h include. NFC.
Simon Pilgrim [Fri, 4 Sep 2020 11:16:48 +0000 (12:16 +0100)]
CallingConvLower.h - remove unnecessary MachineFunction.h include. NFC.

Reduce to forward declaration, add the Register.h include that we still needed, move CCState::ensureMaxAlignment into CallingConvLower.cpp as it was the only function that needed the full definition of MachineFunction.

Fix a few implicit dependencies further down.

3 years ago[X86] Make lowerShuffleAsLanePermuteAndPermute use sublanes on AVX2
Simon Pilgrim [Fri, 4 Sep 2020 10:41:07 +0000 (11:41 +0100)]
[X86] Make lowerShuffleAsLanePermuteAndPermute use sublanes on AVX2

Extends lowerShuffleAsLanePermuteAndPermute to search for opportunities to use vpermq (64-bit cross-lane shuffle) and vpermd (32-bit cross-lane shuffle) to get elements into the correct lane, in addition to the 128-bit full-lane permutes it previously searched for.

This is especially helpful in cross-lane byte shuffles, where the alternative tends to be "vpshufb both lanes separately and blend them with a vpblendvb", which is very expensive, especially on Haswell where vpblendvb uses the same execution port as all the shuffles.

Addresses PR47262

Patch By: @TellowKrinkle (TellowKrinkle)

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

3 years ago[ARM] Fold predicate_cast(load) into vldr p0
David Green [Fri, 4 Sep 2020 10:29:59 +0000 (11:29 +0100)]
[ARM] Fold predicate_cast(load) into vldr p0

This adds a simple tablegen pattern for folding predicate_cast(load)
into vldr p0, providing the alignment and offset are correct.

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

3 years ago[llvm-readelf/obj] - Use `RelSymbol<ELFT>` instead of std::pair. NFCI.
Georgii Rymar [Thu, 3 Sep 2020 14:45:08 +0000 (17:45 +0300)]
[llvm-readelf/obj] - Use `RelSymbol<ELFT>` instead of std::pair. NFCI.

We have the `RelSymbol<ELFT>` struct and can use it instead
of `std::pair<const Elf_Sym *, std::string>` in a few methods.
This is a bit cleaner.

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

3 years agoMIRFormatter.h - remove MachineInstr.h include. NFC.
Simon Pilgrim [Fri, 4 Sep 2020 10:17:02 +0000 (11:17 +0100)]
MIRFormatter.h - remove MachineInstr.h include. NFC.

Use forward declarations and include the inner dependencies directly.

3 years ago[llvm-readobj/elf] - Refine signature of print*Reloc methods.
Georgii Rymar [Thu, 3 Sep 2020 11:19:14 +0000 (14:19 +0300)]
[llvm-readobj/elf] - Refine signature of print*Reloc methods.

This makes the interface cleaner and slightly improves messages
reported.

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

3 years ago[analyzer][StdLibraryFunctionsChecker] Do not match based on the restrict qualifier...
Gabor Marton [Thu, 3 Sep 2020 17:08:54 +0000 (19:08 +0200)]
[analyzer][StdLibraryFunctionsChecker] Do not match based on the restrict qualifier in C++

The "restrict" keyword is illegal in C++, however, many libc
implementations use the "__restrict" compiler intrinsic in functions
prototypes. The "__restrict" keyword qualifies a type as a restricted type
even in C++.
In case of any non-C99 languages, we don't want to match based on the
restrict qualifier because we cannot know if the given libc implementation
qualifies the paramter type or not.

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

3 years ago[FPEnv] Partially implement #pragma STDC FENV_ROUND
Serge Pavlov [Mon, 24 Aug 2020 07:02:26 +0000 (14:02 +0700)]
[FPEnv] Partially implement #pragma STDC FENV_ROUND

This change implements pragma STDC FENV_ROUND, which is introduced by
the extension to standard (TS 18661-1). The pragma is implemented only
in frontend, it sets apprpriate state of FPOptions stored in Sema. Use
of these bits in constant evaluation adn/or code generator is not in the
scope of this change.

Parser issues warning on unsuppored pragma when it encounteres pragma
STDC FENV_ROUND, however it makes syntax checks and updates Sema state
as if the pragma were supported.

Primary purpose of the partial implementation is to facilitate
development of non-default floating poin environment. Previously a
developer cannot set non-default rounding mode in sources, this mades
preparing tests for say constant evaluation  substantially complicated.

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

3 years ago[lldb] Speed up TestValueObjectRecursion by making it a no_debug_info_test
Raphael Isemann [Fri, 4 Sep 2020 09:25:38 +0000 (11:25 +0200)]
[lldb] Speed up TestValueObjectRecursion by making it a no_debug_info_test

This is one of the most expensive tests and runs for nearly half a minute on
my machine. Beside this test just doing a lot of work by iterating 15k times on
one ValueObject (which seems to be the point), it also runs this for every
debug info variant which doesn't seem relevant to just iterating ValueObject.

This marks it as no_debug_info_test to only run one debug info variation
and cut down the runtime to around 7 seconds on my machine.

3 years ago[mlir][VectorOps] Simplify code. NFCI.
Benjamin Kramer [Fri, 4 Sep 2020 09:10:03 +0000 (11:10 +0200)]
[mlir][VectorOps] Simplify code. NFCI.

3 years ago[NFC][Asan] Fix typo in comment
Vitaly Buka [Fri, 4 Sep 2020 09:03:28 +0000 (02:03 -0700)]
[NFC][Asan] Fix typo in comment

3 years ago[SVE][CodeGen] Fix up warnings in sve-split-insert/extract tests
David Sherwood [Fri, 21 Aug 2020 09:59:29 +0000 (10:59 +0100)]
[SVE][CodeGen] Fix up warnings in sve-split-insert/extract tests

I have fixed up some more ElementCount/TypeSize related warnings in
the following tests:

  CodeGen/AArch64/sve-split-extract-elt.ll
  CodeGen/AArch64/sve-split-insert-elt.ll

In SelectionDAG::CreateStackTemporary we were relying upon the implicit
cast from TypeSize -> uint64_t when calling MachineFrameInfo::CreateStackObject.
I've fixed this by passing in the known minimum size instead, which I
believe is fine because the associated stack id indicates whether this
is a scalable object or not.

I've also fixed up a case in TargetLowering::SimplifyDemandedBits when
extracting a vector element from a scalable vector. The result is a scalar,
hence it wasn't caught at the start of the function. If the vector is
scalable we just bail out for now.

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

3 years ago[DSE] Remove some dead code from DSE tests.
Florian Hahn [Fri, 4 Sep 2020 08:39:40 +0000 (09:39 +0100)]
[DSE] Remove some dead code from DSE tests.

Some tests depend on DSE removing dead instructions unrelated to any
memory optimization. That's not really DSE's job, remove it.

3 years ago[NFC][Asan] Reformat some allocator code
Vitaly Buka [Fri, 4 Sep 2020 08:17:18 +0000 (01:17 -0700)]
[NFC][Asan] Reformat some allocator code

3 years ago[MemCpyOpt] Preserve MemorySSA.
Florian Hahn [Fri, 4 Sep 2020 07:44:57 +0000 (08:44 +0100)]
[MemCpyOpt] Preserve MemorySSA.

This patch updates MemCpyOpt to preserve MemorySSA. It uses the
MemoryDef at the insertion point of the builder and inserts the new def
after that def.

In some cases, we just modify a memory instruction. In that case, get
the defining access, then remove the memory access and add a new one.
If the defining access is in a different block, insert a new def at the
beginning of the current block, otherwise after the defining access.

Reviewed By: asbirlea

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

3 years ago[mlir] introduce type constraints for operands of LLVM dialect operations
Alex Zinenko [Fri, 4 Sep 2020 08:00:09 +0000 (10:00 +0200)]
[mlir] introduce type constraints for operands of LLVM dialect operations

Historically, the operations in the MLIR's LLVM dialect only checked that the
operand are of LLVM dialect type without more detailed constraints. This was
due to LLVM dialect types wrapping LLVM IR types and having clunky verification
methods. With the new first-class modeling, it is possible to define type
constraints similarly to other dialects and use them to enforce some
correctness rules in verifiers instead of having LLVM assert during translation
to LLVM IR. This hardening discovered several issues where MLIR was producing
LLVM dialect operations that cannot exist in LLVM IR.

Depends On D85900

Reviewed By: rriddle

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

3 years agoRevert "[lldb] avoid assert in threadsanitizer tests on linux"
Raphael Isemann [Fri, 4 Sep 2020 07:30:12 +0000 (09:30 +0200)]
Revert "[lldb] avoid assert in threadsanitizer tests on linux"

This reverts commit f369d51896e1c0f61df253b116c42771479549df. The bug this
fixes was already fixed by 1c5a0cb1c3bffdae0d73acf8a23e31646b35c596 with the
same approach and this commit is now just giving the variable a second fallback
value.

3 years ago[NFC][Asan] Inline enum doc strings
Vitaly Buka [Fri, 4 Sep 2020 07:17:34 +0000 (00:17 -0700)]
[NFC][Asan] Inline enum doc strings

3 years ago[libc][obvious] Use constants of type double in remquo_test.
Siva Chandra Reddy [Fri, 4 Sep 2020 05:25:14 +0000 (22:25 -0700)]
[libc][obvious] Use constants of type double in remquo_test.

3 years agoAdd comment to describe a field member (NFC)
Mehdi Amini [Fri, 4 Sep 2020 05:24:50 +0000 (05:24 +0000)]
Add comment to describe a field member (NFC)

Address post-review comment.

3 years ago[libc] Add implementations of remquo[f|l] and remainder[f|l].
Siva Chandra Reddy [Mon, 17 Aug 2020 23:24:45 +0000 (16:24 -0700)]
[libc] Add implementations of remquo[f|l] and remainder[f|l].

The implementation is not fully standards compliant in the sense that
errno is not set on error, and floating point exceptions are not raised.

Subnormal range and normal range are tested separately in the tests.

Reviewed By: lntue

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

3 years ago[mlir] [VectorOps] Improve SIMD compares with narrower indices
aartbik [Thu, 3 Sep 2020 22:57:25 +0000 (15:57 -0700)]
[mlir] [VectorOps] Improve SIMD compares with narrower indices

When allowed, use 32-bit indices rather than 64-bit indices in the
SIMD computation of masks. This runs up to 2x and 4x faster on
a number of AVX2 and AVX512 microbenchmarks.

Reviewed By: bkramer

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

3 years ago[NFC] Adding pythonenv* to .gitignore
Puyan Lotfi [Fri, 4 Sep 2020 02:42:27 +0000 (22:42 -0400)]
[NFC] Adding pythonenv* to .gitignore

The new feature in GitHub called 'GitHub Codespaces' generates a
pythonenv3.8 directory in the root level of the llvm-project git
checkout. So I am adding that directory to the .gitignore.

See the following for more info:

https://github.com/features/codespaces

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

3 years ago[NFC][Asan] Rename internal enum value.
Vitaly Buka [Fri, 4 Sep 2020 01:54:52 +0000 (18:54 -0700)]
[NFC][Asan] Rename internal enum value.

New name better represents the state of chunk.

3 years ago[NFC][Asan] Add FIXME into GetAsanChunk
Vitaly Buka [Fri, 4 Sep 2020 01:48:03 +0000 (18:48 -0700)]
[NFC][Asan] Add FIXME into GetAsanChunk

3 years ago[SmallVector] Include stdexcept if LLVM_ENABLE_EXCEPTIONS
Fangrui Song [Fri, 4 Sep 2020 01:06:08 +0000 (18:06 -0700)]
[SmallVector] Include stdexcept if LLVM_ENABLE_EXCEPTIONS

std::length_error needs stdexcept.

3 years agoAMDGPU: Remove code to handle tied si_else operands
Matt Arsenault [Wed, 2 Sep 2020 15:36:22 +0000 (11:36 -0400)]
AMDGPU: Remove code to handle tied si_else operands

This has not used tied operands for a long time.

3 years ago[X86] Update stale comment. NFC
Craig Topper [Thu, 3 Sep 2020 23:19:10 +0000 (16:19 -0700)]
[X86] Update stale comment. NFC

The optimization in ExpandIntOp_UINT_TO_FP was removed in D72728
in January 2020.

3 years ago[libunwind] Minor SJLJ config cleanup. NFCI.
Ryan Prichard [Thu, 3 Sep 2020 22:59:45 +0000 (15:59 -0700)]
[libunwind] Minor SJLJ config cleanup. NFCI.

Simplify:

    defined(__ARM_DWARF_EH__) || !defined(__arm__)

to:

    !defined(_LIBUNWIND_ARM_EHABI)

A later patch benefits from the simplicity. This change will result in
the two DWARF macros being defined when __USING_SJLJ_EXCEPTIONS__ is
defined, but:

 * That's already the case with the __APPLE__ and _WIN32 clauses.
 * That's also already the case with other architectures.
 * With __USING_SJLJ_EXCEPTIONS__, most of the unwinder is #ifdef'ed
   away.

Generally, when __USING_SJLJ_EXCEPTIONS__ is defined, most of the
libunwind code is removed by the preprocessor. e.g. None of the hpp
files are included, and almost all of the .c and .cpp files are defined
away, except in Unwind-sjlj.c. Unwind_AppleExtras.cpp is an exception
because it includes two hpp files, which it doesn't use. Remove the
unneeded includes for consistency with the general rule.

Reviewed By: steven_wu

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

3 years ago[DebugInfo] Add size to class declarations in debug info.
Amy Huang [Thu, 3 Sep 2020 22:42:27 +0000 (15:42 -0700)]
[DebugInfo] Add size to class declarations in debug info.

This adds the size to forward declared class DITypes, if the size is known.

Fixes an issue where we determine whether to emit fragments based on the
type size, so fragments would sometimes be incorrectly emitted if there
was no size.

Bug: https://bugs.llvm.org/show_bug.cgi?id=47338

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

3 years ago[codegen] Ensure target flags are cleared/set properly. NFC.
Michael Liao [Wed, 23 Oct 2019 16:46:37 +0000 (12:46 -0400)]
[codegen] Ensure target flags are cleared/set properly. NFC.

- When an operand is changed into an immediate value or like, ensure their
  target flags being cleared or set properly.

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

3 years agoRemove unused and dangerous overload of PerformImplicitConversion.
Richard Smith [Thu, 3 Sep 2020 22:33:07 +0000 (15:33 -0700)]
Remove unused and dangerous overload of PerformImplicitConversion.

Previously we had two overloads where the only real difference beyond
parameter order was whether a reference parameter is const, where one
overload treated the reference parameter as an in-parameter and the
other treated it as an out-parameter!

3 years agoCanonicalize declaration pointers when forming APValues.
Richard Smith [Wed, 2 Sep 2020 21:42:37 +0000 (14:42 -0700)]
Canonicalize declaration pointers when forming APValues.

References to different declarations of the same entity aren't different
values, so shouldn't have different representations.

3 years ago[llvm-symbolizer] Add back --use-symbol-table=true
Fangrui Song [Thu, 3 Sep 2020 01:20:59 +0000 (18:20 -0700)]
[llvm-symbolizer] Add back --use-symbol-table=true

It is used by clusterfuzz (https://github.com/google/clusterfuzz/pull/2009/)
and having this compatibility option for a while can help they do bisection
with the latest llvm-symbolizer.

Reviewed By: jhenderson

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

3 years ago[NFC][Asan] Set AP32::kMetadataSize to 0
Vitaly Buka [Tue, 1 Sep 2020 09:12:15 +0000 (02:12 -0700)]
[NFC][Asan] Set AP32::kMetadataSize to 0

Asan does not use metadata with primary allocators.
It should match AP64::kMetadataSize whic is 0.

Depends on D86917.

Reviewed By: morehouse

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

3 years ago[Asan] Cleanup atomic usage in allocator
Vitaly Buka [Tue, 1 Sep 2020 07:54:46 +0000 (00:54 -0700)]
[Asan] Cleanup atomic usage in allocator

There are no know bugs related to this, still it may fix some latent ones.
Main concerns with preexisting code:
1. Inconsistent atomic/non-atomic access to the same field.
2. Assumption that bitfield chunk_state is always the first byte without
    even taking into account endianness.

Reviewed By: morehouse

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

3 years ago[Sema] Fix a -Warc-repeated-use-of-weak false-positive by only calling CheckPlacehold...
Erik Pilkington [Thu, 3 Sep 2020 16:41:34 +0000 (12:41 -0400)]
[Sema] Fix a -Warc-repeated-use-of-weak false-positive by only calling CheckPlaceholderExpr once

Previously, this code discarded the result of CheckPlaceholderExpr for
non-matrix subexpressions. Not only is this wasteful, but it was creating a
Warc-repeated-use-of-weak false-positive on the attached testcase, since the
discarded expression was still registered as a use of the weak property.

rdar://66162246

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

3 years ago[libFuzzer] Scale energy assigned to each input based on input execution time.
Dokyung Song [Mon, 17 Aug 2020 16:59:59 +0000 (16:59 +0000)]
[libFuzzer] Scale energy assigned to each input based on input execution time.

This patch scales the energy computed by the Entropic schedule based on the
execution time of each input. The input execution time is compared with the
average execution time of inputs in the corpus, and, based on the amount by
which they differ, the energy is scaled from 0.1x (for inputs executing slow) to
3x (for inputs executing fast). Note that the exact scaling criteria and formula
is borrowed from AFL.

On FuzzBench, this gives a sizeable throughput increase, which in turn leads to
more coverage on several benchmarks. For details, see the following report.

https://storage.googleapis.com/fuzzer-test-suite-public/exectime-report/index.html

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

3 years ago[gn build] Port 7fff1fbd3ce
LLVM GN Syncbot [Thu, 3 Sep 2020 20:13:38 +0000 (20:13 +0000)]
[gn build] Port 7fff1fbd3ce

3 years ago[MIRVRegNamer] Experimental MachineInstr stable hashing (Fowler-Noll-Vo)
Puyan Lotfi [Thu, 3 Sep 2020 19:38:52 +0000 (15:38 -0400)]
[MIRVRegNamer] Experimental MachineInstr stable hashing (Fowler-Noll-Vo)

This hashing scheme has been useful out of tree, and I want to start
experimenting with it. Specifically I want to experiment on the
MIRVRegNamer, MIRCanononicalizer, and eventually the MachineOutliner.

This diff is a first step, that optionally brings stable hashing to the
MIRVRegNamer (and as a result, the MIRCanonicalizer).  We've tested this
hashing scheme on a lot of MachineOperand types that llvm::hash_value
can not handle in a stable manner.

This stable hashing was also the basis for

"Global Machine Outliner for ThinLTO" in EuroLLVM 2020

http://llvm.org/devmtg/2020-04/talks.html#TechTalk_58

Credits: Kyungwoo Lee, Nikolai Tillmann

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

3 years ago[NewPM][Lint] Port -lint to NewPM
Arthur Eubanks [Thu, 3 Sep 2020 04:54:27 +0000 (21:54 -0700)]
[NewPM][Lint] Port -lint to NewPM

This also changes -lint from an analysis to a pass. It's similar to
-verify, and that is a normal pass, and lives in llvm/IR.

Reviewed By: ychen

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

3 years ago[libFuzzer] Evenly select inputs to cross over with from the corpus regardless of...
Dokyung Song [Tue, 1 Sep 2020 16:22:59 +0000 (16:22 +0000)]
[libFuzzer] Evenly select inputs to cross over with from the corpus regardless of the input's coverage.

This patch adds an option "cross_over_uniform_dist", which, if 1, considers all
inputs in the corpus for the crossover input selection. More specifically, this
patch uses a uniform distribution of all inputs in the corpus for the CrossOver
input selection. Note that input selection for mutation is still fully
determined by the scheduling policy (i.e., vanilla or Entropic); the uniform
distribution only applies to the secondary input selection, only for the
crossover mutation of the base input chosen by the scheduling policy. This way
the corpus inputs that have useful fragments in them, even though they are
deprioritized by the scheduling policy, have chances of getting mixed with other
inputs that are prioritized and selected as base input for mutation.

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

3 years agoReplace CRLF with LF; NFC
Bryan Chan [Thu, 3 Sep 2020 19:29:37 +0000 (15:29 -0400)]
Replace CRLF with LF; NFC

3 years ago[test] Use %t instead of %T to remove race conditions between config-file3.c and...
Fangrui Song [Thu, 3 Sep 2020 18:20:29 +0000 (11:20 -0700)]
[test] Use %t instead of %T to remove race conditions between config-file3.c and target-override.c

Both tests operate on `%T/testbin`. If the two tests run concurrently,
one may fail.

This is likely the root cause of flaky failures reported by
https://lists.llvm.org/pipermail/llvm-dev/2020-September/144781.html

https://llvm.org/docs/CommandGuide/lit.html says:

`%T parent directory of %t (not unique, deprecated, do not use)`

Reviewed By: dblaikie

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

3 years ago[lldb] avoid assert in threadsanitizer tests on linux
Luboš Luňák [Mon, 17 Aug 2020 20:54:45 +0000 (22:54 +0200)]
[lldb] avoid assert in threadsanitizer tests on linux

The tests are unsupported on linux, but they assert in
Thread::GetStopDescriptionRaw() because of empty stop reason
description. And it is empty because
InstrumentationRuntimeTSan::NotifyBreakpointHit() fails
to get report from InstrumentationRuntimeTSan::RetrieveReportData(),
which is possibly(?) the reason why this is unsupported on linux.
Add a dummy stop reason description for this case, which changes
the test result from failing to unsupported.

3 years agoSVML support for log2
Wenlei He [Thu, 3 Sep 2020 18:52:14 +0000 (11:52 -0700)]
SVML support for log2

Although LLVM supports vectorization of loops containing log2, it did not support using SVML implementation of it. Added support so that when clang is invoked with -fveclib=SVML now an appropriate SVML library log2 implementation will be invoked.

Follow up on: https://reviews.llvm.org/D77114

Tests:
Added unit tests to svml-calls.ll, svml-calls-finite.ll. Can be run with llvm-lint.
Created a simple c++ file that tests log2, and used clang+ to build it, and output final assembly.

Reviewed By: wenlei, craig.topper

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

3 years agoRevert "Add new hidden option -print-changed which only reports changes to IR"
Jamie Schmeiser [Thu, 3 Sep 2020 18:24:00 +0000 (18:24 +0000)]
Revert "Add new hidden option -print-changed which only reports changes to IR"

This reverts commit 7bc9924cb2fbd9f3ae53577607822ace267a04e6 due to
failure caused by missing a space between trailing >>, required by some
versions of C++:wq.

3 years ago[DebugInfo] Make DWARF ignore sizes on forward declared class types.
Amy Huang [Thu, 3 Sep 2020 18:01:49 +0000 (11:01 -0700)]
[DebugInfo] Make DWARF ignore sizes on forward declared class types.

Make sure the sizes for forward declared classes aren't emitted in
DWARF.

This comes before https://reviews.llvm.org/D87062, which adds sizes to
all classes with definitions.

Bug: https://bugs.llvm.org/show_bug.cgi?id=47338

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

3 years agoSelectionDAG.h - remove unnecessary FunctionLoweringInfo.h include. NFCI.
Simon Pilgrim [Thu, 3 Sep 2020 17:24:06 +0000 (18:24 +0100)]
SelectionDAG.h - remove unnecessary FunctionLoweringInfo.h include. NFCI.

Use forward declarations and move the include down to dependent files that actually use it.

This also exposes a number of implicit dependencies on KnownBits.h

3 years ago[spirv][nfc] Simplify resource limit with default values
Lei Zhang [Thu, 3 Sep 2020 17:29:14 +0000 (13:29 -0400)]
[spirv][nfc] Simplify resource limit with default values

These deafult values are gotten from Vulkan required limits.

Reviewed By: hanchung

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

3 years ago[libc++] Mark std::atomic<_ExtInt> test as unsupported in C++03
Louis Dionne [Thu, 3 Sep 2020 17:27:58 +0000 (13:27 -0400)]
[libc++] Mark std::atomic<_ExtInt> test as unsupported in C++03

3 years ago[libc++] Make ext-int.verify.cpp test compatible with c++03
John Brawn [Thu, 3 Sep 2020 17:11:29 +0000 (18:11 +0100)]
[libc++] Make ext-int.verify.cpp test compatible with c++03

Currently the libcxx/atomics/ext-int.verify.cpp test fails when run with
-std=c++03 because there's an extra error due to using list initialization. Fix
this by using parentheses instead.

3 years ago[ARM] Extra predicate load tests. NFC
David Green [Thu, 3 Sep 2020 16:52:37 +0000 (17:52 +0100)]
[ARM] Extra predicate load tests. NFC

3 years agoWebAssemblyUtilities.h - reduce unnecessary includes to forward declarations. NFCI.
Simon Pilgrim [Thu, 3 Sep 2020 16:05:17 +0000 (17:05 +0100)]
WebAssemblyUtilities.h - reduce unnecessary includes to forward declarations. NFCI.

3 years agoPHIEliminationUtils.cpp - remove unnecessary MachineBasicBlock.h include. NFCI.
Simon Pilgrim [Thu, 3 Sep 2020 15:47:21 +0000 (16:47 +0100)]
PHIEliminationUtils.cpp - remove unnecessary MachineBasicBlock.h include. NFCI.

This is already included in PHIEliminationUtils.h

3 years agoFix Wdocumentation trailing comments warnings. NFCI.
Simon Pilgrim [Thu, 3 Sep 2020 15:42:05 +0000 (16:42 +0100)]
Fix Wdocumentation trailing comments warnings. NFCI.

3 years agoFix Wdocumentation warning. NFCI.
Simon Pilgrim [Thu, 3 Sep 2020 15:34:46 +0000 (16:34 +0100)]
Fix Wdocumentation warning. NFCI.

Remove \returns tag from a void function

3 years ago[InstCombine] canonicalize all commutative intrinsics with constant arg
Sanjay Patel [Thu, 3 Sep 2020 16:27:19 +0000 (12:27 -0400)]
[InstCombine] canonicalize all commutative intrinsics with constant arg

3 years ago[InstCombine] add tests for commutative intrinsics; NFC
Sanjay Patel [Thu, 3 Sep 2020 15:36:32 +0000 (11:36 -0400)]
[InstCombine] add tests for commutative intrinsics; NFC

3 years ago[Analyzer][docs][NFC] Fix typo in code example
Jan Korous [Thu, 3 Sep 2020 16:28:34 +0000 (09:28 -0700)]
[Analyzer][docs][NFC] Fix typo in code example

3 years agoEliminate the sizing template parameter N from CoalescingBitVector
Dimitry Andric [Wed, 2 Sep 2020 16:56:12 +0000 (18:56 +0200)]
Eliminate the sizing template parameter N from CoalescingBitVector

Since the parameter is not used anywhere, and the default size of 16
apparently causes PR47359, remove it. This ensures that IntervalMap will
automatically determine the optimal size, using its NodeSizer struct.

Reviewed By: dblaikie

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

3 years ago[lldb-vscode] Fix TestVSCode_module
Walter Erquinigo [Thu, 3 Sep 2020 15:57:13 +0000 (08:57 -0700)]
[lldb-vscode] Fix TestVSCode_module

Caused by D86662. The fix is only checking some fields when the expect_debug_info_size flag is true. For some reason this was not failing on a local linux machine.

3 years ago[libFuzzer] Add an option to keep initial seed inputs around.
Dokyung Song [Fri, 31 Jul 2020 00:07:20 +0000 (00:07 +0000)]
[libFuzzer] Add an option to keep initial seed inputs around.

This patch adds an option "keep_seed" to keep all initial seed inputs in the
corpus. Previously, only the initial seed inputs that find new coverage were
added to the corpus, and all the other initial inputs were discarded. We
observed in some circumstances that useful initial seed inputs are discarded as
they find no new coverage, even though they contain useful fragments in them
(e.g., SQLITE3 FuzzBench benchmark). This newly added option provides a way to
keeping seed inputs in the corpus for those circumstances. With this patch, and
with -keep_seed=1, all initial seed inputs are kept in the corpus regardless of
whether they find new coverage or not. Further, these seed inputs are not
replaced with smaller inputs even if -reduce_inputs=1.

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

3 years agoAdd new hidden option -print-changed which only reports changes to IR
Jamie Schmeiser [Thu, 3 Sep 2020 15:52:27 +0000 (15:52 +0000)]
Add new hidden option -print-changed which only reports changes to IR

A new hidden option -print-changed is added along with code to support
printing the IR as it passes through the opt pipeline in the new pass
manager. Only those passes that change the IR are reported, with others
only having the banner reported, indicating that they did not change the
IR, were filtered out or ignored. Filtering of output via the
-filter-print-funcs is supported and a new supporting hidden option
-filter-passes is added. The latter takes a comma separated list of pass
names and filters the output to only show those passes in the list that
change the IR. The output can also be modified via the -print-module-scope
function.

The code introduces a template base class that generalizes the comparison
of IRs that takes an IR representation as template parameter. The
constructor takes a series of lambdas that provide an event based API
for generalized reporting of IRs as they are changed in the opt pipeline
through the new pass manager.

The first of several instantiations is provided that prints the IR
in a form similar to that produced by -print-after-all with the above
mentioned filtering capabilities. This version, and the others to
follow will be introduced at the upcoming developer's conference.
See https://hotcrp.llvm.org/usllvm2020/paper/29 for more information.

Reviewed By: yrouban (Yevgeny Rouban)

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

3 years agoStep down from security group
JF Bastien [Thu, 3 Sep 2020 15:44:27 +0000 (08:44 -0700)]
Step down from security group

Propose Ahmed as a replacement. He's fixed many security issues in LLVM for Apple in the last few years, as such he'll fit the "Individual contributors" description.

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

3 years ago[fuzzer] Create user provided fuzzer writeable directories when requested if they...
Matt Morehouse [Thu, 3 Sep 2020 14:58:45 +0000 (07:58 -0700)]
[fuzzer] Create user provided fuzzer writeable directories when requested if they dont exist

Currently, libFuzzer will exit with an error message if a non-existent
directory is provided for any of the appropriate arguments. For cases
where libFuzzer is used in a specialized embedded environment, it would
be much easier to have libFuzzer create the directories for the user.

This patch accommodates for this scenario by allowing the user to provide
the argument `-create_missing_dirs=1` which makes libFuzzer attempt to
create the `artifact_prefix`, `exact_artifact_path`,
`features_dir` and/or corpus directory if they don't already exist rather
than throw an error and exit.

Split off from D84808 as requested [here](https://reviews.llvm.org/D84808#2208546).

Reviewed By: morehouse

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

3 years agoGlobalISel/Utils.h - remove unused includes. NFCI.
Simon Pilgrim [Thu, 3 Sep 2020 14:58:55 +0000 (15:58 +0100)]
GlobalISel/Utils.h - remove unused includes. NFCI.

Twine is unused, and TargetLowering can be reduced to a forward declaration and moved to Utils.cpp

3 years ago[libTooling] Provide overloads of `rewriteDescendants` that operate directly on an...
Yitzhak Mandelbaum [Wed, 2 Sep 2020 14:10:22 +0000 (14:10 +0000)]
[libTooling] Provide overloads of `rewriteDescendants` that operate directly on an AST node.

The new overloads apply directly to a node, like the
`clang::ast_matchers::match` functions, Rather than generating an
`EditGenerator` combinator.

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

3 years agoX86/X86TargetObjectFile.cpp - remove unused headers. NFCI.
Simon Pilgrim [Thu, 3 Sep 2020 14:17:30 +0000 (15:17 +0100)]
X86/X86TargetObjectFile.cpp - remove unused headers. NFCI.

3 years agoFix spelling mistake. NFC.
Simon Pilgrim [Thu, 3 Sep 2020 14:11:56 +0000 (15:11 +0100)]
Fix spelling mistake. NFC.

3 years ago[IR][GVN] add/allow commutative intrinsics with >2 args
Sanjay Patel [Thu, 3 Sep 2020 14:12:59 +0000 (10:12 -0400)]
[IR][GVN] add/allow commutative intrinsics with >2 args

Follow-up to D86798 and rGe25449f.

3 years ago[GVN] add tests for >2 arg commutable intrinsics; NFC
Sanjay Patel [Thu, 3 Sep 2020 13:27:16 +0000 (09:27 -0400)]
[GVN] add tests for >2 arg commutable intrinsics; NFC

3 years ago[LLD][PowerPC][test] Fix out-of-memory issue running ppc64-pcrel-long-branch-error.s
Victor Huang [Thu, 3 Sep 2020 14:08:24 +0000 (09:08 -0500)]
[LLD][PowerPC][test] Fix out-of-memory issue running ppc64-pcrel-long-branch-error.s

Following 97febb1, fix the out-of-memory error associated with buffering the output
in-memory by writing to an allocated file with the minimum offset and running it
on ppc system-linux only.

Peer reviewed by: nemanjai

3 years ago[mlir][VectorOps] Fall back to a loop when accessing a vector from a strided memref
Benjamin Kramer [Thu, 3 Sep 2020 11:49:04 +0000 (13:49 +0200)]
[mlir][VectorOps] Fall back to a loop when accessing a vector from a strided memref

The scalar loop is slow but correct.

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

3 years ago[mlir] Support default valued attribute in StructsGen
Lei Zhang [Thu, 3 Sep 2020 13:44:37 +0000 (09:44 -0400)]
[mlir] Support default valued attribute in StructsGen

Its handling is similar to optional attributes, except for the
getter method.

Reviewed By: rsuderman

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

3 years ago[spirv] Add SPIR-V GLSL extended Round op
Zhibin Li [Thu, 3 Sep 2020 13:29:07 +0000 (09:29 -0400)]
[spirv] Add SPIR-V GLSL extended Round op

Reviewed By: mravishankar, antiagainst

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

3 years agoLowerEmuTLS.cpp - remove unused TargetLowering.h include. NFC.
Simon Pilgrim [Thu, 3 Sep 2020 13:39:57 +0000 (14:39 +0100)]
LowerEmuTLS.cpp - remove unused TargetLowering.h include. NFC.

We only needed llvm/IR/Constants.h.

3 years ago[mlir] Add Acos, Asin, Atan, Sinh, Cosh, Pow to SPIRVGLSLOps
Ling, Liyang [Thu, 3 Sep 2020 13:24:43 +0000 (09:24 -0400)]
[mlir] Add Acos, Asin, Atan, Sinh, Cosh, Pow to SPIRVGLSLOps

Reviewed By: mravishankar, antiagainst

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