platform/upstream/llvm.git
3 years ago[mlir][PDL] Use explicit loop over llvm::find to fix MSVC breakage
River Riddle [Wed, 2 Dec 2020 18:42:40 +0000 (10:42 -0800)]
[mlir][PDL] Use explicit loop over llvm::find to fix MSVC breakage

3 years ago[XCOFF][AIX] Generate LSDA data and compact unwind section on AIX
jasonliu [Wed, 2 Dec 2020 14:48:52 +0000 (14:48 +0000)]
[XCOFF][AIX] Generate LSDA data and compact unwind section on AIX

Summary:
AIX uses the existing EH infrastructure in clang and llvm.
The major differences would be
1. AIX do not have CFI instructions.
2. AIX uses a new personality routine, named __xlcxx_personality_v1.
   It doesn't use the GCC personality rountine, because the
   interoperability is not there yet on AIX.
3. AIX do not use eh_frame sections. Instead, it would use a eh_info
section (compat unwind section) to store the information about
personality routine and LSDA data address.

Reviewed By: daltenty, hubert.reinterpretcast

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

3 years ago[JumpThreading][VectorUtils] avoid infinite loop on unreachable IR
Sanjay Patel [Wed, 2 Dec 2020 18:35:05 +0000 (13:35 -0500)]
[JumpThreading][VectorUtils] avoid infinite loop on unreachable IR

https://llvm.org/PR48362

It's possible that we could stub this out sooner somewhere
within JumpThreading, but I'm not sure how to do that, and
then we would still have potential danger in other callers.

I can't find a way to trigger this using 'instsimplify',
however, because that already has a bailout on unreachable
blocks.

3 years ago[flang][NFC] Add GetTopLevelUnitContaining functions
Tim Keith [Wed, 2 Dec 2020 18:28:48 +0000 (10:28 -0800)]
[flang][NFC] Add GetTopLevelUnitContaining functions

`GetTopLevelUnitContaining` returns the Scope nested in the global scope
that contains the given Scope or Symbol.

Use "Get" rather than "Find" in the name because "Find" implies it might
not be found, which can't happen. Following that logic, rename
`FindProgramUnitContaining` to `GetProgramUnitContaining` and have it
also return a reference rather that a pointer.

Note that the use of "ProgramUnit" is slightly confusing. In the Fortran
standard, "program-unit" refers to what is called a "TopLevelUnit" here.
What we are calling a "ProgramUnit" (here and in `ProgramTree`) includes
internal subprograms while "TopLevelUnit" does not.

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

3 years ago[lldb][NFC] Give class template pack test files unique class names
Raphael Isemann [Wed, 2 Dec 2020 18:19:35 +0000 (19:19 +0100)]
[lldb][NFC] Give class template pack test files unique class names

3 years ago[LoopVectorize] Fix optimal-epilog-vectorization-limitations.ll test on non-debug...
Simon Pilgrim [Wed, 2 Dec 2020 18:00:24 +0000 (18:00 +0000)]
[LoopVectorize] Fix optimal-epilog-vectorization-limitations.ll test on non-debug build bots

Add "REQUIRES: asserts" as the test uses the "--debug-only" switch

Should fix the clang-with-thin-lto-ubuntu buildbot failure

3 years ago[Thumb2] Regenerate predicated-liveout-unknown-lanes.ll test
Simon Pilgrim [Wed, 2 Dec 2020 17:52:04 +0000 (17:52 +0000)]
[Thumb2] Regenerate predicated-liveout-unknown-lanes.ll test

Helps to reduce diff in D90113

3 years ago[PowerPC] Regenerate cmpb tests
Simon Pilgrim [Wed, 2 Dec 2020 17:49:00 +0000 (17:49 +0000)]
[PowerPC] Regenerate cmpb tests

Helps to reduce diff in D90113

3 years agoDelete llvm::is_trivially_copyable and CMake variable HAVE_STD_IS_TRIVIALLY_COPYABLE
Fangrui Song [Wed, 2 Dec 2020 17:58:08 +0000 (09:58 -0800)]
Delete llvm::is_trivially_copyable and CMake variable HAVE_STD_IS_TRIVIALLY_COPYABLE

GCC<5 did not support std::is_trivially_copyable. Now LLVM builds
require 5.1 we can delete llvm::is_trivially_copyable after the users
have been migrated to std::is_trivially_copyable.

3 years agoUse std::is_trivially_copyable
Fangrui Song [Wed, 2 Dec 2020 07:40:38 +0000 (23:40 -0800)]
Use std::is_trivially_copyable

GCC<5 did not support std::is_trivially_copyable. Now LLVM builds require 5.1
we can migrate to std::is_trivially_copyable.

3 years ago[test] Make verify-invalid.ll work with legacy and new PMs
Arthur Eubanks [Tue, 1 Dec 2020 22:34:41 +0000 (14:34 -0800)]
[test] Make verify-invalid.ll work with legacy and new PMs

3 years ago[X86] EltsFromConsecutiveLoads - remove old FIXME comment. NFC.
Simon Pilgrim [Wed, 2 Dec 2020 17:21:41 +0000 (17:21 +0000)]
[X86] EltsFromConsecutiveLoads - remove old FIXME comment. NFC.

Its unlikely an undef element in a zero vector will be any use.

3 years ago[LSR][X86] Replace -march with -mtriples
Simon Pilgrim [Wed, 2 Dec 2020 16:57:35 +0000 (16:57 +0000)]
[LSR][X86] Replace -march with -mtriples

Fixes build on gnux32 hosts

