platform/upstream/llvm.git
2 years ago[cmake] Provide CURRENT_TOOLS_DIR centrally, replacing CLANG_TOOLS_DIR
Sam McCall [Wed, 16 Mar 2022 02:13:44 +0000 (03:13 +0100)]
[cmake] Provide CURRENT_TOOLS_DIR centrally, replacing CLANG_TOOLS_DIR

CLANG_TOOLS_DIR holds the the current bin/ directory, maybe with a %(build_mode)
placeholder. It is used to add the just-built binaries to $PATH for lit tests.
In most cases it equals LLVM_TOOLS_DIR, which is used for the same purpose.
But for a standalone build of clang, CLANG_TOOLS_DIR points at the build tree
and LLVM_TOOLS_DIR points at the provided LLVM binaries.

Currently CLANG_TOOLS_DIR is set in clang/test/, clang-tools-extra/test/, and
other things always built with clang. This is a few cryptic lines of CMake in
each place. Meanwhile LLVM_TOOLS_DIR is provided by configure_site_lit_cfg().

This patch moves CLANG_TOOLS_DIR to configure_site_lit_cfg() and renames it:
 - there's nothing clang-specific about the value
 - it will also replace LLD_TOOLS_DIR, LLDB_TOOLS_DIR etc (not in this patch)

It also defines CURRENT_LIBS_DIR. While I removed the last usage of
CLANG_LIBS_DIR in e4cab4e24d1, there are LLD_LIBS_DIR usages etc that
may be live, and I'd like to mechanically update them in a followup patch.

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

2 years ago[mlir] Add InferTensorType without supporting reifyReturnTypeShapes
Chia-hung Duan [Fri, 25 Mar 2022 18:09:53 +0000 (18:09 +0000)]
[mlir] Add InferTensorType without supporting reifyReturnTypeShapes

This is useful for the case that we don't need to implement
reifyReturnTypeShapes.

Reviewed By: jpienaar

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

2 years ago[SLP] Simplify eraseInstruction [NFC]
Philip Reames [Fri, 25 Mar 2022 18:34:31 +0000 (11:34 -0700)]
[SLP] Simplify eraseInstruction [NFC]

This simplifies the implementation of eraseInstruction by moving the odd-replace-users-with-undef handling back to the only caller which uses it.  This handling was not obviously correct, so add the asserts which make it clear why this is safe to do at all.  The result is simpler code and stronger assertions.

2 years ago[gn build] Port cef52105bd4b
LLVM GN Syncbot [Fri, 25 Mar 2022 18:54:35 +0000 (18:54 +0000)]
[gn build] Port cef52105bd4b

2 years agoRevert "[clang-tidy] Add modernize-macro-to-enum check"
Douglas Yung [Fri, 25 Mar 2022 18:53:42 +0000 (11:53 -0700)]
Revert "[clang-tidy] Add modernize-macro-to-enum check"

This reverts commit 39b80c8380c86539de391600efaa17184b5a52b4.

This change was causing build failures on several build bots:
- https://lab.llvm.org/buildbot/#/builders/139/builds/19210
- https://lab.llvm.org/buildbot/#/builders/93/builds/7956

2 years ago[Clang] Fix error in Documentation introduced by 3784e8cc [nfc].
Corentin Jabot [Fri, 25 Mar 2022 18:34:16 +0000 (19:34 +0100)]
[Clang] Fix error in Documentation introduced by 3784e8cc [nfc].

The documentation contained extra space.
Also remove https://github.com/llvm/llvm-project/issues/54296
from the list of issues by 3784e8cc as this commit did not
fix it (nor was it supposed to).

2 years ago[flang] Fix bogus error from assignment to CLASS(*)
Peter Klausler [Wed, 23 Mar 2022 23:02:59 +0000 (16:02 -0700)]
[flang] Fix bogus error from assignment to CLASS(*)

Assignment semantics was coughing up bad errors and crashes for
intrinsic assignments to unlimited polymorphic entities while
looking for any (impossible) user defined ASSIGNMENT(=) generic
or intrinsic type conversion.

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

2 years ago[Clang] Fix Unevaluated Lambdas
Corentin Jabot [Sat, 12 Mar 2022 19:49:01 +0000 (20:49 +0100)]
[Clang] Fix Unevaluated Lambdas

Unlike other types, when lambdas are instanciated,
they are recreated from scratch.
When an unevaluated lambdas appear in the type of a function,
parameter it is instanciated in the wrong declaration context,
as parameters are transformed before the function.

To support lambda in function parameters, we try to
compute whether they are dependant without looking at the
declaration context.

This is a short term stopgap solution to avoid clang
iceing. A better fix might be to inject some kind of
transparent declaration with correctly computed dependency
for function parameters, variable templates, etc.

Fixes https://github.com/llvm/llvm-project/issues/50376
Fixes https://github.com/llvm/llvm-project/issues/51414
Fixes https://github.com/llvm/llvm-project/issues/51416
Fixes https://github.com/llvm/llvm-project/issues/51641
Fixes https://github.com/llvm/llvm-project/issues/54296

Reviewed By: aaron.ballman

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

2 years ago[Clang,TBAA] Use pattern for metadata reference in test.
Florian Hahn [Fri, 25 Mar 2022 18:12:39 +0000 (18:12 +0000)]
[Clang,TBAA] Use pattern for metadata reference in test.

Update the single check line that still had a hard-coded metadata
reference. This makes it more robust to slight changes in the metadata
numbering.

2 years ago[ConstraintElimination] Use AddOverflow for offset summation.
Florian Hahn [Fri, 25 Mar 2022 18:08:24 +0000 (18:08 +0000)]
[ConstraintElimination] Use AddOverflow for offset summation.

Fixes an incorrect transformation due to values overflowing
https://alive2.llvm.org/ce/z/uizoea

2 years ago[ConstraintElimination] Add test where offset additions overflow.
Florian Hahn [Fri, 25 Mar 2022 18:08:17 +0000 (18:08 +0000)]
[ConstraintElimination] Add test where offset additions overflow.

2 years ago[clang][driver] Disable non-functional --version option for clang -cc1
Emil Kieri [Fri, 25 Mar 2022 15:33:25 +0000 (16:33 +0100)]
[clang][driver] Disable non-functional --version option for clang -cc1

This patch removes --version as a clang -cc1 option.
  clang --version
and
  clang --cc1 -version
remain valid. This behaviour is consistent with clang -cc1as.

