platform/upstream/llvm.git
3 years ago[LSan][RISCV] Enable LSan for RISCV64
Luís Marques [Sun, 31 Jan 2021 21:52:32 +0000 (21:52 +0000)]
[LSan][RISCV] Enable LSan for RISCV64

Fixes the broken RISCV64 implementation of `internal_clone` and
adds RISCV64 support for LSan.

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

3 years ago[LTOCodeGenerator] Use lto::Config for options (NFC).
Florian Hahn [Sun, 31 Jan 2021 19:08:07 +0000 (19:08 +0000)]
[LTOCodeGenerator] Use lto::Config for options (NFC).

This patch removes some options that have been duplicated in
LTOCodeGenerator and instead use lto::Config directly to manage the
options.

This is a cleanup after 6a59f0560648.

Reviewed By: tejohnson

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

3 years ago[ConstraintElimination] Add tests for ICMP_EQ predicates.
Florian Hahn [Thu, 28 Jan 2021 10:35:30 +0000 (10:35 +0000)]
[ConstraintElimination] Add tests for ICMP_EQ predicates.

Pre-commit test coverage for conditions with EQ predicates.

3 years ago[lldb] [Process/FreeBSDRemote] Introduce arm (32-bit) support
Michał Górny [Wed, 27 Jan 2021 14:34:15 +0000 (15:34 +0100)]
[lldb] [Process/FreeBSDRemote] Introduce arm (32-bit) support

Introduce a NativeRegisterContextFreeBSD for 32-bit ARM platform.
This includes support for GPR + VFP registers as exposed by FreeBSD's
ptrace(2) API.  Hardware breakpoints or watchpoints are not supported
due to missing kernel support.  The code is roughly based on the arm64
context.

It also includes an override for GetSoftwareBreakpointTrapOpcode() based
on the matching code in the PlatformFreeBSD plugin.

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

3 years ago[lldb] [Process/FreeBSDRemote] Introduce arm64 support
Michał Górny [Thu, 21 Jan 2021 18:30:56 +0000 (19:30 +0100)]
[lldb] [Process/FreeBSDRemote] Introduce arm64 support

Introduce arm64 support in the FreeBSDRemote plugin.  The code
is roughly based on Linux and reuses the same POSIX RegisterInfos
(but the buffers need to be a few bytes larger due to stricter struct
member alignment in FreeBSD structures -- luckily, they do not affect
the actual member offsets).  It supports reading and writing
general-purpose and FPU registers.  SVE and hardware watchpoint support
is missing due to the limitations of FreeBSD ptrace(2) API.

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

3 years ago[llvm] Drop unnecessary const from return types (NFC)
Kazu Hirata [Sun, 31 Jan 2021 18:23:43 +0000 (10:23 -0800)]
[llvm] Drop unnecessary const from return types (NFC)

Identified with const-return-type.

3 years ago[TableGen] Use ListSeparator (NFC)
Kazu Hirata [Sun, 31 Jan 2021 18:23:41 +0000 (10:23 -0800)]
[TableGen] Use ListSeparator (NFC)

3 years ago[VE] Fix compiler warnings (NFC)
Kazu Hirata [Sun, 31 Jan 2021 18:23:39 +0000 (10:23 -0800)]
[VE] Fix compiler warnings (NFC)

3 years agoRegAlloc: Fix assert if all registers in class reserved
Matt Arsenault [Mon, 18 Jan 2021 14:53:55 +0000 (09:53 -0500)]
RegAlloc: Fix assert if all registers in class reserved

With a context instruction, this would produce a context
error. However, it would continue on and do an out of bounds access of
the empty allocation order array.

3 years agoAMDGPU: Add missing consts
Matt Arsenault [Thu, 28 Jan 2021 20:40:38 +0000 (15:40 -0500)]
AMDGPU: Add missing consts

3 years agoReland [clangd] Quote/escape argv included in log messages.
Sam McCall [Sun, 31 Jan 2021 15:37:42 +0000 (16:37 +0100)]
Reland [clangd] Quote/escape argv included in log messages.

... but don't apply it where we're using hasSubstr

This reverts commit 7a8008d0e8885d22ff9a1fa7f9965c7b2ad2569a.

3 years agoRevert "[clangd] Quote/escape argv included in log messages."
Sam McCall [Sun, 31 Jan 2021 15:21:44 +0000 (16:21 +0100)]
Revert "[clangd] Quote/escape argv included in log messages."

This reverts commit 0962f1d72b1606f3224a14434c7b4500a23f8728.
http://45.33.8.238/win/32346/step_9.txt

3 years ago[dsymutil][DWARFLinker][NFC] make AddressManager not depending on the order of checks...
Alexey Lapshin [Tue, 1 Dec 2020 20:15:34 +0000 (23:15 +0300)]
[dsymutil][DWARFLinker][NFC] make AddressManager not depending on the order of checks for relocations.

Current dsymutil implementation of hasLiveMemoryLocation()/hasLiveAddressRange()
and applyValidRelocs() assume that calls should be done in certain order
(from first Dies to last). Multi-thread implementation might call these methods
in other order(it might process compilation units in order other than they are physically
located), so we remove restriction that searching for relocations should be done
in ascending order. This change does not introduce noticable performance degradation.
The testing results for clang binary:

golden-dsymutil/dsymutil  23787992
clang MD5: 5efa8fd9355ebf81b65f24db5375caa2
elapsed time=91sec

build-Release/bin/dsymutil 23855616
clang MD5: 5efa8fd9355ebf81b65f24db5375caa2
elapsed time=91sec

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