3 years ago[GWP-ASan] Fix flaky test on Fuchsia
Kostya Kortchinsky [Tue, 1 Dec 2020 19:46:23 +0000 (11:46 -0800)]
[GWP-ASan] Fix flaky test on Fuchsia

The LateInit test might be reusing some already initialized thread
specific data if run within the main thread. This means that there
is a chance that the current value will not be enough for the 100
iterations, hence the test flaking.

Fix this by making the test run in its own thread.

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

3 years ago[analyzer][StdLibraryFunctionsChecker] Add return value constraint to functions with...
Gabor Marton [Wed, 2 Dec 2020 11:40:05 +0000 (12:40 +0100)]
[analyzer][StdLibraryFunctionsChecker] Add return value constraint to functions with BufferSize

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

3 years ago[X86] combineX86ShufflesRecursively - remove old FIXME comment. NFC.
Simon Pilgrim [Wed, 2 Dec 2020 16:25:06 +0000 (16:25 +0000)]
[X86] combineX86ShufflesRecursively - remove old FIXME comment. NFC.

Its unlikely an undef element in a zero vector will be any use, and SimplifyDemandedVectorElts now calls combineX86ShufflesRecursively so its unlikely we actually have a dependency on these specific elements.

3 years ago[X86] Regenerate 32-bit merge-consecutive-loads tests
Simon Pilgrim [Wed, 2 Dec 2020 16:10:50 +0000 (16:10 +0000)]
[X86] Regenerate 32-bit merge-consecutive-loads tests

Avoid use of X32 check prefix - we try to only use that for gnux32 triple tests

3 years ago[X86] EltsFromConsecutiveLoads - pull out repeated NumLoadedElts. NFCI.
Simon Pilgrim [Wed, 2 Dec 2020 12:34:57 +0000 (12:34 +0000)]
[X86] EltsFromConsecutiveLoads - pull out repeated NumLoadedElts. NFCI.

3 years agoRemove `-Wunused-result` and `-Wpedantic` warnings from GCC. NFC.
Michael Liao [Wed, 2 Dec 2020 15:51:45 +0000 (10:51 -0500)]
Remove `-Wunused-result` and `-Wpedantic` warnings from GCC. NFC.

3 years ago[hip] Fix host object creation from fatbin
Michael Liao [Tue, 1 Dec 2020 19:59:58 +0000 (14:59 -0500)]
[hip] Fix host object creation from fatbin

- `__hip_fatbin` should a symbol in `.hip_fatbin` section.

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

3 years ago[NFC][sanitizer] Fix test on 32bit platform
Vitaly Buka [Wed, 2 Dec 2020 15:28:45 +0000 (07:28 -0800)]
[NFC][sanitizer] Fix test on 32bit platform

3 years ago[CUDA][HIP] Diagnose reference of host variable
Yaxun (Sam) Liu [Wed, 11 Nov 2020 13:39:00 +0000 (08:39 -0500)]
[CUDA][HIP] Diagnose reference of host variable

This patch diagnoses invalid references of global host variables in device,
global, or host device functions.

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

3 years ago[CUDA][HIP] Fix capturing reference to host variable
Yaxun (Sam) Liu [Tue, 3 Nov 2020 20:24:41 +0000 (15:24 -0500)]
[CUDA][HIP] Fix capturing reference to host variable

In C++ when a reference variable is captured by copy, the lambda
is supposed to make a copy of the referenced variable in the captures
and refer to the copy in the lambda. Therefore, it is valid to capture
a reference to a host global variable in a device lambda since the
device lambda will refer to the copy of the host global variable instead
of access the host global variable directly.

However, clang tries to avoid capturing of reference to a host global variable
if it determines the use of the reference variable in the lambda function is
not odr-use. Clang also tries to emit load of the reference to a global variable
as load of the global variable if it determines that the reference variable is
a compile-time constant.

For a device lambda to capture a reference variable to host global variable
and use the captured value, clang needs to be taught that in such cases the use of the reference
variable is odr-use and the reference variable is not compile-time constant.

This patch fixes that.

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

3 years ago[LV] Epilogue Vectorization with Optimal Control Flow (Recommit)
Bardia Mahjour [Wed, 2 Dec 2020 15:07:41 +0000 (10:07 -0500)]
[LV] Epilogue Vectorization with Optimal Control Flow (Recommit)

This is yet another attempt at providing support for epilogue
vectorization following discussions raised in RFC http://llvm.1065342.n5.nabble.com/llvm-dev-Proposal-RFC-Epilog-loop-vectorization-tt106322.html#none
and reviews D30247 and D88819.

Similar to D88819, this patch achieve epilogue vectorization by
executing a single vplan twice: once on the main loop and a second
time on the epilogue loop (using a different VF). However it's able
to handle more loops, and generates more optimal control flow for
cases where the trip count is too small to execute any code in vector
form.

Reviewed By: SjoerdMeijer

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

3 years ago[PowerPC] Mark sanitizer test case unsupported for powerpc64
Ahsan Saghir [Wed, 2 Dec 2020 15:03:18 +0000 (09:03 -0600)]
[PowerPC] Mark sanitizer test case unsupported for powerpc64

The author of "https://reviews.llvm.org/D92428" marked
'resize_tls_dynamic.cpp' with XFAIL for powerpc64 since
it fails on a bunch of PowerPC buildbots. However, the
original test case passes on clang-ppc64le-rhel bot. So
marking this as XFAIL makes this bot to fail as the test
case passes unexpectedly. We are marking this unsupported
on all PowerPC64 for now until it is fixed for all the
PowerPC buildbots.

