platform/upstream/llvm.git
4 years ago[MLIR][NFC] Add FuncOp::getArgumentTypes()
Rahul Joshi [Fri, 31 Jul 2020 18:39:49 +0000 (11:39 -0700)]
[MLIR][NFC] Add FuncOp::getArgumentTypes()

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

4 years ago[lldb] report an error if a CLI option lacks an argument
Luboš Luňák [Thu, 30 Jul 2020 16:08:13 +0000 (18:08 +0200)]
[lldb] report an error if a CLI option lacks an argument

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

4 years ago[lldb] force full gui redraw on Ctrl+L
Luboš Luňák [Thu, 30 Jul 2020 19:25:38 +0000 (21:25 +0200)]
[lldb] force full gui redraw on Ctrl+L

As is common with curses apps, this allows to redraw everything
in case something corrupts the screen. Apparently key modifiers
are difficult with curses (curses FAQ it "doesn't do that"),
thankfully Ctrl+key are simply control characters, so it's
(ascii & 037) => 12.

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

4 years ago[clang] Use the location of the void parameters when complaining that only a single...
Jaydeep Chauhan [Fri, 31 Jul 2020 19:22:22 +0000 (20:22 +0100)]
[clang] Use the location of the void parameters when complaining that only a single void parameter should be present.

Fixes PR46417.

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

Reviewed By: aaron.ballman

4 years agoFix a test typo which caused a breakage.
Sriraman Tallam [Fri, 31 Jul 2020 19:26:53 +0000 (12:26 -0700)]
Fix a test typo which caused a breakage.

4 years agoNew test for basic block sections options.
Sriraman Tallam [Fri, 31 Jul 2020 19:00:59 +0000 (12:00 -0700)]
New test for basic block sections options.

This tests lld basic block sections options:
+ --lto-basic-block-sections=
+ --lto-unique-basic-block-section-names

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

4 years ago[libc] [obvious] Add rest of strrchr test.
Chris Gyurgyik [Fri, 31 Jul 2020 18:57:46 +0000 (14:57 -0400)]
[libc] [obvious] Add rest of strrchr test.

4 years agoRename basic block sections options to be consistent.
Sriraman Tallam [Fri, 31 Jul 2020 18:14:49 +0000 (11:14 -0700)]
Rename basic block sections options to be consistent.

D68049 created options for basic block sections: -fbasic-block-sections=,
-funique-basic-block-section-names. Rename options in llc and lld (--lto-)
to be consistent. Specifically,

+ Rename basicblock-sections to basic-block-sections
+ Rename unique-bb-section-names to unique-basic-block-section-names

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

4 years ago[compiler-rt][Darwin] Fix GetOSMajorKernelOffset() on watchOS
Julian Lettner [Fri, 31 Jul 2020 18:38:10 +0000 (11:38 -0700)]
[compiler-rt][Darwin] Fix GetOSMajorKernelOffset() on watchOS

`TARGET_OS_IOS` and `TARGET_OS_WATCH` are not mutually exclusive.
`SANITIZER_IOS` is defined for all embedded platforms.  So the branch
for watchOS is never taken.  We could fix this by switching the order
of the branches (but the reason for doing so is non-obvious).  Instead,
lets use the Darwin-specific `TARGET_OS_*` macros which are mutually
exclusive.

4 years ago[libc] Adds strrchr implementation.
cgyurgyik [Fri, 31 Jul 2020 18:36:23 +0000 (14:36 -0400)]
[libc] Adds strrchr implementation.

Reviewed By: sivachandra

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

4 years ago[gn build] Port b7cfa6ca928
LLVM GN Syncbot [Fri, 31 Jul 2020 18:32:54 +0000 (18:32 +0000)]
[gn build] Port b7cfa6ca928

4 years ago[Loop Peeling] Separate the Loop Peeling Utilities from the Loop Unrolling Utilities
Sidharth Baveja [Fri, 31 Jul 2020 18:31:58 +0000 (18:31 +0000)]
[Loop Peeling] Separate the Loop Peeling Utilities from the Loop Unrolling Utilities

Summary: This patch separates the Loop Peeling Utilities from Loop Unrolling.
The reason for this change is that Loop Peeling is no longer only being used by
loop unrolling; Patch D82927 introduces loop peeling with fusion, such that
loops can be modified to have to same trip count, making them legal to be
peeled.

Reviewed By: Meinersbur

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

4 years ago[flang][OpenMP] Added initial support for lowering OpenMP parallel construct
Sourabh Singh Tomar [Thu, 30 Jul 2020 18:17:51 +0000 (23:47 +0530)]
[flang][OpenMP] Added initial support for lowering OpenMP  parallel construct

This patch lower `!OMP PARALLEL` construct from PFT to OpenMPDialect operations.
This is first patch in this direction(lowering parallel construct).

OpenMP parallel construct can have multiple clauses and parameters. This patch
only implements lowering of an empty(contains no code in body) parallel construct
without any clauses or parameters.

Patch is carved out of following approved PR:
https://github.com/flang-compiler/f18-llvm-project/pull/322

Reviewed By: kiranchandramohan, DavidTruby

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

4 years ago[flang][NFC] Verify C781 from - Clause 7 constraint checks for f18.
sameeran joshi [Fri, 24 Jul 2020 06:55:32 +0000 (12:25 +0530)]
[flang][NFC] Verify C781 from - Clause 7 constraint checks for f18.

Reviewed By: PeteSteinfeld

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

4 years ago[libc++] Avoid including <Block.h> from <functional>
Louis Dionne [Fri, 31 Jul 2020 16:56:36 +0000 (12:56 -0400)]
[libc++] Avoid including <Block.h> from <functional>