3 years ago[libc++] Allow building with C++17.
Mark de Wever [Sun, 31 Jan 2021 13:25:01 +0000 (14:25 +0100)]
[libc++] Allow building with C++17.

After committing D92214 it was noticed libc++ no longer builds with
C++17. For now reenable building with C++17. This is intended to be a
temporary measure in the future a C++20 capable compiler will be
required.

3 years ago[clangd] Remove references to old future-based API. NFC
Sam McCall [Sun, 31 Jan 2021 11:13:20 +0000 (12:13 +0100)]
[clangd] Remove references to old future-based API. NFC

3 years ago[clangd] Quote/escape argv included in log messages.
Sam McCall [Sun, 31 Jan 2021 11:00:08 +0000 (12:00 +0100)]
[clangd] Quote/escape argv included in log messages.

https://github.com/clangd/clangd/issues/637

3 years ago[docs] Clarify compile_flags.txt subtleties
Sam McCall [Sun, 31 Jan 2021 10:16:52 +0000 (11:16 +0100)]
[docs] Clarify compile_flags.txt subtleties

See confusion e.g. in https://github.com/clangd/clangd/issues/637

3 years ago[RISCV] Add rv64 command line to bswap-ctlz-cttz-ctpop.ll.
Craig Topper [Sun, 31 Jan 2021 05:30:14 +0000 (21:30 -0800)]
[RISCV] Add rv64 command line to bswap-ctlz-cttz-ctpop.ll.

3 years ago[mlir][AVX512] Fix result type of vp2intersect
Matthias Springer [Sun, 31 Jan 2021 02:57:50 +0000 (11:57 +0900)]
[mlir][AVX512] Fix result type of vp2intersect

The result values of vp2intersect are vectors of bits, i.e.,
vector<8xi1> or vector<16xi8> (instead of i8 or i16).

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

3 years ago[flang] Improve shape & length characterization
peter klausler [Sat, 30 Jan 2021 18:14:07 +0000 (10:14 -0800)]
[flang] Improve shape & length characterization

Analyze the shape of the result of TRANSFER(ptr,array) correctly
when "ptr" is an array of deferred shape.  Fixing this bug led to
some refactoring and concentration of common code in TypeAndShape
member functions with code in general shape and character length
analysis, and this led to some regression test failures that have
all been cleaned up.

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

3 years ago[RISCV] Use MVT instead of EVT in RISCVISelDAGToDAG.cpp
Craig Topper [Sat, 30 Jan 2021 23:57:12 +0000 (15:57 -0800)]
[RISCV] Use MVT instead of EVT in RISCVISelDAGToDAG.cpp

All this code runs post type legalization so we should have
exclusively legal types. The methods on MVT should be more
efficient than EVT.

3 years ago[TableGen] Use emplace_back to add to PatternsToMatch in GenerateVariants. Use std...
Craig Topper [Sat, 30 Jan 2021 21:14:46 +0000 (13:14 -0800)]
[TableGen] Use emplace_back to add to PatternsToMatch in GenerateVariants. Use std::move when adding to PatternsToMatch in AddPatternToMatch.

We already used emplace_back in at least one other place so be
consistent.

AddPatternToMatch already took PTM as an rvalue reference, but
we need to use std::move again to move it into the PatternToMatch
vector.

3 years ago[TableGen] Avoid a couple vector copies in ExpandHwModeBasedTypes.
Craig Topper [Sat, 30 Jan 2021 20:19:14 +0000 (12:19 -0800)]
[TableGen] Avoid a couple vector copies in ExpandHwModeBasedTypes.

Use vector::swap instead of copying to a local vector and clearing
the original. We can just swap into the just created local vector
instead which will move the pointers and not the data.

Use std::move in another place to avoid a copy.

3 years ago[OpenMP][NVPTX] Refined CMake logic to choose compute capabilites
Shilei Tian [Sat, 30 Jan 2021 20:14:41 +0000 (15:14 -0500)]
[OpenMP][NVPTX] Refined CMake logic to choose compute capabilites

This patch refines the logic to choose compute capabilites via the
environment variable `LIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES`. It supports the
following values (all case insensitive):
- "all": Build `deviceRTLs` for all supported compute capabilites;
- "auto": Only build for the compute capability auto detected. Note that this
  requires CUDA. If CUDA is not found, a CMake fatal error will be raised.
- "xx,yy" or "xx;yy": Build for compute capabilities `xx` and `yy`.

If `LIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES` is not set, it is equivalent to set
it to `all`.

Reviewed By: jdoerfert

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

3 years ago[ConstraintElimination] Verify CS and DFSInStack are in sync.(NFC)
Florian Hahn [Sat, 30 Jan 2021 17:56:51 +0000 (17:56 +0000)]
[ConstraintElimination] Verify CS and DFSInStack are in sync.(NFC)

After the main loop is done, we should have one constraint per item in
DFSInStack. Otherwise we added a constraint without a proper DFSInStack
item.

3 years ago[llvm] Add missing header guards (NFC)
Kazu Hirata [Sat, 30 Jan 2021 17:53:42 +0000 (09:53 -0800)]
[llvm] Add missing header guards (NFC)

Identified with llvm-header-guard.

3 years ago[AMDGPU] Forward-declare AMDGPUTargetMachine (NFC)
Kazu Hirata [Sat, 30 Jan 2021 17:53:40 +0000 (09:53 -0800)]
[AMDGPU] Forward-declare AMDGPUTargetMachine (NFC)