3 years ago[mac/lld] Make --reproduce work with thin archives
Nico Weber [Wed, 2 Dec 2020 04:31:57 +0000 (23:31 -0500)]
[mac/lld] Make --reproduce work with thin archives

See http://reviews.llvm.org/rL268229 and
http://reviews.llvm.org/rL313832 which did the same for the ELF port.

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

3 years agoAdd `Operation* OpState::operator->()` to provide more convenient access to members...
Christian Sigg [Sat, 28 Nov 2020 12:35:55 +0000 (13:35 +0100)]
Add `Operation* OpState::operator->()` to provide more convenient access to members of Operation.

Given that OpState already implicit converts to Operator*, this seems reasonable.

The alternative would be to add more functions to OpState which forward to Operation.

Reviewed By: rriddle, ftynse

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

3 years ago[SLP] use 'match' for binop/select; NFC
Sanjay Patel [Wed, 2 Dec 2020 14:00:49 +0000 (09:00 -0500)]
[SLP] use 'match' for binop/select; NFC

This might be a small improvement in readability, but the
real motivation is to make it easier to adapt the code to
deal with intrinsics like 'maxnum' and/or integer min/max.

There is potentially help in doing that with D92086, but
we might also just add specialized wrappers here to deal
with the expected patterns.

3 years ago[OpenMPIRBuilder] forward arguments as pointers to outlined function
Alex Zinenko [Thu, 26 Nov 2020 17:32:30 +0000 (18:32 +0100)]
[OpenMPIRBuilder] forward arguments as pointers to outlined function

OpenMPIRBuilder::createParallel outlines the body region of the parallel
construct into a new function that accepts any value previously defined outside
the region as a function argument. This function is called back by OpenMP
runtime function __kmpc_fork_call, which expects trailing arguments to be
pointers. If the region uses a value that is not of a pointer type, e.g. a
struct, the produced code would be invalid. In such cases, make createParallel
emit IR that stores the value on stack and pass the pointer to the outlined
function instead. The outlined function then loads the value back and uses as
normal.

Reviewed By: jdoerfert, llitchev

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

3 years ago[ThinLTO] Import symver directives for imported symbols (PR48214)
Hans Wennborg [Mon, 30 Nov 2020 15:21:54 +0000 (16:21 +0100)]
[ThinLTO] Import symver directives for imported symbols (PR48214)

When importing symbols from another module, also import any
corresponding symver directives.

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

3 years agoSimplify append to module inline asm string in IRLinker::run()
Hans Wennborg [Wed, 2 Dec 2020 13:45:49 +0000 (14:45 +0100)]
Simplify append to module inline asm string in IRLinker::run()

This also removes the empty extra "module asm" that would be created,
and updates the test to reflect that while making it more explicit.

Broken out from https://reviews.llvm.org/D92335

3 years ago[VE] Add vand, vor, and vxor intrinsic instructions
Kazushi (Jam) Marukawa [Wed, 2 Dec 2020 04:23:02 +0000 (13:23 +0900)]
[VE] Add vand, vor, and vxor intrinsic instructions

Add vand, vor, and vxor intrinsic instructions and regression tests.

Reviewed By: simoll

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

3 years ago[SystemZ] Adding extra extended mnemonics for SystemZ target
Anirudh Prasad [Wed, 2 Dec 2020 12:24:13 +0000 (07:24 -0500)]
[SystemZ] Adding extra extended mnemonics for SystemZ target

This patch consists of the addition of some common additional
extended mnemonics to the SystemZ target.

- These are jnop, jct, jctg, jas, jasl, jxh, jxhg, jxle,
  jxleg, bru, brul, br*, br*l.
- These mnemonics and the instructions they map to are
  defined here, Chapter 4 - Branching with extended
  mnemonic codes.
- Except for jnop (which is a variant of brc 0, label), every
  other mnemonic is marked as a MnemonicAlias since there is
  already a "defined" instruction with the same encoding
  and/or condition mask values.
- brc 0, label doesn't have a defined extended mnemonic, thus
  jnop is defined using as an InstAlias. Furthermore, the
  applyMnemonicAliases function is called in the overridden
  parseInstruction function in SystemZAsmParser.cpp to ensure
  any mnemonic aliases are applied before any further
  processing on the instruction is done.

Reviewed By: uweigand

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

3 years ago[SVE] Add support for scalable vectors with vectorize.scalable.enable loop attribute
David Sherwood [Wed, 7 Oct 2020 08:21:39 +0000 (09:21 +0100)]
[SVE] Add support for scalable vectors with vectorize.scalable.enable loop attribute

In this patch I have added support for a new loop hint called
vectorize.scalable.enable that says whether we should enable scalable
vectorization or not. If a user wants to instruct the compiler to
vectorize a loop with scalable vectors they can now do this as
follows:

  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !2
  ...
  !2 = !{!2, !3, !4}
  !3 = !{!"llvm.loop.vectorize.width", i32 8}
  !4 = !{!"llvm.loop.vectorize.scalable.enable", i1 true}

Setting the hint to false simply reverts the behaviour back to the
default, using fixed width vectors.

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

3 years ago[SystemZ][NFC]Move all SystemZ tests to init-s390x.c
Abhina Sreeskantharajan [Wed, 2 Dec 2020 13:22:40 +0000 (08:22 -0500)]
[SystemZ][NFC]Move all SystemZ tests to init-s390x.c

This patch moves all s390x tests in init.c and init-zos.c to init-s390x.c.

Reviewed By: muiez

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

3 years ago[libc] Add strncpy implementation.
Cheng Wang [Thu, 12 Nov 2020 03:42:04 +0000 (11:42 +0800)]
[libc] Add strncpy implementation.

