platform/upstream/llvm.git
2 years ago[gn build] Port 6546fdbe36fd
LLVM GN Syncbot [Fri, 24 Jun 2022 11:18:35 +0000 (11:18 +0000)]
[gn build] Port 6546fdbe36fd

2 years ago[clang] Emit SARIF Diagnostics: Create `clang::SarifDocumentWriter` interface
Vaibhav Yenamandra [Fri, 24 Jun 2022 11:16:54 +0000 (07:16 -0400)]
[clang] Emit SARIF Diagnostics: Create `clang::SarifDocumentWriter` interface

Create an interface for writing SARIF documents from within clang:

The primary intent of this change is to introduce the interface
clang::SarifDocumentWriter, which allows incrementally adding
diagnostic data to a JSON backed document. The proposed interface is
not yet connected to the compiler internals, which will be covered in
future work. As such this change will not change the input/output
interface of clang.

This change also introduces the clang::FullSourceRange type that is
modeled after clang::SourceRange + clang::FullSourceLoc, this is useful
for packaging a pair of clang::SourceLocation objects with their
corresponding SourceManagers.

Previous discussions:

RFC for this change: https://lists.llvm.org/pipermail/cfe-dev/2021-March/067907.html
https://lists.llvm.org/pipermail/cfe-dev/2021-July/068480.html
SARIF Standard (2.1.0):

https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/sarif-v2.1.0-os.html

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

2 years ago[InlineFunction] Slightly clarify noalias scope calculation (NFC)
Nikita Popov [Fri, 24 Jun 2022 10:30:00 +0000 (12:30 +0200)]
[InlineFunction] Slightly clarify noalias scope calculation (NFC)

Rename CanDeriveViaCapture -> RequiresNoCaptureBefore, drop
unnecessary const cast, reformat some code avoid an ugly
super-indented comment.

2 years ago[SLP] Add cost model for `llvm.powi.*` intrinsics (REAPPLIED)
Nabeel Omer [Wed, 22 Jun 2022 09:56:41 +0000 (09:56 +0000)]
[SLP] Add cost model for `llvm.powi.*` intrinsics (REAPPLIED)

Patch was reverted in 4c5f10a due to buildbot failures, now being
reapplied with updated AArch64 and RISCV tests.

This patch adds handling for the llvm.powi.* intrinsics in
BasicTTIImplBase::getIntrinsicInstrCost() and improves vectorization.
Closes #53887.

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

2 years ago[LLDB] Mark TestExprsChar Xfail for Windows/AArch64
Muhammad Omair Javaid [Fri, 24 Jun 2022 09:41:30 +0000 (13:41 +0400)]
[LLDB] Mark TestExprsChar Xfail for Windows/AArch64

test_unsigned_char test in TestExprsChar.py fails on AArch64/Windows
platform. There is known bug already present for the failure for various
arch/os combinations. This patch marks the test as xfail for
windows/AArch64.

2 years ago[AA] Export isEscapeSource() API (NFC)
Nikita Popov [Fri, 24 Jun 2022 09:58:16 +0000 (11:58 +0200)]
[AA] Export isEscapeSource() API (NFC)

Export API that was previously private to BasicAliasAnalysis and
will be used in D127202.

2 years ago[clang] Update Clang version from 14 to 15 in scan-build.1.
Frederic Cambus [Fri, 24 Jun 2022 09:09:34 +0000 (11:09 +0200)]
[clang] Update Clang version from 14 to 15 in scan-build.1.

Similar to D110763.

2 years ago[AArch64] Convert vector add(ext, ext) into ext(add(ext, ext))
David Green [Fri, 24 Jun 2022 09:04:28 +0000 (10:04 +0100)]
[AArch64] Convert vector add(ext, ext) into ext(add(ext, ext))

Given a vector add or sub from extends that needs more that one 'step'
(i.e i8 to i32 or i16 to i64), we can transform the sequence to
sext(add(ext, ext)), to allow the add(ext, ext) to become a single uaddl
and a larger extend, producing less instructions in total.
https://alive2.llvm.org/ce/z/S2T4k-

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

2 years ago[BasicAA] Handle passthru calls in isEscapeSource()
Nikita Popov [Thu, 23 Jun 2022 14:36:16 +0000 (16:36 +0200)]
[BasicAA] Handle passthru calls in isEscapeSource()

isEscapeSource() currently considers all call return values as
escape sources. However, CaptureTracking can look through certain
calls, so we shouldn't consider these as escape sources either.

The corresponding CaptureTracking code is:
https://github.com/llvm/llvm-project/blob/7c9a3825b8420f5d37c5bb8919a9e46684a87089/llvm/lib/Analysis/CaptureTracking.cpp#L332-L333

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

2 years ago[Flang] enable fir.is_present and fir.absent with function types
Kiran Chandramohan [Fri, 24 Jun 2022 08:45:33 +0000 (08:45 +0000)]
[Flang] enable fir.is_present and fir.absent with function types

Fortran dummy procedures and procedure pointer can be OPTIONAL, and
there is no technical reason to prevent fir.is_present and
fir.absent from accepting function types, so allow it and add test.

Note: This is part of upstreaming from the fir-dev branch of
https://github.com/flang-compiler/f18-llvm-project. This patch is
basically upstreaming the following PR.
https://github.com/flang-compiler/f18-llvm-project/pull/1568

Reviewed By: clementval

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[AArch64] Add addition extend of add/sub neon tests. NFC
David Green [Fri, 24 Jun 2022 08:41:10 +0000 (09:41 +0100)]
[AArch64] Add addition extend of add/sub neon tests. NFC

2 years agoReland "[clang-repl] Recover the lookup tables of the primary context."
Vassil Vassilev [Fri, 24 Jun 2022 07:17:20 +0000 (07:17 +0000)]
Reland "[clang-repl] Recover the lookup tables of the primary context."

The asan issue was fixed in llvm/llvm-project@7bc00ce5cd41

This reverts commit 575e297fcb289f0a9b0ac4b01d1d0fa051f5cc29.

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

2 years agoRevert "[CMake][compiler-rt] Clean up the use of libcxx and libcxxabi"
Petr Hosek [Fri, 24 Jun 2022 08:24:45 +0000 (08:24 +0000)]
Revert "[CMake][compiler-rt] Clean up the use of libcxx and libcxxabi"

This reverts commit c0d4f2282d8335cd15338663b18cd7f22155456e which
broke clang-x86_64-debian-fast:

  https://lab.llvm.org/buildbot/#/builders/109/builds/41268