AMDGPUTargetTransformInfo.h needs AMDGPUTargetMachine but relies on a
forward declaration of AMDGPUTargetMachine in AMDGPU.h.  This patch
adds a forward declaration right in AMDGPUTargetTransformInfo.h.

While we are at it, this patch removes the one in
AMDGPU.h, where it is unnecessary.

3 years ago[TableGen] Use ListSeparator (NFC)
Kazu Hirata [Sat, 30 Jan 2021 17:53:38 +0000 (09:53 -0800)]
[TableGen] Use ListSeparator (NFC)

3 years ago[ASTMatchers] Fix definition of decompositionDecl
Stephen Kelly [Sat, 30 Jan 2021 15:46:08 +0000 (15:46 +0000)]
[ASTMatchers] Fix definition of decompositionDecl

3 years ago[RISCV] Update extractelt tests to sign-extend results (NFC)
Fraser Cormack [Sat, 30 Jan 2021 15:47:16 +0000 (15:47 +0000)]
[RISCV] Update extractelt tests to sign-extend results (NFC)

This demonstrates a missed optimization: the `vmv.x.s` instruction is
used to extract the element from the vector, and this instruction
already sign-extends the value to XLEN.

3 years ago[llvm-symbolizer] - Fix the crash in GNU output style with --no-inlines and missing...
Georgii Rymar [Thu, 28 Jan 2021 13:35:18 +0000 (16:35 +0300)]
[llvm-symbolizer] - Fix the crash in GNU output style with --no-inlines and missing input file.

Fixes https://bugs.llvm.org/show_bug.cgi?id=48882.

If the input file does not exist (or has a reading error), the
following code will crash if there are two or more input addresses.

```
auto ResOrErr = Symbolizer.symbolizeInlinedCode(
  ModuleName, {Offset, object::SectionedAddress::UndefSection});
Printer << (error(ResOrErr) ? DILineInfo() : ResOrErr.get().getFrame(0));
```

For the first address, `symbolizeInlinedCode` returns an error.
For the second address, `symbolizeInlinedCode` returns an empty result
(not an error) and `.getFrame(0)` will crash.

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

3 years agoFix traversal with hasDescendant into lambdas
Stephen Kelly [Thu, 28 Jan 2021 13:12:43 +0000 (13:12 +0000)]
Fix traversal with hasDescendant into lambdas

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

3 years ago[LoopUnswitch] Properly update MSSA if header has non-clobbering stores.
Florian Hahn [Sat, 30 Jan 2021 13:30:48 +0000 (13:30 +0000)]
[LoopUnswitch] Properly update MSSA if header has non-clobbering stores.

This patch fixes updating MemorySSA if the header contains memory
defs that do not clobber a duplicated instruction. We need to find the
first defining access outside the loop body and use that as defining
access of the duplicated instruction.

This fixes a crash caused by bee486851c1a.

3 years ago[ASTMatchers] Fix traversal below range-for elements
Stephen Kelly [Wed, 27 Jan 2021 22:03:23 +0000 (22:03 +0000)]
[ASTMatchers] Fix traversal below range-for elements

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

3 years ago[compiler-rt][tests] Define TARGET_FLAGS
Harald van Dijk [Sat, 30 Jan 2021 13:06:08 +0000 (13:06 +0000)]
[compiler-rt][tests] Define TARGET_FLAGS

D36116 refactored the logic of tests and removed the definition of TARGET_FLAGS, but left one use of it. Restore its definition for that one use, so that an x86_64 test is compiled with -m64.

Reviewed By: vitalybuka

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

3 years ago[LTO] Add option enable NewPM with LTOCodeGenerator.
Florian Hahn [Sat, 30 Jan 2021 11:50:37 +0000 (11:50 +0000)]
[LTO] Add option enable NewPM with LTOCodeGenerator.

This patch adds an option to enable the new pass manager in
LTOCodeGenerator. It also updates a few tests with legacy PM specific
tests, which started failing after 6a59f0560648 when
LLVM_ENABLE_NEW_PASS_MANAGER=true.

3 years ago[LTO] Use lto::backend for code generation.
Florian Hahn [Sat, 30 Jan 2021 10:09:55 +0000 (10:09 +0000)]
[LTO] Use lto::backend for code generation.

This patch updates LTOCodeGenerator to use the utilities provided by
LTOBackend to run middle-end optimizations and backend code generation.

This is a first step towards unifying the code used by libLTO's C API
and the newer, C++ interface (see PR41541).

The immediate motivation is to allow using the new pass manager when
doing LTO using libLTO's C API, which is used on Darwin, among others.

With the changes, there are no codegen/stats differences when building
MultiSource/SPEC2000/SPEC2006 on Darwin X86 with LTO, compared
to without the patch.

Reviewed By: steven_wu

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

3 years ago[ELF][test] Add --emit-relocs --gc-sections test for relocation section for a non...
Fangrui Song [Sat, 30 Jan 2021 08:51:36 +0000 (00:51 -0800)]
[ELF][test] Add --emit-relocs --gc-sections test for relocation section for a non-SHF_ALLOC section

This has been fixed by D89841.

3 years ago[llvm] Use isa instead of dyn_cast (NFC)
Kazu Hirata [Sat, 30 Jan 2021 07:23:37 +0000 (23:23 -0800)]
[llvm] Use isa instead of dyn_cast (NFC)

3 years ago[llvm] Use llvm::lower_bound and llvm::upper_bound (NFC)
Kazu Hirata [Sat, 30 Jan 2021 07:23:35 +0000 (23:23 -0800)]
[llvm] Use llvm::lower_bound and llvm::upper_bound (NFC)