Block.h is a pretty common name, which can lead to nasty collisions with
user provided headers. Since we're only getting a few simple declarations
from the header, it's better to declare them manually than to include the
header.

rdar://66384326

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

4 years ago[Support] Fix computeHostNumPhysicalCores() to respect affinity
Fangrui Song [Fri, 31 Jul 2020 18:20:15 +0000 (11:20 -0700)]
[Support] Fix computeHostNumPhysicalCores() to respect affinity

computeHostNumPhysicalCores() is designed to respect CPU affinity.
D84764 used sysconf(_SC_NPROCESSORS_ONLN) which does not respect
affinity.
SupportTests Threading.PhysicalConcurrency may fail if taskset -c is specified.

4 years ago[flang]Verify C7107, C7108, C7109 from - Clause 7 constraint checks for f18.
sameeran joshi [Fri, 24 Jul 2020 08:19:29 +0000 (13:49 +0530)]
[flang]Verify C7107, C7108, C7109 from - Clause 7 constraint checks for f18.

   1.  Annotate the sources with constraint numbers.
   2.  Add tests for

    *C7107 (R765) digit shall have one of the values 0 or 1.
    *C7108 (R766) digit shall have one of the values 0 through 7.
    *C7109 (R764) A boz-literal-constant shall appear only as a data-stmt-constant in a DATA statement, or where explicitly allowed in 16.9 as an actual argument of an intrinsic procedure.

Reviewed By: PeteSteinfeld

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

4 years agoRevert "[flang] Fix multi-config generator builds."
Tim Keith [Fri, 31 Jul 2020 18:10:44 +0000 (11:10 -0700)]
Revert "[flang] Fix multi-config generator builds."

This reverts commit 332170356e35ea9cdc2c1d612b61a50ec5ea322e.

The change breaks out-of-tree builds.
Discussion in https://reviews.llvm.org/D84022

4 years ago[ConstantFolding] fold abs intrinsic
Sanjay Patel [Fri, 31 Jul 2020 15:50:39 +0000 (11:50 -0400)]
[ConstantFolding] fold abs intrinsic

The handling for minimum value is similar to cttz/ctlz with 0 just above this case.

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

4 years agoRuntimeDyldELF: report_fatal_error instead of asserting for unimplemented relocations...
Hans Wennborg [Thu, 23 Jul 2020 09:17:16 +0000 (11:17 +0200)]
RuntimeDyldELF: report_fatal_error instead of asserting for unimplemented relocations (PR46816)

This fixes the ExecutionEngine/MCJIT/stubs-sm-pic.ll test in no-asserts
builds which is set to XFAIL on some platforms like 32-bit x86. More
importantly, we probably don't want to silently error in these cases.

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

4 years ago[libc] Add islower and isupper implementation.
cgyurgyik [Fri, 31 Jul 2020 18:04:36 +0000 (14:04 -0400)]
[libc] Add islower and isupper implementation.

Reviewed By: sivachandra

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

4 years ago[libunwind] Add -Wno-suggest-override to CMakeLists.txt.
kristina [Fri, 31 Jul 2020 17:44:02 +0000 (18:44 +0100)]
[libunwind] Add -Wno-suggest-override to CMakeLists.txt.

Set -Wno-suggest-override where such warning is provided
by the compiler when building libunwind, alongside libcxx
and libcxxabi, using recent Clang. This extends behavior
introduced in 77e0e9e17daf0865620abcd41f692ab0642367c4
to libunwind, avoiding a large amount of warnings during
builds. See D84126 for the original patch.

4 years ago[OpenMP][docs] Update loop tiling status.
Michael Kruse [Fri, 31 Jul 2020 18:00:06 +0000 (13:00 -0500)]
[OpenMP][docs] Update loop tiling status.

4 years ago[ValueTracking] Add ComputeNumSignBits support for llvm.abs intrinsic
Craig Topper [Fri, 31 Jul 2020 17:43:00 +0000 (10:43 -0700)]
[ValueTracking] Add ComputeNumSignBits support for llvm.abs intrinsic

If absolute value needs turn a negative number into a positive number it reduces the number of sign bits by at most 1.

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

4 years ago[Flang] Checks for constraint C7110-C7115.
sameeran joshi [Thu, 30 Jul 2020 19:32:04 +0000 (01:02 +0530)]
[Flang] Checks for constraint C7110-C7115.

Added more tests.
 Annotate sources and tests.
 Improve error message.

Reviewed By: PeteSteinfeld

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

4 years ago[lldb/Test] Reduce code duplication by importing subprocess globally
Jonas Devlieghere [Fri, 31 Jul 2020 17:52:49 +0000 (10:52 -0700)]
[lldb/Test] Reduce code duplication by importing subprocess globally

Import the subprocess module once instead of doing it inline which is
error prone and leads to needless code duplication.

4 years ago[ThinLTO] Compile time improvement to propagateAttributes
Teresa Johnson [Thu, 30 Jul 2020 20:49:49 +0000 (13:49 -0700)]
[ThinLTO] Compile time improvement to propagateAttributes

I found that propagateAttributes was ~23% of a thin link's run time
(almost 4x higher than the second hottest function). The main reason is
that it re-examines a global var each time it is referenced. This
becomes unnecessary once it is marked both non read only and non write
only. I added a set to avoid doing redundant work, which dropped the
runtime of that thin link by almost 15%.