2 years ago[libc][NFC] Remove the templatization from the linux implementation of thread.
Siva Chandra Reddy [Thu, 23 Jun 2022 18:18:50 +0000 (18:18 +0000)]
[libc][NFC] Remove the templatization from the linux implementation of thread.

This enables setting up a single "self" thread object to be returned by
API like thrd_self and pthread_self.

2 years ago[AArch64] NFC: Fix PRFS -> PRFW inst def name
Cullen Rhodes [Thu, 23 Jun 2022 17:24:07 +0000 (17:24 +0000)]
[AArch64] NFC: Fix PRFS -> PRFW inst def name

2 years ago[VPlan] Set VFs included in plan before last set of VPTransforms (NFC).
Florian Hahn [Fri, 24 Jun 2022 08:16:55 +0000 (10:16 +0200)]
[VPlan] Set VFs included in plan before last set of VPTransforms (NFC).

This allows VPlanTransforms to query the VFs included in the plan in the
future.

2 years ago[CMake][compiler-rt] Clean up the use of libcxx and libcxxabi
Petr Hosek [Thu, 2 Jun 2022 18:45:26 +0000 (18:45 +0000)]
[CMake][compiler-rt] Clean up the use of libcxx and libcxxabi

We no longer support the use of LLVM_ENABLE_PROJECTS for libcxx and
libcxxabi. We don't use paths to libcxx and libcxxabi in compiler-rt.

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

2 years ago[AArch64][SVE] Add sve.dupq.lane(insert(constant vector, 0), 0) ld1rq tests
Matt Devereau [Fri, 24 Jun 2022 07:33:50 +0000 (07:33 +0000)]
[AArch64][SVE] Add sve.dupq.lane(insert(constant vector, 0), 0) ld1rq tests

2 years ago[gdb-scripts] Fix PointerIntPairPrinter.to_string after D127969
Fangrui Song [Fri, 24 Jun 2022 07:36:26 +0000 (00:36 -0700)]
[gdb-scripts] Fix PointerIntPairPrinter.to_string after D127969

2 years ago[flang][OpenMP] Initial support the lowering of copyin clause
Peixin-Qiao [Fri, 24 Jun 2022 07:33:09 +0000 (15:33 +0800)]
[flang][OpenMP] Initial support the lowering of copyin clause

This supports the lowering of copyin clause initially. The pointer,
allocatable, common block, polymorphic varaibles will be supported
later.

This also includes the following changes:

1. Resolve the COPYIN clause and make the entity as host associated.

2. Fix collectSymbolSet by adding one option to control collecting the
   symbol itself or ultimate symbol of it so that it can be used
   explicitly differentiate the host and associated variables in
   host-association.

3. Add one helper function `lookupOneLevelUpSymbol` to differentiate the
   usage of host and associated variables explicitly. The previous
   lowering of firstprivate depends on the order of
   `createHostAssociateVarClone` and `lookupSymbol` of host symbol. With
   this fix, this dependence is removed.

4. Reuse `copyHostAssociateVar` for copying operation of COPYIN clause.

Reviewed By: kiranchandramohan, NimishMishra

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

2 years agoRecommit "[ConstraintElimination] Transfer info from ULT to signed system."
Florian Hahn [Fri, 24 Jun 2022 07:27:14 +0000 (09:27 +0200)]
Recommit "[ConstraintElimination] Transfer info from ULT to signed system."

This reverts commit 94ed2caf708818dd3a0b376bbce56e53c0956f1e.

The issue with no-determinism with the test has been fixed in
d9526e8a52ca9d5.

2 years ago[flang] Keep PURE in IEEE functions
Valentin Clement [Fri, 24 Jun 2022 07:10:03 +0000 (09:10 +0200)]
[flang] Keep PURE in IEEE functions

PURE keyword should be kept in `__fortran_ieee_exceptions.f90`
and `ieee_arithmetic.f90` and not removed as done in
https://reviews.llvm.org/D128431

Reviewed By: vdonaldson

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

2 years ago[flang] Fix forall issue with substring operation
Valentin Clement [Fri, 24 Jun 2022 07:07:03 +0000 (09:07 +0200)]
[flang] Fix forall issue with substring operation

When there is a substring operation on a scalar assignment in a FORALL
context, we have to lower the entire substring and not the entire
CHARACTER variable.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld, klausler

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[llvm-readobj] Simplify startswith+drop_front pattern with consume_front. NFC
Fangrui Song [Fri, 24 Jun 2022 07:04:55 +0000 (00:04 -0700)]
[llvm-readobj] Simplify startswith+drop_front pattern with consume_front. NFC

2 years ago[RISCV] Move vfma_vl+fneg_vl matching to DAG combine.
Craig Topper [Fri, 24 Jun 2022 06:35:15 +0000 (23:35 -0700)]
[RISCV] Move vfma_vl+fneg_vl matching to DAG combine.

This patch adds 3 new _VL RISCVISD opcodes to represent VFMA_VL with
different portions negated. It also adds a DAG combine to peek
through FNEG_VL to create these new opcodes.

This is modeled after similar code from X86.

This makes the isel patterns more regular and reduces the size of
the isel table by ~37K.

The test changes look like regressions, but they point to a bug that
was already there. We aren't able to commute a masked FMA instruction
to improve register allocation because we always use a mask undisturbed
policy. Prior to this patch we matched two multiply operands in a
different order and hid this issue for these test cases, but a different
test still could have encountered it.

Reviewed By: frasercrmck

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

2 years ago[CMake][compiler-rt] Use COMPILE_OPTIONS and LINK_OPTIONS
Petr Hosek [Wed, 30 Mar 2022 17:33:40 +0000 (10:33 -0700)]
[CMake][compiler-rt] Use COMPILE_OPTIONS and LINK_OPTIONS

This avoids the need for string-ification and lets CMake deduplicate
potentially duplicate flags.

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

2 years ago[CodeGen] Simplify isVirtualRegister. NFC
Fangrui Song [Fri, 24 Jun 2022 06:26:02 +0000 (23:26 -0700)]
[CodeGen] Simplify isVirtualRegister. NFC

2 years ago[libc++] P2321R2 section [tuple.tuple]. Adding C++23 constructors, assignment operato...
Hui Xie [Thu, 12 May 2022 12:23:11 +0000 (13:23 +0100)]
[libc++] P2321R2 section [tuple.tuple]. Adding C++23 constructors, assignment operators and swaps to `tuple`