3 years ago[llvm] Use append_range (NFC)
Kazu Hirata [Sat, 30 Jan 2021 07:23:34 +0000 (23:23 -0800)]
[llvm] Use append_range (NFC)

3 years ago[NFC][VFS] Fix a build warning due to an extra semicolon
Yang Fan [Sat, 30 Jan 2021 06:52:43 +0000 (14:52 +0800)]
[NFC][VFS] Fix a build warning due to an extra semicolon

3 years ago[lld-macho][NFC] Add new option group for versions
Greg McGary [Fri, 11 Dec 2020 05:36:42 +0000 (21:36 -0800)]
[lld-macho][NFC] Add new option group for versions

Coalesce all version control options into a group

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

3 years ago[llvm-objdump-macho] print per-second-level-page encodings for option --unwind-info
Greg McGary [Fri, 11 Dec 2020 04:54:45 +0000 (20:54 -0800)]
[llvm-objdump-macho] print per-second-level-page encodings for option --unwind-info

Compact unwind entries have 8 bits for the encoding-table offset:
* offsets 0..126 reference the global commmon-encodings table, while
* offsets 127..255 reference a per-second-level-page table.
This diff teaches `llvm-objdump` to print this per-page encodings table.

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

3 years ago[X86] Fix tile config register spill issue.
Wang, Pengfei [Sat, 30 Jan 2021 04:00:55 +0000 (12:00 +0800)]
[X86] Fix tile config register spill issue.

This is an optimized approach for D94155.

Previous code build the model that tile config register is the user of
each AMX instruction. There is a problem for the tile config register
spill. When across function, the ldtilecfg instruction may be inserted
on each AMX instruction which use tile config register. This cause all
tile data register clobber.

To fix this issue, we remove the model of tile config register. Instead,
we analyze the AMX instructions between one call to another. We will
insert ldtilecfg after the first call if we find any AMX instructions.

Reviewed By: LuoYuanke

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

3 years agoDetect Source Drift with Propeller.
Sriraman Tallam [Sat, 30 Jan 2021 02:47:26 +0000 (18:47 -0800)]
Detect Source Drift with Propeller.

Source Drift happens when the sources are updated after profiling the binary
but before building the final optimized binary. If the source has changed since
the profiles were obtained, optimizing basic blocks might be sub-optimal. This
only applies to BasicBlockSection::List as it creates clusters of basic blocks
using basic block ids. Source drift can invalidate these groupings leading to
sub-optimal code generation with regards to performance.

PGO source drift for a particular function can be detected using function
metadata added in D95495.

When source drift is deected, disable basic block clusters by default
which can be re-enabled with  -mllvm option
bbsections-detect-source-drift=false.

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

3 years agoUse type alias for large tuples
Jacques Pienaar [Sat, 30 Jan 2021 01:42:23 +0000 (17:42 -0800)]
Use type alias for large tuples

Tuples can occupy quite a lot of space, instead of printing out tuple type
everywhere, just use the type alias if larger (arbitrarily chose a bound for
now).

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

3 years ago[RISCV] Merge rv32 and rv64 vector fadd/fsub/fmul/fdiv sdnode tests into single tests...
Craig Topper [Sat, 30 Jan 2021 01:32:01 +0000 (17:32 -0800)]
[RISCV] Merge rv32 and rv64 vector fadd/fsub/fmul/fdiv sdnode tests into single tests files with 2 run lines.

The IR and CHECK lines are identical so just keep one copy.

3 years ago[VFS] Combine VFSFromYamlDirIterImpl and OverlayFSDirIterImpl into a single implement...
Nathan Hawes [Sat, 16 Jan 2021 01:44:14 +0000 (11:44 +1000)]
[VFS] Combine VFSFromYamlDirIterImpl and OverlayFSDirIterImpl into a single implementation (NFC)

As a fixme notes, both of these directory iterator implementations are
conceptually similar and duplicate the functionality of returning and uniquing
entries across two or more directories. This patch combines them into a single
class 'CombiningDirIterImpl'.

This also drops the 'Redirecting' prefix from RedirectingDirEntry and
RedirectingFileEntry to save horizontal space. There's no loss of clarity as
they already have to be prefixed with 'RedirectingFileSystem::' whenever
they're referenced anyway.

rdar://problem/72485443
Differential Revision: https://reviews.llvm.org/D94857

3 years agoUpdate ElementsAttr::isValidIndex to handle ElementsAttr with a scalar. Scalar will...
karimnosseir [Sat, 30 Jan 2021 00:55:12 +0000 (16:55 -0800)]
Update ElementsAttr::isValidIndex to handle ElementsAttr with a scalar. Scalar will have rank 0.

Update ElementsAttr::isValidIndex to handle ElementsAttr with a scalar. Scalar will have rank 0.

Reviewed By: rriddle

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

3 years ago[RISCV] Update the version number to v0.10 for vector.
Hsiangkai Wang [Fri, 29 Jan 2021 23:54:41 +0000 (07:54 +0800)]
[RISCV]  Update the version number to v0.10 for vector.

3 years ago[flang] Support disabled alternative PARAMETER statement
peter klausler [Fri, 29 Jan 2021 21:34:22 +0000 (13:34 -0800)]
[flang] Support disabled alternative PARAMETER statement

Legacy Fortran implementations support an alternative form of the
PARAMETER statement; it differs syntactically from the standard's
PARAMETER statement by lacking parentheses, and semantically by
using the type and shape of the initialization expression to define
the attributes of the named constant.  (GNU Fortran gets that part
wrong; Intel Fortran and nvfortran have full support.)