I made a smaller efficiency improvement (no measurable impact) to skip
all summaries for a VI if the first copy is dead. I added an assert to
ensure that all copies are dead if any is. The code in
computeDeadSymbols marks all summaries for a VI as live. There is one
corner case where it was skipping marking an alias as live, that I
fixed. However, since the code earlier marked all copies of a preserved
GUID's VI as live, and each 'visit' marks all copies live, the only case
where this could make a difference is summaries that were marked live
when they were built initially, and that is only a few special compiler
generated symbols and inline assembly symbols, so it likely is never
provoked in practice.

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

4 years ago[Support][CommandLine] Delete unused llvm::cl::ParseEnvrironmentOptions
Fangrui Song [Fri, 31 Jul 2020 17:46:27 +0000 (10:46 -0700)]
[Support][CommandLine] Delete unused llvm::cl::ParseEnvrironmentOptions

The function was added in 2003. It is not used and can be emulated with ParseCommandLineOptions.

4 years ago[PowerPC] Add Vector String Isolate instruction definitions and MC Tests
Albion Fung [Fri, 31 Jul 2020 16:57:59 +0000 (11:57 -0500)]
[PowerPC] Add Vector String Isolate instruction definitions and MC Tests

This patch implements the instruction definition and MC tests for the vector
string isolate instructions.

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

4 years ago[SCEVExpander] Name temporary instructions for LCSSA insertion (NFC).
Florian Hahn [Fri, 31 Jul 2020 17:16:01 +0000 (18:16 +0100)]
[SCEVExpander] Name temporary instructions for LCSSA insertion (NFC).

4 years ago[GISel] Add combiners for G_INTTOPTR and G_PTRTOINT
Aditya Nandakumar [Fri, 31 Jul 2020 16:41:06 +0000 (09:41 -0700)]
[GISel] Add combiners for G_INTTOPTR and G_PTRTOINT

https://reviews.llvm.org/D84909

Patch adds two new GICombinerRules, one for G_INTTOPTR and one for
G_PTRTOINT. The G_INTTOPTR elides ptr2int(int2ptr(x)) to a copy of x, if
the cast is within the same address space. The G_PTRTOINT elides
int2ptr(ptr2int(x)) to a copy of x. Patch additionally adds new combiner
tests for the AArch64 target to test these new combiner rules.

Patch by mkitzan

4 years agoDisable getauxval for Go
Keith Randall [Fri, 31 Jul 2020 17:04:04 +0000 (10:04 -0700)]
Disable getauxval for Go

We want the Go build to not use getauxval, as we must support glibc < 2.16 platforms.

Reviewed By: dvyukov

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

4 years ago[X86][SSE] Cleanup bitwise reduction check prefixes. NFC
Simon Pilgrim [Fri, 31 Jul 2020 11:51:46 +0000 (12:51 +0100)]
[X86][SSE] Cleanup bitwise reduction check prefixes. NFC

Add AVX512BW/AVX512BWVL prefixes for a future patch

4 years ago[PGO][test] Add test to check memops changes function hash
Hiroshi Yamauchi [Thu, 30 Jul 2020 18:22:25 +0000 (11:22 -0700)]
[PGO][test] Add test to check memops changes function hash

Following up D84782.

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

4 years ago[AutoFDO] Avoid merging inlinee samples multiple times
Hongtao Yu [Fri, 31 Jul 2020 01:22:50 +0000 (18:22 -0700)]
[AutoFDO] Avoid merging inlinee samples multiple times

A function call can be replicated by optimizations like loop unroll and jump threading and the replicates end up sharing the sample nested callee profile. Therefore when it comes to merging samples for uninlined callees in the sample profile inliner, a callee profile can be merged multiple times which will cause an assert to fire.

This change avoids merging same callee profile for duplicate callsites by filtering out callee profiles with a non-zero head sample count.

Reviewed By: wenlei, wmi

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

4 years ago[gn build] Port df69492cdfa
LLVM GN Syncbot [Fri, 31 Jul 2020 16:23:24 +0000 (16:23 +0000)]
[gn build] Port df69492cdfa

4 years ago[llvm-libtool-darwin] Refactor Slice and writeUniversalBinary
Sameer Arora [Thu, 23 Jul 2020 23:26:42 +0000 (16:26 -0700)]
[llvm-libtool-darwin] Refactor Slice and writeUniversalBinary

Refactoring `Slice` class and function `createUniversalBinary` from
`llvm-lipo` into  MachOUniversalWriter. This refactoring is necessary so
as to use the refactored code for creating universal binaries under
llvm-libtool-darwin.

Reviewed by alexshap, smeenai

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

4 years ago[PowerPC] Implement low-order Vector Modulus Builtins, and add Vector Multiply/Divide...
Amy Kwan [Tue, 28 Jul 2020 04:45:54 +0000 (23:45 -0500)]
[PowerPC] Implement low-order Vector Modulus Builtins, and add Vector Multiply/Divide/Modulus Builtins Tests

Power10 introduces new instructions for vector multiply, divide and modulus.
These instructions can be exploited by the builtin functions: vec_mul, vec_div,
and vec_mod, respectively.

This patch aims adds the function prototype, vec_mod, as vec_mul and vec_div
been previously implemented in altivec.h.

This patch also adds the following front end tests:
vec_mul for v2i64
vec_div for v4i32 and v2i64
vec_mod for v4i32 and v2i64

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

4 years ago[DWARFYAML][debug_aranges] Use yaml::Hex64 rather than uint64_t as length. NFC.
Xing GUO [Fri, 31 Jul 2020 15:20:44 +0000 (23:20 +0800)]
[DWARFYAML][debug_aranges] Use yaml::Hex64 rather than uint64_t as length. NFC.

It's better to use yaml::Hex64 as length in the tuples of the address
range table.

