platform/upstream/llvm.git
4 years ago[SystemZ] Support -msoft-float
Jonas Paulsson [Fri, 3 Jan 2020 23:39:07 +0000 (00:39 +0100)]
[SystemZ]  Support -msoft-float

This is needed when building the Linux kernel.

Review: Ulrich Weigand

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

4 years agoRevert "DebugInfo: Add missing test coverage for DW_OP_convert in loclists"
Nico Weber [Tue, 4 Feb 2020 15:10:04 +0000 (10:10 -0500)]
Revert "DebugInfo: Add missing test coverage for DW_OP_convert in loclists"

This reverts commit 5327b917e3bd0b3db352cb5a61eea7409f2d1972.
Already fails on non-Linux at this commit.

4 years agoRevert "DebugInfo: Check DW_OP_convert in loclists with Split DWARF"
Nico Weber [Tue, 4 Feb 2020 15:05:49 +0000 (10:05 -0500)]
Revert "DebugInfo: Check DW_OP_convert in loclists with Split DWARF"
and follow-ups.

This reverts commit 1ced28cbe75ff81f35ac2c71e941041eb3afcd00.
This reverts commit 4f281f047457ce3f1870a93253476222314f420b.
This reverts commit 552a8fe12bd1822f48dda2e9e8728a179f82d356.

The test fails on non-Linux.

4 years ago[DebugInfo] Re-instate LiveDebugVariables scope trimming
Jeremy Morse [Tue, 4 Feb 2020 14:19:42 +0000 (14:19 +0000)]
[DebugInfo] Re-instate LiveDebugVariables scope trimming

This patch reverts part of r362750 / D62650, which stopped
LiveDebugVariables from trimming leading variable location ranges down
to only covering those instructions that are in scope. I've observed some
circumstances where the number of DBG_VALUEs in a function can be
amplified in an un-necessary way, to cover more instructions that are
out of scope, leading to very slow compile times. Trimming the range
of instructions that the variables cover solves the slow compile times.

The specific problem that r362750 tries to fix is addressed by the
assignment to RStart that I've added. Any variable location that begins
at the first instruction of a block will now be considered to begin at the
start of the block. While these sound the same, the have different
SlotIndexes, and the register allocator may shoehorn additional
instructions in between the two. The test added in the past
(wrong_debug_loc_after_regalloc.ll) still works with this modification.

live-debug-variables.ll has a range trimmed to not cover the prologue of
the function, while dbg-addr-dse.ll has a DBG_VALUE sink past one
instruction with no DebugLoc, which is expected behaviour.

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

4 years ago[ARM] Make ARM::ArchExtKind use 64-bit underlying type (part 2), NFCI
Mikhail Maltsev [Tue, 4 Feb 2020 14:48:10 +0000 (14:48 +0000)]
[ARM] Make ARM::ArchExtKind use 64-bit underlying type (part 2), NFCI

Summary:
After following Simon's suggestion about additional testing posted at
https://reviews.llvm.org/D73906, I found several more places that
need to be updated.

Reviewers: simon_tatham, dmgreen, ostannard, eli.friedman

Reviewed By: simon_tatham

Subscribers: merge_guards_bot, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoRevert "[clangd] Mechanism to make update debounce responsive to rebuild speed."
Sam McCall [Tue, 4 Feb 2020 14:33:53 +0000 (15:33 +0100)]
Revert "[clangd] Mechanism to make update debounce responsive to rebuild speed."

This reverts commit 92570718a86cc4c23108b596002114ab25857b14.
Breaking tests: http://45.33.8.238/linux/9296/step_9.txt

4 years ago[Polly] Fix compilation after 105642af5eef: include PassManagerImpl.h
Krzysztof Parzyszek [Tue, 4 Feb 2020 14:18:40 +0000 (08:18 -0600)]
[Polly] Fix compilation after 105642af5eef: include PassManagerImpl.h

4 years ago[clangd] Increase stack size of the new threads on macOS
Sam McCall [Tue, 4 Feb 2020 14:08:11 +0000 (15:08 +0100)]
[clangd] Increase stack size of the new threads on macOS

Summary: By default it's 512K, which is way to small for clang parser to run on. There is no way to do it via platform-independent API, so it's implemented via pthreads directly in clangd/Threading.cpp.

Fixes https://github.com/clangd/clangd/issues/273

Patch by Dmitry Kozhevnikov!

Reviewers: ilya-biryukov, sammccall, arphaman

Reviewed By: ilya-biryukov, sammccall, arphaman

Subscribers: dexonsmith, umanwizard, jfb, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

4 years ago[InstCombine] add more splat tests with undef elements; NFC
Sanjay Patel [Tue, 4 Feb 2020 14:01:16 +0000 (09:01 -0500)]
[InstCombine] add more splat tests with undef elements; NFC

4 years ago[lldb] [testsuite] Fixup: generalize `DWARFASTParserClangTests` based on `DWARFExpres...
Jan Kratochvil [Tue, 4 Feb 2020 14:02:10 +0000 (15:02 +0100)]
[lldb] [testsuite] Fixup: generalize `DWARFASTParserClangTests` based on `DWARFExpressionTest`'s YAML

The testcase did not compile now because of an upstream change in the
meantime.

For: https://reviews.llvm.org/D73279

4 years ago[mlir][spirv] Wrap debug-only method in #ifndef NDEBUG
Lei Zhang [Tue, 4 Feb 2020 13:56:28 +0000 (08:56 -0500)]
[mlir][spirv] Wrap debug-only method in #ifndef NDEBUG

4 years ago[Linalg] Add tiling of Linalg to parallel loops.
Alexander Belyaev [Tue, 4 Feb 2020 13:11:10 +0000 (14:11 +0100)]
[Linalg] Add tiling of Linalg to parallel loops.

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

4 years ago[mlir][spirv] Add resource limits into target environment
Lei Zhang [Fri, 31 Jan 2020 15:23:41 +0000 (10:23 -0500)]
[mlir][spirv] Add resource limits into target environment

This commit adds two resource limits, max_compute_workgroup_size
and max_compute_workgroup_invocations as resource limits to
the target environment. They are not used at the current moment,
but they will affect the SPIR-V CodeGen. Adding for now to have
a proper target environment modelling.

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

4 years ago[lldb] [testsuite] generalize `DWARFASTParserClangTests` based on `DWARFExpressionTes...
Jan Kratochvil [Tue, 4 Feb 2020 13:33:29 +0000 (14:33 +0100)]
[lldb] [testsuite] generalize `DWARFASTParserClangTests` based on `DWARFExpressionTest`'s YAML

YAMLModuleTester from DWARFExpressionTest can be reused for more
testcases.

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