Add libc strncpy implementation.

Reviewed By: sivachandra, gchatelet

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

3 years ago[LLDB/Python] Fix segfault on Python scripted entrypoints
Pedro Tammela [Fri, 27 Nov 2020 22:29:56 +0000 (22:29 +0000)]
[LLDB/Python] Fix segfault on Python scripted entrypoints

The code that gets the ScriptInterpreter was not considering the
case that it receives a Lua interpreter.

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

3 years ago[llvm-readobj, libSupport] - Refine the implementation of the code that dumps build...
Georgii Rymar [Mon, 30 Nov 2020 12:38:42 +0000 (15:38 +0300)]
[llvm-readobj, libSupport] - Refine the implementation of the code that dumps build attributes.

This implementation of `ELFDumper<ELFT>::printAttributes()` in llvm-readobj has issues:
1) It crashes when the content of the attribute section is empty.
2) It uses `unwrapOrError` and `reportWarning` calls, though
   ideally we want to use `reportUniqueWarning`.
3) It contains a TODO about redundant format version check.

`lib/Support/ELFAttributeParser.cpp` uses a hardcoded constant instead of the named constant.

This patch fixes all these issues.

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

3 years ago[InstructionsTest] NFC: Replace VectorType::get(.., .., true) with ScalableVectorType...
Cullen Rhodes [Fri, 27 Nov 2020 17:30:29 +0000 (17:30 +0000)]
[InstructionsTest] NFC: Replace VectorType::get(.., .., true) with ScalableVectorType::get

Reviewed By: sdesmalen

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

3 years ago[libc++] [docs] Mark LWG2296 as complete not only on clang.
Marek Kurdej [Wed, 2 Dec 2020 10:39:43 +0000 (11:39 +0100)]
[libc++] [docs] Mark LWG2296 as complete not only on clang.

std::addressof was made constexpr in gcc 7.
libc++ fixed it in ac473034fc771e5f1b4ef0ac405df70ed27412a1 (Provide a constexpr addressof with GCC 7.)

3 years ago[libc++] [docs] Mark P1424 as superseded by P1902.
Marek Kurdej [Wed, 2 Dec 2020 10:19:22 +0000 (11:19 +0100)]
[libc++] [docs] Mark P1424 as superseded by P1902.

3 years ago[AMDGPU] Stop adding an implicit def of vcc_hi for wave32
Jay Foad [Tue, 1 Dec 2020 11:55:50 +0000 (11:55 +0000)]
[AMDGPU] Stop adding an implicit def of vcc_hi for wave32

This doesn't seem to be needed for anything.

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

3 years ago[llvm-readelf/obj] - Lowercase the warning message reported.
Georgii Rymar [Wed, 2 Dec 2020 10:01:52 +0000 (13:01 +0300)]
[llvm-readelf/obj] - Lowercase the warning message reported.

Our warnings/errors reported are using lowercase normally.

This addresses one of review comments from D92382.

3 years ago[llvm-readelf/obj] - Report unique warnings in `parseDynamicTable`.
Georgii Rymar [Tue, 1 Dec 2020 12:05:23 +0000 (15:05 +0300)]
[llvm-readelf/obj] - Report unique warnings in `parseDynamicTable`.

This makes the warnings reported to be unique and adds test cases.

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

3 years ago[lldb] Don't reject empty or unnamed template parameter packs
Raphael Isemann [Wed, 2 Dec 2020 09:35:07 +0000 (10:35 +0100)]
[lldb] Don't reject empty or unnamed template parameter packs

We currently reject all templates that have either zero args or that have a
parameter pack without a name. Both cases are actually allowed in C++, so
rejecting them leads to LLDB instead falling back to a dummy 'void' type. This
leads to all kind of errors later on (most notable, variables that have such
template types appear to be missing as we can't have 'void' variables and
inheriting from such a template type will cause Clang to hit some asserts when
finding that the base class is 'void').

This just removes the too strict tests and adds a few tests for this stuff (+
some combinations of these tests with preceding template parameters).

Things that I left for follow-up patches:
* All the possible interactions with template-template arguments which seem like a whole new source of possible bugs.
* Function templates which completely lack sanity checks.
* Variable templates are not implemented.
* Alias templates are not implemented too.
* The rather strange checks that just make sure that the separate list of
  template arg names and values always have the same length. I believe those
  ought to be asserts, but my current plan is to move both those things into a
  single list that can't end up in this inconsistent state.

Reviewed By: JDevlieghere, shafik

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

3 years ago[Intrinsics] Re-remove experimental_vector_reduce intrinsics
David Green [Wed, 2 Dec 2020 09:22:41 +0000 (09:22 +0000)]
[Intrinsics] Re-remove experimental_vector_reduce intrinsics

These were re-added by fbfb1c790982277eaa5134c2b6aa001e97fe828d but
should not have been. This removes the old experimental versions of the
reduction intrinsics again, leaving the new non experimental ones.

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

3 years ago[PowerPC] Fix FLT_ROUNDS_ on little endian
Qiu Chaofan [Wed, 2 Dec 2020 09:12:20 +0000 (17:12 +0800)]
[PowerPC] Fix FLT_ROUNDS_ on little endian

In lowering of FLT_ROUNDS_, FPSCR content will be moved into FP register
and then GPR, and then truncated into word.

For subtargets without direct move support, it will store and then load.
The load address needs adjustment (+4) only on big-endian targets. This
patch fixes it on using generic opcodes on little-endian and subtargets
with direct-move.

Reviewed By: steven.zhang

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