4 years agoHide some internal symbols. NFC.
Benjamin Kramer [Fri, 31 Jul 2020 15:27:44 +0000 (17:27 +0200)]
Hide some internal symbols. NFC.

4 years agoAdd flang to export.sh to it gets source tarballs in releases
Hans Wennborg [Fri, 31 Jul 2020 15:22:49 +0000 (17:22 +0200)]
Add flang to export.sh to it gets source tarballs in releases

4 years ago[libc++] Fix eager generator expression in DefineLinkerScript
Louis Dionne [Fri, 31 Jul 2020 15:18:01 +0000 (11:18 -0400)]
[libc++] Fix eager generator expression in DefineLinkerScript

As explained in https://gitlab.kitware.com/cmake/cmake/-/issues/21045,
both branches of an $<IF> generator expression are evaluated eagerly
by CMake. As a result, if the non-selected branch contains an invalid
generator expression (such as getting the OUTPUT_NAME property of a
non-existent target), a hard error will occur.

This failed builds using the cxxrt ABI library, which doesn't create
a CMake target currently.

4 years ago[mlir][spirv] Relax restriction on pointer type for CooperativeMatrix load/store
Thomas Raoux [Fri, 31 Jul 2020 15:02:21 +0000 (08:02 -0700)]
[mlir][spirv] Relax restriction on pointer type for CooperativeMatrix load/store

This change allow CooperativeMatrix Load/Store operations to use pointer type
that may not match the matrix element type. This allow us to declare buffer
with a larger type size than the matrix element type. This follows SPIR-V spec
and this is needed to be able to use cooperative matrix in combination with
shared local memory efficiently.

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

4 years ago[flang] Add -h as a synonym for help
Richard Barton [Sat, 18 Jul 2020 13:22:18 +0000 (14:22 +0100)]
[flang] Add -h as a synonym for help

As expected by user in http://lists.llvm.org/pipermail/flang-dev/2020-June/000404.html

Depends on D84856

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

4 years ago[flang] Add details to --help screen on default behaviour
Richard Barton [Thu, 25 Jun 2020 15:01:56 +0000 (16:01 +0100)]
[flang] Add details to --help screen on default behaviour

Add a usage string and a defaults section that clarifies:
 * If no input files are given, f18 reads from stdin
 * If no input files are given, f18 dumps the parse tree.
 * The default behaviour is to exec F18_FC.
 * The fefault F18_FC setting is 'gfortran'

Adds a simple regression test which tests the top and tail of the help
screen and the exit status.

Depends on D84855

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

4 years ago[flang] Make interactive behaviour more obvious
Richard Barton [Fri, 17 Jul 2020 08:15:21 +0000 (09:15 +0100)]
[flang] Make interactive behaviour more obvious

When flang is invoked with no files it waits for input on stdin. Make it
print a message saying this to prevent the user being surprised.

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

4 years agoSupport addrspacecast initializers with isNoopAddrSpaceCast
Matt Arsenault [Fri, 27 May 2016 22:50:12 +0000 (15:50 -0700)]
Support addrspacecast initializers with isNoopAddrSpaceCast

Moves isNoopAddrSpaceCast to the TargetMachine. It logically belongs
with the DataLayout.

4 years ago[MLIR][Shape] Allow unsafe `shape.broadcast`
Frederik Gossen [Fri, 31 Jul 2020 14:17:31 +0000 (14:17 +0000)]
[MLIR][Shape] Allow unsafe `shape.broadcast`

In a context in which `shape.broadcast` is known not to produce an error value,
we want it to operate solely on extent tensors. The operation's behavior is
then undefined in the error case as the result type cannot hold this value.

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

4 years ago[gn build] (manually) merge 63d3aeb529
Nico Weber [Fri, 31 Jul 2020 13:54:39 +0000 (09:54 -0400)]
[gn build] (manually) merge 63d3aeb529

4 years ago[MLIR,OpenMP][NFCI] Removed loop for accessing regions of ParallelOp
Sourabh Singh Tomar [Fri, 31 Jul 2020 13:22:12 +0000 (18:52 +0530)]
[MLIR,OpenMP][NFCI] Removed loop for accessing regions of ParallelOp

`ParallelOp` has only one region associated with it.

Reviewed By: kiranchandramohan, ftynse

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

4 years agoDR2303: Prefer 'nearer' base classes during template deduction.
Erich Keane [Fri, 17 Jul 2020 16:48:01 +0000 (09:48 -0700)]
DR2303: Prefer 'nearer' base classes during template deduction.

DR2303 fixes the case where the derived-base match for template
deduction is ambiguous if a base-of-base ALSO matches. The canonical
example (as shown in the test) is just like the MSVC implementation of
std::tuple.

This fixes a fairly sizable issue, where if a user inherits from
std::tuple on Windows (with the MS STL), they cannot use that type to
call a function that takes std::tuple.

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

4 years ago[clangd] Be more explicit on testing the optional DefLoc in LocatedSymbol.
Haojian Wu [Fri, 31 Jul 2020 12:32:18 +0000 (14:32 +0200)]
[clangd] Be more explicit on testing the optional DefLoc in LocatedSymbol.

And also fix a bug where we may return a meaningless location.

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

4 years ago[clang-tidy] Fix build problem after commit 45a720a864320bbbeb596a
Bjorn Pettersson [Fri, 31 Jul 2020 12:28:49 +0000 (14:28 +0200)]
[clang-tidy] Fix build problem after commit 45a720a864320bbbeb596a

When building with LLVM8.0 on RHEL7.8 I got failures like this
after commit 45a720a864320bbbe:

