platform/upstream/llvm.git
3 years ago[RISCV] Optimize fixed vector ABS. Fix crash on scalable vector ABS for SEW=64 with...
Craig Topper [Tue, 9 Mar 2021 16:51:01 +0000 (08:51 -0800)]
[RISCV] Optimize fixed vector ABS. Fix crash on scalable vector ABS for SEW=64 with RV32.

The default fixed vector expansion uses sra+xor+add since it can't
see that smax is legal due to our custom handling. So we select
smax(X, sub(0, X)) manually.

Scalable vectors are able to use the smax expansion automatically
for most cases. It crashes in one case because getConstant can't build a
SPLAT_VECTOR for nxvXi64 when i64 scalars aren't legal. So
we manually emit a SPLAT_VECTOR_I64 for that case.

Reviewed By: frasercrmck

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

3 years ago[RISCV] Make the hasStdExtM() check in RISCVInstrInfo::getVLENFactoredAmount emit...
Craig Topper [Tue, 9 Mar 2021 16:38:45 +0000 (08:38 -0800)]
[RISCV] Make the hasStdExtM() check in RISCVInstrInfo::getVLENFactoredAmount emit a diagnostic rather than an assert.

As far as I know we're not enforcing the StdExtM must be enabled
to use the V extension. If we use an assert here and hit this
code in a release build we'll silently emit an invalid instruction.

By using a diagnostic we report the error to the user in release
builds. I think there may still be a later fatal error from
the code emitter though.

Reviewed By: frasercrmck

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

3 years ago[DebugInfo] Handle multiple variable location operands in IR
gbtozers [Wed, 30 Sep 2020 18:07:01 +0000 (19:07 +0100)]
[DebugInfo] Handle multiple variable location operands in IR

This patch updates the various IR passes to correctly handle dbg.values with a
DIArgList location. This patch does not actually allow DIArgLists to be produced
by salvageDebugInfo, and it does not affect any pass after codegen-prepare.
Other than that, it should cover every IR pass.

Most of the changes simply extend code that operated on a single debug value to
operate on the list of debug values in the style of any_of, all_of, for_each,
etc. Instances of setOperand(0, ...) have been replaced with with
replaceVariableLocationOp, which takes the value that is being replaced as an
additional argument. In places where this value isn't readily available, we have
to track the old value through to the point where it gets replaced.

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

3 years ago[InstCombine] canonicalize 'not' op after min/max intrinsic
Sanjay Patel [Tue, 9 Mar 2021 16:23:34 +0000 (11:23 -0500)]
[InstCombine] canonicalize 'not' op after min/max intrinsic

This is another step towards parity between existing select
transforms and min/max intrinsics (D98152)..

The existing 'not' folds around select are complicated, so
it's likely that we will need to enhance this, but this
should be a safe step.

3 years ago[InstCombine] add tests for min/max intrinsics with not+constant; NFC
Sanjay Patel [Tue, 9 Mar 2021 14:29:30 +0000 (09:29 -0500)]
[InstCombine] add tests for min/max intrinsics with not+constant; NFC

3 years ago[clang] Fix crash when creating deduction guide.
Adam Czachorowski [Thu, 4 Mar 2021 17:01:06 +0000 (18:01 +0100)]
[clang] Fix crash when creating deduction guide.

We used to trigger assertion when transforming c-tor with unparsed
default argument. Now we ignore such constructors for this purpose.

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

3 years ago[Sema] Fix diagnostics for one-byte length modifier
Anton Bikineev [Thu, 4 Mar 2021 15:18:35 +0000 (16:18 +0100)]
[Sema] Fix diagnostics for one-byte length modifier

In case a char-literal of type int (C/ObjectiveC) corresponds to a
format specifier with the %hh length modifier, don't treat the literal
as of type char for issuing diagnostics, as otherwise this results in:

printf("%hhd", 'e');
warning: format specifies type 'char' but the argument has type 'char'.

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

3 years ago[AIX] do not emit visibility attribute into IR when there is -mignore-xcoff-visibility
diggerlin [Tue, 9 Mar 2021 15:38:00 +0000 (10:38 -0500)]
[AIX] do not emit visibility attribute into IR when there is -mignore-xcoff-visibility

SUMMARY:

n the patch https://reviews.llvm.org/D87451 "add new option -mignore-xcoff-visibility"
we did as "The option -mignore-xcoff-visibility has no effect on visibility attribute when compile with -emit-llvm option to generated LLVM IR."

in these patch we let -mignore-xcoff-visibility effect on generating IR too. the new feature only work on AIX OS

Reviewer: Jason Liu,

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

3 years ago[OpenMP] libomp: eliminate pause from atomic CAS loops
AndreyChurbanov [Tue, 9 Mar 2021 15:30:08 +0000 (18:30 +0300)]
[OpenMP] libomp: eliminate pause from atomic CAS loops

For clang this change is NFC cleanup, because clang
never calls atomic functions from runtime library.

Basically, pause is good in spin-loops waiting for something.
Atomic CAS loops do not wait for anything,
each CAS failure means some other thread progressed.

Performance experiments show that the pause only causes unnecessary slowdown
on CPUs with slow pause instruction, no difference on CPUs with fast pause
instruction, removal of the pause gives lesser binary size which is good.

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

3 years ago[flang][driver] Refine tests for module search directories
Andrzej Warzynski [Tue, 9 Mar 2021 14:20:43 +0000 (14:20 +0000)]
[flang][driver] Refine tests for module search directories

This patch refactors include-module.f90:
  * rename the test file as use-module.f90 to better highlight which
  driver feature is being tested
  * move tests for diagnostics to use-module-error.f90 (it tests that
  `-J/-module-dir` can only be used once)
  * make sure that `f18` is tested when `FLANG_BUILD_NEW_DRIVER` is
  set to `Off`
  * add tests for when all module files are successfully discovered and
  loaded

With this patch, there should be a clear separation into 3 scenarios in
use-module.f90:
  * Everything is OK
  * One module file wasn't found (missing include path for
  basictestingmoduletwo.mod)
  * Two module files are found, but the test requires
  `basictestingmoduleone.mod` from both `Inputs` and `Inputs/module-dir`.
  Only the latter is found.

Reviewed By: tskeith

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

3 years ago[ARM] Add comment explaining stack frame layout
Oliver Stannard [Tue, 9 Mar 2021 14:41:31 +0000 (14:41 +0000)]
[ARM] Add comment explaining stack frame layout