1. for constructors that takes cvref variation of tuple<UTypes...>, there
used to be two SFINAE helper _EnableCopyFromOtherTuple,
_EnableMoveFromOtherTuple. And the implementations of these two helpers
seem to slightly differ from the spec. But now, we need 4 variations.
Instead of adding another two, this change refactored it to a single one
_EnableCtrFromUTypesTuple, which directly maps to the spec without
changing the C++11 behaviour. However, we need the helper __copy_cvref_t
to get the type of std::get<i>(cvref tuple<Utypes...>) for different
cvref, so I made __copy_cvref_t to be available in C++11.

2. for constructors that takes variations of std::pair, there used to be
four helpers _EnableExplicitCopyFromPair, _EnableImplicitCopyFromPair,
_EnableImplicitMoveFromPair, _EnableExplicitMoveFromPair. Instead of
adding another four, this change refactored into two helper
_EnableCtrFromPair and _BothImplicitlyConvertible. This also removes the
need to use _nat

3. for const member assignment operator, since the requirement is very
simple, I haven't refactored the old code but instead directly adding
the new c++23 code.

4. for const swap, I pretty much copy pasted the non-const version to make
these overloads look consistent

5. while doing these change, I found two of the old constructors wasn't
marked constexpr for C++20 but they should. fixed them and added unit
tests

Reviewed By: #libc, ldionne

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

2 years ago[AMDGPU][NFC] Correct typo in DWARF Extensions For Heterogeneous Debugging
Venkata Ramanaiah Nalamothu [Mon, 20 Jun 2022 15:14:18 +0000 (20:44 +0530)]
[AMDGPU][NFC] Correct typo in DWARF Extensions For Heterogeneous Debugging

The `DW_AT_LLVM_address_space` attribute is mentioned as `DW_AT_address_space` in
one of the notes.

Reviewed By: scott.linder

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

2 years ago[BOLT][NFC] Use range-based STL wrappers
Amir Ayupov [Fri, 24 Jun 2022 05:15:47 +0000 (22:15 -0700)]
[BOLT][NFC] Use range-based STL wrappers

Replace `std::` algorithms taking begin/end iterators with `llvm::` counterparts
accepting ranges.

Reviewed By: rafauler

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

2 years ago[GuardWidening] Update all tests with update_test_checks.py
Serguei Katkov [Fri, 24 Jun 2022 04:56:23 +0000 (11:56 +0700)]
[GuardWidening] Update all tests with update_test_checks.py

2 years ago[MachineSink] Clear kill flags on operands outside loop
Carl Ritson [Fri, 24 Jun 2022 05:02:48 +0000 (14:02 +0900)]
[MachineSink] Clear kill flags on operands outside loop

If an instruction is sunk into a loop then any kill flags on
operands declared outside the loop must be cleared as these
will be live for all loop iterations.

Fixes #46827

Reviewed By: MatzeB

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

2 years agoRevert "Add support for decoding base64."
Douglas Yung [Fri, 24 Jun 2022 04:47:20 +0000 (21:47 -0700)]
Revert "Add support for decoding base64."

This reverts commit 8b987ca5e37ee670dface295bd147b8d6d312084.

This change breaks several Windows bots
 - https://lab.llvm.org/buildbot/#/builders/123/builds/11371
 - https://lab.llvm.org/buildbot/#/builders/117/builds/7685
 - https://lab.llvm.org/buildbot/#/builders/42/builds/6077
 - https://lab.llvm.org/buildbot/#/builders/216/builds/6340

2 years ago[PowerPC][AIX] Fix assertion message on AIX. NFC.
Kai Luo [Fri, 24 Jun 2022 04:02:30 +0000 (12:02 +0800)]
[PowerPC][AIX] Fix assertion message on AIX. NFC.

Fixes build https://lab.llvm.org/buildbot/#/builders/214/builds/1980.

2 years ago[LegalizeTypes][NFC] Add an assert to WidenVecRes_EXTRACT_SUBVECTOR and adjust some...
Lian Wang [Fri, 17 Jun 2022 09:17:14 +0000 (09:17 +0000)]
[LegalizeTypes][NFC] Add an assert to WidenVecRes_EXTRACT_SUBVECTOR and adjust some code

Reviewed By: craig.topper, david-arm

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

2 years ago[PowerPC] Allow llvm.ppc.cfence to accept pointer types
Kai Luo [Fri, 24 Jun 2022 02:24:23 +0000 (10:24 +0800)]
[PowerPC] Allow llvm.ppc.cfence to accept pointer types

In the context of atomic load, integer, pointer and float point types are allowed, thus we should allow llvm.ppc.cfence to accept any type mentioned.

Fixes https://github.com/llvm/llvm-project/issues/55983.

Reviewed By: shchenz, vchuravy

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

2 years ago[SelectionDAG] Enable WidenVecOp_VECREDUCE for scalable vector
Lian Wang [Tue, 21 Jun 2022 02:34:15 +0000 (02:34 +0000)]
[SelectionDAG] Enable WidenVecOp_VECREDUCE for scalable vector

Reviewed By: craig.topper

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

2 years ago[mlir][spirv] Fix bitcast input order for UnifyAliasedResourcePass
Lei Zhang [Fri, 24 Jun 2022 02:19:08 +0000 (22:19 -0400)]
[mlir][spirv] Fix bitcast input order for UnifyAliasedResourcePass

spv.bitcast from a vector to a scalar expects the lower-numbered
components of the the vector to map to the lower-ordered bits of
the scalar. That actually already matches how little endian stores
data in the memory. So we just need to read and push to the back
of the vector sequentially.

Reviewed By: hanchung

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

2 years ago[libcxx][test] Suppress complex<int> warnings when testing MSVC
Casey Carter [Fri, 24 Jun 2022 00:46:47 +0000 (17:46 -0700)]
[libcxx][test] Suppress complex<int> warnings when testing MSVC

2 years agoclang: Tweak behaviour of warn_empty_while_body and warn_empty_if_body
Dmitri Gribenko [Fri, 24 Jun 2022 00:26:07 +0000 (02:26 +0200)]
clang: Tweak behaviour of warn_empty_while_body and warn_empty_if_body

Use the if/while statement right paren location instead of the end of the
condition expression to determine if the semicolon is on its own line, for the
purpose of not warning about code like this:

    while (foo())
      ;

Using the condition location meant that we would also not report a warning on
code like this:

    while (MACRO(a,
                 b));
      body();

The right paren loc wasn't stored in the AST or passed into Sema::ActOnIfStmt
when this logic was first written.

Reviewed By: rnk, gribozavr2

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