This patch disables the old style PARAMETER statement by default, as
it is syntactically ambiguous with conforming assignment statements;
adds a new "-falternative-parameter-statement" option to enable it;
and implements it correctly when enabled.

Fixes https://bugs.llvm.org/show_bug.cgi?id=48774, in which a user
tripped over the syntactic ambiguity.

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

3 years ago[RISCV] Update the version number to v0.10 for vector.
Hsiangkai Wang [Fri, 29 Jan 2021 13:59:49 +0000 (21:59 +0800)]
[RISCV] Update the version number to v0.10 for vector.

v0.10 is tagged in V specification. Update the version to v0.10.

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

3 years ago[NFC][RISCV] Remove redundant pseudo instructions for vector load/store.
Hsiangkai Wang [Fri, 29 Jan 2021 06:35:58 +0000 (14:35 +0800)]
[NFC][RISCV] Remove redundant pseudo instructions for vector load/store.

Not all combinations of SEW and LMUL we need to support. For example, we
only need to support [M1, M2, M4, M8] for SEW = 64. There is no need to
define pseudos for PseudoVLSE64MF8, PseudoVLSE64MF4, and PseudoVLSE64MF2.

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

3 years ago[AMDGPU] Be more specific in needsFrameBaseReg
Stanislav Mekhanoshin [Fri, 29 Jan 2021 22:38:29 +0000 (14:38 -0800)]
[AMDGPU] Be more specific in needsFrameBaseReg

A condition "mayLoadOrStore" is too broad for that function.

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

3 years ago[ExpandMemCmpPass] Preserve Dominator Tree, if available
Roman Lebedev [Fri, 29 Jan 2021 19:46:34 +0000 (22:46 +0300)]
[ExpandMemCmpPass] Preserve Dominator Tree, if available

This finishes getting rid of all the avoidable Dominator Tree recalculations
in X86 optimized codegen pipeline.

3 years ago[ShadowStackGCLowering] Preserve Dominator Tree, if avaliable
Roman Lebedev [Fri, 29 Jan 2021 18:14:34 +0000 (21:14 +0300)]
[ShadowStackGCLowering] Preserve Dominator Tree, if avaliable

This doesn't help avoid any Dominator Tree recalculations just yet,
there's one more pass to go..

3 years ago[LowerConstantIntrinsics] Preserve Dominator Tree, if avaliable
Roman Lebedev [Fri, 29 Jan 2021 18:33:49 +0000 (21:33 +0300)]
[LowerConstantIntrinsics] Preserve Dominator Tree, if avaliable

3 years ago[SVE] delete VectorType::getNumElements()
Christopher Tetreault [Fri, 29 Jan 2021 20:52:39 +0000 (12:52 -0800)]
[SVE] delete VectorType::getNumElements()

The previously agreed-upon deprecation period for
VectorType::getNumElements() has passed. This patch removes this method
and completes the refactor proposed in the RFC:
https://lists.llvm.org/pipermail/llvm-dev/2020-March/139811.html

Reviewed By: david-arm, rjmccall

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

3 years agoEmit metadata when instr. profiles hash mismatch occurs.
Sriraman Tallam [Fri, 29 Jan 2021 20:52:59 +0000 (12:52 -0800)]
Emit metadata when instr. profiles hash mismatch occurs.

This patch emits "instr_prof_hash_mismatch" function annotation metadata if
there is a hash mismatch while applying instrumented profiles.

During the PGO optimized build using instrumented profiles, if the CFG of
the function has changed since generating the profile, a hash mismatch is
encountered. This patch emits this information as annotation metadata. We
plan to use this with Propeller which is done at the machine IR level.
Propeller is usually applied on top of PGO and a hash mismatch during
PGO could be used to detect source drift.

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

3 years ago[clang-tidy] Fix linking tests to LLVMTestingSupport
Michał Górny [Fri, 29 Jan 2021 01:14:47 +0000 (02:14 +0100)]
[clang-tidy] Fix linking tests to LLVMTestingSupport

LLVMTestingSupport is not part of libLLVM, and therefore can not
be linked to via LLVM_LINK_COMPONENTS.  Instead, it needs to be
specified explicitly to ensure that it is linked explicitly
even if LLVM_LINK_LLVM_DYLIB is used.  This is consistent with handling
in clangd.

Fixes PR#48931

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

3 years ago[mlir] Preserve lexicographic order after loop collapsing.
Alexander Belyaev [Fri, 29 Jan 2021 20:26:57 +0000 (21:26 +0100)]
[mlir] Preserve lexicographic order after loop collapsing.

Currently, for a scf.parallel (i,j,k) after the loop collapsing to 1D is done, the
IVs would be traversed as for an scf.parallel(k,j,i).

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

3 years agoRevert "[CMake] Actually require python 3.6 or greater"
Christopher Tetreault [Fri, 29 Jan 2021 20:03:32 +0000 (12:03 -0800)]
Revert "[CMake] Actually require python 3.6 or greater"

There are builders that do not have python 3.6. Revert until this situation can be rectified

This reverts commit 0703b0753c40dad30f1683403f6600bd2cb42055.

3 years ago[CMake] Actually require python 3.6 or greater
Christopher Tetreault [Fri, 29 Jan 2021 17:11:38 +0000 (09:11 -0800)]
[CMake] Actually require python 3.6 or greater

Previously, CMake would find any version of Python3. However, the project
claims to require 3.6 or greater, and 3.6 features are being used.