Add a comment explaining how we lay out stack frames for ARM targets,
based on the existing one for AArch64. Also expand the comment to
explain reserved call frames for both architectures.

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

3 years ago[clang][sema][NFC] Remove a superfluous semicolon
Timm Bäder [Tue, 9 Mar 2021 15:11:26 +0000 (16:11 +0100)]
[clang][sema][NFC] Remove a superfluous semicolon

Silences a GCC warning:

clang/lib/Sema/SemaChecking.cpp:4506:2: warning: extra ‘;’ [-Wpedantic]
 };
  ^

3 years ago[libcxx] [test] Adjust separator form in fs.op.absolute for libc++ on windows
Martin Storsjö [Fri, 26 Feb 2021 12:08:11 +0000 (14:08 +0200)]
[libcxx] [test] Adjust separator form in fs.op.absolute for libc++ on windows

This test was previously tweaked in
321f696920630be1b3c93e2a8b965c624ddd646c to match the output of
of MS STL (except that the MS STL fails on the testcase with an
empty path).

libc++ doesn't produce paths with all normalized separators (and the
spec doesn't mandate it to either).

Tweak the test reference to match exactly what libc++ produces. If
testing with a non-libc++ library, do a relaxed comparison that allows
the separators to differ.

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

3 years ago[clangd][NFC] Silence some buildbot warnings after 0250b053
Nathan James [Tue, 9 Mar 2021 14:55:55 +0000 (14:55 +0000)]
[clangd][NFC] Silence some buildbot warnings after 0250b053

https://reviews.llvm.org/D94554 introduced code which wont compile with some build flags due to a field having the same identifier as a type.

clang-tools-extra/clangd/DraftStore.h:55:11: error: declaration of ‘clang::clangd::DraftStore::Draft clang::clangd::DraftStore::DraftAndTime::Draft’ changes meaning of ‘Draft’ [-fpermissive]
   55 |     Draft Draft;
      |           ^~~~~