2 years agoAdd support for decoding base64.
Greg Clayton [Mon, 23 May 2022 23:01:00 +0000 (16:01 -0700)]
Add support for decoding base64.

An upcoming patch to LLDB will require the ability to decode base64. This patch adds support for decoding base64 and adds tests.

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

2 years agoRevert "[LoopInterchange] New cost model for loop interchange"
Evgenii Stepanov [Thu, 23 Jun 2022 23:03:21 +0000 (16:03 -0700)]
Revert "[LoopInterchange] New cost model for loop interchange"

llvm/lib/Analysis/LoopCacheAnalysis.cpp:702:30: runtime error: signed
integer overflow: 6148914691236517209 * 100 cannot be represented in
type 'long'

https://lab.llvm.org/buildbot/#/builders/5/builds/25185

This reverts commit 1b24fe34b06cd9f2337313f513a8b19f9a37c5de.

2 years ago[MLIR] Add `decomposeMixedStridesOrOffsets` and `decomposeMixedSizes`
Frederik Gossen [Wed, 22 Jun 2022 20:36:24 +0000 (16:36 -0400)]
[MLIR] Add `decomposeMixedStridesOrOffsets` and `decomposeMixedSizes`

Add the reverse functions to the ViewLikeInterface's functions
`getMixedStrides`, `getMixedSizes`, and `getMixedOffsets`. The new functions
are useful to build view-like operations from an array of mixed static/dynamic
values.

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

2 years ago[RISCV] Replace two calls to getMinRVVVectorSizeInBits with useRVVForFixedLengthVecto...
Philip Reames [Thu, 23 Jun 2022 22:58:54 +0000 (15:58 -0700)]
[RISCV] Replace two calls to getMinRVVVectorSizeInBits with useRVVForFixedLengthVectors [nfc]

2 years ago[NFC][lld] Fix typos to test commit access
Daniel Bertalan [Thu, 23 Jun 2022 22:19:18 +0000 (00:19 +0200)]
[NFC][lld] Fix typos to test commit access

2 years ago[lldb] Fix up Objective-C ISA pointers
Jonas Devlieghere [Thu, 23 Jun 2022 21:14:49 +0000 (14:14 -0700)]
[lldb] Fix up Objective-C ISA pointers

Support stripping the PAC bits from Objective-C ISA pointers in the
Objective-C runtime plugin.

2 years agoRevert "[libc++] P2321R2 section [tuple.tuple]. Adding C++23 constructors, assignment...
Hui Xie [Thu, 23 Jun 2022 20:54:23 +0000 (21:54 +0100)]
Revert "[libc++] P2321R2 section [tuple.tuple]. Adding C++23 constructors, assignment operators and swaps to `tuple`"

When merging the changes of <type_traits> header with the commits on
this header over the last month, several conflicts were mistaken
resolved and the wrong branch was picked while resolving conflicts,
which leads to CI failure. In order to resolve the conflicts properly
with qualification CI job, this change is reverted.

This reverts commit 95733a55b986e73f4d8f5314e0d4557d8ae0b226.

2 years ago[WebAssembly][Object] Remove requirement that objects must have code sections
Derek Schuff [Fri, 17 Jun 2022 20:09:43 +0000 (13:09 -0700)]
[WebAssembly][Object] Remove requirement that objects must have code sections

When parsing name and linking sections, we currently require that the object
must have a code section (it seems that this was intended to verify section
ordering). However it can be useful for binaries to have their code sections
stripped out (e.g. if we just want the debug info). In that case we need
the rest of the known sections (so e.g. we know how many functions there
are, to verify the name section) but not the actual code.

I've removed the restriction completely. I think this is OK because the
section-parsing code already checks function and global indices in many
places for validity and will return appropriate errors if the relevant sections
are missing. Also we can't just replace the requirement of seeing a code section
with a requirement  that we see a function or global section, because a binary
may just not have any functions or globals.
But there's only an problem if the name or linking section tries to name a
nonexistent function.

Part of a fix for https://github.com/emscripten-core/emscripten/issues/13084

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

2 years ago[lldb/Fuzzer] Have fuzzers write artifacts to specific directory
Chelsea Cassanova [Thu, 23 Jun 2022 15:38:18 +0000 (11:38 -0400)]
[lldb/Fuzzer] Have fuzzers write artifacts to specific directory

This makes the LLDB fuzzers write their fuzzer artifacts to
their own directory in the build directory. It also adds an artifact
prefix to the target fuzzer to make it easier to tell which fuzzer
wrote the artifact.

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

2 years agoThe help string for stop-on-shared-library-load was copied to stop-on-exec.
Jim Ingham [Thu, 23 Jun 2022 20:53:59 +0000 (13:53 -0700)]
The help string for stop-on-shared-library-load was copied to stop-on-exec.
Fix it so it says it does what it does.

2 years ago[libc] Revert "Eliminate the internal header library target."
Siva Chandra Reddy [Thu, 23 Jun 2022 20:53:09 +0000 (20:53 +0000)]
[libc] Revert "Eliminate the internal header library target."

This reverts commit 306f2731f482d32ccf557996ff122f7293cb30cb. The CMake
version used by the bots does like it.

2 years ago[libc][NFC] Eliminate the internal header library target.
Siva Chandra Reddy [Thu, 9 Jun 2022 20:23:33 +0000 (20:23 +0000)]
[libc][NFC] Eliminate the internal header library target.

The internal header library target with name suffix .__header_library
has been removed as it serves no purpose now.

2 years ago[libc][NFC] Convert pthread tests which create threads to integration tests.
Siva Chandra Reddy [Wed, 22 Jun 2022 22:51:26 +0000 (22:51 +0000)]
[libc][NFC] Convert pthread tests which create threads to integration tests.

2 years ago[LoopInterchange] New cost model for loop interchange
Congzhe Cao [Thu, 23 Jun 2022 20:26:24 +0000 (16:26 -0400)]
[LoopInterchange] New cost model for loop interchange

This is the second attempt to land this patch.

The patch proposed to use a new cost model for loop interchange,
which is obtained from loop cache analysis.

Given a loopnest, what loop cache analysis returns is a vector of
loops [loop0, loop1, loop2, ...] where loop0 should be replaced as the
outermost loop, loop1 should be placed one more level inside, and loop2
one more level inside, etc. What loop cache analysis does is not only more
comprehensive than the current cost model, it is also a "one-shot" query
which means that we only need to query it once during the entire loop
interchange pass, which is better than the current cost model where we
query it every time we check whether it is profitable to interchange two
loops. Thus complexity is reduced, especially after D120386 where we do
more interchanges to get the globally optimal loop access pattern.