/app/llvm/8.0/bin/../lib/gcc/x86_64-unknown-linux-gnu/
5.4.0/../../../../include/c++/5.4.0/ext/new_allocator.h:120:23:
error: no matching constructor for initialization of
'std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> >'
{ ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }

...

../../clang-tools-extra/clang-tidy/ClangTidyOptions.cpp:73:15:
note: in instantiation of function template specialization
'std::vector<std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> >,
std::allocator<std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> > > >::emplace_back<llvm::StringRef,
const std::__cxx11::basic_string<char> &>' requested here
Options.emplace_back(KeyValue.getKey(), KeyValue.getValue().Value);

This is an attempt to avoid such build problems.

4 years ago[DWARFYAML] Make the debug_aranges entry optional.
Xing GUO [Fri, 31 Jul 2020 04:56:10 +0000 (12:56 +0800)]
[DWARFYAML] Make the debug_aranges entry optional.

This patch makes the 'debug_aranges' entry optional. If the entry is
empty, yaml2obj will only emit the header for it.

Reviewed By: jhenderson

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

4 years ago[DWARFYAML] Add helper function getDWARFEmitterByName(). NFC.
Xing GUO [Fri, 31 Jul 2020 12:06:30 +0000 (20:06 +0800)]
[DWARFYAML] Add helper function getDWARFEmitterByName(). NFC.

In this patch, we add a helper function getDWARFEmitterByName(). This
function returns the proper DWARF section emitting method by the name.

Reviewed By: jhenderson

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

4 years ago[DWARFYAML] Add emitDebug[GNU]Pub[names/types] functions. NFC.
Xing GUO [Fri, 31 Jul 2020 12:02:20 +0000 (20:02 +0800)]
[DWARFYAML] Add emitDebug[GNU]Pub[names/types] functions. NFC.

In this patch, emitDebugPubnames(), emitDebugPubtypes(),
emitDebugGNUPubnames(), emitDebugGNUPubtypes() are added.

Reviewed By: jhenderson

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

4 years ago[clangd] Fix remote index build on macOS
Kirill Bobyrev [Fri, 31 Jul 2020 12:02:19 +0000 (14:02 +0200)]
[clangd] Fix remote index build on macOS

macOS builds suddenly started failing:

https://github.com/kirillbobyrev/indexing-tools/runs/925090879

This patch makes use of imported libraries and fixes builds for macOS.

Landing this without a review since the patch is quite straightforward
and I've been testing it on my local macOS machine for a while.

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

4 years ago[Sanitizers] Fix lint failure with Python 3.6
Nemanja Ivanovic [Fri, 31 Jul 2020 11:19:47 +0000 (06:19 -0500)]
[Sanitizers] Fix lint failure with Python 3.6

There are some files in compiler-rt that use UTF-8 characters in some of the
comments. This causes lint failures with some versions of Python. This patch
just makes the encoding explicit in the call to open.

4 years ago[mlir][Linalg] Conv {1,2,3}D ops defined with TC syntax
Jakub Lichman [Fri, 31 Jul 2020 11:18:11 +0000 (13:18 +0200)]
[mlir][Linalg] Conv {1,2,3}D ops defined with TC syntax

Replaced definition of named ND ConvOps with tensor comprehension
syntax which reduces boilerplate code significantly. Furthermore,
new ops to support TF convolutions added (without strides and dilations).

Reviewed By: nicolasvasilache

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

4 years ago[OpenMP] Use weak attribute in interface only for static library
Joachim Protze [Thu, 30 Jul 2020 07:28:17 +0000 (09:28 +0200)]
[OpenMP] Use weak attribute in interface only for static library

This is to address the issue reported at:
https://bugs.llvm.org/show_bug.cgi?id=46863

Since weak is meaningless for a shared library interface function, this patch
disables the attribute, when the OpenMP library is built as shared library.

ompt_start_tool is not an interface function, but a internally called function
possibly implemented by an OMPT tool.
This function needs to be weak if possible to allow overwriting ompt_start_tool
with a function implementation built into the application.

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

4 years ago[clang][Syntax] syntax::Arena doesnt own TokenBuffer
Kadir Cetinkaya [Thu, 30 Jul 2020 19:38:40 +0000 (21:38 +0200)]
[clang][Syntax] syntax::Arena doesnt own TokenBuffer

Currently an Arena can only be built while consuming a TokenBuffer,
some users (like clangd) might want to share a TokenBuffer with multiple
compenents. This patch changes Arena's TokenBuffer member to be a reference so
that it can be created with read-only token buffers.

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

4 years ago[clangd] Propagate remote index errors via Expected
Kirill Bobyrev [Fri, 31 Jul 2020 09:48:27 +0000 (11:48 +0200)]
[clangd] Propagate remote index errors via Expected

This is a refactoring: errors should be logged only on the highest level.
Switch from Optional to Expected in the serialization code.

Reviewed By: kadircet

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

4 years ago[NFC] Remove unused GetUnderlyingObject paramenter
Vitaly Buka [Fri, 31 Jul 2020 09:09:54 +0000 (02:09 -0700)]
[NFC] Remove unused GetUnderlyingObject paramenter

 Depends on D84617.

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

4 years ago[mlir] Add TFFramework dialect to DialectSymbolRegistry.
Alexander Belyaev [Fri, 31 Jul 2020 09:00:15 +0000 (11:00 +0200)]
[mlir] Add TFFramework dialect to DialectSymbolRegistry.

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

4 years ago[analyzer] Fix out-of-tree only clang build by not relaying on private header
Balazs Benics [Fri, 31 Jul 2020 08:28:14 +0000 (10:28 +0200)]
[analyzer] Fix out-of-tree only clang build by not relaying on private header