Reviewed By: yln

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

3 years ago[GlobalISel] Remove hint instructions in generic InstructionSelect code.
Jessica Paquette [Thu, 28 Jan 2021 20:27:30 +0000 (12:27 -0800)]
[GlobalISel] Remove hint instructions in generic InstructionSelect code.

I think every target will want to remove these in the same way. Rather than
making them all implement the same code, let's just put this in
InstructionSelect.

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

3 years ago[VE] Add include for formatted_raw_ostream after 046cfb856517c6140d5e1c0989232e26d00b05b2
Fangrui Song [Fri, 29 Jan 2021 19:18:30 +0000 (11:18 -0800)]
[VE] Add include for formatted_raw_ostream after 046cfb856517c6140d5e1c0989232e26d00b05b2

3 years ago[AIX] Actually push back "-mabi=vec-extabi" when option is on.
Zarko Todorovski [Fri, 29 Jan 2021 19:05:17 +0000 (14:05 -0500)]
[AIX] Actually push back "-mabi=vec-extabi" when option is on.

Accidentaly ommitted the portion of pushing back the option in
https://reviews.llvm.org/D94986

3 years ago[libcxx][test] Silence MSVC narrowing warning
Casey Carter [Fri, 29 Jan 2021 19:05:52 +0000 (11:05 -0800)]
[libcxx][test] Silence MSVC narrowing warning

3 years ago[OpenMP] Add environment variable to force monotonic dynamic scheduling
Jonathan Peyton [Fri, 22 Jan 2021 20:45:45 +0000 (14:45 -0600)]
[OpenMP] Add environment variable to force monotonic dynamic scheduling

This patch introduces a new environment variable to force monotonic
behavior for users that absolutely need it.  This is in anticipation
of 5.0 change that uses non-monotonic behavior for dynamic scheduling
by default. Fixes for that and the actual switch are coming soon.

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

3 years ago[OpenMP][NFC] Added release note for new `deviceRTLs` and hidden helper task
Shilei Tian [Fri, 29 Jan 2021 18:12:47 +0000 (13:12 -0500)]
[OpenMP][NFC] Added release note for new `deviceRTLs` and hidden helper task

Added release note for new `deviceRTLs` and hidden helper task for LLVM
12.

Reviewed By: jdoerfert

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

3 years ago[libcxx][test] Silence false positive MSVC /analyze warning
Casey Carter [Fri, 29 Jan 2021 18:05:14 +0000 (10:05 -0800)]
[libcxx][test] Silence false positive MSVC /analyze warning

3 years ago[libcxx][test] explicitly discard bitset::test's return
Casey Carter [Fri, 29 Jan 2021 18:01:37 +0000 (10:01 -0800)]
[libcxx][test] explicitly discard bitset::test's return

... just in case some implementation annotates it `[[nodiscard]]`.

3 years agoMake the profile-filter.c test compatible with 32-bit systems
Petr Hosek [Fri, 29 Jan 2021 03:01:41 +0000 (19:01 -0800)]
Make the profile-filter.c test compatible with 32-bit systems

This addresses PR48930.

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

3 years ago[AArch64][Clang][Linux] Enable out-of-line atomics by default.
Pavel Iliin [Thu, 17 Dec 2020 20:07:35 +0000 (20:07 +0000)]
[AArch64][Clang][Linux] Enable out-of-line atomics by default.

Generate outline atomics if compiling for armv8-a non-LSE AArch64 Linux
(including Android) targets to use LSE instructions, if they are available,
at runtime. Library support is checked by clang driver which doesn't enable
outline atomics if no proper libraries (libgcc >= 9.3.1 or compiler-rt) found.

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

3 years ago[mlir][docs] Fix typo: even -> event
Jordan Rupprecht [Fri, 29 Jan 2021 17:16:35 +0000 (09:16 -0800)]
[mlir][docs] Fix typo: even -> event

3 years ago[flang][docs] Add New Flang Driver Biweekly call
Andrzej Warzynski [Fri, 29 Jan 2021 16:56:53 +0000 (16:56 +0000)]
[flang][docs] Add New Flang Driver Biweekly call

3 years ago[GlobalISel] Fix modifying a G_OR without notifying the observer
Jay Foad [Fri, 29 Jan 2021 14:41:58 +0000 (14:41 +0000)]
[GlobalISel] Fix modifying a G_OR without notifying the observer

Remove the call to setFlags in favour of creating the instruction with
the correct flags in the first place, so we don't have to explicitly
notify the observer.

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

3 years agoRevert "Disable rosegment for old Android versions."
Nico Weber [Fri, 29 Jan 2021 16:20:04 +0000 (11:20 -0500)]
Revert "Disable rosegment for old Android versions."

This reverts commit fae16fc0eed7cf60207901818cfe040116f2ef00.
Breaks building compiler-rt android runtimes with trunk clang
but older NDK, see discussion on https://reviews.llvm.org/D95166

3 years ago[AMDGPU] Test all register names known to AMDGPUPALMetadata
Jay Foad [Thu, 28 Jan 2021 14:19:31 +0000 (14:19 +0000)]
[AMDGPU] Test all register names known to AMDGPUPALMetadata

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

3 years ago[flang] Fix problems with constant arrays with lower bounds that are not 1
Peter Steinfeld [Tue, 26 Jan 2021 16:20:57 +0000 (08:20 -0800)]
[flang] Fix problems with constant arrays with lower bounds that are not 1