Updates made to test cases are mostly minor changes and some corrections.
One change that applies to all tests is that we added an option
`-cache-line-size=64` to the RUN lines. This is ensure that loop cache
analysis receives a valid number of cache line size for correct analysis.
Test coverage for loop interchange is not reduced.

Currently we did not completely remove the legacy cost model, but keep it
as fall-back in case the new cost model did not run successfully. This is
because currently we have some limitations in delinearization, which sometimes
makes loop cache analysis bail out. The longer term goal is to enhance
delinearization and eventually remove the legacy cost model compeletely.

Reviewed By: bmahjour, #loopoptwg

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

2 years ago[libc][NFC] Convert threads unittests in to integration tests.
Siva Chandra Reddy [Wed, 22 Jun 2022 21:27:57 +0000 (21:27 +0000)]
[libc][NFC] Convert threads unittests in to integration tests.

This is mostly a mechanical change. In a future pass, all tests from
pthread which create threads will also be converted to integration tests.

Some of thread related features are tightly coupled with the loader. So,
they can only be tested with the in-house loader. Hence, going forward, all
tests which create threads will have to be integration tests.

Reviewed By: lntue

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

2 years ago[libc++] P2321R2 section [tuple.tuple]. Adding C++23 constructors, assignment operato...
Hui Xie [Thu, 12 May 2022 12:23:11 +0000 (13:23 +0100)]
[libc++] P2321R2 section [tuple.tuple]. Adding C++23 constructors, assignment operators and swaps to `tuple`

1. for constructors that takes cvref variation of tuple<UTypes...>, there
used to be two SFINAE helper _EnableCopyFromOtherTuple,
_EnableMoveFromOtherTuple. And the implementations of these two helpers
seem to slightly differ from the spec. But now, we need 4 variations.
Instead of adding another two, this change refactored it to a single one
_EnableCtrFromUTypesTuple, which directly maps to the spec without
changing the C++11 behaviour. However, we need the helper __copy_cvref_t
to get the type of std::get<i>(cvref tuple<Utypes...>) for different
cvref, so I made __copy_cvref_t to be available in C++11.

2. for constructors that takes variations of std::pair, there used to be
four helpers _EnableExplicitCopyFromPair, _EnableImplicitCopyFromPair,
_EnableImplicitMoveFromPair, _EnableExplicitMoveFromPair. Instead of
adding another four, this change refactored into two helper
_EnableCtrFromPair and _BothImplicitlyConvertible. This also removes the
need to use _nat

3. for const member assignment operator, since the requirement is very
simple, I haven't refactored the old code but instead directly adding
the new c++23 code.

4. for const swap, I pretty much copy pasted the non-const version to make
these overloads look consistent

5. while doing these change, I found two of the old constructors wasn't
marked constexpr for C++20 but they should. fixed them and added unit
tests

Reviewed By: #libc, ldionne

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

2 years ago[libc++] Add a test to pin down the set of transitive public includes
Louis Dionne [Mon, 20 Jun 2022 21:10:53 +0000 (17:10 -0400)]
[libc++] Add a test to pin down the set of transitive public includes

A situation that happens fairly often in libc++ is that we remove some
transitive includes in a header (either purposefully or not) and that
ends up breaking users. Of course, we want to be able to remove our
transitive includes, however it's also good to have a grip on that
to know which commit changed what and when. Furthermore, it's good
to accumulate include removals for a couple of releases to avoid
breaking users at every release for this reason.

This commit adds a test that should break whenever we remove an
include. Hence, it should allow us to track which headers include
which other headers transitively, giving us a traceable way to
remove headers.

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

2 years agoDebugInfo: Fully integrate ctor type homing into 'limited' debug info
David Blaikie [Wed, 22 Jun 2022 23:26:23 +0000 (23:26 +0000)]
DebugInfo: Fully integrate ctor type homing into 'limited' debug info

Simplify debug info back to just "limited" or "full" by rolling the ctor
type homing fully into the "limited" debug info.

Also fix a bug I found along the way that was causing ctor type homing
to kick in even when something could be vtable homed (where vtable
homing is stronger/more effective than ctor homing) - fixing at the same
time as it keeps the tests (that were testing only "limited non ctor"
homing and now test ctor homing) passing.

2 years ago[HLSL] Enable half type for hlsl.
Xiang Li [Sun, 19 Jun 2022 22:37:00 +0000 (15:37 -0700)]
[HLSL] Enable half type for hlsl.

HLSL supports half type.
When enable-16bit-types is not set, half will be treated as float.
When enable-16bit-types is set, half will be treated like real 16bit float type and map to llvm half type.
Also change CXXABI to Microsoft to match dxc behavior.
The mangle name for half is "$f16@" when half is treat as native half type and "$halff@" when treat as float.

In AST, half is still half.
The special thing is done at clang codeGen, when NativeHalfType is false, half will translated into float.

Reviewed By: aaron.ballman

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

2 years ago[lld, ELF and mac] Add --time-trace=<file>, remove --time-trace-file=<file>
Nico Weber [Thu, 23 Jun 2022 16:11:47 +0000 (12:11 -0400)]
[lld, ELF and mac] Add --time-trace=<file>, remove --time-trace-file=<file>

`--time-trace=foo` has the same behavior as `--time-trace --time-trace-file=<file>`
had previously.

Also, for mac, make --time-trace-granularity *not* imply --time-trace, to match
behavior of the ELF port.

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

2 years ago[LV] Avoid a crash when costing a uniform store which doesn't correspond to a legal...
Philip Reames [Thu, 23 Jun 2022 19:13:45 +0000 (12:13 -0700)]
[LV] Avoid a crash when costing a uniform store which doesn't correspond to a legal scatter

If we have an unaligned uniform store, then when costing a scalable VF we can't emit code to scalarize it.  (Well, we could, but we haven't implemented that case.)  This change replaces an assert with a cost-model bailout such that we reject vectorization with the scalable VF instead of crashing.

2 years ago[CUDA] Do not embed a fatbinary when using the new driver
Joseph Huber [Thu, 23 Jun 2022 14:06:26 +0000 (10:06 -0400)]
[CUDA] Do not embed a fatbinary when using the new driver