It turned out that the D78704 included a private LLVM header, which is excluded
from the LLVM install target.
I'm substituting that `#include` with the public one by moving the necessary
`#define` into that. There was a discussion about this at D78704 and on the
cfe-dev mailing list.

I'm also placing a note to remind others of this pitfall.

Reviewed By: mgorny

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

4 years ago[flang] Fix CMPLX folding with complex arguments
Jean Perier [Fri, 31 Jul 2020 08:25:34 +0000 (10:25 +0200)]
[flang] Fix CMPLX folding with complex arguments

CMPLX folding was expecting only one arguments in case X argument
is complex. This is wrong since there is also the optional KIND
argument.

Reviewed By: schweitz

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

4 years agoRevert "[ELF] Add --dependency-file option"
Petr Hosek [Fri, 31 Jul 2020 08:12:38 +0000 (01:12 -0700)]
Revert "[ELF] Add --dependency-file option"

This reverts commit b4c7657ba602acde1c2ea5391c973949b9c3ce09 which
seems to be breaking certain bots with assertion error.

4 years ago[PowerPC] Retrieve the offset from load/store if it stores to stack slots
QingShan Zhang [Fri, 31 Jul 2020 07:05:45 +0000 (07:05 +0000)]
[PowerPC] Retrieve the offset from load/store if it stores to stack slots

Scheduler will try to retrieve the offset and base addr to determine if two
loads/stores are disjoint memory access. PowerPC failed to handle this for
frame index which will bring extra memory dependency for loads/stores.

Reviewed By: jji

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

4 years ago[Driver] Exclude options::LinkerInput for GCC linking
Fangrui Song [Fri, 31 Jul 2020 07:04:09 +0000 (00:04 -0700)]
[Driver] Exclude options::LinkerInput for GCC linking

options::LinkerInput options may get duplicated after 6a75496836ea14bcfd2f4b59d35a1cad4ac58cee..

4 years ago[Driver] Render -e for Gnu.cpp
Fangrui Song [Fri, 31 Jul 2020 06:49:32 +0000 (23:49 -0700)]
[Driver] Render -e for Gnu.cpp

4 years ago[JumpThreading] Let SimplifyPartiallyRedundantLoad look into freeze
Juneyoung Lee [Fri, 31 Jul 2020 06:26:54 +0000 (15:26 +0900)]
[JumpThreading] Let SimplifyPartiallyRedundantLoad look into freeze

This patch allows SimplifyPartiallyRedundantLoad work when
the branch condition was frozen.

Reviewed By: efriedma

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

4 years ago[MC] Support infix operator !
Fangrui Song [Fri, 31 Jul 2020 06:24:09 +0000 (23:24 -0700)]
[MC] Support infix operator !

Disabled for Darwin mode.

Also disabled for ARM which has compatible aliases (implied 'sp' operand
in 'srs*' instructions like 'srsda #31!').

4 years ago[JumpThreading] Add a test for D84944 ; NFC
Juneyoung Lee [Fri, 31 Jul 2020 06:20:38 +0000 (15:20 +0900)]
[JumpThreading] Add a test for D84944 ; NFC

4 years ago[JITLink] Use correct Addressable constructor.
Lang Hames [Fri, 31 Jul 2020 05:46:04 +0000 (22:46 -0700)]
[JITLink] Use correct Addressable constructor.

Calling createAddressable(false) generates an absolute symbol. We want
createAddressable(0, false), which generates an external symbol.

4 years ago[X86] Remove x86_sse42_crc32_64_64 from X86TTIImpl::simplifyDemandedUseBitsIntrinsic
Craig Topper [Fri, 31 Jul 2020 04:50:17 +0000 (21:50 -0700)]
[X86] Remove x86_sse42_crc32_64_64 from X86TTIImpl::simplifyDemandedUseBitsIntrinsic

It doesn't do any simplifying. It just computes known bits. We
can just let InstCombine call computeKnownBits which will handle
this just as well.

4 years ago[SimpleLoopUnswitch] Preserve make.implicit in non-trivial unswitch if legal
Max Kazantsev [Fri, 31 Jul 2020 04:38:43 +0000 (11:38 +0700)]
[SimpleLoopUnswitch] Preserve make.implicit in non-trivial unswitch if legal

We can preserve make.implicit metadata in the split block if it is
guaranteed that after following the branch we always reach the block
where processing of null case happens, which is equivalent to
"initial condition must execute if the loop is entered".

Differential Revision: https://reviews.llvm.org/D84925
Reviewed By: asbirlea

4 years ago[SimpleLoopUnswitch] Drop make.implicit metadata in case of non-trivial unswitching
Max Kazantsev [Fri, 31 Jul 2020 04:10:00 +0000 (11:10 +0700)]
[SimpleLoopUnswitch] Drop make.implicit metadata in case of non-trivial unswitching

Non-trivial unswitching simply moves terminator being unswitch from the loop
up to the switch block. It also preserves all metadata that was there. It might not
be a correct thing to do for `make.implicit` metadata. Consider case:
```
for (...) {
  cond = // computed in loop
  if (cond) return X;
  if (p == null) throw_npe(); !make implicit
}
```
Before the unswitching, if `p` is null and we reach this check, we are guaranteed
to go to `throw_npe()` block. Now we unswitch on `p == null` condition:
```
if (p == null) !make implicit {
  for (...) {
    if (cond) return X;
    throw_npe()
  }
} else {
  for (...) {
    if (cond) return X;
  }
}
```
Now, following `true` branch of `p == null` does not always lead us to
`throw_npe()` because the loop has side exit. Now, if we run ImplicitNullCheck
pass on this code, it may end up making the unswitch condition implicit. This may
lead us to turning normal path to `return X` into signal-throwing path, which is
not efficient.