Previously, clang -cc1 accepted both --version and -version, but
only -version was acted upon. The call
  clang -cc1 --version
stalled without any message: --version was an accepted option but
triggered no action, and the driver waited for standard input.

Reviewed By: thakis

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

2 years agoReland "[ASTMatchers] Output currently processing match and nodes on crash"
Nathan James [Fri, 25 Mar 2022 17:53:24 +0000 (17:53 +0000)]
Reland "[ASTMatchers] Output currently processing match and nodes on crash"

This reverts commit cff34ccb605aa78030cd51cfe44362ed1c1fb80b.

This relands commit d89f9e963e4979466193dc6a15fe091bf7ca5c47

2 years agoReapply "[SLP] Schedule only sub-graph of vectorizable instructions"" (try 3)
Philip Reames [Fri, 18 Mar 2022 22:33:43 +0000 (15:33 -0700)]
Reapply "[SLP] Schedule only sub-graph of vectorizable instructions"" (try 3)

The original commit exposed several missing dependencies (e.g. latent bugs in SLP scheduling).  Most of these were fixed over the weekend and have had several days to bake.  The last was fixed this morning after being noticed in manual review of test changes yesterday.  See the review thread for links to each change.

Original commit message follows:

SLP currently schedules all instructions within a scheduling window which stretches from the first instruction potentially vectorized to the last. This window can include a very large number of unrelated instructions which are not being considered for vectorization. This change switches the code to only schedule the sub-graph consisting of the instructions being vectorized and their transitive users.

This has the effect of greatly reducing the amount of work performed in large basic blocks, and thus greatly improves compile time on degenerate examples. To understand the effects, I added some statistics (not planned for upstream contribution). Here's an illustration from my motivating example:

   Before this patch:

   704357 SLP                          - Number of calcDeps actions
   699021 SLP                          - Number of schedule calls
   5598 SLP                          - Number of ReSchedule actions
   59 SLP                          - Number of ReScheduleOnFail actions
   10084 SLP                          - Number of schedule resets
   8523 SLP                          - Number of vector instructions generated

   After this patch:

   102895 SLP                          - Number of calcDeps actions
   161916 SLP                          - Number of schedule calls
   5637 SLP                          - Number of ReSchedule actions
   55 SLP                          - Number of ReScheduleOnFail actions
   10083 SLP                          - Number of schedule resets
   8403 SLP                          - Number of vector instructions generated

I do want to highlight that there is a small difference in number of generated vector instructions. This example is hitting the bailout due to maximum window size, and the change in scheduling is slightly perturbing when and how we hit it. This can be seen in the RescheduleOnFail counter change. Given that, I think we can safely ignore.

The downside of this change can be seen in the large test diff. We group all vectorizable instructions together at the bottom of the scheduling region. This means that vector instructions can move quite far from their original point in code. While maybe undesirable, I don't see this as being a major problem as this pass is not intended to be a general scheduling pass.

For context, it's worth noting that the pre-scheduling that SLP does while building the vector tree is exactly the sub-graph scheduling implemented by this patch.

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

2 years ago[mlir][NVVM] Add support for nvvm mma.sync ops
Christopher Bate [Fri, 25 Mar 2022 17:20:07 +0000 (17:20 +0000)]
[mlir][NVVM] Add support for nvvm mma.sync ops

This patch adds MLIR NVVM support for the various NVPTX `mma.sync`
operations. There are a number of possible data type, shape,
and other attribute combinations supported by the operation, so a
custom assebmly format is added and attributes are inferred where
possible.

Reviewed By: ThomasRaoux

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

2 years ago[flang][lowering] Handle zero extent case in LBOUND
Jean Perier [Fri, 25 Mar 2022 17:01:50 +0000 (18:01 +0100)]
[flang][lowering] Handle zero extent case in LBOUND

Follow up of https://reviews.llvm.org/D121488. Ensure lower bounds
are `1` when the related dimension extent is zero. Note that lower
bounds from descriptors are now guaranteed to fulfill this property
after the runtime/codegen patches.

Also fixes explicit shape array extent lowering when instantiating
variables to deal with negative extent cases (issue found while testing
LBOUND edge case). This notably caused allocation crashes when dealing
with automatic arrays with reversed bounds or negative size
specification expression. The standard specifies that the extent of such
arrays is zero. This change has some ripple effect in the current lit
tests.

Add move two helpers as part of this change:
- Add a helper to tell if a fir::ExtendedValue describes an assumed size
  array (last dimension extent is unknown to the compiler, both at compile
  time and runtime).

- Move and share getIntIfConstant from Character.cpp so that it can be
  used elsewhere (NFC).

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

2 years ago[SLP] Optimize stacksave dependence handling [NFC]
Philip Reames [Fri, 25 Mar 2022 17:01:39 +0000 (10:01 -0700)]
[SLP] Optimize stacksave dependence handling [NFC]

After writing the commit message for 4b1bace28, realized that the mentioned optimization was rather straight forward.  We already have the code for scanning a block during region initialization, we can simply keep track if we've seen a stacksave or stackrestore.  If we haven't, none of these dependencies are relevant and we can avoid the relatively expensive scans entirely.

2 years ago[SLP] Explicit track required stacksave/alloca dependency (try 3)
Philip Reames [Fri, 25 Mar 2022 16:09:02 +0000 (09:09 -0700)]
[SLP] Explicit track required stacksave/alloca dependency (try 3)

This is an extension of commit b7806c to handle one last case noticed in test changes for D118538.  Again, this is thought to be a latent bug in the existing code, though this time I have not managed to reduce tests for the original algoritthm.

The prior attempt had failed to account for this case:
  %a = alloca i8
  stacksave
  stackrestore
  store i8 0, i8* %a

If we allow '%a' to reorder into the stacksave/restore region, then the alloca will be deallocated before the use.  We will have taken a well defined program, and introduced a use-after-free bug.

There's also an inverse case where the alloca originally follows the stackrestore, and we need to prevent the reordering it above the restore.

Compile time wise, we potentially do an extra scan of the block for each alloca seen in a bundle.  This is significantly more expensive than the stacksave rooted version and is why I'd tried to avoid this in the initial patch.  There is room to optimize this (by essentially caching a "has stacksave" bit per block), but I'm leaving that to future work if it actually shows up in practice.  Since allocas in bundles should be rare in practice, I suspect we can defer the complexity for a long while.