3 years ago[llvm-readelf/obj] - Refine the error message about the broken string table.
Georgii Rymar [Tue, 1 Dec 2020 10:59:47 +0000 (13:59 +0300)]
[llvm-readelf/obj] - Refine the error message about the broken string table.

This:
1) Changes `reportWarning` to `reportUniqueWarning` (no-op here).
2) Adds more context to the message.
3) Merges `broken-dynsym-link.test` into `dyn-symbols.test`, adds more testing.

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

3 years ago[Clang] Don't adjust align for IBM extended double
Qiu Chaofan [Wed, 2 Dec 2020 09:02:26 +0000 (17:02 +0800)]
[Clang] Don't adjust align for IBM extended double

Commit 6b1341eb fixed alignment for 128-bit FP types on PowerPC.
However, the quadword alignment adjustment shouldn't be applied to IBM
extended double (ppc_fp128 in IR) values.

Reviewed By: jsji

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

3 years ago[LLD][ELF] - Don't keep empty output sections which have explicit program headers.
Georgii Rymar [Fri, 27 Nov 2020 18:42:35 +0000 (21:42 +0300)]
[LLD][ELF] - Don't keep empty output sections which have explicit program headers.

This reverts a side effect introduced in the code cleanup patch D43571:
LLD started to emit empty output sections that are explicitly assigned to a segment.

This patch fixes the issue by removing the !sec.phdrs.empty() special case from
isDiscardable. As compensation, we add an early phdrs propagation step (see the inline comment).
This is similar to one that we do in adjustSectionsAfterSorting.

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

3 years ago[mlir][doc] Correct method names in DialectConversion.md to match the code.
Hanhan Wang [Wed, 2 Dec 2020 08:00:36 +0000 (00:00 -0800)]
[mlir][doc] Correct method names in DialectConversion.md to match the code.

Reviewed By: rriddle

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

3 years ago[libc++] [P0482] [C++20] Implement missing bits for codecvt and codecvt_byname.
Marek Kurdej [Wed, 2 Dec 2020 07:57:02 +0000 (08:57 +0100)]
[libc++] [P0482] [C++20] Implement missing bits for codecvt and codecvt_byname.

Add codecvt*<char16_t, char8_t> and codecvt*<char32_t, char8_t>.
Deprecate codecvt<char(16|32)_t, char>.
Enable disabled tests.
Update _LIBCPP_STD_VER to use 20 for C++20. Add _LIBCPP_DEPRECATED_IN_CXX20 macro.

Reviewed By: ldionne, #libc, #libc_abi

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

3 years ago[libcxx] Apply msvcrt specific exception for lgamma() to mingw configurations, too
Martin Storsjö [Tue, 1 Dec 2020 11:37:16 +0000 (13:37 +0200)]
[libcxx] Apply msvcrt specific exception for lgamma() to mingw configurations, too

This fixes linking code that uses some bits of the <random> header
on mingw targets.

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

3 years ago[libc++] [docs] Update and move NOTES.txt to docs/Contributing.rst.
Marek Kurdej [Wed, 2 Dec 2020 07:52:35 +0000 (08:52 +0100)]
[libc++] [docs] Update and move NOTES.txt to docs/Contributing.rst.

Also, add notes about exporting ABI symbols.
Later, we can add notes about using git-clang-format before sending a patch for review.

Reviewed By: ldionne, #libc

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

3 years ago[lldb][NFC] Fix test file name in lang/cpp/non-type-template-param
Raphael Isemann [Wed, 2 Dec 2020 07:39:51 +0000 (08:39 +0100)]
[lldb][NFC] Fix test file name in lang/cpp/non-type-template-param

The 'AlignAsBaseClass' part was a leftover form the align_as test that served as
the template for this test.

3 years ago[Test] One CodeGen test showing missing opportunity on move elimination
Max Kazantsev [Wed, 2 Dec 2020 06:15:06 +0000 (13:15 +0700)]
[Test] One CodeGen test showing missing opportunity on move elimination

3 years ago[Test] One more IndVars test
Max Kazantsev [Wed, 2 Dec 2020 06:14:49 +0000 (13:14 +0700)]
[Test] One more IndVars test

3 years ago[PowerPC] Promote the i1 to i64 for SINT_TO_FP/FP_TO_SINT
QingShan Zhang [Wed, 2 Dec 2020 05:37:45 +0000 (05:37 +0000)]
[PowerPC] Promote the i1 to i64 for SINT_TO_FP/FP_TO_SINT

i1 is the native type for PowerPC if crbits is enabled. However, we need
to promote the i1 to i64 as we didn't have the pattern for i1.

Reviewed By: Qiu Chao Fang

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

3 years ago[mlir][PDL] Forward captured single entity constraint functions instead of copy-capture
River Riddle [Wed, 2 Dec 2020 05:05:13 +0000 (21:05 -0800)]
[mlir][PDL] Forward captured single entity constraint functions instead of copy-capture

3 years ago[mac/lld] Include archive name in diagnostics
Nico Weber [Wed, 2 Dec 2020 00:00:48 +0000 (19:00 -0500)]
[mac/lld] Include archive name in diagnostics

Also, for .o files, include full path as given on link command line.

Before:
    lld: error: undefined symbol [...], referenced from sandbox_logging.o

After:
    lld: error: undefined symbol [...], referenced from libseatbelt.a(sandbox_logging.o)

Move archiveName up to InputFile so we can consistently use toString()
to print InputFiles in diags, and pass it to the ObjFile ctor. This
matches the ELF and COFF ports.

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