Note that this does not happen during trivial unswitch: it guarantees that we do not
have side exits before condition being unswitched.

This patch fixes this situation by unconditional dropping of `make.implicit` metadata
when we perform non-trivial unswitch. We could preserve it if we could prove that the
condition always executes. This can be done as a follow-up.

Differential Revision: https://reviews.llvm.org/D84916
Reviewed By: asbirlea

4 years agoFix a crash when the sample profile uses md5 and -sample-profile-merge-inlinee
Wei Mi [Fri, 31 Jul 2020 00:47:27 +0000 (17:47 -0700)]
Fix a crash when the sample profile uses md5 and -sample-profile-merge-inlinee
is enabled.

When -sample-profile-merge-inlinee is enabled, new FunctionSamples may be
created during profile merge without GUIDToFuncNameMap being initialized.
That will occasionally cause compiler crash. The patch fixes it.

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

4 years agodebguserver's type sniffer to only treat .app things that end in .app
Jason Molenda [Fri, 31 Jul 2020 03:55:41 +0000 (20:55 -0700)]
debguserver's type sniffer to only treat .app things that end in .app

On an iOS device, if debugserver is left to figure out how to launch
the binary provided, it looks at the filename to see if it contains
".app" and asks FrontBoard to launch it.  However, if this is actually
a command line app with the characters ".app" in the name, it would
end up trying to launch that via the FrontBoard calls even though it
needed to be launched via posix_spawn.  For instance, a command line
program called com.application.tester.

Jim suggested this patch where we only send binaries that end in ".app"
to FrontBoard.

Often debugsever is invoked with a --launch command line argument to
specify the launch method, and none of this code is hit in that
instance.

<rdar://problem/65297100>

4 years ago[NFC] GetUnderlyingObject -> getUnderlyingObject
Vitaly Buka [Fri, 31 Jul 2020 04:07:10 +0000 (21:07 -0700)]
[NFC] GetUnderlyingObject -> getUnderlyingObject

I am going to touch them in the next patch anyway

4 years agoMake a test case more flexible on Windows wrt the number of backslashes.
Wolfgang Pieb [Fri, 31 Jul 2020 03:36:31 +0000 (20:36 -0700)]
Make a test case more flexible on Windows wrt the number of backslashes.

4 years ago[test] Fix thinlto-distributed-newpm.ll
Arthur Eubanks [Fri, 31 Jul 2020 03:09:34 +0000 (20:09 -0700)]
[test] Fix thinlto-distributed-newpm.ll

Broken by https://reviews.llvm.org/D84981.

4 years ago[X86] Pass the OperandVector by reference to ParseIntelOperand and ParseRoundingMode...
Craig Topper [Fri, 31 Jul 2020 02:42:57 +0000 (19:42 -0700)]
[X86] Pass the OperandVector by reference to ParseIntelOperand and ParseRoundingMode. NFCI

Similar to what was recently done to ParseATTOperand. Make
ParseIntelOperand directly responsible for adding to the operand
vector instead of returning the operand. Return a bool for error.

Remove ErrorOperand since it is no longer used.

4 years ago[tbaa] Rename type-based-aa -> tbaa
Arthur Eubanks [Wed, 29 Jul 2020 23:44:22 +0000 (16:44 -0700)]
[tbaa] Rename type-based-aa -> tbaa

For consistency with legacy pass name.
Helps with 37 instances of "unknown pass name 'tbaa'" in check-llvm under NPM.

Reviewed By: ychen

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

4 years ago[NewPM] Don't print 'Invalidating all non-preserved analyses'
Arthur Eubanks [Thu, 30 Jul 2020 20:49:41 +0000 (13:49 -0700)]
[NewPM] Don't print 'Invalidating all non-preserved analyses'

If an analysis is actually invalidated, there's already a log statement
for that: 'Invalidating analysis: FooAnalysis'.
Otherwise the statement is not very useful.

Reviewed By: asbirlea, ychen

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

4 years ago[flang] Fixes for RESHAPE()
Peter Steinfeld [Wed, 29 Jul 2020 21:46:36 +0000 (14:46 -0700)]
[flang] Fixes for RESHAPE()

I fixed an assert caused by passing an empty array as the source= argument to
RESHAPE().  In the process, I noticed that there were no tests for RESHAPE(),
so I wrote a test that covers all the description in 16.9.163.  In the process,
I made the error messages more consistent and descriptive.  I also changed the
test to see if a reference to an intrinsic function was a constant to say that
it is a constant if it's a refererence to an invalid intrinsic.  This avoids
emitting multiple messages for the same erroneous source.

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

4 years ago[ValueTracking] Remove AllocaForValue parameter
Vitaly Buka [Fri, 31 Jul 2020 01:48:34 +0000 (18:48 -0700)]
[ValueTracking] Remove AllocaForValue parameter

findAllocaForValue uses AllocaForValue to cache resolved values.
The function is used only to resolve arguments of lifetime
intrinsic which usually are not fare for allocas. So result reuse
is likely unnoticeable.

In followup patches I'd like to replace the function with
GetUnderlyingObjects.

Depends on D84616.

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

4 years ago[OpenMP] Refactored the function `targetDataEnd`
Shilei Tian [Fri, 31 Jul 2020 01:37:01 +0000 (21:37 -0400)]
[OpenMP] Refactored the function `targetDataEnd`