Previously, when using the new driver we created a fatbinary with the
PTX and Cubin output. This was mainly done in an attempt to create some
backwards compatibility with the existing CUDA support that embeds the
fatbinary in each TU. This will most likely be more work than necessary
to actually implement. The linker wrapper cannot do anything with these
embedded PTX files because we do not know how to link them, and if we
did want to include multiple files it should go through the
`clang-offload-packager` instead. Also this didn't repsect the setting
that disables embedding PTX (although it wasn't used anyway).

Reviewed By: tra

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

2 years ago[ThinLTO][ELF] Add --thinlto-emit-index-files option
Jin Xin Ng [Wed, 1 Jun 2022 17:49:36 +0000 (10:49 -0700)]
[ThinLTO][ELF] Add --thinlto-emit-index-files option

Allows ThinLTO indices to be written to disk on-the-fly/as-part-of “normal” linker execution. Previously ThinLTO indices could be written via --thinlto-index-only but that would cause the linker to exit early. For MLGO specifically, this enables saving the ThinLTO index files without having to restart the linker to collect data only available at later stages (i.e. output of --save-temps) of the linker's execution.

Note, this option does not currently work with:
--thinlto-object-suffix-replace, as this is intended to be used to consume minimized IR bitcode files while --thinlto-emit-index-files is intended to be run together with InProcessThinLTO (which cannot parse minimized IR).
--thinlto-prefix-replace  support is left unimplemented but can be implemented if needed

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

2 years ago[mlir][Transform] Fix applyToOne corner case when no op is matched.
Nicolas Vasilache [Thu, 23 Jun 2022 19:14:23 +0000 (12:14 -0700)]
[mlir][Transform] Fix applyToOne corner case when no op is matched.

Such situations manifest themselves with an empty payload which ends up producing empty results.
In such cases, we still want to match the transform op contract and return as many empty SmallVector<Operation*>
as the op requires.

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

2 years ago[clang-tidy] Extend spelling for CheckOptions
Nathan James [Thu, 23 Jun 2022 18:59:30 +0000 (19:59 +0100)]
[clang-tidy] Extend spelling for CheckOptions

The current way to specify CheckOptions is pretty verbose and unintuitive.
Given that the options are a dictionary it makes much more sense to treat them as such in the config files.
Example:
```
CheckOptions: {SomeCheck.Option: true, SomeCheck.OtherOption: 'ignore'}
# Or
CheckOptions:
  SomeCheck.Option: true
  SomeCheck.OtherOption: 'ignore'
```

This change will still handle the old syntax with no issue, ensuring we don't screw up users current config files.

The only observable differences are support for the new syntax and `-dump=config` will emit using the new syntax.

Reviewed By: aaron.ballman

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

2 years ago[llvm] Update module map to include the `IR/ConstantFold` header
Med Ismail Bennani [Thu, 23 Jun 2022 18:52:25 +0000 (11:52 -0700)]
[llvm] Update module map to include the `IR/ConstantFold` header

This should fix the build failure occuring when enabling modules
(LLVM_ENABLE_MODULES=On):

https://green.lab.llvm.org/green/job/lldb-cmake/44785/

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[pseudo] Handle no-reductions-available on the fastpath. NFC
Sam McCall [Thu, 23 Jun 2022 18:33:26 +0000 (20:33 +0200)]
[pseudo] Handle no-reductions-available on the fastpath. NFC

This is a ~2% speedup.

2 years ago[SLP]Fix a crash when reorder masked gather nodes with reused scalars.
Alexey Bataev [Wed, 22 Jun 2022 16:31:03 +0000 (09:31 -0700)]
[SLP]Fix a crash when reorder masked gather nodes with reused scalars.

If the masked gather nodes must be reordered, we can just reorder
scalars, just like for gather nodes. But if the node contains reused
scalars, it must be handled same way as a regular vectorizable node,
since need to reorder reused mask, not the scalars directly.

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

2 years ago[flang][runtime] Improve G0 output editing
Peter Klausler [Wed, 22 Jun 2022 20:27:59 +0000 (13:27 -0700)]
[flang][runtime] Improve G0 output editing

G0 output editing should never overflow an output field and fill it
with asterisks.  It should also never elide the "E" in an exponent
field, even if it has more than three digits.

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

2 years ago[clang-tidy] Add `-verify-config` command line argument
Nathan James [Thu, 23 Jun 2022 18:23:08 +0000 (19:23 +0100)]
[clang-tidy] Add `-verify-config` command line argument

Adds a `-verify-config` command line argument, that when specified will verify the Checks and CheckOptions fields in the config files:
 - A warning will be raised for any check that doesn't correspond to a registered check, a suggestion will also be emitted for close misses.
 - A warning will be raised for any check glob(containing *) that doesn't match any registered check.
 - A warning will be raised for any CheckOption that isn't read by any registered check, a suggestion will also be emitted for close misses.

This can be useful if debuging why a certain check isn't enabled, or the options are being handled as you expect them to be.

Reviewed By: aaron.ballman

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

2 years ago[flang] Make SQRT folding exact
Peter Klausler [Tue, 21 Jun 2022 00:22:33 +0000 (17:22 -0700)]
[flang] Make SQRT folding exact

Replace the latter half of the SQRT() folding algorithm with code that
calculates an exact root with extra rounding bits, and then lets the
usual normalization and rounding code do the right thing.  Extend
tests to catch regressions.

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

2 years ago[flang] Fix wording of warning message
Peter Klausler [Fri, 17 Jun 2022 23:31:17 +0000 (16:31 -0700)]
[flang] Fix wording of warning message

"division on intrinsic call" should read "division by zero on intrinsic call".

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

2 years ago[pseudo] Store last node popped in the queue, not its parent(s). NFC
Sam McCall [Thu, 23 Jun 2022 18:06:04 +0000 (20:06 +0200)]
[pseudo] Store last node popped in the queue, not its parent(s). NFC

We have to walk up to the last node to find the start token, but no need
to go even one node further.

This is one node fewer to store, but more importantly if the last node
happens to have multiple parents we avoid storing the sequence multiple times.

This saves ~5% on glrParse.
Based on a comment by hokein@ on https://reviews.llvm.org/D128307

2 years ago[flang][runtime] FLUSH(bad or unconnected unit number) is an error
Peter Klausler [Wed, 22 Jun 2022 20:24:51 +0000 (13:24 -0700)]
[flang][runtime] FLUSH(bad or unconnected unit number) is an error

Some I/O control statements are no-ops when attempted on a bad or
unconnected UNIT=, but the standard says that FLUSH is an error
in that case.

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

2 years ago[Inline] Introduce a backend option to suppress inlining of functions with large...
Wolfgang Pieb [Wed, 22 Jun 2022 20:02:01 +0000 (13:02 -0700)]
[Inline] Introduce a backend option to suppress inlining of functions with large stack sizes.

The hidden option max-inline-stacksize=<N> prevents the inlining of functions
with a stack size larger than N.

Reviewed By: mtrofin, aeubanks

Differential Review: https://reviews.llvm.org/D127988

2 years ago[mlir][math] Lower atan to libm
Slava Zakharin [Thu, 23 Jun 2022 17:10:56 +0000 (10:10 -0700)]
[mlir][math] Lower atan to libm

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

2 years ago[pseudo] Store reduction sequences by pointer in heaps, instead of by value.
Sam McCall [Tue, 21 Jun 2022 22:20:38 +0000 (00:20 +0200)]
[pseudo] Store reduction sequences by pointer in heaps, instead of by value.

Copying sequences around as the heap resized is significantly expensive.

This speeds up glrParse by ~35% (2.4 => 3.25 MB/s)

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

2 years ago[mlir][bufferization][NFC] Make `escape` a dialect attribute
Matthias Springer [Thu, 23 Jun 2022 17:28:46 +0000 (19:28 +0200)]
[mlir][bufferization][NFC] Make `escape` a dialect attribute

All bufferizable ops that bufferize to an allocation receive a `bufferization.escape` attribute during TensorCopyInsertion.

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

2 years ago[flang] Fix bogus errors from SIZE/SHAPE/UBOUND on assumed-shape
Peter Klausler [Fri, 17 Jun 2022 21:12:13 +0000 (14:12 -0700)]
[flang] Fix bogus errors from SIZE/SHAPE/UBOUND on assumed-shape

While it is indeed an error to use SIZE, SHAPE, or UBOUND on an
assumed-shape dummy argument without also supplying a DIM= argument
to the intrinsic function, it is *not* an error to use these intrinsic
functions on sections or expressions of such arrays.  Refine the test
used for the error message.

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

2 years ago[pseudo] Turn glrReduce into a class, reuse storage across calls.
Sam McCall [Tue, 21 Jun 2022 20:19:06 +0000 (22:19 +0200)]
[pseudo] Turn glrReduce into a class, reuse storage across calls.

This is a ~5% speedup, we no longer have to allocate the priority queues and
other collections for each reduction step where we use them.

It's also IMO easier to understand the structure of a class with methods vs a
function with nested lambdas.

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

2 years ago[RISCV] Fix a crash in InsertVSETVLI where we hadn't properly guarded for a SEWLMULRa...
Philip Reames [Thu, 23 Jun 2022 17:19:45 +0000 (10:19 -0700)]
[RISCV] Fix a crash in InsertVSETVLI where we hadn't properly guarded for a SEWLMULRatioOnly abstract state

A forward abstract state can be in the special SEWLMULRatioOnly state which means we're not allowed to inspect its fields.  The scalar to vector move case was mising a guard, and we'd crash on an assert.  Test cases included.

2 years ago[ConstraintElimination] Use stable_sort to sort worklist.
Florian Hahn [Thu, 23 Jun 2022 16:46:15 +0000 (18:46 +0200)]
[ConstraintElimination] Use stable_sort to sort worklist.

If there are multiple constraints in the same block, at the moment the
order they are processed may be different depending on the sort
implementation.

Use stable_sort to ensure consistent ordering.

2 years ago[Offloading] Embed the target features in the OffloadBinary
Joseph Huber [Mon, 13 Jun 2022 19:26:55 +0000 (15:26 -0400)]
[Offloading] Embed the target features in the OffloadBinary

The target features are necessary for correctly compiling most programs
in LTO mode. Currently, these are derived in clang at link time and
passed as an arguemnt to the linker wrapper. This is problematic because
it requires knowing the required toolchain at link time, which should
not be necessry. Instead, these features should be embedded into the
offloading binary so we can unify them in the linker wrapper for LTO.
This also required changing the offload packager to interpret multiple
arguments as concatenation with a comma. This is so we can still use the
`,` separator for the argument list.

Depends on D127246

Reviewed By: tra

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

2 years ago[docs][NewPM] Add more info on why accessing mutable outer analyses is disallowed
Arthur Eubanks [Wed, 22 Jun 2022 19:40:03 +0000 (12:40 -0700)]
[docs][NewPM] Add more info on why accessing mutable outer analyses is disallowed

Reviewed By: asbirlea, rnk

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

2 years ago[flang][runtime] Handle READ of non-UTF-8 data into multi-byte CHARACTER
Peter Klausler [Fri, 17 Jun 2022 19:14:46 +0000 (12:14 -0700)]
[flang][runtime] Handle READ of non-UTF-8 data into multi-byte CHARACTER

When a READ statement reads into a CHARACTER(2 or 4) variable from a
unit whose encoding is not UTF-8, don't copy bytes directly; they must
each be zero-extended.

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

2 years ago[test][GlobalOpt] Update precommitted test
Arthur Eubanks [Thu, 23 Jun 2022 16:56:31 +0000 (09:56 -0700)]
[test][GlobalOpt] Update precommitted test

2 years ago[flang][runtime] Respect PAD='NO' on READ/WRITE
Peter Klausler [Fri, 17 Jun 2022 18:45:14 +0000 (11:45 -0700)]
[flang][runtime] Respect PAD='NO' on READ/WRITE

The check for the PAD= setting should examine the mutable modes
of the current I/O statement, not the persistent modes of the
I/O unit.

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

2 years agoAdding a named op for grouped convolutions
gpetters94 [Tue, 21 Jun 2022 16:51:18 +0000 (16:51 +0000)]
Adding a named op for grouped convolutions

2 years ago[pseudo] Add a fast-path to GLR reduce when both pop and push are trivial
Sam McCall [Tue, 21 Jun 2022 19:47:14 +0000 (21:47 +0200)]
[pseudo] Add a fast-path to GLR reduce when both pop and push are trivial

In general we split a reduce into pop/push, so concurrently-available reductions
can run in the correct order. The data structures for this are expensive.

When only one reduction is possible at a time, we need not do this: we can pop
and immediately push instead.
Strictly this is correct whenever we yield one concurrent PushSpec.

This patch recognizes a trivial but common subset of these cases:
 - there must be no pending pushes and only one head available to pop
 - the head must have only one reduction rule
 - the reduction path must be a straight line (no multiple parents)

On my machine this speeds up by 2.12 -> 2.30 MB/s = 8%

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

2 years agoReland "[pseudo] Track heads as GSS nodes, rather than as "pending actions"."
Sam McCall [Thu, 23 Jun 2022 16:16:49 +0000 (18:16 +0200)]
Reland "[pseudo] Track heads as GSS nodes, rather than as "pending actions"."

This reverts commit 2c80b5319870b57fbdbb6c9cef9c86c26c65371d.

Fixes LRTable::buildForTest to create states that are referenced but
have no actions.

2 years ago[flang] Fix READ/WRITE with POS= on stream units, with refactoring
Peter Klausler [Fri, 17 Jun 2022 18:20:29 +0000 (11:20 -0700)]
[flang] Fix READ/WRITE with POS= on stream units, with refactoring

First, ExternalFileUnit::SetPosition was being used both as a utility
within the class' member functions as well as an API from I/O statement
processing.  Make it private, and add APIs for SetStreamPos and SetDirectRec.

Second, ensure that SetStreamPos for POS= positioning in a stream
doesn't leave the current record number and endfile record number
in an arbitrary state.  In stream I/O they are used only to manage
end-of-file detection, and shouldn't produce false positive results
from IsAtEnd() after repositioning.

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

2 years agoRevert "[pseudo] Track heads as GSS nodes, rather than as "pending actions"."
Sam McCall [Thu, 23 Jun 2022 16:16:03 +0000 (18:16 +0200)]
Revert "[pseudo] Track heads as GSS nodes, rather than as "pending actions"."

This reverts commit e3ec054dfdf48f19cb6726cb3f4965b9ab320ed9.

Tests fail in asserts mode: https://lab.llvm.org/buildbot/#/builders/109/builds/41217

2 years ago[BasicTTI] Avoid crash when costing scalable select expansion
Philip Reames [Thu, 23 Jun 2022 16:11:24 +0000 (09:11 -0700)]
[BasicTTI] Avoid crash when costing scalable select expansion

If the target has chosen to expand a scalable vector type, BasicTTI tries to scalarize and we'd crash.  As a minimum, we should return an invalid cost instead.

The added test provide coverage for the moment, but given they show a number of gaps in RISCV costing, they're likely not to cover this code path long term.

2 years ago[lldb] Make thread safety the responsibility of the log handlers
Jonas Devlieghere [Thu, 23 Jun 2022 15:08:36 +0000 (08:08 -0700)]
[lldb] Make thread safety the responsibility of the log handlers

Drop the thread-safe flag and make the locking strategy the
responsibility of the individual log handler.

Previously we got away with a non-thread safe mode because we were using
unbuffered streams that rely on the underlying syscalls/OS for
synchronization. With the introduction of log handlers, we can have
arbitrary logic involved in writing out the logs. With this patch the
log handlers can pick the most appropriate locking strategy for their
particular implementation.

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

2 years ago[lldb] Support a buffered logging mode
Jonas Devlieghere [Thu, 23 Jun 2022 15:06:17 +0000 (08:06 -0700)]
[lldb] Support a buffered logging mode

This patch adds a buffered logging mode to lldb. A buffer size can be
passed to `log enable` with the -b flag. If no buffer size is specified,
logging is unbuffered.

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

2 years ago[flang] Handle boxed characters that are values when doing a conversion
Valentin Clement [Thu, 23 Jun 2022 16:04:50 +0000 (18:04 +0200)]
[flang] Handle boxed characters that are values when doing a conversion

Character conversion requires memory storage as it operates on a
sequence of code points.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[flang] Increase support for intrinsic module procedures
Val Donaldson [Thu, 23 Jun 2022 16:03:06 +0000 (18:03 +0200)]
[flang] Increase support for intrinsic module procedures

* Make Semantics test doconcurrent01.f90 an expected failure pending a fix
for a problem in recognizing a PURE prefix specifier for a specific procedure
that occurs in new intrinsic module source code,

* review update

* review update

* Increase support for intrinsic module procedures

The f18 standard defines 5 intrinsic modules that define varying numbers
of procedures, including several operators:

  2  iso_fortran_env
 55  ieee_arithmetic
 10  ieee_exceptions
  0  ieee_features
  6  iso_c_binding

There are existing fortran source files for each of these intrinsic modules.
This PR adds generic procedure declarations to these files for procedures
that do not already have them, together with associated specific procedure
declarations.  It also adds the capability of recognizing intrinsic module
procedures in lowering code, making it possible to use existing language
intrinsic code generation for intrinsic module procedures for both scalar
and elemental calls.  Code can then be generated for intrinsic module
procedures using existing options, including front end folding, direct
inlining, and calls to runtime support routines.  Detailed code generation
is provided for several procedures in this PR, with others left to future PRs.
Procedure calls that reach lowering and don't have detailed implementation
support will generate a "not yet implemented" message with a recognizable name.

The generic procedures in these modules may each have as many as 36 specific
procedures.  Most specific procedures are generated via macros that generate
type specific interface declarations.  These specific declarations provide
detailed argument information for each individual procedure call, similar
to what is done via other means for standard language intrinsics.  The
modules only provide interface declarations.  There are no procedure
definitions, again in keeping with how language intrinsics are processed.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier, PeteSteinfeld

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2 years ago[gn build] Port 4045b62d4cc9
LLVM GN Syncbot [Thu, 23 Jun 2022 15:49:40 +0000 (15:49 +0000)]
[gn build] Port 4045b62d4cc9

2 years ago[RISCV] Disable <vscale x 1 x *> types with Zve32x or Zve32f.
Craig Topper [Thu, 23 Jun 2022 15:41:12 +0000 (08:41 -0700)]
[RISCV] Disable <vscale x 1 x *> types with Zve32x or Zve32f.

According to the vector spec, mf8 is not supported for i8 if ELEN
is 32. Similarily mf4 is not suported for i16/f16 or mf2 for i32/f32.

Since RVVBitsPerBlock is 64 and LMUL is calculated as
((MinNumElements * ElementSize) / RVVBitsPerBlock) this means we
need to disable any type with MinNumElements==1.

For generic IR, these types will now be widened in type legalization.
For RVV intrinsics, we'll probably hit a fatal error somewhere. I plan
to work on disabling the intrinsics in the riscv_vector.h header.

Reviewed By: arcbbb

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

2 years ago[lld/mac] Add a few TimeTraceScopes
Nico Weber [Wed, 22 Jun 2022 14:58:33 +0000 (10:58 -0400)]
[lld/mac] Add a few TimeTraceScopes

Identical literal folding takes ~1.4% of the time, and was missing
from the trace.

Signature computation still needs ~2.2% of the time, so probably worth
explicitly marking its contribution to "Write output file" (9.1%)

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