3 years ago[Transforms] Remove unused declaration fillImplicitControlFlowInfo (NFC)
Kazu Hirata [Wed, 2 Dec 2020 03:42:14 +0000 (19:42 -0800)]
[Transforms] Remove unused declaration fillImplicitControlFlowInfo (NFC)

The definition was removed on Aug 7, 2018 in commit
640cb0036548293c74949801ba9f831344789e99, but the declaration has
remained since.

3 years ago[LSR][NFC] don't collect chains when isNumRegsMajorCostOfLSR is false.
Chen Zheng [Thu, 26 Nov 2020 09:26:23 +0000 (04:26 -0500)]
[LSR][NFC] don't collect chains when isNumRegsMajorCostOfLSR is false.

Reviewed By: samparker

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

3 years ago[WebAssembly] Support select and block for reference types
Heejin Ahn [Mon, 30 Nov 2020 09:39:13 +0000 (01:39 -0800)]
[WebAssembly] Support select and block for reference types

This adds missing `select` instruction support and block return type
support for reference types. Also refactors WebAssemblyInstrRef.td and
rearranges tests in reference-types.s. Tests don't include `exnref`
types, because we currently don't support `exnref` for `ref.null` and
the type will be removed soon anyway.

Reviewed By: tlively, sbc100, wingo

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

3 years ago[lldb] Fix build after found_decls was removed by 1f40d60a3b7f310ff3f77bb8643a27d979a...
Fangrui Song [Wed, 2 Dec 2020 03:14:34 +0000 (19:14 -0800)]
[lldb] Fix build after found_decls was removed by 1f40d60a3b7f310ff3f77bb8643a27d979a703cb

3 years agos/instantate/instantiate/ throughout. NFCI.
Arthur O'Dwyer [Wed, 2 Dec 2020 01:02:46 +0000 (20:02 -0500)]
s/instantate/instantiate/ throughout. NFCI.

The static_assert in "libcxx/include/memory" was the main offender here,
but then I figured I might as well `git grep -i instantat` and fix all
the instances I found. One was in user-facing HTML documentation;
the rest were in comments or tests.

3 years ago[libc++] Consistently replace `std::` qualification with `_VSTD::` or nothing. NFCI.
Arthur O'Dwyer [Fri, 27 Nov 2020 16:02:06 +0000 (11:02 -0500)]
[libc++] Consistently replace `std::` qualification with `_VSTD::` or nothing. NFCI.

I used a lot of `git grep` to find places where `std::` was being used
outside of comments and assert-messages. There were three outcomes:

- Qualified function calls, e.g. `std::move` becomes `_VSTD::move`.
    This is the most common case.

- Typenames that don't need qualification, e.g. `std::allocator` becomes `allocator`.
    Leaving these as `_VSTD::allocator` would also be fine, but I decided
    that removing the qualification is more consistent with existing practice.

- Names that specifically need un-versioned `std::` qualification,
    or that I wasn't sure about. For example, I didn't touch any code in
    <atomic>, <math.h>, <new>, or any ext/ or experimental/ headers;
    and I didn't touch any instances of `std::type_info`.

In some deduction guides, we were accidentally using `class Alloc = typename std::allocator<T>`,
despite `std::allocator<T>`'s type-ness not being template-dependent.
Because `std::allocator` is a qualified name, this did parse as we intended;
but what we meant was simply `class Alloc = allocator<T>`.

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

3 years ago[libc++] ADL-proof <thread>, and eliminate `using namespace chrono`.
Arthur O'Dwyer [Fri, 27 Nov 2020 19:44:53 +0000 (14:44 -0500)]
[libc++] ADL-proof <thread>, and eliminate `using namespace chrono`.

Since we know exactly which identifiers we expect to find in `chrono`,
a using-directive seems like massive overkill. Remove the directives
and qualify the names as needed.

One subtle trick here: In two places I replaced `*__p` with `*__p.get()`.
The former is an unqualified call to `operator*` on a class type, which
triggers ADL and breaks the new test. The latter is a call to the
built-in `operator*` on pointers, which specifically
does NOT trigger ADL thanks to [over.match.oper]/1.

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

3 years ago[libc++] Support simply `std::iterator_traits` in the iterator_traits test.
Arthur O'Dwyer [Fri, 27 Nov 2020 18:48:44 +0000 (13:48 -0500)]
[libc++] Support simply `std::iterator_traits` in the iterator_traits test.