2 years ago[InstrProfiling] No runtime hook for unused funcs
Gulfem Savrun Yeniceri [Wed, 23 Mar 2022 16:22:32 +0000 (16:22 +0000)]
[InstrProfiling] No runtime hook for unused funcs

CoverageMappingModuleGen generates a coverage mapping record
even for unused functions with internal linkage, e.g.
static int foo() { return 100; }
Clang frontend eliminates such functions, but InstrProfiling pass
still pulls in profile runtime since there is a coverage record.
Fuchsia uses runtime counter relocation, and pulling in profile
runtime for unused functions causes a linker error:
undefined hidden symbol: __llvm_profile_counter_bias.
Since 389dc94d4be7, we do not hook profile runtime for the binaries
that none of its translation units have been instrumented in Fuchsia.
This patch extends that for the instrumented binaries that
consist of only unused functions.

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

2 years ago[Support/BLAKE3] Do manual instrumentation of `llvm_blake3_hasher_finalize` for memor...
Argyrios Kyrtzidis [Fri, 25 Mar 2022 16:47:41 +0000 (09:47 -0700)]
[Support/BLAKE3] Do manual instrumentation of `llvm_blake3_hasher_finalize` for memory sanitizer

This is to avoid false positives when using the uninstrumented assembly code implementation.

2 years ago[LV] Use getVectorLoopRegion to retrieve header. (NFC)
Florian Hahn [Fri, 25 Mar 2022 16:57:12 +0000 (16:57 +0000)]
[LV] Use getVectorLoopRegion to retrieve header. (NFC)

Update all places that currently assume the entry block to the plan is
also the vector loop header to use getVectorLoopRegion instead.

getVectorLoopRegion will keep doing the right thing when the pre-header
is modeled explicitly (and becomes the new entry block in the plan).

2 years ago[lldb] Conditionalize target_link_libraries on the target
Jonas Devlieghere [Fri, 25 Mar 2022 16:47:08 +0000 (09:47 -0700)]
[lldb] Conditionalize target_link_libraries on the target

Fixes "Cannot specify link libraries for target "lldb-target-fuzzer"
which is not built by this project." Normally that's taken care of by
add_llvm_fuzzer but we need target_link_libraries for liblldb and our
utility library.

2 years ago[mlir][tosa] : adding folder and canonicalizer for select
lipracer [Fri, 25 Mar 2022 16:49:14 +0000 (16:49 +0000)]
[mlir][tosa] : adding folder and canonicalizer for select

define canonicalizer and folder for tosa::select

Reviewed By: mehdi_amini, Mogball

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

2 years ago[flang] Fix cycle-catcher in procedure characterization
Peter Klausler [Mon, 21 Mar 2022 23:18:03 +0000 (16:18 -0700)]
[flang] Fix cycle-catcher in procedure characterization

The "seenProcs" sets passed as arguments to the procedure and dummy
procedure characterization routines need to be passed by value so that
local updates to those sets do not become permanent.  They are
presently passed by reference and that has led to bogus errors about
recursively defined procedures in testing.

(It might be faster to pass the sets by reference and undo those local
updates in these functions, but that's error-prone, and the performance
difference is not expected to be detectable in practice.)

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

2 years ago[clang][dataflow] Add support for disabling warnings on smart pointers.
Yitzhak Mandelbaum [Mon, 21 Mar 2022 15:03:52 +0000 (15:03 +0000)]
[clang][dataflow] Add support for disabling warnings on smart pointers.

This patch provides the user with the ability to disable all checked of accesses
to optionals that are the pointees of smart pointers. Since smart pointers are
not modeled (yet), the system cannot distinguish safe from unsafe accesses to
optionals through smart pointers. This results in false positives whenever
optionals are used through smart pointers. The patch gives the user the choice
of ignoring all positivess in these cases.

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

2 years ago[OpenMP][FIX] Ensure exclusive access to the HDTT map
Johannes Doerfert [Sat, 5 Mar 2022 21:14:20 +0000 (15:14 -0600)]
[OpenMP][FIX] Ensure exclusive access to the HDTT map

This patch solves two problems with the `HostDataToTargetMap` (HDTT
map) which caused races and crashes before:

1) Any access to the HDTT map needs to be exclusive access. This was not
   the case for the "dump table" traversals that could collide with
   updates by other threads. The new `Accessor` and `ProtectedObject`
   wrappers will ensure we have a hard time introducing similar races in
   the future. Note that we could allow multiple concurrent
   read-accesses but that feature can be added to the `Accessor` API
   later.
2) The elements of the HDTT map were `HostDataToTargetTy` objects which
   meant that they could be copied/moved/deleted as the map was changed.
   However, we sometimes kept pointers to these elements around after we
   gave up the map lock which caused potential races again. The new
   indirection through `HostDataToTargetMapKeyTy` will allows us to
   modify the map while keeping the (interesting part of the) entries
   valid. To offset potential cost we duplicate the ordering key of the
   entry which avoids an additional indirect lookup.

We should replace more objects with "protected objects" as we go.

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

2 years ago[lldb] Add a fuzzer for target creation
Jonas Devlieghere [Fri, 25 Mar 2022 16:03:52 +0000 (09:03 -0700)]
[lldb] Add a fuzzer for target creation

This patch adds a generic fuzzer that interprets inputs as object files
and uses them to create a target in lldb. It is very similar to the
llvm-dwarfdump fuzzer which found a bunch of issues in libObject.

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

2 years ago[libc] Improve the performance of expf.
Tue Ly [Thu, 24 Mar 2022 22:07:46 +0000 (18:07 -0400)]
[libc] Improve the performance of expf.

Reduce the polynomial's degree from 7 down to 4.