4 years ago[lldb] Increase LINK_INTERFACE_MULTIPLICITY for Debug builds
Jan Kratochvil [Tue, 4 Feb 2020 13:30:27 +0000 (14:30 +0100)]
[lldb] Increase LINK_INTERFACE_MULTIPLICITY for Debug builds

On Fedora 30 x86_64 with
cmake ../llvm-monorepo/llvm/ -DCMAKE_BUILD_TYPE=Debug  -DLLVM_USE_LINKER=gold -DLLVM_ENABLE_PROJECTS="lldb;clang;lld"  -DLLVM_USE_SPLIT_DWARF=ON -DCMAKE_C_COMPILER=clang  -DCMAKE_CXX_COMPILER=clang++ -DLLVM_ENABLE_ASSERTIONS=ON

It does not affect Release builds.

getting:
lldb/source/Expression/IRInterpreter.cpp:1471: error: undefined reference to 'lldb_private::ThreadPlanCallFunctionUsingABI::ThreadPlanCallFunctionUsingABI(lldb_private::Thread&, lldb_private::Address const&, llvm::Type&, llvm::Type&, llvm::ArrayRef<lldb_private::ABI::CallArgument>, lldb_private::EvaluateExpressionOptions const&)'
lldb/source/Expression/LLVMUserExpression.cpp:148: error: undefined reference to 'lldb_private::ThreadPlanCallUserExpression::ThreadPlanCallUserExpression(lldb_private::Thread&, lldb_private::Address&, llvm::ArrayRef<unsigned long>, lldb_private::EvaluateExpressionOptions const&, std::shared_ptr<lldb_private::UserExpression>&)'

Pavel Labath has suggest LINK_INTERFACE_MULTIPLICITY could be further
increased.

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

4 years ago[InstCombine] add splat tests with undef elements; NFC
Sanjay Patel [Tue, 4 Feb 2020 12:59:12 +0000 (07:59 -0500)]
[InstCombine] add splat tests with undef elements; NFC

4 years ago[InstCombine] fix operands of shouldChangeType() for casted phi transform
Sanjay Patel [Tue, 4 Feb 2020 12:02:01 +0000 (07:02 -0500)]
[InstCombine] fix operands of shouldChangeType() for casted phi transform

This is a bug noted in the recent D72733 and seen
in the similar transform just above the changed source code.

I added tests with illegal types and zexts to show the bug -
we could transform legal phi ops to illegal, etc. I did not add
tests with trunc because we won't see any diffs on those patterns.
That is because InstCombiner::SliceUpIllegalIntegerPHI() appears to
do those transforms independently of datalayout. It can also create
more casts than are present in existing code.

There are some existing regression tests that do not include a
datalayout that would be altered by this fix. I assumed that the
lack of a datalayout in those regression files is an oversight, so
I added the minimal layout (make i32 legal) necessary to preserve
behavior on those tests.

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

4 years ago[Matrix] Mark matrix memory intrinsics as argmemonly/write|read mem.
Florian Hahn [Tue, 4 Feb 2020 12:23:42 +0000 (12:23 +0000)]
[Matrix] Mark matrix memory intrinsics as argmemonly/write|read mem.

matrix.columnwise.load and matrix.columnwise.store only access memory
through the argument pointers. Also matrix.columnwise.store only writes
memory.

4 years ago[yaml2obj/obj2yaml] - Add support for the SHT_LLVM_CALL_GRAPH_PROFILE section.
Georgii Rymar [Fri, 31 Jan 2020 09:43:09 +0000 (12:43 +0300)]
[yaml2obj/obj2yaml] - Add support for the SHT_LLVM_CALL_GRAPH_PROFILE section.

This is a LLVM specific section that is well described here:
https://llvm.org/docs/Extensions.html#sht-llvm-call-graph-profile-section-call-graph-profile

This patch teaches yaml2obj and obj2yaml about how to work with it.

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

4 years ago[clangd] Mechanism to make update debounce responsive to rebuild speed.
Sam McCall [Mon, 3 Feb 2020 12:01:03 +0000 (13:01 +0100)]
[clangd] Mechanism to make update debounce responsive to rebuild speed.

Summary:
Currently we delay AST rebuilds by 500ms after each edit, to wait for
further edits. This is a win if a rebuild takes 5s, and a loss if it
takes 50ms.

This patch sets debouncepolicy = clamp(min, ratio * rebuild_time, max).
However it sets min = max = 500ms so there's no policy change or actual
customizability - will do that in a separate patch.

See https://github.com/clangd/clangd/issues/275

Reviewers: hokein

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

Tags: #clang

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

4 years ago[ARM] Make ARM::ArchExtKind use 64-bit underlying type, NFCI
Mikhail Maltsev [Tue, 4 Feb 2020 11:22:07 +0000 (11:22 +0000)]
[ARM] Make ARM::ArchExtKind use 64-bit underlying type, NFCI

Summary:
This patch changes the underlying type of the ARM::ArchExtKind
enumeration to uint64_t and adjusts the related code.

The goal of the patch is to prepare the code base for a new
architecture extension.

Reviewers: simon_tatham, eli.friedman, ostannard, dmgreen

Reviewed By: dmgreen

Subscribers: merge_guards_bot, kristof.beyls, hiraditya, cfe-commits, llvm-commits, pbarrio

Tags: #clang, #llvm

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

4 years ago[OpenMP][OMPT] fix reduction test for 32-bit x86
protze@itc.rwth-aachen.de [Tue, 4 Feb 2020 11:16:03 +0000 (12:16 +0100)]
[OpenMP][OMPT] fix reduction test for 32-bit x86

Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=44733 | TEST 'libomp :: ompt/synchronization/reduction/tree_reduce.c' FAILED on 32-bit x86 ]]

For 32-bit we need at least 3 variables to avoid atomic reduction to be
choosen by runtime function `__kmp_determine_reduction_method`.
This patch adds reduction variables to the testcase.

Reviewers: mgorny, Hahnfeld

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

4 years agoImprove error message of FileCheck when stdin is empty
David Bozier [Mon, 3 Feb 2020 15:13:31 +0000 (15:13 +0000)]
Improve error message of FileCheck when stdin is empty

Summary: Replace '-' in the error message with <stdin>. This is also consistent with another error message in the code.

Reviewers: jhenderson, probinson, jdenny, grimar, arichardson

Reviewed By: jhenderson

Subscribers: thopre, llvm-commits

Tags: #llvm

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

4 years ago[NFC] Fix some spelling mistakes to test pushing to GH.
Filipe Cabecinhas [Tue, 29 Oct 2019 12:54:20 +0000 (12:54 +0000)]
[NFC] Fix some spelling mistakes to test pushing to GH.