This follows on from D56698. I copied this fix (simpler than D92142's)
from commit 66e6e37447b183b1c8bac9330a4658530d2d49e6.

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

3 years ago[lld-macho] Add dependency to DebugInfoDWARF
Heejin Ahn [Wed, 2 Dec 2020 03:00:46 +0000 (19:00 -0800)]
[lld-macho] Add dependency to DebugInfoDWARF

Without this `-DBUILD_SHARED_LIBS=ON` doesn't work.

3 years ago[NFC][AMDGPU] Fix broken link to ClangOffloadBundler in AMDGPUUsage
Tony [Wed, 2 Dec 2020 03:04:28 +0000 (03:04 +0000)]
[NFC][AMDGPU] Fix broken link to ClangOffloadBundler in AMDGPUUsage

3 years ago[NFC] Add CLangOffloadBundler documentation to Clang index
Tony [Wed, 2 Dec 2020 02:07:07 +0000 (02:07 +0000)]
[NFC] Add CLangOffloadBundler documentation to Clang index

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

3 years ago[LLDB] Rename duplicate TestAlignAsBaseClass.py
Muhammad Omair Javaid [Wed, 2 Dec 2020 02:30:51 +0000 (07:30 +0500)]
[LLDB] Rename duplicate TestAlignAsBaseClass.py

lldb-dotest breaks due to duplicate TestAlignAsBaseClass.py. I have
renamed later version to TestAlignAsBaseClassNonTemplateParam.py.

3 years ago[NFC][PowerPC] code refactor: split IsReassociable to fma and add.
Chen Zheng [Wed, 25 Nov 2020 02:50:39 +0000 (21:50 -0500)]
[NFC][PowerPC] code refactor: split IsReassociable to fma and add.

Reviewed By: jsji

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

3 years ago[VE] Add vcmp, vmax, and vmin intrinsic instructions
Kazushi (Jam) Marukawa [Tue, 1 Dec 2020 11:12:25 +0000 (20:12 +0900)]
[VE] Add vcmp, vmax, and vmin intrinsic instructions

Add vcmp, vmax, and vmin intrinsic instructions and regression tests.

Reviewed By: simoll

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

3 years ago[mlir][PDL] Use .getOperation() when construction SuccessorRange to avoid ambiguous...
River Riddle [Wed, 2 Dec 2020 02:13:27 +0000 (18:13 -0800)]
[mlir][PDL] Use .getOperation() when construction SuccessorRange to avoid ambiguous constructor in GCC5

3 years ago[NFC][sanitizer] Fix ppc -> powerpc64 in XFAIL
Vitaly Buka [Wed, 2 Dec 2020 01:56:45 +0000 (17:56 -0800)]
[NFC][sanitizer] Fix ppc -> powerpc64 in XFAIL

3 years ago[mac/lld] fix typo in 07ab597bb0356c that broke test on Windows
Nico Weber [Wed, 2 Dec 2020 01:36:31 +0000 (20:36 -0500)]
[mac/lld] fix typo in 07ab597bb0356c that broke test on Windows

3 years ago[mlir][Python] Check numpy in Python bindings configuration.
zhanghb97 [Sun, 29 Nov 2020 09:37:36 +0000 (17:37 +0800)]
[mlir][Python] Check numpy in Python bindings configuration.

The test process of the ir_array_attributes.py depends on numpy. This patch checks numpy in Python bindings configuration.
- Add NumPy in find_package as a required component to check numpy.
- If numpy is found, print the version and include directory.

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

3 years agofix typos to cycle bots
Nico Weber [Wed, 2 Dec 2020 01:27:33 +0000 (20:27 -0500)]
fix typos to cycle bots

3 years ago[mlir][PDL] Add append specialization for ByteCode OpCode to fix GCC5 build
River Riddle [Wed, 2 Dec 2020 01:08:38 +0000 (17:08 -0800)]
[mlir][PDL] Add append specialization for ByteCode OpCode to fix GCC5 build

3 years ago[msan] Replace 8 by kShadowTLSAlignment
Jianzhou Zhao [Mon, 23 Nov 2020 05:53:03 +0000 (05:53 +0000)]
[msan] Replace 8 by kShadowTLSAlignment

Reviewed-by: eugenis
Differential Revision: https://reviews.llvm.org/D92275

3 years ago[lld] Use -1 as tombstone value for discarded code ranges
Eric Leese [Wed, 2 Dec 2020 00:01:33 +0000 (16:01 -0800)]
[lld] Use -1 as tombstone value for discarded code ranges

Under existing behavior discarded functions are relocated to have the start pc
0. This causes problems when debugging as they typically overlap the first
function and lldb symbol resolution frequently chooses a discarded function
instead of the correct one. Using the value -1 or -2 (depending on which DWARF
section we are writing) is sufficient to prevent lldb from resolving to these
symbols.

Reviewed By: MaskRay, yurydelendik, sbc100

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

3 years agoRecommit "[clang][Fuchsia] Add relative-vtables multilib"
Leonard Chan [Wed, 2 Dec 2020 00:59:04 +0000 (16:59 -0800)]
Recommit "[clang][Fuchsia] Add relative-vtables multilib"

This recommits fdbd84c6c819d4462546961f6086c1524d5d5ae8 whose initial
build issues were fixed in 19bdc8e5a307f6eb209d4f91620d70bd2f80219e.

3 years agoFix typo in testcase runline that got there because I have very bad hands
Jessica Paquette [Wed, 2 Dec 2020 00:55:25 +0000 (16:55 -0800)]
Fix typo in testcase runline that got there because I have very bad hands

llvm/test/CodeGen/AArch64/GlobalISel/speculative-hardening-brcond.mir had a
slash in its runline.

3 years ago[NFC] Disable new test from D92428 on PPC TSAN
Vitaly Buka [Wed, 2 Dec 2020 00:53:18 +0000 (16:53 -0800)]
[NFC] Disable new test from D92428 on PPC TSAN

3 years ago[WebAssembly] Rename --lto-no-new-pass-manager to --no-lto-new-pass-manager
Fangrui Song [Wed, 2 Dec 2020 00:52:37 +0000 (16:52 -0800)]
[WebAssembly] Rename --lto-no-new-pass-manager to --no-lto-new-pass-manager

In addition, disallow `-lto-new-pass-manager` (see D79371).

Note: the ELF port has also adopted --no-lto-new-pass-manager

Reviewed By: aeubanks

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

3 years ago[AArch64][GlobalISel] Don't write to WZR in non-flag-setting G_BRCOND case
Jessica Paquette [Mon, 2 Nov 2020 17:47:51 +0000 (09:47 -0800)]
[AArch64][GlobalISel] Don't write to WZR in non-flag-setting G_BRCOND case

We are avoiding writing to WZR just about everywhere else.

Also update the code to use MachineIRBuilder for the sake of consistency.

We also didn't have a GlobalISel testcase for this path, so add a simple one
now.

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

3 years agoRemove CXXBasePaths::found_decls and simplify and modernize its only
Richard Smith [Wed, 2 Dec 2020 00:28:46 +0000 (16:28 -0800)]
Remove CXXBasePaths::found_decls and simplify and modernize its only
caller.

This function did not satisfy its documented contract: it only
considered the first lookup result on each base path, not all lookup
results. It also performed unnecessary memory allocations.

This change results in a minor change to our representation: we now
include overridden methods that are found by any derived-to-base path
(not involving another override) in the list of overridden methods for a
function, rather than filtering out functions from bases that are both
direct virtual bases and indirect virtual bases for which the indirect
virtual base path contains another override for the function. (That
filtering rule is part of the class-scope name lookup rules, and doesn't
really have much to do with enumerating overridden methods.) The users
of the list of overridden methods do not appear to rely on this
filtering having happened, and it's simpler to not do it.

3 years agogithub actions: Update branch_sync to push to main
Tom Stellard [Wed, 2 Dec 2020 00:22:30 +0000 (16:22 -0800)]
github actions: Update branch_sync to push to main

3 years ago[sanitizer] Make DTLS_on_tls_get_addr signal safer
Vitaly Buka [Tue, 1 Dec 2020 21:14:18 +0000 (13:14 -0800)]
[sanitizer] Make DTLS_on_tls_get_addr signal safer

Avoid relocating DTV table and use linked list of mmap-ed pages.

Reviewed By: eugenis

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

3 years ago[NFC] Extract ForEachDVT
Vitaly Buka [Tue, 1 Dec 2020 05:04:04 +0000 (21:04 -0800)]
[NFC] Extract ForEachDVT

3 years ago[RISCVAsmParser] Allow a SymbolRef operand to be a complex expression
Fangrui Song [Wed, 2 Dec 2020 00:08:09 +0000 (16:08 -0800)]
[RISCVAsmParser] Allow a SymbolRef operand to be a complex expression

So that instructions like `lla a5, (0xFF + end) - 4` (supported by GNU as) can
be parsed.

Add a missing test that an operand like `foo + foo` is not allowed.

Reviewed By: jrtc27

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

3 years ago[lld/mac] Fix issues around thin archives
Nico Weber [Fri, 20 Nov 2020 15:14:57 +0000 (10:14 -0500)]
[lld/mac] Fix issues around thin archives

- most importantly, fix a use-after-free when using thin archives,
  by putting the archive unique_ptr to the arena allocator. This
  ports D65565 to MachO

- correctly demangle symbol namess from archives in diagnostics

- add a test for thin archives -- it finds this UaF, but only when
  running it under asan (it also finds the demangling fix)

- make forceLoadArchive() use addFile() with a bool to have the archive
  loading code in fewer places. no behavior change; matches COFF port a
  bit better

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

3 years ago[llvm] Fix for failing test from fdbd84c6c819d4462546961f6086c1524d5d5ae8
Leonard Chan [Tue, 1 Dec 2020 23:45:07 +0000 (15:45 -0800)]
[llvm] Fix for failing test from fdbd84c6c819d4462546961f6086c1524d5d5ae8

When handling a DSOLocalEquivalent operand change:

- Remove assertion checking that the `To` type and current type are the
  same type. This is not always a requirement.
- Add a missing bitcast from an old DSOLocalEquivalent to the type of
  the new one.

3 years ago[AArch64][GlobalISel] Select Bcc when it's better than TB(N)Z
Jessica Paquette [Tue, 1 Dec 2020 01:21:21 +0000 (17:21 -0800)]
[AArch64][GlobalISel] Select Bcc when it's better than TB(N)Z

Instead of falling back to selecting TB(N)Z when we fail to select an
optimized compare against 0, select Bcc instead.

Also simplify selectCompareBranch a little while we're here, because the logic
was kind of hard to follow.

At -O0, this is a 0.1% geomean code size improvement for CTMark.

A simple example of where this can kick in is here:
https://godbolt.org/z/4rra6P

In the example above, GlobalISel currently produces a subs, cset, and tbnz.
SelectionDAG, on the other hand, just emits a compare and b.le.

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

3 years ago[NFC][AMDGPU] AMDGPU code object V4 ABI documentation
Tony [Tue, 1 Dec 2020 04:12:04 +0000 (04:12 +0000)]
[NFC][AMDGPU] AMDGPU code object V4 ABI documentation

- Documantation for AMDGPU code object V4.
- Documentation clarification for code object V2 and V3.
- Documentation for the clang-offload-bundler.
- Numerous other documentation clarifications.

Change-Id: I338b327cc9e75da6c987b7e081b496402a5a020e

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

3 years ago[gn build] Port 3fcb0eeb152
LLVM GN Syncbot [Tue, 1 Dec 2020 23:11:06 +0000 (23:11 +0000)]
[gn build] Port 3fcb0eeb152

3 years ago[gn build] Format all gn files
Arthur Eubanks [Tue, 1 Dec 2020 23:07:16 +0000 (15:07 -0800)]
[gn build] Format all gn files

$ git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format

3 years ago[gn build] Manually port 8fee2ee9
Arthur Eubanks [Tue, 1 Dec 2020 23:02:50 +0000 (15:02 -0800)]
[gn build] Manually port 8fee2ee9

3 years ago[ms] [llvm-ml] Support command-line defines
Eric Astor [Tue, 1 Dec 2020 22:48:49 +0000 (17:48 -0500)]
[ms] [llvm-ml] Support command-line defines

Enable command-line defines as textmacros

Reviewed By: thakis

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