There were two problems with constant arrays whose lower bound is not 1.
First, when folding the arrays, we were creating the folded array to have lower
bounds of 1 but, we were not re-adjusting their lower bounds to the
declared values.  Second, we were not calculating the extents correctly.
Both of these problems led to bogus error messages.

I fixed the first problem by adjusting the lower bounds in
NonPointerInitializationExpr() in Evaluate/check-expression.cpp.  I wrote the
class ArrayConstantBoundChanger, which is similar to the existing class
ScalarConstantExpander.  In the process of implementing and testing it, I found
a bug that I fixed in ScalarConstantExpander which caused it to infinitely
recurse on parenthesized expressions.  I also removed the unrelated class
ScalarExpansionVisitor, which was not used.

I fixed the second problem by changing the formula that calculates upper bounds
in in the function ComputeUpperBound() in Evaluate/shape.cpp.

I added tests that trigger the bogus error messages mentioned above along with
a constant folding tests that uses array operands with shapes that conform but
have different bounds.

In the process of adding tests, I discovered that tests in
Evaluate/folding09.f90 and folding16.f90 were written incorrectly, and I
fixed them.  This also revealed a bug in contant folding of the
intrinsic "lbounds" which I plan to fix in a later change.

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

3 years ago[TableGen] Fix instantiating multiclass in foreach
J-Y You [Fri, 29 Jan 2021 15:24:30 +0000 (10:24 -0500)]
[TableGen] Fix instantiating multiclass in foreach

If multiclass argument comes from loop varaible and argument is record type,
it will not recognize the type. This patch ensures that loop variables are
resolved correctly.

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

3 years agoclang-cl: Accept /std:c11, /std:c17 flags
Nico Weber [Wed, 27 Jan 2021 23:59:39 +0000 (18:59 -0500)]
clang-cl: Accept /std:c11, /std:c17 flags

clang-cl already defaults to C17 for .c files, but no harm
in accepting these flags. Fixes PR48185.

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

3 years agoclang-cl: Invent a /winsysroot concept
Nico Weber [Wed, 27 Jan 2021 16:01:59 +0000 (11:01 -0500)]
clang-cl: Invent a /winsysroot concept

On non-Windows platforms, --sysroot can be used to make the compiler use
a single, hermetic directory for all header and library files.

This is useful, but difficult to do on Windows. After D95472 it's
possible to achieve this with two flags:

    out/gn/bin/clang-cl win.c -fuse-ld=lld \
        /vctoolsdir path/to/VC/Tools/MSVC/14.26.28801 \
        /winsdkdir path/to/win_sdk

But that's still cumbersome: It requires two flags instead of one, and
it requires writing down the (changing) VC/Tools/MSVC version.

This adds a new `/winsysroot <dir>` flag that's effectively an alias to
these two flags. With this, building against a hermetic Windows
toolchain only needs:

    out/gn/bin/clang-cl win.c -fuse-ld=lld /winsysroot path

`/winsysroot <dir>` is the same as adding

    /vctoolsdir <dir>/VC/Tools/MSVC/<vctoolsver>
    /winsdkdir <dir>/Windows Kits/<winsdkmajorversion>

`<vctoolsver>` is taken from `/vctoolsversion` if passed, or else it's
the name of the directory in `<dir>/VC/Tools/MSVC` that's the highest
numeric tuple.

`<winsdkmajorversion>` is the major version in /winsdkversion if passed,
else it's the name of the directory in `<dir>/Windows Kits` that's the
highest number.

So `/winsysroot <path>` requires this subfolder structure:

  path/
    VC/
      Tools/
        MSVC/
          14.26.28801  (or another number)
            include/
            ...
    Windows Kits/
      10/
        Include/
          10.0.19041.0/ (or another number)
            um/
            ...
        Lib/
          10.0.19041.0/ (or another number)
            um/
              x64/
              ...
            ...

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

3 years ago[X86][SSE] combineExtractWithShuffle - support zero-extending to allow extracting...
Simon Pilgrim [Fri, 29 Jan 2021 14:21:55 +0000 (14:21 +0000)]
[X86][SSE] combineExtractWithShuffle - support zero-extending to allow extracting from narrow shuffle masks

If the shuffle mask can't be widened to match the original extracted element width, see if the upper bits are zeroable - which allows us to extract+zero-extend the smaller extraction.

3 years ago[mlir] Remove mlir_c_runner_utils_static.
Christian Sigg [Thu, 28 Jan 2021 14:03:25 +0000 (15:03 +0100)]
[mlir] Remove mlir_c_runner_utils_static.

The library is not actually static when BUILD_SHARED_LIBS is on, and tests need to explicitly load it already. Also, the shared objects it was linked to did not use any symbols from it and it was therefore never linked to it.

Reviewed By: ftynse

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

3 years agoRevert "[clangd] Extract symbol-scope logic out of Quality, add tests. NFC"
Sam McCall [Fri, 29 Jan 2021 13:59:16 +0000 (14:59 +0100)]
Revert "[clangd] Extract symbol-scope logic out of Quality, add tests. NFC"

On second thought, this can't properly be reused for highlighting.

Consider this example, which Quality wants to consider function-scope,
but highlighting must consider class-scope:

void foo() {
  class X {
    int ^y;
  };
}

3 years ago[clangd] Extract symbol-scope logic out of Quality, add tests. NFC
Sam McCall [Fri, 29 Jan 2021 13:38:43 +0000 (14:38 +0100)]
[clangd] Extract symbol-scope logic out of Quality, add tests. NFC

This prepares for reuse from the semantic highlighting code.