4 years ago[OpenCL] Tidy up OpenCLBuiltins.td
Sven van Haastregt [Tue, 4 Feb 2020 10:56:53 +0000 (10:56 +0000)]
[OpenCL] Tidy up OpenCLBuiltins.td

Align `Type` names to their actual OpenCL C type names, such that we
can print OpenCL C types from TableGen.  This is particularly helpful
for completeness comparisons with `opencl-c.h`.

Drop the "Name" field from `TypeList`, as it is unused.

Minor formatting changes.

4 years ago[DAG] OptLevelChanger - fix uninitialized variable analyzer warning (PR44471)
Simon Pilgrim [Tue, 4 Feb 2020 10:51:48 +0000 (10:51 +0000)]
[DAG] OptLevelChanger - fix uninitialized variable analyzer warning (PR44471)

Ensure that OptLevelChanger::SavedFastISel is initialized in the constructor.

This should be NFC - as the equivalent 'same opt level' early-out is used in the destructor as well, so SavedFastISel is only actually referenced in the general case.

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

4 years ago[lldb][NFC] Use correct Decl typedef in ClangASTSource
Raphael Isemann [Tue, 4 Feb 2020 10:52:37 +0000 (11:52 +0100)]
[lldb][NFC] Use correct Decl typedef in ClangASTSource

This is iterating over a DeclContext and not a TagDecl (even
though both iterators are the same underlying type).

4 years agoRevert "[X86] Use X86ISD::SUB instead of X86ISD::CMP in some places."
Kadir Cetinkaya [Tue, 4 Feb 2020 10:21:53 +0000 (11:21 +0100)]
Revert "[X86] Use X86ISD::SUB instead of X86ISD::CMP in some places."

This reverts commit 8413116bf10402eef12f556cb9d80b08faeb9890.

this seems to be causing crashes while compiling ncurses.
```
$ ./bin/llc bugpoint-reduced-simplified.ll
LLVM ERROR: Cannot emit physreg copy instruction
```

Here are the crashers: https://gist.github.com/kadircet/918f5bb97a2afe048cb875490edba46e

executing with an llc compiled at 904d54de9ba9f71e937b24e04ad5941281cd50b7 works fine.

4 years ago[ARM][VecReduce] Force expand vector_reduce_fmin
David Green [Tue, 4 Feb 2020 09:25:01 +0000 (09:25 +0000)]
[ARM][VecReduce] Force expand vector_reduce_fmin

Under MVE, we do not have any lowering for fminimum, which a
vector_reduce_fmin without NoNan will be expanded into. As with the
other recent patches, force this to expand in the pre-isel pass. Note
that Neon lowering would be OK because the scalar fminimum uses the
vector VMIN instruction, but is probably better to just rely on the
scalar operations, which is what is done here.

Also fixes what appears to be the reversal of INF vs -INF in the
vector_reduce_fmin widening code.

4 years ago[NFC] Encapsulate MemOp logic
Guillaume Chatelet [Tue, 4 Feb 2020 08:52:21 +0000 (09:52 +0100)]
[NFC] Encapsulate MemOp logic

Summary:
This patch simply introduces functions instead of directly accessing the fields.
This helps introducing additional check logic. A second patch will add simplifying functions.

Reviewers: courbet

Subscribers: arsenm, nemanjai, jvesely, nhaehnle, hiraditya, kbarton, jsji, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[update_cc_test_checks] Don't attach CHECK lines to function declarations
Alex Richardson [Tue, 4 Feb 2020 08:40:56 +0000 (08:40 +0000)]
[update_cc_test_checks] Don't attach CHECK lines to function declarations

Previously we were adding the CHECK lines to both definitions and
declarations. Update the JSON AST dump parsing code to skip all
FunctionDecls without an "inner" node (i.e. no body).

Reviewed By: MaskRay, greened
Differential Revision: https://reviews.llvm.org/D73708

4 years ago[ValueTracking] Let isGuaranteedToBeUndefOrPoison look into operands of icmp
Juneyoung Lee [Tue, 4 Feb 2020 08:16:32 +0000 (17:16 +0900)]
[ValueTracking] Let isGuaranteedToBeUndefOrPoison look into operands of icmp

4 years agoLet isGuaranteedNotToBeUndefOrPoison consider PHINode with constant values
Juneyoung Lee [Tue, 4 Feb 2020 07:46:54 +0000 (16:46 +0900)]
Let isGuaranteedNotToBeUndefOrPoison consider PHINode with constant values