clang-tools-extra/clangd/DraftStore.h:30:10: note: ‘Draft’ declared here as ‘struct clang::clangd::DraftStore::Draft’
   30 |   struct Draft {
         |          ^~~~~

3 years ago[clangd] Add a Filesystem that overlays Dirty files.
Nathan James [Tue, 9 Mar 2021 14:35:20 +0000 (14:35 +0000)]
[clangd] Add a Filesystem that overlays Dirty files.

Create a `ThreadsafeFS` in the `DraftStore` that overlays the dirty file contents over another `ThreadsafeFS`.
This provides a nice thread-safe interface for using dirty file contents throughout the codebase, for example cross file refactoring.
Creating a Filesystem view will overlay a snapshot of the current contents, so if the draft store is updated while the view is being used, it will contain stale contents.

Reviewed By: sammccall

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

3 years ago[lldb] Fix a bug in D96779 (shared lib directory logic)
Pavel Labath [Tue, 9 Mar 2021 14:15:45 +0000 (15:15 +0100)]
[lldb] Fix a bug in D96779 (shared lib directory logic)

This function would fail in debug builds, as the two usages of the
LLDB_PYTHON_RELATIVE_LIBDIR macro would expand to two distinct strings.
The path iterator macros don't support that.

Use a temporary variable to ensure everything points to a single string.

3 years ago[X86] canonicalizeShuffleWithBinOps - add binary shuffle handling
Simon Pilgrim [Tue, 9 Mar 2021 12:29:16 +0000 (12:29 +0000)]
[X86] canonicalizeShuffleWithBinOps - add binary shuffle handling

3 years ago[InstCombine] fold min/max intrinsics with not ops
Sanjay Patel [Tue, 9 Mar 2021 13:14:30 +0000 (08:14 -0500)]
[InstCombine] fold min/max intrinsics with not ops

This is a partial translation of the existing select-based
folds. We need to recreate several different transforms to
avoid regressions as noted in D98152.

https://alive2.llvm.org/ce/z/teuZ_J

3 years ago[mlir] Use affine.apply when distributing to processors
Lei Zhang [Tue, 9 Mar 2021 13:36:42 +0000 (08:36 -0500)]
[mlir] Use affine.apply when distributing to processors

This makes it easy to compose the distribution computation with
other affine computations.

Reviewed By: mravishankar

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

3 years ago[X86][NFC] Move instruction selection of the x86_tdpb[s,u]d_internal and x86_tilezero...
Liu, Chen3 [Fri, 5 Mar 2021 00:46:44 +0000 (08:46 +0800)]
[X86][NFC] Move instruction selection of the x86_tdpb[s,u]d_internal and x86_tilezero_internal to X86InstrAMX.td

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

3 years ago[lldb][JITLoaderGDB] Test debug support in JITLink
Stefan Gränitz [Tue, 2 Mar 2021 14:53:58 +0000 (15:53 +0100)]
[lldb][JITLoaderGDB] Test debug support in JITLink

LLVM OrcJIT is shifting from RuntimeDyld to JITLink. Starting with D96627 I am planning to add debug support. It would be great to have test coverage for it in LLDB early on.

Reviewed By: labath

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

3 years ago[ExtVectorType] Support conditional select operator for C++.
Florian Hahn [Tue, 9 Mar 2021 12:22:20 +0000 (12:22 +0000)]
[ExtVectorType] Support conditional select operator for C++.

This patch implements the conditional select operator for
ext_vector_types in C++. It does so by using the same semantics as for
C.

D71463 added support for the conditional select operator for VectorType
in C++. Unfortunately the semantics between ext_vector_type in C are
different to VectorType in C++. Select for ext_vector_type is based on
the MSB of the condition vector, whereas for VectorType it is `!= 0`.

This unfortunately means that the behavior is inconsistent between
ExtVectorType and VectorType, but I think using the C semantics for
ExtVectorType in C++ as well should be less surprising for users.

Reviewed By: erichkeane, aaron.ballman

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

3 years ago[Orc] Always check mapped sections for ELFDebugObject are in bounds of working memory...
Stefan Gränitz [Tue, 9 Mar 2021 11:51:51 +0000 (12:51 +0100)]
[Orc] Always check mapped sections for ELFDebugObject are in bounds of working memory buffer

As stated in the JITLink user guide: Do not assume that the input object is well formed.
https://llvm.org/docs/JITLink.html#tips-for-jitlink-backend-developers

3 years ago[Orc] Test DebugObjectManagerPlugin fills in load-address for .text section of in...
Stefan Gränitz [Tue, 9 Mar 2021 11:49:08 +0000 (12:49 +0100)]
[Orc] Test DebugObjectManagerPlugin fills in load-address for .text section of in-memory ELF debug object

3 years ago[Orc] Fix working memory buffer for section mapping in ELFDebugObject
Stefan Gränitz [Tue, 9 Mar 2021 11:44:21 +0000 (12:44 +0100)]
[Orc] Fix working memory buffer for section mapping in ELFDebugObject

3 years ago[DebugInfo] Add tests for ISel handling of variadic debug values
gbtozers [Tue, 29 Sep 2020 15:04:05 +0000 (16:04 +0100)]
[DebugInfo] Add tests for ISel handling of variadic debug values

This patch adds a set of lit tests for ISel support of DIArgList/DBG_VALUE_LIST.

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

3 years ago[DebugInfo] Emit DBG_VALUE_LIST from ISel
gbtozers [Tue, 29 Sep 2020 14:54:29 +0000 (15:54 +0100)]
[DebugInfo] Emit DBG_VALUE_LIST from ISel

This patch completes ISel support for DIArgList dbg.values by allowing
SDDbgValues with multiple location operands to be emitted as DBG_VALUE_LIST
instructions.

The primary change of this patch is refactoring EmitDbgValue by pulling location
operand emission out to the new function AddDbgValueLocationOps, which is used
for both DIArgList and single value dbg.values. Outside of that, the only
behaviour change is that the scheduler has a lambda added, HasUnknownVReg, to
prevent us from attempting to emit a DBG_VALUE_LIST before all of its used VRegs
have become available.

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

3 years ago[lld][MachO] Add missing test requirements
Alexander Shaposhnikov [Tue, 9 Mar 2021 12:05:08 +0000 (04:05 -0800)]
[lld][MachO] Add missing test requirements

Similarly to the existing tests (e.g. stab.s) function-starts.s
is not supported on Windows.

3 years ago[X86][NFC] Adding one flag to imply whether the instruction should check the predicat...
Liu, Chen3 [Fri, 5 Mar 2021 07:11:20 +0000 (15:11 +0800)]
[X86][NFC] Adding one flag to imply whether the instruction should check the predicate when compress EVEX instructions to VEX encoding.

Some EVEX instructions should check the predicates when compress to VEX
encoding. For example, avx512vnni instructions. This is because avx512vnni
doesn't mean that avxvnni is supported on the target.
This patch moving the manually added check to .inc that generated by tablegen.

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

3 years ago[X86][AMX] Add test case for combining AMX bitcast.
Luo, Yuanke [Tue, 9 Mar 2021 11:46:00 +0000 (19:46 +0800)]
[X86][AMX] Add test case for combining AMX bitcast.

3 years ago[InstCombine] Simplify phis with incoming pointer-casts.
Florian Hahn [Tue, 9 Mar 2021 09:27:25 +0000 (09:27 +0000)]
[InstCombine] Simplify phis with incoming pointer-casts.

If the incoming values of a phi are pointer casts of the same original
value, replace the phi with a single cast. Such redundant phis are
somewhat common after loop-rotate and removing them can avoid some
unnecessary code bloat, e.g. because an iteration of a loop is peeled
off to make the phi invariant. It should also simplify further analysis
on its own.

InstCombine already uses stripPointerCasts in a couple of places and
also simplifies phis based on the incoming values, so the patch should
fit in the existing scope.

The patch causes binary changes in 47 out of 237 benchmarks in
MultiSource/SPEC2000/SPEC2006 with -O3 -flto on X86.

Reviewed By: lebedev.ri

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

3 years ago[OpenCL] Fix builtins that require multiple extensions
Sven van Haastregt [Tue, 9 Mar 2021 11:37:26 +0000 (11:37 +0000)]
[OpenCL] Fix builtins that require multiple extensions

Builtins that require multiple extensions, such as certain
`write_imagef` forms, were not exposed because of the Sema check not
splitting the extension string.

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

3 years agoM68kInstrInfo::AnalyzeBranchImpl - fix MSVC build. NFCI.
Simon Pilgrim [Tue, 9 Mar 2021 11:06:29 +0000 (11:06 +0000)]
M68kInstrInfo::AnalyzeBranchImpl - fix MSVC build. NFCI.

MSVC couldn't resolve the decltype of a capture of a capture - but is happy with an auto.

3 years ago[compiler-rt] FuzzedDataProvider: Add missing include
MarcoFalke [Fri, 5 Mar 2021 18:20:22 +0000 (19:20 +0100)]
[compiler-rt] FuzzedDataProvider: Add missing include

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

3 years ago[clangd] Move logging out of LSPTest base class into a separate one.
Kadir Cetinkaya [Tue, 9 Mar 2021 10:15:40 +0000 (11:15 +0100)]
[clangd] Move logging out of LSPTest base class into a separate one.

This was causing TSan failures due to a race on vptr during destruction,
see
https://lab.llvm.org/buildbot/#/builders/131/builds/6579/steps/6/logs/FAIL__Clangd_Unit_Tests__LSPTest_FeatureModulesThr.

The story is, during the execution of a destructor all the virtual
dispatches should resolve to implementations in the class being
destroyed, not the derived ones. And LSPTests will log some stuff during
destruction (we send shutdown/exit requests, which are logged), which is
a virtual dispatch when LSPTest is derived from clang::clangd::Logger.

It is a benign race in our case, as gtests that derive from LSPTest
doesn't override the `log` method. But still during destruction, we
might try to update vtable ptr (due to being done with destruction of
test and starting destruction of LSPTest) and read from it to dispatch a
log message at the same time.

This patch fixes that race by moving `log` out of the vtable of
`LSPTest`.

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

3 years ago[CodeGen] Report a normal instead of fatal error for label redefinition
John Brawn [Tue, 9 Mar 2021 10:54:41 +0000 (10:54 +0000)]
[CodeGen] Report a normal instead of fatal error for label redefinition

A symbol being redefined as a label is something that can happen as a result of
ordinary input, so it shouldn't cause a fatal error. Also adjust the error
message to match the one you get when a symbol is redefined as a variable.

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

3 years ago[sanitizers] Enable runtime vma for mips64 in buildgo.sh
Dmitry Vyukov [Tue, 9 Mar 2021 10:44:23 +0000 (11:44 +0100)]
[sanitizers] Enable runtime vma for mips64 in buildgo.sh

Go requires 47 bits VA for tsan.
Go will run race_detector testcases unless tsan warns about "unsupported VMA range"

Author: mzh (Meng Zhuo)
Reviewed-in: https://reviews.llvm.org/D98238

3 years ago[IR] Introduce llvm.experimental.vector.splice intrinsic
Cullen Rhodes [Fri, 8 Jan 2021 14:06:13 +0000 (14:06 +0000)]
[IR] Introduce llvm.experimental.vector.splice intrinsic

This patch introduces a new intrinsic @llvm.experimental.vector.splice
that constructs a vector of the same type as the two input vectors,
based on a immediate where the sign of the immediate distinguishes two
variants. A positive immediate specifies an index into the first vector
and a negative immediate specifies the number of trailing elements to
extract from the first vector.

For example:

  @llvm.experimental.vector.splice(<A,B,C,D>, <E,F,G,H>, 1) ==> <B, C, D, E>  ; index
  @llvm.experimental.vector.splice(<A,B,C,D>, <E,F,G,H>, -3) ==> <B, C, D, E> ; trailing element count

These intrinsics support both fixed and scalable vectors, where the
former is lowered to a shufflevector to maintain existing behaviour,
although while marked as experimental the recommended way to express
this operation for fixed-width vectors is to use shufflevector. For
scalable vectors where it is not possible to express a shufflevector
mask for this operation, a new ISD node has been implemented.

This is one of the named shufflevector intrinsics proposed on the
mailing-list in the RFC at [1].

Patch by Paul Walker and Cullen Rhodes.

[1] https://lists.llvm.org/pipermail/llvm-dev/2020-November/146864.html

Reviewed By: sdesmalen

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

3 years ago[Clang][Sema] Warn when function argument is less aligned than parameter
Tomas Matheson [Fri, 19 Feb 2021 17:33:56 +0000 (17:33 +0000)]
[Clang][Sema] Warn when function argument is less aligned than parameter

See https://bugs.llvm.org/show_bug.cgi?id=42154.

GCC's __attribute__((align)) can reduce the alignment of a type when applied to
a typedef.  However, functions which take a pointer or reference to the
original type are compiled assuming the original alignment.  Therefore when any
such function is passed an object of the new, less-aligned type, an alignment
fault can occur.  In particular, this applies to the constructor, which is
defined for the original type and called for the less-aligned object.

This change adds a warning whenever an pointer or reference to an object is
passed to a function that was defined for a more-aligned type.

The calls to ASTContext::getTypeAlignInChars seem change the order in which
record layouts are evaluated, which caused changes to the output of
-fdump-record-layouts. As such some tests needed to be updated:

  * Use CHECK-LABEL rather than counting the number of "Dumping AST Record
    Layout" headers.

  * Check for end of line in labels, so that struct B1 doesn't match struct B
    etc.

  * Add --strict-whitespace, since the whitespace shows meaningful structure.

  * The order in which record layouts are printed has changed in some cases.

  * clang-format for regions changed

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

3 years ago[sanitizers] fix wrong enum of memory_order for mips
Dmitry Vyukov [Tue, 9 Mar 2021 06:46:33 +0000 (07:46 +0100)]
[sanitizers] fix wrong enum of memory_order for mips

Author: mzh (Meng Zhuo)
Reviewed-in: https://reviews.llvm.org/D98231

3 years agoFix a crash in DWARFUnit::getInlinedChainForAddress in case of unexpected DWARF infor...
Alex Orlov [Tue, 9 Mar 2021 10:20:27 +0000 (14:20 +0400)]
Fix a crash in DWARFUnit::getInlinedChainForAddress in case of unexpected DWARF information.

In some cases a broken or invalid debug info could cause a crash in DWARFUnit::getInlinedChainForAddress during parsing a chain of in-lined functions. This patch fixes this issue.

Reviewed By: dblaikie

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

3 years ago[DebugInfo] Handle dbg.values with multiple variable location operands in ISel
gbtozers [Tue, 29 Sep 2020 14:43:21 +0000 (15:43 +0100)]
[DebugInfo] Handle dbg.values with multiple variable location operands in ISel

This patch adds partial support in Instruction Selection for dbg.values that use
a DIArgList. This patch does not add support for producing DBG_VALUE_LIST, but
adds the logic for processing DIArgLists within the ISel pass. This change is
largely focused on handleDebugValue and some of the functions that it calls.
Outside of this, salvageDebugInfo and transferDbgValues have been modified to
replace individual operands instead of the entire value; dangling debug info for
variadic debug values is not currently supported (but may be added later).

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

3 years ago[lldb] Fix DWARF-5 DW_FORM_implicit_const (used by GCC)
Jan Kratochvil [Tue, 9 Mar 2021 09:23:05 +0000 (10:23 +0100)]
[lldb] Fix DWARF-5 DW_FORM_implicit_const (used by GCC)

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

3 years ago[flang] update character tests to use gtest
Asher Mancinelli [Tue, 9 Mar 2021 08:31:12 +0000 (08:31 +0000)]
[flang] update character tests to use gtest

Move character tests to gtest, according to reviews from revision
D97349. Create a new temporary directory parallel to old runtime
unittests directory to facilitate the transition. Once patches for all
tests have been accepted using GTest, the old directory may be removed.
The new directory is required because LLVM's CMake unit test
infrastructure requires that the test depends on all source files in
the `CMAKE_CURRENT_SOURCE_DIR` directory.

Reviewed By: awarzynski

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

3 years agollvm-dwarfdump: Fix DWARF-5 DW_FORM_implicit_const (used by GCC)
Jan Kratochvil [Tue, 9 Mar 2021 08:26:17 +0000 (09:26 +0100)]
llvm-dwarfdump: Fix DWARF-5 DW_FORM_implicit_const (used by GCC)

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

3 years ago[mlir] move LLVM target import header and tests
Alex Zinenko [Mon, 8 Mar 2021 14:40:25 +0000 (15:40 +0100)]
[mlir] move LLVM target import header and tests

Move Target/LLVMIR.h to target/LLVMIR/Import.h to better reflect the purpose of
this file. Also move all LLVM IR target tests under the LLVMIR directory.

Reviewed By: mehdi_amini

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

3 years ago[mlir] make MLIRPresburger depend on MLIRIR
Alex Zinenko [Tue, 9 Mar 2021 08:15:57 +0000 (09:15 +0100)]
[mlir] make MLIRPresburger depend on MLIRIR

The analysis library uses Location, which is defined in the MLIRIR
library.

3 years agoclang-format: use `pb` as a canonical raw string delimiter for google style
Krasimir Georgiev [Tue, 9 Mar 2021 08:06:25 +0000 (09:06 +0100)]
clang-format: use `pb` as a canonical raw string delimiter for google style

This updates the canonical text proto raw string delimiter to `pb` for Google style, moving codebases towards a simpler and more consistent style.

Also updates a behavior where the canonical delimiter was not applied for raw strings with empty delimiters detected via well-known enclosing functions that expect a text proto, effectively making the canonical delimiter more viral. This feature is not widely used so this should be safe and more in line with promoting the canonicity of the canonical delimiter.

Reviewed By: sammccall

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

3 years ago[mlir][CMAKE] Fix cross-compilation build
Vladislav Vinogradov [Thu, 4 Mar 2021 17:24:25 +0000 (20:24 +0300)]
[mlir][CMAKE] Fix cross-compilation build

Use `MLIR_LINALG_ODS_GEN` and `MLIR_LINALG_ODS_YAML_GEN` variables
instead of `MLIR_LINALG_ODS_GEN_EXE` and `MLIR_LINALG_ODS_YAML_GEN_EXE`.
The former are defined in PARENT SCOPE only, so the `if` condition
is never evaluates to `TRUE`.

The logic should be the following (taken from tblgen part):

1. `TOOL_NAME` - CACHE variable (default equal to target name).
   User can override it to actual executable path.
2. `TOOL_NAME_EXE` - internal variable, initialized to `${TOOL_NAME}` first.
   In case of cross-compilation (`LLVM_USE_HOST_TOOLS == TRUE`) if user
   didn't set own path to native executable via `TOOL_NAME` variable,
   CMake will create separate targets to build native tool and
   will override `TOOL_NAME_EXE` to the executable produced by this target.
3. `TOOL_NAME_TARGET` - internal variable, which points to tool target name.
   If the native tool is built as described above, it will point to the
   target correspondant to that native tool.

Reviewed By: mehdi_amini

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

3 years ago[nfc] llvm-dwarfdump: DWARFAbbreviationDeclaration::AttributeSpec -> DWARFAttribute
Jan Kratochvil [Tue, 9 Mar 2021 07:31:23 +0000 (08:31 +0100)]
[nfc] llvm-dwarfdump: DWARFAbbreviationDeclaration::AttributeSpec -> DWARFAttribute

`AttributeSpec` does not contain values while `DWARFAttribute` already
does. Therefore one no longer needs to pass `uint64_t *OffsetPtr`.

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

3 years ago[mlir][linalg] refactor the result handling during vectorization.
Tobias Gysi [Mon, 8 Mar 2021 16:08:40 +0000 (16:08 +0000)]
[mlir][linalg] refactor the result handling during vectorization.

Return the vectorization results using a vector passed by reference instead of returning them embedded in a structure.

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

3 years ago[mlir][python] Reorganize MLIR python into namespace packages.
Stella Laurenzo [Sat, 6 Mar 2021 02:00:16 +0000 (18:00 -0800)]
[mlir][python] Reorganize MLIR python into namespace packages.

* Only leaf packages are non-namespace packages. This allows most of the top levels to be split into different directories or deployment packages. In the previous state, the presence of __init__.py files at each level meant that the entire tree could only ever exist in one physical directory on the path.
* This changes the API usage slightly: `import mlir` will no longer do a deep import of `mlir.ir`, etc. This may necessitate some client code changes.
* Dialect gen code was restructured so that the user is responsible for providing the `my_dialect.py` file, which then must import its peer `_my_dialect_ops_gen`. This gives complete control of the dialect namespace to the user instead of to tablegen code, allowing further dialect-specific python APIs.
* Correspondingly, the previous extension modules `_my_dialect.py` are now `_my_dialect_ops_ext.py`.
* Now that the `linalg` namespace is open, moved the `linalg_opdsl` tool into it.
* This may require some corresponding downstream adjustments to npcomp, circt, et al:
  * Probably some shallow imports need to be converted to deep imports (i.e. not `import mlir` brings in the world).
  * Each tablegen generated dialect now needs an explicit `foo.py` which does a `from ._foo_ops_gen import *`. This is similar to the way that generated code operates in the C++ world.
  * If providing dialect op extensions, those need to be moved from `_foo.py` -> `_foo_ops_ext.py`.

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

3 years ago[CSSPGO] Always use callsite samples as callsite probe counts.
Hongtao Yu [Sat, 6 Mar 2021 02:02:13 +0000 (18:02 -0800)]
[CSSPGO] Always use callsite samples as callsite probe counts.

For CS profile, the callsite count of previously inlined callees is populated with the entry count of the callees. Therefore when trying to get a weight for calliste probe after inlinining, the callsite count should always be used. The same fix has already been made for non-probe case.

Reviewed By: wenlei

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

3 years ago[lldb] Remove duplicated ThreadPlanStepOverBreakpoint comment
Dave Lee [Tue, 9 Mar 2021 06:25:30 +0000 (22:25 -0800)]
[lldb] Remove duplicated ThreadPlanStepOverBreakpoint comment

This comment was present twice in the function.

3 years ago[lld][MachO] Add support for LC_FUNCTION_STARTS
Alexander Shaposhnikov [Tue, 9 Mar 2021 06:00:37 +0000 (22:00 -0800)]
[lld][MachO] Add support for LC_FUNCTION_STARTS

Add first bits for emitting LC_FUNCTION_STARTS.

This is a recommit of f344dfeb with the adjusted test
which should address build bots breakages.

Test plan: make check-all

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

3 years ago[CodeGenPrepare] Fix isIVIncrement (PR49466)
Ta-Wei Tu [Tue, 9 Mar 2021 05:31:20 +0000 (13:31 +0800)]
[CodeGenPrepare] Fix isIVIncrement (PR49466)

In the NFC commit 8d835f42a57f15c0b9053bd7c41ea95821a40e5f, the check for `!L` is
moved to a separate function `getIVIncrement` which, instead of using `BO->getParent()`,
uses `PN->getParent()`. However, these two basic blocks are not necessarily the same.

https://bugs.llvm.org/show_bug.cgi?id=49466 demonstrates a case where `PN` is contained in
a loop while `BO` is not, causing the null-pointer dereference in `L->getLoopLatch()`.

This patch checks whether both `BO` and `PN` belong to the same loop before entering `getIVIncrement`.

Reviewed By: mkazantsev

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

3 years agoMove LLVM::FMFAttr definition to TableGen (NFC)
Mehdi Amini [Fri, 5 Mar 2021 06:38:59 +0000 (06:38 +0000)]
Move LLVM::FMFAttr definition to TableGen (NFC)

This is using the new Attribute storage generation support in
TableGen to define the LLVM FastMathFlags.

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

3 years agoRevert "[lld][MachO] Add support for LC_FUNCTION_STARTS"
Alexander Shaposhnikov [Tue, 9 Mar 2021 05:10:10 +0000 (21:10 -0800)]
Revert "[lld][MachO] Add support for LC_FUNCTION_STARTS"

This reverts commit f344dfebdb127f66f591749b1f12e9ddfa10a05c.

3 years agoRevert "[lld][MachO] Fix function starts test"
Alexander Shaposhnikov [Tue, 9 Mar 2021 05:08:57 +0000 (21:08 -0800)]
Revert "[lld][MachO] Fix function starts test"

This reverts commit 179d72549ea57b8a539ebd94d7d79f12ccc3360c
since some build bots still appear to be broken.

3 years ago[lld][MachO] Fix function starts test
Alexander Shaposhnikov [Tue, 9 Mar 2021 04:54:27 +0000 (20:54 -0800)]
[lld][MachO] Fix function starts test

Fix the build breakage caught by the ppc64le-lld-multistage-test build bot.
NFC.

3 years ago[lld][MachO] Add support for LC_FUNCTION_STARTS
Alexander Shaposhnikov [Tue, 23 Feb 2021 05:21:53 +0000 (21:21 -0800)]
[lld][MachO] Add support for LC_FUNCTION_STARTS

Add first bits for emitting LC_FUNCTION_STARTS.

Test plan: make check-all

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

3 years ago[DebugInfo] Do not error on unsupported CIE version
Rafael Auler [Tue, 9 Mar 2021 03:21:16 +0000 (19:21 -0800)]
[DebugInfo] Do not error on unsupported CIE version

D81469 introduced a check to error on CIE version different
than 1 for eh_frame, but older compilers mistakenly create binaries
with this version set to 3 for DWARF4 or 4 to DWARF5. Move the check
to dump time instead of eh_frame parse time, so we can be tolerant
with older binaries.

Reviewed By: aprantl

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

3 years ago[RISCV][MC] Fix nf encoding for vector ld/st whole register
ShihPo Hung [Mon, 8 Mar 2021 16:15:06 +0000 (08:15 -0800)]
[RISCV][MC] Fix nf encoding for vector ld/st whole register

The three bit nf is one less than the number of NFIELDS,
so we manually decrement 1 for VS1/2/4/8R & VL1/2/4/8R.

Reviewed By: craig.topper

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

3 years ago[docs] Fix llvm-objcopy.rst
Alexander Shaposhnikov [Tue, 9 Mar 2021 03:06:32 +0000 (19:06 -0800)]
[docs] Fix llvm-objcopy.rst

Adjust the title underline, NFC.

3 years ago[llvm-objcopy][MachO] Add support for --keep-undefined
Alexander Shaposhnikov [Tue, 9 Mar 2021 02:54:00 +0000 (18:54 -0800)]
[llvm-objcopy][MachO] Add support for --keep-undefined

This diff introduces --keep-undefined in llvm-objcopy/llvm-strip for Mach-O
which makes the tools preserve undefined symbols.

Test plan: make check-all

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

3 years ago[AMDGPU] Remove unused function opcodeEmitsNoInsts()
Ruiling Song [Tue, 9 Mar 2021 02:11:36 +0000 (10:11 +0800)]
[AMDGPU] Remove unused function opcodeEmitsNoInsts()

This was missed in the patch D97545, and cause buildbot failure.

Reviewed by: critson

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

3 years ago[llvm-objdump][MachO] Add support for dumping function starts
Alexander Shaposhnikov [Tue, 9 Mar 2021 02:44:13 +0000 (18:44 -0800)]
[llvm-objdump][MachO] Add support for dumping function starts

Add support for dumping function starts for Mach-O binaries.

Test plan: make check-all

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

3 years ago[LangRef] mention that the lifetime intrinsics' description in LangRef isn't everything
Juneyoung Lee [Tue, 9 Mar 2021 02:33:31 +0000 (11:33 +0900)]
[LangRef] mention that the lifetime intrinsics' description in LangRef isn't everything

This is a minor patch that addresses concerns about lifetime in D94002.

We need to mention that what's written in LangRef isn't everything about lifetime.start/end
and its semantics depends on the stack coloring algorithm's pattern matching of a stack pointer.

If the stack coloring algorithm cannot conclude that a pointer is a stack-allocated object, the pointer is conservatively
considered as a non-stack one because stack coloring won't take this lifetime into account while assigning addresses.

A reference from alloca to lifetime.start/end is added as well.

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

3 years agoReland: [Docs][Windows Itanium] Add a How-To document for Windows Itanium.
Ben Dunbobbin [Tue, 9 Mar 2021 01:33:54 +0000 (01:33 +0000)]
Reland: [Docs][Windows Itanium] Add a How-To document for Windows Itanium.

This is a basic How-To that describes:
- What Windows Itanium is.
- How to assemble a build environment.

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

3 years agoRevert "Run non-filechecked commands in update_cc_test_checks.py"
Jon Roelofs [Tue, 9 Mar 2021 01:26:24 +0000 (17:26 -0800)]
Revert "Run non-filechecked commands in update_cc_test_checks.py"

This reverts commit 60d4c73b30a0e324c6ae314722eb036f70f4b03a.

The new test is broken on macos hosts. Discussion here:
https://reviews.llvm.org/D97068#2611269
https://reviews.llvm.org/D97068#2612675

... revert to green.

3 years ago[AMDGPU] Remove SI_MASK_BRANCH
Ruiling Song [Thu, 25 Feb 2021 01:19:37 +0000 (09:19 +0800)]
[AMDGPU] Remove SI_MASK_BRANCH

This is already deprecated, so remove code working on this.
Also update the tests by using S_CBRANCH_EXECZ instead of SI_MASK_BRANCH.

Reviewed By: foad

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

3 years agoRead NumBlocks as uint64_t.
Rahman Lavaee [Tue, 9 Mar 2021 00:46:00 +0000 (16:46 -0800)]
Read NumBlocks as uint64_t.

This fixes the Buildbot failure happened due to a sloppy merge.

3 years agoMove ObjCARCUtil.h back to llvm/Analysis
Akira Hatanaka [Tue, 9 Mar 2021 00:31:38 +0000 (16:31 -0800)]
Move ObjCARCUtil.h back to llvm/Analysis

Instead of adding the header to llvm/IR, just duplicate the marker
string in the auto upgrader.

3 years ago[NFC][AMDGPU] Correct typo in DWARF Extensions For Heterogeneous Debugging
Tony [Sun, 7 Mar 2021 22:43:48 +0000 (22:43 +0000)]
[NFC][AMDGPU] Correct typo in DWARF Extensions For Heterogeneous Debugging

A note in the defintion of DW_OP_piece had an incomplete sentence.

Reviewed By: scott.linder

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

3 years ago[llvm-readelf] Support dumping the BB address map section with --bb-addr-map.
Rahman Lavaee [Tue, 9 Mar 2021 00:02:00 +0000 (16:02 -0800)]
[llvm-readelf] Support dumping the BB address map section with --bb-addr-map.

This patch lets llvm-readelf dump the content of the BB address map
section in the following format:
```
Function {
  At: <address>
  BB entries [
    {
      Offset:   <offset>
      Size:     <size>
      Metadata: <metadata>
    },
    ...
  ]
}
...
```

Reviewed By: jhenderson

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

3 years ago[AMDGPU] Cleanup test checks. NFC.
Stanislav Mekhanoshin [Mon, 8 Mar 2021 23:38:23 +0000 (15:38 -0800)]
[AMDGPU] Cleanup test checks. NFC.

3 years agoRevert "[Docs][Windows Itanium] Add a How-To document for Windows Itanium."
Ben Dunbobbin [Mon, 8 Mar 2021 23:56:46 +0000 (23:56 +0000)]
Revert "[Docs][Windows Itanium] Add a How-To document for Windows Itanium."

This reverts commit 5a91d23ddfb2effd471b919241d1ef80bf1a4c9d.

Markup was incorrect.

3 years ago[build][modules] Fix ObjCARCUtil.h modularization
Dave Lee [Mon, 8 Mar 2021 23:42:51 +0000 (15:42 -0800)]
[build][modules] Fix ObjCARCUtil.h modularization

This change was introduced by this fix:
a2a55def354df2cd4de0b1cbd6b2795a07e6905a.

This makes a submodule for ObjCARCUtil.h, because leaving it in
LLVM_intrinsic_gen causes a dependency cycle between LLVM_IR and
LLVM_intrinsic_gen.

3 years ago[Docs][Windows Itanium] Add a How-To document for Windows Itanium.
Ben Dunbobbin [Mon, 8 Mar 2021 23:01:02 +0000 (23:01 +0000)]
[Docs][Windows Itanium] Add a How-To document for Windows Itanium.

This is a basic How-To that describes:
- What Windows Itanium is.
- How to assemble a build environment.

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

3 years ago[libc][Obvious] Add a file which was missed in 001a12ed59c354aa759ff3e104748c36803cfaa2.
Siva Chandra Reddy [Mon, 8 Mar 2021 23:38:48 +0000 (15:38 -0800)]
[libc][Obvious] Add a file which was missed in 001a12ed59c354aa759ff3e104748c36803cfaa2.

3 years ago[libc][NFC] Make x86_64 fenv functions msan safe.
Siva Chandra Reddy [Mon, 8 Mar 2021 23:12:22 +0000 (15:12 -0800)]
[libc][NFC] Make x86_64 fenv functions msan safe.

These functions used inline asm to read FPU state. This change adds
explicit unpoisoning in these functions as the sanitizers don't see the
read operations.

3 years ago[ValueTracking] Move matchSimpleRecurrence out of line
Benjamin Kramer [Mon, 8 Mar 2021 23:04:47 +0000 (00:04 +0100)]
[ValueTracking] Move matchSimpleRecurrence out of line

The header only has a forward declaration of PHINode available, and this
function doesn't seem to get much out of inlining.

3 years ago[flang] Fix bad dereference of NULLIFY pointer object
Peter Steinfeld [Mon, 8 Mar 2021 16:21:30 +0000 (08:21 -0800)]
[flang] Fix bad dereference of NULLIFY pointer object

When we have a subprogram that has been determined to contain errors, we do not
perform name resolution on its execution part.  In this case, if the subprogram
contains a NULLIFY statement, the parser::Name of a pointer object in a NULLIFY
statement will not have had name resolution performed on it.  Thus, its symbol
will not have been set.  Later, however, we do semantic checking on the NULLIFY
statement.  The code that did this assumed that the parser::Name of the
pointer object was non-null.

I fixed this by just removing the null pointer check for the "symbol" member of
the "parser::Name" of the pointer object when doing semantic checking for
NULLIFY statements.  I also added a test that will make the compiler crash
without this change.

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

3 years ago[AIX][TLS] Generate 64-bit general-dynamic access code sequence
Lei Huang [Fri, 5 Mar 2021 22:17:06 +0000 (16:17 -0600)]
[AIX][TLS] Generate 64-bit general-dynamic access code sequence

Add support for the TLS general dynamic access model to assembly
files on AIX 64-bit.

Reviewed By: sfertile

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

3 years agoscudo: Support memory tagging in the secondary allocator.
Peter Collingbourne [Tue, 22 Dec 2020 02:39:03 +0000 (18:39 -0800)]
scudo: Support memory tagging in the secondary allocator.

This patch enhances the secondary allocator to be able to detect buffer
overflow, and (on hardware supporting memory tagging) use-after-free
and buffer underflow.

Use-after-free detection is implemented by setting memory page
protection to PROT_NONE on free. Because this must be done immediately
rather than after the memory has been quarantined, we no longer use the
combined allocator quarantine for secondary allocations. Instead, a
quarantine has been added to the secondary allocator cache.

Buffer overflow detection is implemented by aligning the allocation
to the right of the writable pages, so that any overflows will
spill into the guard page to the right of the allocation, which
will have PROT_NONE page protection. Because this would require the
secondary allocator to produce a header at the correct position,
the responsibility for ensuring chunk alignment has been moved to
the secondary allocator.

Buffer underflow detection has been implemented on hardware supporting
memory tagging by tagging the memory region between the start of the
mapping and the start of the allocation with a non-zero tag. Due to
the cost of pre-tagging secondary allocations and the memory bandwidth
cost of tagged accesses, the allocation itself uses a tag of 0 and
only the first four pages have memory tagging enabled.

This is a reland of commit 7a0da8894348 which was reverted in commit
9678b07e42ee. This reland includes the following changes:

- Fix the calculation of BlockSize which led to incorrect statistics
  returned by mallinfo().
- Add -Wno-pedantic to silence GCC warning.
- Optionally add some slack at the end of secondary allocations to help
  work around buggy applications that read off the end of their
  allocation.

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

3 years ago[InstCombine] add tests for min/max intrinsics with not ops; NFC
Sanjay Patel [Mon, 8 Mar 2021 22:37:52 +0000 (17:37 -0500)]
[InstCombine] add tests for min/max intrinsics with not ops; NFC

3 years ago[ValueTracking] move/add helper to get inverse min/max; NFC
Sanjay Patel [Mon, 8 Mar 2021 22:19:04 +0000 (17:19 -0500)]
[ValueTracking] move/add helper to get inverse min/max; NFC

We will need to this functionality to improve min/max folds
in instcombine when we canonicalize to intrinsics.

3 years ago[SelectionDAG] Don't scalarize vector fpround sources that don't need it.
Jessica Paquette [Mon, 8 Mar 2021 19:32:58 +0000 (11:32 -0800)]
[SelectionDAG] Don't scalarize vector fpround sources that don't need it.

Similar to the workaround code in ScalarizeVecRes_UnaryOp, ScalarizeVecRes_SETCC
, ScalarizeVecRes_VSELECT, etc.

If we have a case like this:

```
define <1 x half> @func(<1 x float> %x) {
  %tmp = fptrunc <1 x float> %x to <1 x half>
  ret <1 x half> %tmp
}
```

On AArch64, the <1 x float> is legal. So, this will crash if we call
GetScalarizedVector on it.

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

3 years ago[CSSPGO][llvm-profgen] Change sample count of dangling probe in llvm-profgen
wlei [Tue, 16 Feb 2021 20:55:06 +0000 (12:55 -0800)]
[CSSPGO][llvm-profgen] Change sample count of dangling probe in llvm-profgen

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

3 years ago[mlir][IR][NFC] Move the remaining builtin types to ODS
River Riddle [Mon, 8 Mar 2021 22:25:47 +0000 (14:25 -0800)]
[mlir][IR][NFC] Move the remaining builtin types to ODS

This will allow for removing the duplicated type documentation from LangRef and instead link to the builtin dialect documentation.

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

3 years ago[mlir][IR][NFC] Define the Location classes in ODS instead of C++
River Riddle [Mon, 8 Mar 2021 22:25:38 +0000 (14:25 -0800)]
[mlir][IR][NFC] Define the Location classes in ODS instead of C++

This also removes the need for LocationDetail.h.

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

3 years ago[Sanitizer][RISCV] Fix internal_clone
Luís Marques [Mon, 8 Mar 2021 22:28:19 +0000 (22:28 +0000)]
[Sanitizer][RISCV] Fix internal_clone

A RISC-V implementation of `internal_clone` was introduced in D87573, as
part of the RISC-V ASan patch set by @EccoTheDolphin. That function was
never used/tested until I ported LSan for RISC-V, as part of D92403. That
port revealed problems in the original implementation, so I provided a fix
in D92403. Unfortunately, my choice of replacing the assembly with regular
C++ code wasn't correct. The clone syscall arguments specify a separate
stack, so non-inlined calls, spills, etc. aren't going to work. This wasn't
a problem in practice for optimized builds of Compiler-RT, but it breaks
for debug builds. This patch fixes the original problem while keeping the
assembly.

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

3 years agoAdd intrinsics_gen as a dependency of libRemarks
Jon Roelofs [Mon, 8 Mar 2021 21:34:58 +0000 (13:34 -0800)]
Add intrinsics_gen as a dependency of libRemarks

Builds were failing with errors like:

```
fatal error: 'llvm/IR/Attributes.inc' file not found
         ^~~~~~~~~~~~~~~~~~~~~~~~
```

rdar://75179147

3 years ago[tsan] Use large address space mapping on Apple Silicon Macs
Kuba Mracek [Mon, 8 Mar 2021 22:09:02 +0000 (14:09 -0800)]
[tsan] Use large address space mapping on Apple Silicon Macs

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

3 years ago[PowerPC] Removing _massv place holder
Masoud Ataei [Mon, 8 Mar 2021 21:43:24 +0000 (21:43 +0000)]
[PowerPC] Removing _massv place holder

Since P8 is the oldest machine supported by MASSV pass,
_massv place holder is removed and the oldest version of
MASSV functions is assumed. If the P9 vector specific is
detected in the compilation process, the P8 prefix will
be updated to P9.

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

3 years ago[InstSimplify] cttz(1<<x) --> x
Sanjay Patel [Mon, 8 Mar 2021 20:42:01 +0000 (15:42 -0500)]
[InstSimplify] cttz(1<<x) --> x

https://alive2.llvm.org/ce/z/TDacYu
https://alive2.llvm.org/ce/z/KF84S3

3 years ago[InstSimplify] add tests for cttz of shifted-1; NFC
Sanjay Patel [Mon, 8 Mar 2021 20:29:26 +0000 (15:29 -0500)]
[InstSimplify] add tests for cttz of shifted-1; NFC

3 years ago[gn build] Port 5c26be214d9f
LLVM GN Syncbot [Mon, 8 Mar 2021 21:01:52 +0000 (21:01 +0000)]
[gn build] Port 5c26be214d9f

3 years ago[AArch64][GlobalISel] Lower G_BUILD_VECTOR -> G_DUP
Jessica Paquette [Mon, 1 Mar 2021 19:58:07 +0000 (11:58 -0800)]
[AArch64][GlobalISel] Lower G_BUILD_VECTOR -> G_DUP

If we have

```
%vec = G_BUILD_VECTOR %reg, %reg, ..., %reg
```

Then lower it to

```
%vec = G_DUP %reg
```

Also update the selector to handle constant splats on G_DUP.

This will not combine when the splat is all zeros or ones. Tablegen-imported
patterns rely on these being G_BUILD_VECTOR.

Minor code size improvements on CTMark at -Os.

Also adds some utility functions to make it a bit easier to recognize splats,
and an AArch64-specific splat helper.

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

3 years agoRevert "[LICM] Make promotion faster"
Alina Sbirlea [Mon, 8 Mar 2021 20:50:36 +0000 (12:50 -0800)]
Revert "[LICM] Make promotion faster"

Revert 3d8f842712d49b0767832b6e3f65df2d3f19af4e
Revision triggers a miscompile sinking a store incorrectly outside a
threading loop. Detected by tsan.
Reverting while investigating.

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