Refactored the function `targetDataEnd` to make preparation of fixing
the issue of ahead-of-time target memory deallocation. This patch only
renamed `targetDataEnd` related variables and functions to conform
with LLVM code standard.

Reviewed By: ye-luo

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

4 years ago[NFC] Move findAllocaForValue into ValueTracking.h
Vitaly Buka [Fri, 31 Jul 2020 01:22:59 +0000 (18:22 -0700)]
[NFC] Move findAllocaForValue into ValueTracking.h

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

4 years ago[OpenMP] Refactored the function `target`
Shilei Tian [Fri, 31 Jul 2020 01:05:30 +0000 (21:05 -0400)]
[OpenMP] Refactored the function `target`

Refactored the function `target` to make preparation for fixing the
issue of ahead-of-time device memory deallocation.

Reviewed By: ye-luo

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

4 years ago[NFC][AMDGPU] Improve fused fmul+fadd tests.
dfukalov [Thu, 30 Jul 2020 01:12:17 +0000 (04:12 +0300)]
[NFC][AMDGPU] Improve fused fmul+fadd tests.

Reviewed By: rampitec

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

4 years ago[X86] Fix for ballooning compile times due to Load Value Injection (LVI) mitigations
Scott Constable [Fri, 31 Jul 2020 00:21:48 +0000 (17:21 -0700)]
[X86] Fix for ballooning compile times due to Load Value Injection (LVI) mitigations

Fix for the issue raised in https://github.com/rust-lang/rust/issues/74632.

The current heuristic for inserting LFENCEs uses a quadratic-time algorithm. This can apparently cause substantial compilation slowdowns for building Rust projects, where functions > 5000 LoC are apparently common.

The updated heuristic in this patch implements a linear-time algorithm. On a set of benchmarks, the slowdown factor for the generated code was comparable (2.55x geo mean for the quadratic-time heuristic, vs. 2.58x for the linear-time heuristic). Both heuristics offer the same security properties, namely, mitigating LVI.

This patch also includes some formatting fixes.

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

4 years ago[X86] Separate CPU Feature lists in X86.td between architecture features and tuning...
Craig Topper [Fri, 31 Jul 2020 00:05:06 +0000 (17:05 -0700)]
[X86] Separate CPU Feature lists in X86.td between architecture features and tuning features

After the recent change to the tuning settings for pentium4 to improve our default 32-bit behavior, I've decided to see about implementing -mtune support. This way we could have a default architecture CPU of "pentium4" or "x86-64" and a default tuning cpu of "generic". And we could change our "pentium4" tuning settings back to what they were before.

As a step to supporting this, this patch separates all of the features lists for the CPUs into 2 lists. I'm using the Proc class and a new ProcModel class to concat the 2 lists before passing to the target independent ProcessorModel. Future work to truly support mtune would change ProcessorModel to take 2 lists separately. I've diffed the X86GenSubtargetInfo.inc file before and after this patch to ensure that the final feature list for the CPUs isn't changed.

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

4 years ago[Attributor] Add time trace support.
kuterd [Thu, 30 Jul 2020 20:26:39 +0000 (23:26 +0300)]
[Attributor] Add time trace support.

This patch addes time trace functionality to have a better understanding
of the analysis times.

Reviewed By: jdoerfert

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

4 years ago[ValueTracking] Add basic computeKnownBits support for llvm.abs intrinsic
Craig Topper [Thu, 30 Jul 2020 18:25:55 +0000 (11:25 -0700)]
[ValueTracking] Add basic computeKnownBits support for llvm.abs intrinsic

This includes basic support for computeKnownBits on abs. I've left FIXMEs for more complicated things we could do.

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

4 years ago[profile] Remove dependence on getpagesize from InstrProfilingBuffer.c.o
Vedant Kumar [Thu, 30 Jul 2020 23:19:05 +0000 (16:19 -0700)]
[profile] Remove dependence on getpagesize from InstrProfilingBuffer.c.o

InstrProfilingBuffer.c.o is generic code that must support compilation
into freestanding projects. This gets rid of its dependence on the
_getpagesize symbol from libc, shifting it to InstrProfilingFile.c.o.

This fixes a build failure seen in a firmware project.

rdar://66249701

4 years ago[debugserver/Apple Silicon] Handoff connections when attaching to translated processes
Davide Italiano [Thu, 30 Jul 2020 23:20:38 +0000 (16:20 -0700)]
[debugserver/Apple Silicon] Handoff connections when attaching to translated processes

When we detect a process that the native debugserver cannot handle,
handoff the connection fd to the translated debugserver.

4 years ago[LegalizeTypes][SVE] Support widen/split legalization for SPLAT_VECTOR
Eli Friedman [Mon, 27 Jul 2020 21:08:31 +0000 (14:08 -0700)]
[LegalizeTypes][SVE] Support widen/split legalization for SPLAT_VECTOR

Just the obvious implementation that rewrites the result type. Also fix
warning from EXTRACT_SUBVECTOR legalization that triggers on the test.

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

4 years ago[AArch64][GlobalISel] Add legalization & selection support for G_INTRINSIC_LRINT.
Amara Emerson [Fri, 24 Jul 2020 20:01:36 +0000 (13:01 -0700)]
[AArch64][GlobalISel] Add legalization & selection support for G_INTRINSIC_LRINT.

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

4 years ago[doc] Describe the header guard style
Mircea Trofin [Thu, 30 Jul 2020 23:08:06 +0000 (16:08 -0700)]
[doc] Describe the header guard style

clang-tidy's llvm-header-guard rule references the LLVM style - where it's
missing.

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