4 years ago[X86] Remove unneeded code that looks for (and (i8 (X86setcc_c))
Craig Topper [Tue, 4 Feb 2020 07:17:20 +0000 (23:17 -0800)]
[X86] Remove unneeded code that looks for (and (i8 (X86setcc_c))

I don't believe we use this construct anymore so I don't think
we need to look for it.

4 years ago[GVN] Add GVNOption to control load-pre more fine-grained.
Thomas Raoux [Tue, 4 Feb 2020 06:24:12 +0000 (22:24 -0800)]
[GVN] Add GVNOption to control load-pre more fine-grained.

Adds the global (cl::opt) GVNOption enable-load-in-loop-pre in order
to control whether the optimization will be performed if the load
is part of a loop.

Patch by Hendrik Greving!

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

4 years ago[X86] Remove some uncovered and possibly broken code from combineZext.
Craig Topper [Tue, 4 Feb 2020 06:43:33 +0000 (22:43 -0800)]
[X86] Remove some uncovered and possibly broken code from combineZext.

This code matches (zext (trunc (setcc_carry))) -> (and (setcc_carry), 1)
but the code never checks what type we're truncating too. An and
mask of 1 would only make sense if the trunc was to MVT::i1, but
we didn't check for that.

I believe this code is a leftover from when i1 was a legal type.

4 years ago[mlir] Emit a fatal error when the assembly format is invalid
River Riddle [Tue, 4 Feb 2020 06:14:33 +0000 (22:14 -0800)]
[mlir] Emit a fatal error when the assembly format is invalid

This revision makes sure that errors emitted outside of testing are treated as fatal errors. This avoids the current silent failures that occur when the format is invalid.

4 years ago[mlir][ODS] Refactor BuildableType to use $_builder as part of the format
River Riddle [Tue, 4 Feb 2020 05:52:43 +0000 (21:52 -0800)]
[mlir][ODS] Refactor BuildableType to use $_builder as part of the format

Summary:
Currently BuildableType is assumed to be preceded by a builder. This prevents constructing types that don't have a callable 'get' method with the builder. This revision reworks the format to be like attribute builders, i.e. by accepting $_builder within the format itself.

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

4 years ago[mlir] Initial support for type constraints in the declarative assembly format
River Riddle [Tue, 4 Feb 2020 05:52:38 +0000 (21:52 -0800)]
[mlir] Initial support for type constraints in the declarative assembly format

Summary: This revision add support for accepting a few type constraints, e.g. AllTypesMatch, when inferring types for operands and results. This is used to remove the c++ parsers for several additional operations.

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

4 years ago[X86] Use X86ISD::SUB instead of X86ISD::CMP in some places.
Craig Topper [Tue, 4 Feb 2020 04:43:07 +0000 (20:43 -0800)]
[X86] Use X86ISD::SUB instead of X86ISD::CMP in some places.

Our normal lowering for ISD::SETCC uses X86ISD::SUB to enable
CSE unless the RHS is 0. optimizeCompareInstr called by the peephole
pass can turn subs with unused results into cmps to clean this up.

This commit makes other places that create X86ISD::CMP have the
same behavior.

4 years ago[lldb/Test] Sort substr for TestDataFormatterStdMap.py (2/2)
Jonas Devlieghere [Tue, 4 Feb 2020 04:59:21 +0000 (20:59 -0800)]
[lldb/Test] Sort substr for TestDataFormatterStdMap.py (2/2)

4 years ago[lldb/Test] Fix substr order in asan & ubsan tests
Jonas Devlieghere [Tue, 4 Feb 2020 04:57:52 +0000 (20:57 -0800)]
[lldb/Test] Fix substr order in asan & ubsan tests

4 years agoUpdate TTI's getUserCost to return TCC_Free on freeze
Juneyoung Lee [Tue, 4 Feb 2020 04:56:15 +0000 (13:56 +0900)]
Update TTI's getUserCost to return TCC_Free on freeze

4 years ago[lldb] [ObjectFile/ELF] Fix negated seg ids on 32-bit arches
Michał Górny [Mon, 3 Feb 2020 19:32:01 +0000 (20:32 +0100)]
[lldb] [ObjectFile/ELF] Fix negated seg ids on 32-bit arches

Scale segment identifier up to user_id_t before negating it.  This fixes
the identifers being wrongly e.g. 0x00000000fffffffe instead of
0xfffffffffffffffe.  Fix suggested by Pavel Labath.

This fixes 5 tests failing on i386 (PR #44748):

  lldb-shell :: ObjectFile/ELF/PT_LOAD-overlap-PT_INTERP.yaml
  lldb-shell :: ObjectFile/ELF/PT_LOAD-overlap-PT_TLS.yaml
  lldb-shell :: ObjectFile/ELF/PT_LOAD-overlap-section.yaml
  lldb-shell :: ObjectFile/ELF/PT_LOAD.yaml
  lldb-shell :: ObjectFile/ELF/PT_TLS-overlap-PT_LOAD.yaml

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

4 years ago[lldb/Test] Fix typo in TestDataFormatterStdMap.py
Jonas Devlieghere [Tue, 4 Feb 2020 04:44:53 +0000 (20:44 -0800)]
[lldb/Test] Fix typo in TestDataFormatterStdMap.py

4 years ago[lldb/Test] Sort substr for TestDataFormatterStdMap.py
Jonas Devlieghere [Tue, 4 Feb 2020 04:35:43 +0000 (20:35 -0800)]
[lldb/Test] Sort substr for TestDataFormatterStdMap.py

4 years ago[lldb/Test] Use arrays instead of sets for build_and_run_expr
Jonas Devlieghere [Tue, 4 Feb 2020 04:32:36 +0000 (20:32 -0800)]
[lldb/Test] Use arrays instead of sets for build_and_run_expr

4 years agoRe-land "[lldb/Test] Make substrs argument to self.expect ordered."
Jonas Devlieghere [Fri, 31 Jan 2020 22:13:20 +0000 (14:13 -0800)]
Re-land "[lldb/Test] Make substrs argument to self.expect ordered."

Re-landing this now that (hopefully) all the failures this caused on the
bots have been addressed.

This patch changes the behavior of the substrs argument to self.expect.
Currently, the elements of substrs are unordered and as long as the
string appears in the output, the assertion passes.

We can be more precise by requiring that the substrings be ordered in
the way they appear. My hope is that this will make it harder to
accidentally pass a check because a string appears out of order.

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

4 years ago[X86] Don't emit two X86ISD::COMI/UCOMI nodes when handling comi/ucomi intrinsics.
Craig Topper [Tue, 4 Feb 2020 04:07:06 +0000 (20:07 -0800)]
[X86] Don't emit two X86ISD::COMI/UCOMI nodes when handling comi/ucomi intrinsics.

We were creating two with different operand orders, and then only
using one of them.

Instead just swap the operands when needed and create a single node.

4 years agoFix unused variable warning (NFC)
Mehdi Amini [Tue, 4 Feb 2020 02:20:10 +0000 (02:20 +0000)]
Fix unused variable warning (NFC)

Use isa<> instead of dyn_cast<> when the result isn't used.

4 years agoDebugInfo: Hash DW_OP_convert in loclists when using Split DWARF
David Blaikie [Tue, 4 Feb 2020 03:15:02 +0000 (19:15 -0800)]
DebugInfo: Hash DW_OP_convert in loclists when using Split DWARF

This code was incorrectly emitting extra bytes into arbitrary parts of
the object file when it was meant to be hashing them to compute the DWO
ID.

Follow-up patch(es) will refactor this API somewhat to make such bugs
harder to introduce, hopefully.

4 years agoXfail this test temporarily until AdrianM or I can
Jason Molenda [Tue, 4 Feb 2020 02:52:23 +0000 (18:52 -0800)]
Xfail this test temporarily until AdrianM or I can
debug why his patch is causing this regression; or
if it doesn't get figured out tomorrow, we'll
revert the patch.

4 years agoDebugInfo: Simplify emitDebugLocEntry by never passing a null CU
David Blaikie [Tue, 4 Feb 2020 02:47:14 +0000 (18:47 -0800)]
DebugInfo: Simplify emitDebugLocEntry by never passing a null CU

4 years agoDebugInfo: Fix convert-loclist.ll to handle different target instruction lengths
David Blaikie [Tue, 4 Feb 2020 02:44:18 +0000 (18:44 -0800)]
DebugInfo: Fix convert-loclist.ll to handle different target instruction lengths

4 years agoDebugInfo: Check DW_OP_convert in loclists with Split DWARF
David Blaikie [Tue, 4 Feb 2020 02:39:36 +0000 (18:39 -0800)]
DebugInfo: Check DW_OP_convert in loclists with Split DWARF

4 years agohwasan_symbolize: allow 0x in the address field
Evgenii Stepanov [Sat, 1 Feb 2020 02:10:17 +0000 (18:10 -0800)]
hwasan_symbolize: allow 0x in the address field

Summary:
Fix parsing of mangled stack trace lines where the address has been
replaced with "0x", literally.

Reviewers: vitalybuka

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years agohwasan_symbolize: warn about missing symbols at most once per library
Evgenii Stepanov [Sat, 1 Feb 2020 02:05:41 +0000 (18:05 -0800)]
hwasan_symbolize: warn about missing symbols at most once per library

Reviewers: vitalybuka

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years agoDebugInfo: Add missing test coverage for DW_OP_convert in loclists
David Blaikie [Tue, 4 Feb 2020 02:20:38 +0000 (18:20 -0800)]
DebugInfo: Add missing test coverage for DW_OP_convert in loclists

4 years ago[X86] Update the haswell and broadwell scheduler information for gather instructions
Craig Topper [Tue, 4 Feb 2020 01:57:12 +0000 (17:57 -0800)]
[X86] Update the haswell and broadwell scheduler information for gather instructions

Broadwell was missing half the gather instructions. Both models
had some mixups in the resource costs and number of uops.

I've updated here based on what I think the original IACA source
says with some cross checking against the microcode.

I'm not sure about latency as the IACA source I have doesn't have
that information. So I'm using the latency from uops.info.

I plan to update Skylake models as well, but I'll do that in a
separate patch.

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

4 years agoRevert "Reland "[AArch64] Fix data race on RegisterBank initialization.""
Huihui Zhang [Tue, 4 Feb 2020 00:58:58 +0000 (16:58 -0800)]
Revert "Reland "[AArch64] Fix data race on RegisterBank initialization.""

This reverts commit 9c726e9d90583a4bf2934ada9c9d8030c44a868d.

There still buildbot failure:
http://lab.llvm.org:8011/builders/clang-armv7-linux-build-cache/builds/25749

4 years agoReland "[AArch64] Fix data race on RegisterBank initialization."
Huihui Zhang [Mon, 3 Feb 2020 23:28:08 +0000 (15:28 -0800)]
Reland "[AArch64] Fix data race on RegisterBank initialization."

Minor fix, lambda function should capture all automatic variables
by reference.
Harbormaster pass with: https://reviews.llvm.org/B45640

4 years ago[TestKernVerStrLCNOTE] Strengthen a check. NFC.
Davide Italiano [Tue, 4 Feb 2020 00:39:02 +0000 (16:39 -0800)]
[TestKernVerStrLCNOTE] Strengthen a check. NFC.

4 years ago[compiler-rt] implement sigaltstack interception
Evgenii Stepanov [Tue, 4 Feb 2020 00:20:07 +0000 (16:20 -0800)]
[compiler-rt] implement sigaltstack interception

Summary:
An implementation for `sigaltstack` to make its side effect be visible to MSAN.

```
ninja check-msan
```

Reviewers: vitalybuka, eugenis

Reviewed By: eugenis

Subscribers: dberris, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

Patch by Igor Sugak.

4 years ago[lldb/StringPrinter] Simplify StringPrinterBufferPointer, NFC
Vedant Kumar [Mon, 3 Feb 2020 23:51:59 +0000 (15:51 -0800)]
[lldb/StringPrinter] Simplify StringPrinterBufferPointer, NFC

Remove its template arguments and delete its copy/assign methods.

4 years ago[lldb/DataExtractor] Use an early return in GetMaxS64Bitfield, NFC
Vedant Kumar [Mon, 3 Feb 2020 22:38:42 +0000 (14:38 -0800)]
[lldb/DataExtractor] Use an early return in GetMaxS64Bitfield, NFC

Shafik suggested this cleanup in https://reviews.llvm.org/D73913.

4 years ago[lldb/DataExtractor] Fix UB shift in GetMaxS64Bitfield
Vedant Kumar [Mon, 3 Feb 2020 19:14:28 +0000 (11:14 -0800)]
[lldb/DataExtractor] Fix UB shift in GetMaxS64Bitfield

DataExtractor::GetMaxS64Bitfield performs a shift with UB in order to
construct a bitmask when bitfield_bit_size is 64. The current
implementation actually does “work” in this case, because the assumption
that the shift result is 0 holds, and 0 minus 1 gives the all-ones value
(the correct mask). However, the more readable/maintainable approach
might be to use an off-the-shelf UB-free helper.

Fixes a UBSan issue:

  "col" : 37,
  "description" : "invalid-shift-exponent",
  "filename" : "/Users/vsk/src/llvm-project-master/lldb/source/Utility/DataExtractor.cpp",
  "instrumentation_class" : "UndefinedBehaviorSanitizer",
  "line" : 615,
  "memory_address" : 0,
  "summary" : "Shift exponent 64 is too large for 64-bit type 'uint64_t' (aka 'unsigned long long')",

rdar://59117758

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

4 years ago[OpenMP] [DOCS] Update OMP5.0 feature status table [NFC]
Kelvin Li [Fri, 17 Jan 2020 07:56:08 +0000 (21:56 -1000)]
[OpenMP] [DOCS] Update OMP5.0 feature status table [NFC]

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

4 years ago[AArch64][GlobalISel] Fold G_XOR into TB(N)Z bit calculation
Jessica Paquette [Mon, 3 Feb 2020 22:26:17 +0000 (14:26 -0800)]
[AArch64][GlobalISel] Fold G_XOR into TB(N)Z bit calculation

This ports the existing case for G_XOR from `getTestBitOperand` in
AArch64ISelLowering into GlobalISel.

The idea is to flip between TBZ and TBNZ while walking through G_XORs.

Let's say we have

```
tbz (xor x, c), b
```

Let's say the `b`-th bit in `c` is 1. Then

- If the `b`-th bit in `x` is 1, the `b`-th bit in `(xor x, c)` is 0.
- If the `b`-th bit in `x` is 0, then the `b`-th bit in `(xor x, c)` is 1.

So, then

```
tbz (xor x, c), b == tbnz x, b
```

Let's say the `b`-th bit in `c` is 0. Then

- If the `b`-th bit in `x` is 1, the `b`-th bit in `(xor x, c)` is 1.
- If the `b`-th bit in `x` is 0, then the `b`-th bit in `(xor x, c)` is 0.

So, then

```
tbz (xor x, c), b == tbz x, b
```

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

4 years ago[ANDGPU] getMemOperandsWithOffset: support BUF non-stack-access instructions with...
Jay Foad [Fri, 20 Dec 2019 14:59:15 +0000 (14:59 +0000)]
[ANDGPU] getMemOperandsWithOffset: support BUF non-stack-access instructions with resource but no vaddr

Summary:
This enables clustering for many more BUF instructions.

Reviewers: rampitec, arsenm, nhaehnle

Subscribers: jvesely, wdng, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[libFuzzer] Minor documentation fixes.
Max Moroz [Mon, 3 Feb 2020 22:40:08 +0000 (14:40 -0800)]
[libFuzzer] Minor documentation fixes.

4 years ago[AArch64][GlobalISel] Fold G_SHL into TB(N)Z bit calculation
Jessica Paquette [Mon, 3 Feb 2020 21:35:09 +0000 (13:35 -0800)]
[AArch64][GlobalISel] Fold G_SHL into TB(N)Z bit calculation

This implements the following optimization:

```
(tbz (shl x, c), b) -> (tbz x, b-c)
```

Which appears in `getTestBitOperand` in AArch64ISelLowering.cpp.

If we test bit `b` of `shl x, c`, we can fold away the `shl` by looking `c` bits
to the right of `b` in `x` when this fits in the type. So, we can just test the
`b-c`th bit.

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

4 years agoAMDGPU: Add flag to control mem intrinsic expansion
Matt Arsenault [Sat, 1 Feb 2020 00:39:02 +0000 (19:39 -0500)]
AMDGPU: Add flag to control mem intrinsic expansion

GlobalISel doesn't implement the expansion for these yet, so add a
flag to force expanding these so it's possible to avoid these for a
while.

4 years agoFix modules build after PassManagerImpl.h addition
Reid Kleckner [Mon, 3 Feb 2020 22:25:15 +0000 (14:25 -0800)]
Fix modules build after PassManagerImpl.h addition

This new header needs to be in the LLVM_intrinsics_gen module.

4 years agoImprove help text for (lldb) target symbols add
Adrian McCarthy [Tue, 28 Jan 2020 23:15:58 +0000 (15:15 -0800)]
Improve help text for (lldb) target symbols add

There were some missing words and awkward syntax.  I think this is clearer.

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

4 years agoRefactor CommandObjectTargetSymbolsAdd::AddModuleSymbols
Adrian McCarthy [Wed, 29 Jan 2020 00:49:54 +0000 (16:49 -0800)]
Refactor CommandObjectTargetSymbolsAdd::AddModuleSymbols

* [NFC] Renamed local `matching_module_list` to `matching_modules` for
conciseness.

* [NFC] Eliminated redundant local variable `num_matches` to reduce the risk
that changes get it out of sync with `matching_modules.GetSize()`.

* Used an early return from case where the symbol file specified matches
multiple modules.  This is a slight behavior change, but it's an improvement:
It didn't make sense to tell the user that the symbol file simultaneously
matched multiple modules and no modules.

* [NFC] Used an early return from the case where no matches are found, to
better align with LLVM coding style.

* [NFC] Simplified call of `AppendWarningWithFormat("%s", stuff)` to
`AppendWarning(stuff)`.  I don't think this adds any copies.  It does
construct a StringRef, but it was going to have to scan the string for the
length anyway.

* [NFC] Removed unnecessary comments and reworded others for clarity.

* Used an early return if the symbol file could not be loaded.  This is a
behavior change because previously it could fail silently.

* Used an early return if the object file could not be retrieved from the
symbol file.  Again, this is a change because now there's an error message.

* [NFC] Eliminated a namespace alias that wasn't particularly helpful.

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

4 years agoFix LLVM_ENABLE_MODULES build after TypeSize.h change
Reid Kleckner [Mon, 3 Feb 2020 22:21:35 +0000 (14:21 -0800)]
Fix LLVM_ENABLE_MODULES build after TypeSize.h change

4 years ago[ARM] MVE vector reduction fadd and fmul tests. NFC
David Green [Mon, 3 Feb 2020 18:56:15 +0000 (18:56 +0000)]
[ARM] MVE vector reduction fadd and fmul tests. NFC

4 years agoOmit "Contents of" headers when -no-leading-headers is specified.
Michael Trent [Wed, 29 Jan 2020 19:18:19 +0000 (11:18 -0800)]
Omit "Contents of" headers when -no-leading-headers is specified.

Summary:
llvm-objdump -macho will no longer print "Contents of" headers when
disassembling section contents when -no-leading-headers is specified.
For historical reasons, this flag is independent of -no-leading-addr.

Reviewers: ab, pete, jhenderson

Reviewed By: jhenderson

Subscribers: rupprecht, llvm-commits

Tags: #llvm

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

4 years ago[mlir] Accept an LLVM::LLVMFuncOp in the builder of LLVM::CallOp
Alex Zinenko [Mon, 3 Feb 2020 15:51:16 +0000 (16:51 +0100)]
[mlir] Accept an LLVM::LLVMFuncOp in the builder of LLVM::CallOp

Summary:
Replace the generic zero- and one-result builders in LLVM::CallOp with a custom
builder that takes an LLVMFuncOp, which can be used to extract the result type
and create the symbol reference attribute. This is merely a convenience for
upcoming changes. The ODS-generated builders remain present.

Introduce LLVM::LLVMType::isVoidTy by analogy with the underlying LLVM type.

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

4 years ago[NFC] Factor out function to detect if an attribute has an argument.
Tyker [Sun, 2 Feb 2020 13:47:00 +0000 (14:47 +0100)]
[NFC] Factor out function to detect if an attribute has an argument.

4 years agoscudo: Use more size classes in the malloc_free_loop benchmarks.
Peter Collingbourne [Mon, 3 Feb 2020 20:39:59 +0000 (12:39 -0800)]
scudo: Use more size classes in the malloc_free_loop benchmarks.

As a result of recent changes to the Android size classes, the malloc_free_loop
benchmark started exhausting the 8192 size class at 32768 iterations. To avoid
this problem (and to make the test more realistic), change the benchmark to
use a variety of size classes.

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

4 years ago[analyzer] Suppress linker invocation in scan-build tests.
Artem Dergachev [Mon, 3 Feb 2020 21:11:56 +0000 (00:11 +0300)]
[analyzer] Suppress linker invocation in scan-build tests.

This should fix PS4 buildbots.

4 years ago[analyzer] Re-land 0aba69e "Add test directory for scan-build."
Artem Dergachev [Fri, 15 Nov 2019 22:36:42 +0000 (14:36 -0800)]
[analyzer] Re-land 0aba69e "Add test directory for scan-build."

The tool is now looked for in the source directory rather than in the
install directory, which should exclude the problems with not being able
to find it.

The tests still aren't being run on Windows, but they hopefully will run
on other platforms that have shell, which hopefully also means Perl.

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

4 years agoAMDGPU: Analyze divergence of inline asm
Matt Arsenault [Mon, 3 Feb 2020 17:33:43 +0000 (12:33 -0500)]
AMDGPU: Analyze divergence of inline asm

4 years ago[GWP-ASan] Allow late initialisation if single-threaded.
Mitch Phillips [Mon, 3 Feb 2020 20:25:51 +0000 (12:25 -0800)]
[GWP-ASan] Allow late initialisation if single-threaded.

Summary:
This patch allows for late initialisation of the GWP-ASan allocator. Previously, if late initialisation occurred, the sample counter was never updated, meaning we would end up having to wait for 2^32 allocations before getting a sampled allocation.

Now, we initialise the sampling mechanism in init() as well. We require init() to be called single-threaded, so this isn't a problem.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: merge_guards_bot, mgorny, #sanitizers, llvm-commits, cferris

Tags: #sanitizers, #llvm

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

4 years agoAMDGPU/GlobalISel: Allow selecting s128 load/stores
Matt Arsenault [Sat, 1 Feb 2020 16:02:04 +0000 (11:02 -0500)]
AMDGPU/GlobalISel: Allow selecting s128 load/stores

4 years agoAMDGPU: Fix splitting wide f32 s.buffer.load intrinsics
Matt Arsenault [Sat, 1 Feb 2020 16:35:15 +0000 (11:35 -0500)]
AMDGPU: Fix splitting wide f32 s.buffer.load intrinsics

This would witch f32 to i32, and produce an invald concat_vectors from
i32 pieces to an f32 vector.

4 years agoRevert "[clang-doc] Improving Markdown Output"
Petr Hosek [Mon, 3 Feb 2020 20:27:09 +0000 (12:27 -0800)]
Revert "[clang-doc] Improving Markdown Output"

This reverts commit 0fbaf3a7c2395d751cfa4ecd7f483f077b03d9bd as tests
are failing on some bots.

4 years ago[AIX] Don't use a zero fill with a second parameter
David Tenty [Mon, 3 Feb 2020 20:14:08 +0000 (15:14 -0500)]
[AIX] Don't use a zero fill with a second parameter

Summary:
The AIX assembler .space directive can't take a second non-zero argument to fill
with. But LLVM emitFill currently assumes it can. We add a flag to the AsmInfo
to check if non-zero fill is supported, and if we can't zerofill non-zero values
we just splat the .byte directives.

Reviewers: stevewan, sfertile, DiggerLin, jasonliu, Xiangling_L

Reviewed By: jasonliu

Subscribers: Xiangling_L, wuzish, nemanjai, hiraditya, kbarton, jsji, llvm-commits

Tags: #llvm

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

4 years ago[clang-doc] Improving Markdown Output
Petr Hosek [Mon, 3 Feb 2020 19:45:25 +0000 (11:45 -0800)]
[clang-doc] Improving Markdown Output

This change has two components. The moves the generated file
for a namespace to the directory named after the namespace in
a file named 'index.<format>'. This greatly improves the browsing
experience since the index page is shown by default for a directory.

The second improves the markdown output by adding the links to the
referenced pages for children objects and the link back to the source
code.

Patch By: Clayton

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

4 years ago[MLIR][Linalg] Use GenericLoopNestRangeBuilder in tiling code.
Alexander Belyaev [Mon, 3 Feb 2020 11:41:19 +0000 (12:41 +0100)]
[MLIR][Linalg] Use GenericLoopNestRangeBuilder in tiling code.

Preparation for adding support for tiling to parallel loops.

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

4 years ago[MLIR][Linalg] Allow fusion of more than 2 linalg ops.
Alexander Belyaev [Mon, 3 Feb 2020 12:52:13 +0000 (13:52 +0100)]
[MLIR][Linalg] Allow fusion of more than 2 linalg ops.

LinalgDependenceGraph was not updated after successful producer-consumer
fusion for linalg ops. In this patch it is fixed by reconstructing
LinalgDependenceGraph on every iteration. This is very ineffective and
should be improved by updating LDGraph only when it is necessary.

4 years ago[AArch64][GlobalISel] Walk through G_AND in TB(N)Z bit calculation
Jessica Paquette [Fri, 31 Jan 2020 00:17:21 +0000 (16:17 -0800)]
[AArch64][GlobalISel] Walk through G_AND in TB(N)Z bit calculation

Given

```
tb(n)z (and x, m), b
```

Where the `b`-th bit of `m` is 1,

```
tb(n)z (and x, m), b == tb(n)z x, b
```

So, we can walk past a `G_AND` in this case.

Also add test/CodeGen/AArch64/GlobalISel/opt-fold-and-tbz-tbnz.mir to test this.

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

4 years ago[AArch64][GlobalISel] Don't reconvert to p0 in convertPtrAddToAdd().
Amara Emerson [Mon, 3 Feb 2020 18:32:25 +0000 (10:32 -0800)]
[AArch64][GlobalISel] Don't reconvert to p0 in convertPtrAddToAdd().

convertPtrAddToAdd improved overall code size and quality by a significant amount,
but on -O0 we generate some cross-class copies due to the fact that we emitted
G_PTRTOINT and G_INTTOPTR around the G_ADD. Unfortunately at -O0 we don't run any
register coalescing, so these cross class copies end up escaping as moves, and
we ended up regressing 3 benchmarks on CTMark (though still a winner overall).

This patch changes the lowering to instead directly emit the G_ADD into the
destination register, and then force changes the dest LLT to s64 from p0. This
should be ok, as all uses of the register should now be selected and therefore
the LLT doesn't matter for the users. It does however matter for the importer
patterns, which will fail to select a G_ADD if there's a p0 LLT.

I'm not able to get rid of the G_PTRTOINT on the source yet however. We can't
use the same trick of breaking the type system since that could break the
selection of the defining instruction. Thus with -O0 we still end up with a
cross class copy on source.

Code size improvements on -O0:
Program                                         baseline      new         diff
 test-suite :: CTMark/Bullet/bullet.test        965520       949164      -1.7%
 test-suite...TMark/7zip/7zip-benchmark.test    1069456      1052600     -1.6%
 test-suite...ark/tramp3d-v4/tramp3d-v4.test    1213692      1199804     -1.1%
 test-suite...:: CTMark/sqlite3/sqlite3.test    421680       419736      -0.5%
 test-suite...-typeset/consumer-typeset.test    837076       833380      -0.4%
 test-suite :: CTMark/lencod/lencod.test        799712       796976      -0.3%
 test-suite...:: CTMark/ClamAV/clamscan.test    688264       686132      -0.3%
 test-suite :: CTMark/kimwitu++/kc.test         1002344      999648      -0.3%
 test-suite...Mark/mafft/pairlocalalign.test    422296       421768      -0.1%
 test-suite :: CTMark/SPASS/SPASS.test          656792       656532      -0.0%
 Geomean difference                                                      -0.6%

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

4 years agoGlobalISel: Implement fewerElementsVector for G_SEXT_INREG
Matt Arsenault [Sun, 12 Jan 2020 00:05:06 +0000 (19:05 -0500)]
GlobalISel: Implement fewerElementsVector for G_SEXT_INREG

Start using a new strategy with a combination of merge and unmerges.

This allows scalarizing before lowering, which in cases like
<2 x s128> avoids producing giant illegal shifts.

4 years ago[TargetRegisterInfo] Make the heuristic to skip region split overridable by the target
Quentin Colombet [Mon, 3 Feb 2020 18:22:50 +0000 (10:22 -0800)]
[TargetRegisterInfo] Make the heuristic to skip region split overridable by the target

RegAllocGreedy uses a fairly compile time intensive splitting heuristic
called region splitting. This heuristic was disabled via another heuristic
when it is likely that it won't be worth the compile time. The only way
to control this other heuristic was via a command line option (huge-size-for-split).

This commit gives more control on this heuristic by making it overridable
by the target using a target hook in TargetRegisterInfo called
shouldRegionSplitForVirtReg.

The default implementation of this hook keeps the heuristic as it was
before this patch.

4 years agoFix a -Wbitwise-conditional-parentheses warning in _LIBUNWIND_ARM_EHABI libunwind...
Nico Weber [Mon, 3 Feb 2020 19:16:52 +0000 (14:16 -0500)]
Fix a -Wbitwise-conditional-parentheses warning in _LIBUNWIND_ARM_EHABI libunwind builds

```
src/UnwindCursor.hpp:1344:51: error: operator '?:' has lower precedence than '|';
    '|' will be evaluated first [-Werror,-Wbitwise-conditional-parentheses]
  _info.flags = isSingleWordEHT ? 1 : 0 | scope32 ? 0x2 : 0;  // Use enum?
                                      ~~~~~~~~~~~ ^
src/UnwindCursor.hpp:1344:51: note: place parentheses around the '|' expression
    to silence this warning
  _info.flags = isSingleWordEHT ? 1 : 0 | scope32 ? 0x2 : 0;  // Use enum?
                                                  ^
                                      (          )
src/UnwindCursor.hpp:1344:51: note: place parentheses around the '?:' expression
    to evaluate it first
  _info.flags = isSingleWordEHT ? 1 : 0 | scope32 ? 0x2 : 0;  // Use enum?
                                                  ^
                                          (                )
```

But `0 |` is a no-op for either of those two interpretations, so I think
what was meant here was

```
  _info.flags = (isSingleWordEHT ? 1 : 0) | (scope32 ? 0x2 : 0);  // Use enum?
```

Previously, if `isSingleWordEHT` was set, bit 2 would never be set. Now
it is. From what I can tell, the only thing that checks these bitmask is
ProcessDescriptors in Unwind-EHABI.cpp, and that only cares about bit 1,
so in practice this shouldn't have much of an effect.

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

4 years agoAdd PassManagerImpl.h to hide implementation details
Reid Kleckner [Sat, 1 Feb 2020 00:05:32 +0000 (16:05 -0800)]
Add PassManagerImpl.h to hide implementation details

ClangBuildAnalyzer results show that a lot of time is spent
instantiating AnalysisManager::getResultImpl across the code base:

**** Templates that took longest to instantiate:
 50445 ms: llvm::AnalysisManager<llvm::Function>::getResultImpl (412 times, avg 122 ms)
 47797 ms: llvm::AnalysisManager<llvm::Function>::getResult<llvm::TargetLibraryAnalysis> (389 times, avg 122 ms)
 46894 ms: std::tie<const unsigned long long, const bool> (2452 times, avg 19 ms)
 43851 ms: llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096, 4096>::Allocate (3228 times, avg 13 ms)
 33911 ms: std::tie<const unsigned int, const unsigned int, const unsigned int, const unsigned int> (897 times, avg 37 ms)
 33854 ms: std::tie<const unsigned long long, const unsigned long long> (1897 times, avg 17 ms)
 27886 ms: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string (11156 times, avg 2 ms)

I mentioned this result to @chandlerc, and he suggested this direction.

AnalysisManager is already explicitly instantiated, and getResultImpl
doesn't need to be inlined. Move the definition to an Impl header, and
include that header in files that explicitly instantiate
AnalysisManager. There are only four (real) IR units:
- function
- module
- loop
- cgscc

Looking at a specific transform (ArgumentPromotion.cpp), here are three
compilations before & after this change:

BEFORE:
$ for i in $(seq 3) ; do ./ccit.bat ; done
peak memory: 258.15MB
real: 0m6.297s
peak memory: 257.54MB
real: 0m5.906s
peak memory: 257.47MB
real: 0m6.219s

AFTER:
$ for i in $(seq 3) ; do ./ccit.bat ; done
peak memory: 235.35MB
real: 0m5.454s
peak memory: 234.72MB
real: 0m5.235s
peak memory: 234.39MB
real: 0m5.469s

The 20MB of memory saved seems real, and the time improvement seems like
it is there.

Reviewed By: MaskRay

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

4 years agoRevert "[SVE] Fix bug in simplification of scalable vector instructions"
Reid Kleckner [Mon, 3 Feb 2020 19:12:09 +0000 (11:12 -0800)]
Revert "[SVE] Fix bug in simplification of scalable vector instructions"

This reverts commit 31574d38ac5fa4646cf01dd252a23e682402134f.

The newly added shufflevector test does not pass locally on either of my
workstations.

4 years ago[llvm-objdump] Suppress spurious warnings when parsing Mach-O binaries.
Michael Trent [Wed, 29 Jan 2020 19:07:53 +0000 (11:07 -0800)]
[llvm-objdump] Suppress spurious warnings when parsing Mach-O binaries.

Summary:
llvm-objdump started warning when asked to disassemble a section that
isn't present in the input files, in Yuanfang Chen's change:
d16c162c9453db855503134fe29ae4a3c0bec936. The problem is that the
logic was restricted only to the generic llvm-objdump parser, not to the
Mach-O-specific parser used for Apple toolchain compatibility. The
solution is to log section names from the Mach-O parser.

The macho-cstring-dump.test has been updated to fail if it encounters
this new warning in the future.

Reviewers: pete, ab, lhames, jhenderson, grimar, MaskRay, ychen

Reviewed By: jhenderson, grimar

Subscribers: rupprecht, llvm-commits

Tags: #llvm

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