Currently we use a degree-7 minimax polynomial on an interval of length 2^-7
around 0 to compute `expf`. Based on the suggestion of @santoshn and the RLIBM
project (https://github.com/rutgers-apl/rlibm-all/blob/main/source/float/exp.c)
and the improvement we made with `exp2f` in https://reviews.llvm.org/D122346,
it is possible to have a good polynomial of degree-4 on a subinterval of length
2^(-7) to approximate e^x.

We did try to either reduce the degree of the polynomial down to 3 or increase
the interval size to 2^(-6), but in both cases the number of exceptional values
exploded. So we settle with using a degree-4 polynomial of the interval of
size 2^(-7) around 0.

Reviewed By: sivachandra, zimmermann6, santoshn

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

2 years ago[NFCI] Fix set-but-unused warning in DenseMap.h in some configurations
Dávid Bolvanský [Fri, 25 Mar 2022 16:12:53 +0000 (17:12 +0100)]
[NFCI] Fix set-but-unused warning in DenseMap.h in some configurations

2 years ago[NFCI] Fix set-but-unused warning in AArch64AsmParser.cpp
Dávid Bolvanský [Fri, 25 Mar 2022 16:10:25 +0000 (17:10 +0100)]
[NFCI] Fix set-but-unused warning in AArch64AsmParser.cpp

2 years ago[CSSPGO] Turn on profi and ext-tsp when using probe-based profile.
Hongtao Yu [Thu, 24 Mar 2022 23:30:20 +0000 (16:30 -0700)]
[CSSPGO] Turn on profi and ext-tsp when using probe-based profile.

Probe-based profile leads to a better performance when combined with profi and ext-tsp block layout. I'm turning them on by default.

Reviewed By: wenlei

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

2 years ago[slp] Factor out a lambda to avoid uplicating code a third time in upcoming patch...
Philip Reames [Fri, 25 Mar 2022 16:02:23 +0000 (09:02 -0700)]
[slp] Factor out a lambda to avoid uplicating code a third time in upcoming patch [nfc]

2 years ago[AVR][NFC] Fix incorrect register states in expanding pseudo instructions
Ben Shi [Thu, 27 Jan 2022 12:51:52 +0000 (12:51 +0000)]
[AVR][NFC] Fix incorrect register states in expanding pseudo instructions

Reviewed By: aykevl

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

2 years ago[gn build] Port 39b80c8380c8
LLVM GN Syncbot [Fri, 25 Mar 2022 15:50:53 +0000 (15:50 +0000)]
[gn build] Port 39b80c8380c8

2 years ago[test,slp] Add another stacksave related dependence test
Philip Reames [Fri, 25 Mar 2022 15:48:08 +0000 (08:48 -0700)]
[test,slp] Add another stacksave related dependence test

2 years ago[clang-tidy] Add modernize-macro-to-enum check
Richard [Mon, 3 Jan 2022 16:24:12 +0000 (09:24 -0700)]
[clang-tidy] Add modernize-macro-to-enum check

This check performs basic analysis of macros and replaces them
with an anonymous unscoped enum.  Using an unscoped anonymous enum
ensures that everywhere the macro token was used previously, the
enumerator name may be safely used.

Potential macros for replacement must meet the following constraints:
- Macros must expand only to integral literal tokens.  The unary
  operators plus, minus and tilde are recognized to allow for positive,
  negative and bitwise negated integers.
- Macros must be defined on sequential source file lines, or with
  only comment lines in between macro definitions.
- Macros must all be defined in the same source file.
- Macros must not be defined within a conditional compilation block.
- Macros must not be defined adjacent to other preprocessor directives.
- Macros must not be used in preprocessor conditions

Each cluster of macros meeting the above constraints is presumed to
be a set of values suitable for replacement by an anonymous enum.
From there, a developer can give the anonymous enum a name and
continue refactoring to a scoped enum if desired.  Comments on the
same line as a macro definition or between subsequent macro definitions
are preserved in the output.  No formatting is assumed in the provided
replacements.

The check cppcoreguidelines-macro-to-enum is an alias for this check.

Fixes #27408

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

2 years ago[InstCombine] SimplifyDemandedUseBits - remove ashr node if we only demand known...
Simon Pilgrim [Fri, 25 Mar 2022 15:39:08 +0000 (15:39 +0000)]
[InstCombine] SimplifyDemandedUseBits - remove ashr node if we only demand known sign bits

We already do this for SelectionDAG, but we're missing it here.

Noticed while re-triaging PR21929

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

2 years ago[OpenMP] Replace device kernel linkage with weak_odr
Joseph Huber [Thu, 24 Mar 2022 23:32:05 +0000 (19:32 -0400)]
[OpenMP] Replace device kernel linkage with weak_odr

Currently the device kernels all have weak linkage to prevent linkage
errors on multiple defintions. However, this prevents some optimizations
from adequately analyzing them because of the nature of weak linkage.
This patch replaces the weak linkage with weak_odr linkage so we can
statically assert that multiple declarations of the same kernel will
have the same definition.

Reviewed By: jdoerfert

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

2 years ago[AMDGPU][DOC][NFC] Added GFX1030 assembler syntax description
Dmitry Preobrazhensky [Fri, 25 Mar 2022 14:52:13 +0000 (17:52 +0300)]
[AMDGPU][DOC][NFC] Added GFX1030 assembler syntax description

2 years ago[C++20][Modules] Correct an assert for modules-ts.
Iain Sandoe [Thu, 24 Mar 2022 13:10:38 +0000 (13:10 +0000)]
[C++20][Modules] Correct an assert for modules-ts.

When adding the support for modules partitions we added an assert that the
actual status of Global Module Fragments matches the state machine that is
driven by the module; keyword.

That does not apply to the modules-ts case, where there is an implicit GMF.

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

2 years ago[clang] Do not crash on arrow operator on dependent type.
Adam Czachorowski [Wed, 16 Mar 2022 13:27:27 +0000 (14:27 +0100)]
[clang] Do not crash on arrow operator on dependent type.

There seems to be more than one way to get to that state. I included to
example cases in the test, both were noticed recently.

There is room for improvement, for example by creating RecoveryExpr in
place of the bad initializer, but for now let's stop the crashes.

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

2 years agoReapply "[Intrinsics] Add `nocallback` to the default intrinsic attributes"
Johannes Doerfert [Thu, 24 Mar 2022 20:08:53 +0000 (15:08 -0500)]
Reapply "[Intrinsics] Add `nocallback` to the default intrinsic attributes"

This reverts commit c5f789050daab25aad6770790987e2b7c0395936 and
reapplies 7aea3ea8c3b33c9bb338d5d6c0e4832be1d09ac3 with additional test
changes.

2 years ago[Flang] Lower achar intrinsic
Kiran Chandramohan [Fri, 25 Mar 2022 14:22:49 +0000 (14:22 +0000)]
[Flang] Lower achar intrinsic

The intrinsic returns the character located at the position requested
in the ASCII sequence. The intrinsic is lowered to inline FIR code.

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Reviewed By: clementval

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[AMDGPU] Move VOP3 classes into VOPInstructions.td. NFC.
Jay Foad [Fri, 25 Mar 2022 09:57:28 +0000 (09:57 +0000)]
[AMDGPU] Move VOP3 classes into VOPInstructions.td. NFC.

These classes are also used by VOP1/2/C instructions.

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

2 years ago[X86] Add test showing failure to fold multiple constant args in ADC
Simon Pilgrim [Fri, 25 Mar 2022 13:41:59 +0000 (13:41 +0000)]
[X86] Add test showing failure to fold multiple constant args in ADC

As noticed on Issue #35256

2 years ago[mlir][Vector] Add integration tests for ArmSVE
Javier Setoain [Thu, 3 Jun 2021 09:34:44 +0000 (10:34 +0100)]
[mlir][Vector] Add integration tests for ArmSVE

In order to run these integration tests, it is required access to an
SVE-enabled CPU or and emulator with SVE support. In case of using
an emulator, aarch64 versions of lli and the MLIR C Runner Utils Library
are also required.

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

2 years ago[pseudo] Use box-drawing chars to prettify debug dumps. NFC
Sam McCall [Fri, 25 Mar 2022 13:17:31 +0000 (14:17 +0100)]
[pseudo] Use box-drawing chars to prettify debug dumps. NFC

2 years ago[SimplifyCFG] `FoldBranchToCommonDest()`: allow branch-on-select
Roman Lebedev [Fri, 25 Mar 2022 12:11:49 +0000 (15:11 +0300)]
[SimplifyCFG] `FoldBranchToCommonDest()`: allow branch-on-select

This whole check is bogus, it's some kind of a profitability check.
For now, simply extend it to not only allow branch-on-binary-ops,
but also on poison-safe logic ops.

Refs. https://github.com/llvm/llvm-project/issues/53861
Refs. https://github.com/llvm/llvm-project/issues/54553

2 years ago[NFC][SimplifyCFG] Add test from https://github.com/llvm/llvm-project/issues/53861
Roman Lebedev [Fri, 25 Mar 2022 12:09:50 +0000 (15:09 +0300)]
[NFC][SimplifyCFG] Add test from https://github.com/llvm/llvm-project/issues/53861

2 years ago[X86] combineADC - pull out repeated dyn_cast<ConstantSDNode> calls. NFC.
Simon Pilgrim [Fri, 25 Mar 2022 12:52:53 +0000 (12:52 +0000)]
[X86] combineADC - pull out repeated dyn_cast<ConstantSDNode> calls. NFC.

2 years ago[libc++] Remove the _LIBCPP_BOOL_CONSTANT macro
Louis Dionne [Wed, 23 Mar 2022 21:02:07 +0000 (17:02 -0400)]
[libc++] Remove the _LIBCPP_BOOL_CONSTANT macro

I suspect this is a remnant of the times when we were not comfortable
using Clang's C++11/14 extensions everywhere, but now we do, so we can
use _BoolConstant instead and get rid of the macro.

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

2 years agoUpdated MLIR type stubs to work with pytype
Sergei Lebedev [Fri, 25 Mar 2022 12:38:13 +0000 (13:38 +0100)]
Updated MLIR type stubs to work with pytype

The diff is big, but there are in fact only three kinds of changes

* ir.py had a synax error -- underminated [
* forward references are unnecessary in .pyi files (see https://github.com/python/typeshed/blob/9a76b13127ffa8365431dcc105fc111cdd267e7e/CONTRIBUTING.md?plain=1#L450-L454)
* methods defined via .def_static() are now decorated with @staticmethod

Reviewed By: ftynse

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

2 years agoPrevent comparison with wider type in loop condition
Aakanksha [Fri, 25 Mar 2022 11:33:25 +0000 (11:33 +0000)]
Prevent comparison with wider type in loop condition

This change fixes the code violations flagged in AMD compute CodeQL scan - "comparison-with-wider-type"

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

2 years agoFix clang Sphinx build bot
Aaron Ballman [Fri, 25 Mar 2022 11:13:26 +0000 (07:13 -0400)]
Fix clang Sphinx build bot

2 years ago[SDAG] enable binop identity constant folds for multiplies
Simon Pilgrim [Fri, 25 Mar 2022 11:06:41 +0000 (11:06 +0000)]
[SDAG] enable binop identity constant folds for multiplies

Add mul to the list of ops that we canonicalize with a select to expose an identity merge

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

2 years ago[bazel] Add missing dependency after a75a46db89
Benjamin Kramer [Fri, 25 Mar 2022 11:04:43 +0000 (12:04 +0100)]
[bazel] Add missing dependency after a75a46db89

2 years ago[bazel] Add missing dependency after a75a46db89
Benjamin Kramer [Fri, 25 Mar 2022 11:02:36 +0000 (12:02 +0100)]
[bazel] Add missing dependency after a75a46db89

2 years ago[mlir][Sparse] Add option for VLA sparsification
Javier Setoain [Thu, 2 Dec 2021 15:09:33 +0000 (15:09 +0000)]
[mlir][Sparse] Add option for VLA sparsification

Use "enable-vla-vectorization=vla" to generate a vector length agnostic
loops during vectorization. This option works for vectorization strategy 2.

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

2 years ago[X86] combineAdd - fold ADD(ADC(Y,0,W),X) -> ADC(X,Y,W)
Simon Pilgrim [Fri, 25 Mar 2022 10:49:04 +0000 (10:49 +0000)]
[X86] combineAdd - fold ADD(ADC(Y,0,W),X) -> ADC(X,Y,W)

This also exposed a missed ADC canonicalization of constant ops to the RHS

2 years ago[mlir][Vector] Enable create_mask for scalable vectors
Javier Setoain [Wed, 26 Jan 2022 15:01:39 +0000 (15:01 +0000)]
[mlir][Vector] Enable create_mask for scalable vectors

The way vector.create_mask is currently lowered is
vector-length-dependent, and therefore incompatible with scalable vector
types. This patch adds an alternative lowering path for create_mask
operations that return a scalable vector mask.

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

2 years ago[AMDGPU] Improve v_cmpx usage on GFX10.3.
Thomas Symalla [Tue, 1 Feb 2022 09:28:18 +0000 (10:28 +0100)]
[AMDGPU] Improve v_cmpx usage on GFX10.3.

On GFX10.3 targets, the following instruction sequence

v_cmp_* SGPR, ...
s_and_saveexec ..., SGPR

leads to a fairly long stall caused by a VALU write to a SGPR and having the
following SALU wait for the SGPR.

An equivalent sequence is to save the exec mask manually instead of letting
s_and_saveexec do the work and use a v_cmpx instruction instead to do the
comparison.

This patch modifies the SIOptimizeExecMasking pass as this is the last position
where s_and_saveexec instructions are inserted. It does the transformation by
trying to find the pattern, extracting the operands and generating the new
instruction sequence.

It also changes some existing lit tests and introduces a few new tests to show
the changed behavior on GFX10.3 targets.

Same as D119696 including a buildbot and MIR test fix.

Reviewed By: critson

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

2 years ago[AArch64] isProfitableToHoist - remove nullptr test
Simon Pilgrim [Fri, 25 Mar 2022 10:27:16 +0000 (10:27 +0000)]
[AArch64] isProfitableToHoist - remove nullptr test

User is dereferenced on the main codepath so the null test is likely superfluous

2 years ago[Utils] stripDebugifyMetadata - use cast<> instead of dyn_cast_or_null<> to avoid...
Simon Pilgrim [Fri, 25 Mar 2022 10:25:04 +0000 (10:25 +0000)]
[Utils] stripDebugifyMetadata - use cast<> instead of dyn_cast_or_null<> to avoid dereference of nullptr

The pointer is dereferenced immediately, so assert the cast is correct instead of returning nullptr

2 years ago[AsmPrinter] AIXException::endFunction - use cast<> instead of dyn_cast<> to avoid...
Simon Pilgrim [Fri, 25 Mar 2022 10:23:22 +0000 (10:23 +0000)]
[AsmPrinter] AIXException::endFunction - use cast<> instead of dyn_cast<> to avoid dereference of nullptr

The pointer is used immediately inside the getSymbol() call, so assert the cast is correct instead of returning nullptr

2 years ago[clang] CheckSizelessVectorOperands - use castAs<> instead of getAs<> to avoid derefe...
Simon Pilgrim [Fri, 25 Mar 2022 10:22:05 +0000 (10:22 +0000)]
[clang] CheckSizelessVectorOperands - use castAs<> instead of getAs<> to avoid dereference of nullptr

Move the only uses of the cast to where they are dereferenced.

2 years ago[X86] Add test showing failure to fold add(adc(x,0,carry),c) -> adc(x,c,carry)
Simon Pilgrim [Fri, 25 Mar 2022 10:14:11 +0000 (10:14 +0000)]
[X86] Add test showing failure to fold add(adc(x,0,carry),c) -> adc(x,c,carry)

2 years agoRevert "[AArch64] Lower 3 and 4 sources buildvectors to TBL"
David Green [Fri, 25 Mar 2022 10:03:10 +0000 (10:03 +0000)]
Revert "[AArch64] Lower 3 and 4 sources buildvectors to TBL"

This reverts commit ec93b28909749619dbe58b092a13da9d1ff1eb1e as problems
with it have been reported.

2 years ago[clang-format] Clean up DefinitionBlockSeparatorTest. NFC.
Marek Kurdej [Fri, 25 Mar 2022 09:44:36 +0000 (10:44 +0100)]
[clang-format] Clean up DefinitionBlockSeparatorTest. NFC.

2 years ago[PowerPC] Add test for failing lowering llvm.ppc.cfence on i128. NFC.
Kai Luo [Fri, 25 Mar 2022 09:54:34 +0000 (17:54 +0800)]
[PowerPC] Add test for failing lowering llvm.ppc.cfence on i128. NFC.

2 years ago[Clang] Added release note for improved -Wunused-but-set-variable warning
Dávid Bolvanský [Fri, 25 Mar 2022 09:45:08 +0000 (10:45 +0100)]
[Clang] Added release note for improved -Wunused-but-set-variable warning

2 years ago[NVPTX] Remove code duplication in LowerCall
Daniil Kovalev [Fri, 25 Mar 2022 09:36:20 +0000 (12:36 +0300)]
[NVPTX] Remove code duplication in LowerCall

In D120129 we enhanced vectorization options of byval parameters. This patch
removes code duplication when handling byval and non-byval cases.

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

2 years ago[C++20][Modules][HU 1/5] Introduce header units as a module type.
Iain Sandoe [Sun, 20 Sep 2020 08:29:14 +0000 (09:29 +0100)]
[C++20][Modules][HU 1/5] Introduce header units as a module type.

This is the first in a series of patches that introduce C++20 importable
header units.

These differ from clang header modules in that:
 (a) they are identifiable by an internal name
 (b) they represent the top level source for a single header - although
     that might include or import other headers.

We name importable header units with the path by which they are specified
(although that need not be the absolute path for the file).

So "foo/bar.h" would have a name "foo/bar.h".  Header units are made a
separate module type so that we can deal with diagnosing places where they
are permitted but a named module is not.

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

2 years ago[BPF] Don't fetch alignment of llvm.preserve.union.access.index argument
Nikita Popov [Thu, 24 Mar 2022 10:24:40 +0000 (11:24 +0100)]
[BPF] Don't fetch alignment of llvm.preserve.union.access.index argument

The way the alignment is determined here is not compatible with
opaque pointers -- we'd have to thread it through using either
align or elementtype attributes.

However, as far as I can tell this alignment is actually never
used for this particular intrinsic, so I've dropped the assignment
entirely and converted RecordAlignment to MaybeAlign, so we get an
assertion failure if it does end up being used.

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

2 years ago[flang][NFC] fix comment typo in SetLowerBound description
Jean Perier [Fri, 25 Mar 2022 08:18:09 +0000 (01:18 -0700)]
[flang][NFC] fix comment typo in SetLowerBound description

2 years ago[flang][codegen] ensure descriptor lower bounds are LBOUND compliant
Jean Perier [Fri, 25 Mar 2022 08:02:48 +0000 (09:02 +0100)]
[flang][codegen] ensure descriptor lower bounds are LBOUND compliant

Follow-up of https://reviews.llvm.org/D121488 to ensure all descriptors
created inline complies with LBOUND requirement that the lower bound is
`1` when the related dimension extent is zero.

Both fir.xrebox and fir.xembox codegen is updated to enforce this
constraint.

Also upstream the "normalized lower bound" attribute that was added in fir-dev
since embox codegen was upstreamed, it is conflicting with this patch
otherwise.

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

2 years ago[flang] Fix LBOUND rewrite on descriptor components
Jean Perier [Fri, 25 Mar 2022 08:00:23 +0000 (09:00 +0100)]
[flang] Fix LBOUND rewrite on descriptor components

GetLowerBoundHelper rewrite in https://reviews.llvm.org/D121488 was
incorrect with POINTER/ALLOCATABLE components. The rewrite created a
descriptor inquiry to the component symbol only instead of the whole
named entity. The base information was lost, and not retrievable.
LBOUND(a(10)%p) became LBOUND(p).

Fix this regression, and also update DescriptorInquiry unparsing to
carry the kind information. DescriptorInquiries are KIND 8 expressions,
while LBOUND/SIZE/RANK, %LEN are default kind expressions.
This caused `print *,lbound(x,kind=8)` to unparse as `print*,lbound(x)` which is not
semantically the same (this unparsing issue was not an issue for
lowering, but I noticed it while writing my regression test).

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

2 years agoRelease Workflow: Remove cherry-pick-failed label when pull request is created
Tom Stellard [Fri, 25 Mar 2022 07:45:25 +0000 (00:45 -0700)]
Release Workflow: Remove cherry-pick-failed label when pull request is created

Reviewed By: nikic

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

2 years ago[gn build] Port 75112133b83e
LLVM GN Syncbot [Fri, 25 Mar 2022 07:28:25 +0000 (07:28 +0000)]
[gn build] Port 75112133b83e

2 years ago[llvm-pdbutil] Move InputFile/FormatUtil/LinePrinter to PDB library.
Carlos Alberto Enciso [Thu, 24 Mar 2022 16:33:08 +0000 (16:33 +0000)]
[llvm-pdbutil] Move InputFile/FormatUtil/LinePrinter to PDB library.

At Sony we are developing llvm-dva

https://lists.llvm.org/pipermail/llvm-dev/2020-August/144174.html

For its PDB support, it requires functionality already present in
llvm-pdbutil.

We intend to move that functionaly into the PDB library to be
shared by both tools. That change will be done in 2 steps, that
will be submitted as 2 patches:

(1) Replace 'ExitOnError' with explicit error handling.
(2) Move the intended shared code to the PDB library.

Patch for step (1): https://reviews.llvm.org/D121801

This patch is for step (2).

Move InputFile.cpp[h], FormatUtil.cpp[h] and LinePrinter.cpp[h]
files to the debug PDB library.

It exposes the following functionality that can be used by tools:

- Open a PDB file.
- Get module debug stream.
- Traverse module sections.
- Traverse module subsections.

Most of the needed functionality is in InputFile, but there are
dependencies from LinePrinter and FormatUtil.

Some other functionality is in the following functions in
DumpOutputStyle.cpp file:

- iterateModuleSubsections
- getModuleDebugStream
- iterateOneModule
- iterateSymbolGroups
- iterateModuleSubsections

Only these specific functions from DumpOutputStyle are moved to
the PDB library.

Reviewed By: aganea, dblaikie, rnk

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

2 years ago[flang] Lower mvbits intrinsic
Valentin Clement [Fri, 25 Mar 2022 07:00:10 +0000 (08:00 +0100)]
[flang] Lower mvbits intrinsic

This patch adds the lowering for the `mvbits`
intrinsic.

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

Reviewed By: PeteSteinfeld

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[clang] Propagate requires-clause from constructor template to implicit deduction...
Nathan Ridge [Sun, 14 Nov 2021 06:39:17 +0000 (01:39 -0500)]
[clang] Propagate requires-clause from constructor template to implicit deduction guide

Fixes https://github.com/clangd/clangd/issues/890

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

2 years ago[ELF] addSectionSymbols: simplify isec->getOutputSection(). NFC
Fangrui Song [Fri, 25 Mar 2022 04:54:20 +0000 (21:54 -0700)]
[ELF] addSectionSymbols: simplify isec->getOutputSection(). NFC

2 years ago[mlir][gpu] Relax restriction on mma load/store op
Thomas Raoux [Fri, 25 Mar 2022 03:31:06 +0000 (03:31 +0000)]
[mlir][gpu] Relax restriction on mma load/store op

Those ops can support more complex layout as long as the most inner
dimension is contiguous.

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

2 years ago[AVR] Add more devices
Ben Shi [Thu, 24 Mar 2022 14:29:52 +0000 (14:29 +0000)]
[AVR] Add more devices

Synchronize device list with avr-gcc 7.3.0 and avrlibc 2.0.0.

Reviewed By: aykevl

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

2 years agoMake BLAKE3 a component library
Nico Weber [Thu, 24 Mar 2022 19:39:54 +0000 (15:39 -0400)]
Make BLAKE3 a component library

It's unusual that BLAKE3/CMakeLists.txt just defines a list of
files that it injects into its parent scope. The list should either
be defined in llvm/lib/Support/CMakeLists.txt, or
llvm/lib/Support/BLAKE3/CMakeLists.txt should define an object
library.

This does the latter. It makes llvm/lib/Support/BLAKE3/CMakeLists.txt
more self-contained.

No behavior change.

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

2 years agoFix a bug where an extended vector of __fp16 was being converted to a
Akira Hatanaka [Fri, 25 Mar 2022 00:38:48 +0000 (17:38 -0700)]
Fix a bug where an extended vector of __fp16 was being converted to a
generic vector type

rdar://86109177

2 years ago[Clang] Work with multiple pragmas weak before definition
Hubert Tong [Fri, 25 Mar 2022 00:11:54 +0000 (20:11 -0400)]
[Clang] Work with multiple pragmas weak before definition

Update `WeakUndeclaredIdentifiers` to hold a collection of weak
aliases per identifier instead of only one.

This also allows the "used" state to be removed from `WeakInfo`
because it is really only there as an alternative to removing
processed map entries, and we can represent that using an empty set
now. The serialization code is updated for the removal of the field.
Additionally, a PCH test is added for the new functionality.

The records are grouped by the "target" identifier, which was already
being used as a key for lookup purposes. We also store only one record
per alias name; combined, this means that diagnostics are grouped by
the "target" and limited to one per alias (which should be acceptable).

Fixes PR28611.
Fixes llvm/llvm-project#28985.

Reviewed By: aaron.ballman, cebowleratibm

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

Co-authored-by: Rachel Craik <rcraik@ca.ibm.com>
Co-authored-by: Jamie Schmeiser <schmeise@ca.ibm.com>
2 years ago[MLIR][Presburger] Merge PresburgerLocalSpace and PresburgerSpace
Groverkss [Thu, 24 Mar 2022 23:46:48 +0000 (05:16 +0530)]
[MLIR][Presburger] Merge PresburgerLocalSpace and PresburgerSpace

This patch is a cleanup patch that merges PresburgerLocalSpace and
PresburgerSpace. Asserting that there are no locals is shifted to the
users of PresburgerSpace themselves.

The reasoning for this patch is that PresburgerLocalSpace did not contribute
much and only introduced additional complexity as locals could still be present
in PresburgerSpace, just not writable. This could introduce problems if a
PresburgerSpace with locals was copied to PresburgerLocalSpace which expected
no locals in a PresburgerSpace.

Reviewed By: arjunp

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

2 years ago[libc++] Rename __identity to __type_identity
Nikolas Klauser [Fri, 18 Mar 2022 16:49:02 +0000 (17:49 +0100)]
[libc++] Rename __identity to __type_identity

In C++20 the type trait `type_identity` was introduced. For the same purpose there is `__identity` for pre-C++20 code. The name is confusing, because since C++20 there is also `identity`, which isn't a type trait.

Reviewed By: ldionne, Mordante, #libc

Spies: EricWF, libcxx-commits

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

2 years agoRe-commit: Driver: Don't warn on -mbranch-protection when linking
Tom Stellard [Wed, 23 Mar 2022 06:17:39 +0000 (23:17 -0700)]
Re-commit: Driver: Don't warn on -mbranch-protection when linking

This is a re-commit of 98fd3b359866f474ab1c097c22fb5c3be356b996.  The
newly added test was failing on the bots, and I've fixed the test now so
that it doesn't actually invoke the linker.

2 years ago[OpenMP] Add a semantic check for updating hidden or internal values
Joseph Huber [Thu, 24 Mar 2022 12:26:32 +0000 (08:26 -0400)]
[OpenMP] Add a semantic check for updating hidden or internal values

A previous patch removed the compiler generating offloading entries
for variables that were declared on the device but were internal or
hidden. This allowed us to compile programs but turns any attempt to run
'#pragma omp target update' on one of those variables a silent failure.
This patch adds a check in the semantic analysis for if the user is
attempting the update a variable on the device from the host that is not
externally visible.

Reviewed By: jdoerfert

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

2 years ago[mlir][linalg] Add pattern to split reduction dimension in a linalg op
Thomas Raoux [Thu, 24 Mar 2022 21:02:17 +0000 (21:02 +0000)]
[mlir][linalg] Add pattern to split reduction dimension in a linalg op

This transformation allow to break up a reduction dimension in a
parallel and a reduction dimension. This is followed by a separate
reduction op. This allows to generate tree reduction which is beneficial
on target allowing to take advantage parallelism.

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

2 years agoDon't search for sim SDK path until we know we need it
Jason Molenda [Thu, 24 Mar 2022 21:35:46 +0000 (14:35 -0700)]
Don't search for sim SDK path until we know we need it

When iterating over all Platforms looking for the best one, on a Mac the
Simulator platforms (iOS, tvOS, watchOS) will first find their SDK
directory by calling xcrun, then decide if they should activate or not.
When that SDK is absent, the call to xcrun to find it can be very slow.
This patch delays that directory search until we know we're activating
this platform, so non-simulator environments don't pay a perf cost ever
time they go through the list of platforms.

Differential Revision: https://reviews.llvm.org/D122373
rdar://87960090

2 years ago[Bazel] Add BLAKE3 files to llvm:Support
Fangrui Song [Thu, 24 Mar 2022 22:26:40 +0000 (15:26 -0700)]
[Bazel] Add BLAKE3 files to llvm:Support

Hope someone can figure out how to leverage SSE42/AVE2/Arm Neon.

2 years ago[flang] Make not yet implemented messages more consistent
Peter Steinfeld [Wed, 23 Mar 2022 22:20:56 +0000 (15:20 -0700)]
[flang] Make not yet implemented messages more consistent

To make it easier to find things that are not yet implemented, I'm changing the
messages that appear in the compiler's output to all have the string "not yet
implemented:".

These changes apply to files in the front end.  I have another set of changes
to files in the lowering code.

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

2 years ago[NFC][clang][extract-api] Rename variable
Zixu Wang [Thu, 24 Mar 2022 22:09:25 +0000 (15:09 -0700)]
[NFC][clang][extract-api] Rename variable

Rename a local variable name to avoid potential ambiguity/conflict for
some compilers.

2 years ago[libc] Improve the performance of exp2f.
Tue Ly [Wed, 23 Mar 2022 19:37:19 +0000 (15:37 -0400)]
[libc] Improve the performance of exp2f.

Reduce the range-reduction table size from 128 entries down to 64 entries, and
reduce the polynomial's degree from 6 down to 4.

Currently we use a degree-6 minimax polynomial on an interval of length 2^-7
around 0 to compute exp2f.  Based on the suggestion of @santoshn and the RLIBM
project (https://github.com/rutgers-apl/rlibm-prog/blob/main/libm/float/exp2.c)
it is possible to have a good polynomial of degree-4 on a subinterval of length
2^(-6) to approximate 2^x.

We did try to either reduce the degree of the polynomial down to 3 or increase
the interval size to 2^(-5), but in both cases the number of exceptional values
exploded.  So we settle with using a degree-4 polynomial of the interval of
size 2^(-6) around 0.

Reviewed By: michaelrj, sivachandra, zimmermann6, santoshn

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

2 years ago[NFC][clang][extract-api] Add missing virtual anchors
Zixu Wang [Thu, 24 Mar 2022 21:30:14 +0000 (14:30 -0700)]
[NFC][clang][extract-api] Add missing virtual anchors

Add missing virtual method anchors for structs in ExtractAPI/API.h

2 years ago[opt] Remove -analyze option
Arthur Eubanks [Thu, 10 Feb 2022 23:39:29 +0000 (15:39 -0800)]
[opt] Remove -analyze option

This is legacy PM-specific, which is deprecated.

Uses of this should be replaced with a corresponding `-passes='print<foo>'`.

Reviewed By: asbirlea

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

2 years ago[mlir][spirv] Add Apple into the vendor list
Lei Zhang [Thu, 24 Mar 2022 19:00:39 +0000 (15:00 -0400)]
[mlir][spirv] Add Apple into the vendor list

Reviewed By: ThomasRaoux, hanchung

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