There's a bit of yak-shaving here:
 - when the enum is moved into the clangd namespace, promote it to a
   scoped enum. This means teaching the decision forest infrastructure
   to deal with scoped enums.
 - AccessibleScope isn't quite the right name: e.g. public class members
   are treated as accessible, but still have class scope. So rename to
   SymbolScope.
 - Rename some QualitySignals members to avoid name conflicts.
   (the string) SymbolScope -> Scope
   (the enum) Scope -> ScopeKind

3 years ago[MachineLICM] Fix wrong and confusing comment. NFC.
Sjoerd Meijer [Fri, 29 Jan 2021 13:32:56 +0000 (13:32 +0000)]
[MachineLICM] Fix wrong and confusing comment. NFC.

3 years ago[gn build] port e90e455d2a0cc
Nico Weber [Fri, 29 Jan 2021 13:36:19 +0000 (08:36 -0500)]
[gn build] port e90e455d2a0cc

3 years ago[Syntax] Add syntax-tree-dump in clang-check.
Haojian Wu [Fri, 29 Jan 2021 08:08:02 +0000 (09:08 +0100)]
[Syntax] Add syntax-tree-dump in clang-check.

This is useful to experiment/develop syntax trees.

Reviewed By: sammccall

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

3 years ago[test] Use host platform specific error message substitution in lit tests
Abhina Sreeskantharajan [Fri, 29 Jan 2021 12:15:50 +0000 (07:15 -0500)]
[test] Use host platform specific error message substitution in lit tests

On z/OS, the following error message is not matched correctly in lit tests.

```
EDC5129I No such file or directory.
```

This patch uses a lit config substitution to check for platform specific error messages.

Reviewed By: muiez, jhenderson

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

3 years ago[MemCpyOpt] Add test for incorrect optimization across lifetime (NFC)
Nikita Popov [Fri, 29 Jan 2021 11:56:23 +0000 (12:56 +0100)]
[MemCpyOpt] Add test for incorrect optimization across lifetime (NFC)

This only affects the MemorySSA-based implementation.

3 years ago[LTO] Update splitCodeGen to take a reference to the module. (NFC)
Florian Hahn [Fri, 29 Jan 2021 10:20:54 +0000 (10:20 +0000)]
[LTO] Update splitCodeGen to take a reference to the module. (NFC)

splitCodeGen does not need to take ownership of the module, as it
currently clones the original module for each split operation.

There is an ~4 year old fixme to change that, but until this is
addressed, the function can just take a reference to the module.

This makes the transition of LTOCodeGenerator to use LTOBackend a bit
easier, because under some circumstances, LTOCodeGenerator needs to
write the original module back after codegen.

Reviewed By: tejohnson

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

3 years ago[gn build] (semi-manually) port 2ff8662b5d16
Nico Weber [Fri, 29 Jan 2021 11:48:17 +0000 (06:48 -0500)]
[gn build] (semi-manually) port 2ff8662b5d16

3 years ago[libcxx] Sanitize paths before creating symlinks on windows
Martin Storsjö [Mon, 9 Nov 2020 13:20:18 +0000 (15:20 +0200)]
[libcxx] Sanitize paths before creating symlinks on windows

The MS STL does even more cleanup (corresponding to lexically_normal
I think), but this seems to be the very minimum needed for making the
symlinks work when the target path contains non-native paths.

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

3 years ago[libcxx] Hook up a number of operation functions to their windows counterparts
Martin Storsjö [Fri, 6 Nov 2020 09:16:30 +0000 (11:16 +0200)]
[libcxx] Hook up a number of operation functions to their windows counterparts

Use the corresponding wchar functions, named "_wfunc" instead of "func",
where feasible, or reimplement functions with native windows APIs.

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

3 years ago[libcxx] Implement _FilesystemClock::now() and __last_write_time for windows
Martin Storsjö [Wed, 4 Nov 2020 20:56:03 +0000 (22:56 +0200)]
[libcxx] Implement _FilesystemClock::now() and __last_write_time for windows

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

3 years ago[libcxx] Implement the stat function family on top of native windows APIs
Martin Storsjö [Wed, 4 Nov 2020 14:59:07 +0000 (16:59 +0200)]
[libcxx] Implement the stat function family on top of native windows APIs

While the windows CRTs (the modern UCRT, and the legacy msvcrt.dll
that mingw still often defaults to) do provide stat functions, they're
a bit lacking - they only provide second precision on the modification
time, lack support for symlinks and a few other details.

Instead reimplement them using a couple windows native functions,
getting exactly the info we need. (Technically, the implementation
within the CRT calls these functions anyway.)

If we only need a few fields, we could also do with fewer calls, as a
later optimization.

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

3 years agoFix macos target assumption in test
Thomas Preud'homme [Wed, 6 Jan 2021 23:22:12 +0000 (23:22 +0000)]
Fix macos target assumption in test

Clang test Driver/macos-apple-silicon-slice-link-libs-darwin-only.cpp
assumes the target is darwin when the host is darwin which is not
necessarily the case, causing the test to fail when it is not. This
commit adds a -triple argument to the clang invocation to ensure the
target is darwin.

Reviewed By: hans

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

3 years ago[OpenMP] libomp: fix build by cl with vs2019
AndreyChurbanov [Fri, 29 Jan 2021 10:16:41 +0000 (13:16 +0300)]
[OpenMP] libomp: fix build by cl with vs2019

Replace VLA with dynamic allocation using alloca().
This fixes https://bugs.llvm.org/show_bug.cgi?id=48919.

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