platform/upstream/llvm.git
22 months ago[flang][hlfir] lower hlfir.product into fir runtime call
Jacob Crawley [Tue, 2 May 2023 10:15:54 +0000 (10:15 +0000)]
[flang][hlfir] lower hlfir.product into fir runtime call

The shared code for lowering the sum and product operations in
flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp have
been moved into a new class HlfirReductionIntrinsicConverion.

Depends on: D148719

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

22 months ago[flang] lower product intrinsic to hlfir.product operation
Jacob Crawley [Wed, 19 Apr 2023 14:16:35 +0000 (14:16 +0000)]
[flang] lower product intrinsic to hlfir.product operation

Carries out the initial lowering of the product intrinsic into HLFIR
following a similar method to sum, the --use-hlfir-intrinsic-ops flag
in test/Lower/HLFIR/expr-box is set to false so that the tests will
pass until hlfir.product is lowered into fir.call

Depends on: D147624

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

22 months ago[flang] add hlfir.product operation
Jacob Crawley [Wed, 5 Apr 2023 11:48:53 +0000 (11:48 +0000)]
[flang] add hlfir.product operation

Adds a HLFIR operation for the PRODUCT intrinsic according to
the design set out in flang/doc/HighLevelFIR.md

Since the PRODUCT intrinsic is essentially identical to SUM
in terms of its arguments and result characteristics in the
Fortran Standard, the operation definition and subsequent
tests also take the same form.

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

22 months ago[analyzer][NFC] Use std::optional instead of custom "empty" state
Donát Nagy [Wed, 26 Apr 2023 13:58:46 +0000 (15:58 +0200)]
[analyzer][NFC] Use std::optional instead of custom "empty" state

This commit eliminates the uninitialized error state from the class
RegionRawOffsetV2 (which is locally used by the Clang Static Analyzer
checker alpha.security.ArrayBoundV2) and replaces its use with
std::optional.

Motivated by https://reviews.llvm.org/D148355#inline-1437928

Moreover, the code of RegionRawOffsetV2::computeOffset() is rearranged
to clarify its behavior. The helper function getValue() was eliminated
by picking a better initial value for the variable Offset; two other
helper functions were replaced by the lambda function Calc() because
this way it doesn't need to take the "context" objects as parameters.

This reorganization revealed some surprising (but not outright buggy)
behavior that's marked by a FIXME and will be revisited in a separate
commit.

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

22 months ago[RISCV] Fix extract_vector_elt on i1 at idx 0 being inverted
Luke Lau [Wed, 3 May 2023 09:25:05 +0000 (10:25 +0100)]
[RISCV] Fix extract_vector_elt on i1 at idx 0 being inverted

It looks like the intention here is to truncate a XLenVT -> i1, in
which case we should be emitting snez instead of sneq if I'm understanding
correctly.

Reviewed By: jacquesguan, frasercrmck

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

22 months ago[docs] Hide collaboration and include graphs in doxygen docs
Timm Bäder [Tue, 2 May 2023 10:06:48 +0000 (12:06 +0200)]
[docs] Hide collaboration and include graphs in doxygen docs

They don't convey any useful information and make the documentation
unnecessarily hard to read.

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

22 months agoRevert "[DebugInfo] add test case for D147506, NFC"
Tom Weaver [Thu, 4 May 2023 10:21:21 +0000 (11:21 +0100)]
Revert "[DebugInfo] add test case for D147506, NFC"

This reverts commit 6a808270e8a9becc07857240ebbf6731743a4485.

This test was added after https://reviews.llvm.org/D147506 was comittted which
has been reverted pending a buildbot fix for:
https://lab.llvm.org/buildbot/#/builders/247/builds/4125

22 months ago[flang]Add test for 2D loop versioning test
Mats Petersson [Wed, 26 Apr 2023 16:20:10 +0000 (17:20 +0100)]
[flang]Add test for 2D loop versioning test

Another test based on review comments added late in the review.

This one confirms that the multiplication and addition of the outer
index to the inner index and thus form the 2D index.

Reviewed By: tblah

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

22 months agoRevert "[DebugLine] save one debug line entry for empty prologue"
Tom Weaver [Thu, 4 May 2023 10:08:58 +0000 (11:08 +0100)]
Revert "[DebugLine] save one debug line entry for empty prologue"

This reverts commit b48a8233f5e230e46182bf5c523ceb6a04cec8f5.

This change caused https://lab.llvm.org/buildbot/#/builders/247/builds/4125
to start failing, please address the failures before resubmitting.

22 months ago[OpenMP][libomptarget][AMDGPU] Enable active HSA wait state
gregrodgers [Wed, 19 Apr 2023 21:14:40 +0000 (16:14 -0500)]
[OpenMP][libomptarget][AMDGPU] Enable active HSA wait state

Adds HSA timeout hint of 2 seconds to the AMDGPU nextgen-plugin to improve
performance of small kernels.
The HSA runtime may stay in HSA_WAIT_STATE_ACTIVE for up to the timeout
value before switching to HSA_WAIT_STATE_BLOCKED. This can improve
latency from which small kernels can benefit.
The value was determined via experimentation w/ different benchmarks.

The timeout value can be overriden using the environment variable
LIBOMPTARGET_AMDGPU_STREAM_BUSYWAIT with a value in microseconds.

Original author: Greg Rodgers <Gregory.Rodgers@amd.com>
Contributions from: JP Lehr <JanPatrick.Lehr@amd.com>

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

22 months ago[clang-format] Correctly limit formatted ranges when specifying qualifier alignment
Colin Ogilvie [Thu, 4 May 2023 09:48:51 +0000 (02:48 -0700)]
[clang-format] Correctly limit formatted ranges when specifying qualifier alignment

The qualifier alignment fixer appeared to ignore any ranges specified for limiting formatting.
This change ensures that it only formats affected lines to avoid unexpected changes.

Fixes #54888.

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

22 months ago[libc][rpc] Treat pointers as arrays consistently
Jon Chesterfield [Thu, 4 May 2023 09:52:44 +0000 (10:52 +0100)]
[libc][rpc] Treat pointers as arrays consistently

Noticed in passing. Either way compiles.

Reviewed By: jhuber6

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

22 months ago[RISCV] Use setcc to truncate results in widenVectorOpsToi8
Luke Lau [Wed, 3 May 2023 17:06:02 +0000 (18:06 +0100)]
[RISCV] Use setcc to truncate results in widenVectorOpsToi8

To avoid an unnecessary vand.vi

Reviewed By: craig.topper

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

22 months ago[Support][Parallel] Change check for nested TaskGroups.
Alexey Lapshin [Fri, 21 Apr 2023 14:25:41 +0000 (16:25 +0200)]
[Support][Parallel] Change check for nested TaskGroups.

This patch changes check for nested TaskGroups so that it allows
parallel execution for TaskGroups. Following pattern would not work
parallelly with current check:

std::function<void()> Fn = [&]() {
  parallel::TaskGroup tg;

  tg.spawn([&]() { });
};

ThreadPool Pool;

Pool.async(Fn);
Pool.async(Fn);

Pool.wait();

One of the TaskGroup would work sequentially as current check
verifies overall number of TaskGroup. Two not nested
TaskGroups can work parallelly but current check prevents this.

Also this patch avoids parallel mode for TaskGroup
in parallel::strategy.ThreadsRequested == 1 case.

This patch is a followup of discussion from D142318

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

22 months ago[DAG] computeKnownBits - remove old ashr TODO comment
Simon Pilgrim [Thu, 4 May 2023 09:26:30 +0000 (10:26 +0100)]
[DAG] computeKnownBits - remove old ashr TODO comment

KnownBits::ashr now uses the minimum shift amount to try and extend the sign bit

22 months ago[Flang][Driver][NFC] Improve -emit-obj unit tests
Sergio Afonso [Mon, 1 May 2023 10:59:37 +0000 (11:59 +0100)]
[Flang][Driver][NFC] Improve -emit-obj unit tests

Instead of looking for the existence of a `ret` instruction after disassembly
as a way to check that the right ISA is present in the produced binary, check
instead the ELF header of the file. This is a more reliable solution, since the
alternative can easily result in false positives.

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

22 months ago[mlir][Bazel] Update BUILD.bazel file for cc4703745ffa398b66f985b483cb8b61eb2ed425
Adrian Kuegel [Thu, 4 May 2023 08:09:53 +0000 (10:09 +0200)]
[mlir][Bazel] Update BUILD.bazel file for cc4703745ffa398b66f985b483cb8b61eb2ed425

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

22 months ago[LV] Use VPValue for SCEV expansion in fixupIVUsers.
Florian Hahn [Thu, 4 May 2023 08:25:59 +0000 (09:25 +0100)]
[LV] Use VPValue for SCEV expansion in fixupIVUsers.

The step is already expanded in the VPlan. Use this expansion instead.
This is a step towards modeling fixing up IV users in VPlan.

 It also fixes a crash casued by SCEV-expanding the Step expression in
fixupIVUsers, where the IR is in an incomplete state

Reviewed By: Ayal

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

22 months ago[clang][Interp][NFC] Remove unnecessary include from State.h
Timm Bäder [Thu, 4 May 2023 05:09:24 +0000 (07:09 +0200)]
[clang][Interp][NFC] Remove unnecessary include from State.h

Forward-declare OptionalDiagnostic instead. And turn a few comments in
to doc comments.

22 months ago[clang][Interp][NFC] Use const references to Floating
Timm Bäder [Sat, 22 Apr 2023 12:18:09 +0000 (14:18 +0200)]
[clang][Interp][NFC] Use const references to Floating

in the static functions. Since a Floating is backed by an APFloat, we
don't want to copy that around if it's not necessary.

22 months ago[flang][hlfir] Add assignment mask operations
Jean Perier [Thu, 4 May 2023 08:00:23 +0000 (10:00 +0200)]
[flang][hlfir] Add assignment mask operations

Add hlfir.forall_mask, hlfir.where, and hlfir.elsewhere operations that
are operations that holds (optionally for hlfir.elsewhere) the
evaluation of a logical mask that controls the evaluation of nested
operations.

They allow representing Fortran forall control mask, as well as where
and eslewhere statements/constructs.

They use the OrderedAssignmentTreeOpInterface since they can all be used
inside Forall and their masks should be fully evaluated for all the
index-value set induced by parent Forall before any of the nested
operations in their body is evaluated.

I initially tried making them into a single operation with some attributes
to make a difference, but I felt this made the verifier/parser/printer and
usages messier/tricky compared to making three distinct operations that
represent the three Fortran feature in a vanilla way.

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

22 months ago[flang][hlfir] Add hlfir.forall and its OrderAssignmentTreeOpInterface
Jean Perier [Thu, 4 May 2023 07:56:12 +0000 (09:56 +0200)]
[flang][hlfir] Add hlfir.forall and its OrderAssignmentTreeOpInterface

This patch adds the hlfir.forall operation and the
OrderAssignmentTreeOpInterface that allows representing Fortran forall.

It uses regions to keep Fortran expression evaluation independent from
each other in the IR. Forall assignments inside hlfir.forall are
represented with hlfir.region_assign which also keeps the IR generated
for each expressions independently.

The goal of this representation is to provide a representation that is
straightforward to generate from Fortran parse tree without any analysis, while
providing enough structure information so that an optimization pass can decide
how to schedule, and save if needed, the evaluations of the Forall and Where
expression and statements. It allows the data dependency analysis to be done at
the HLFIR level.

The OrderAssignmentTreeOpInterface allows ensuring that the Forall/Where
tree structure is kept in the IR. It will allow visiting this tree in
the IR without hard coding the operation structures in the pass.

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

22 months ago[FuzzMutate] Remove unused variable [NFC]
Mikael Holmen [Thu, 4 May 2023 07:30:46 +0000 (09:30 +0200)]
[FuzzMutate] Remove unused variable [NFC]

gcc warned with
 ../lib/FuzzMutate/RandomIRBuilder.cpp:319:28: warning: unused variable 'PtrTy' [-Wunused-variable]
   319 |           if (PointerType *PtrTy = dyn_cast<PointerType>(I.getType()))
       |                            ^~~~~

22 months ago[clangd] Remove unused variable [NFC]
Mikael Holmen [Thu, 4 May 2023 07:29:02 +0000 (09:29 +0200)]
[clangd] Remove unused variable [NFC]

gcc warned with
 ../../clang-tools-extra/clangd/Protocol.cpp:481:23: warning: unused variable 'ChangeAnnotation' [-Wunused-variable]
   481 |       if (const auto& ChangeAnnotation =
       |                       ^~~~~~~~~~~~~~~~

22 months ago[clang][Interp][NFC] Don't cast primitive types to the same type
Timm Bäder [Tue, 2 May 2023 09:34:39 +0000 (11:34 +0200)]
[clang][Interp][NFC] Don't cast primitive types to the same type

We might classify different clang types to the same interp types, so
skip the cast in that case.

No test attached since this is already exercised a few times in the
existing tests.

22 months ago[clang][Interp][NFC] Make Pointer::block() const
Timm Bäder [Tue, 2 May 2023 06:47:36 +0000 (08:47 +0200)]
[clang][Interp][NFC] Make Pointer::block() const

22 months ago[clang][Interp] Add missing static_assert messages
Timm Bäder [Thu, 4 May 2023 07:09:57 +0000 (09:09 +0200)]
[clang][Interp] Add missing static_assert messages

22 months ago[libc] Use proper flags for compiler version detection
Guillaume Chatelet [Thu, 4 May 2023 07:03:59 +0000 (07:03 +0000)]
[libc] Use proper flags for compiler version detection

The `-v` flag means verbose and not version.
With `clang` this flag prints the version and exits successfully.
Under `GCC` this is not a valid command line so the binary exits with
an error.

22 months ago[lld][RISCV][NFC] Simplify symbol value calculation in relax
Job Noorman [Thu, 4 May 2023 06:57:54 +0000 (08:57 +0200)]
[lld][RISCV][NFC] Simplify symbol value calculation in relax

The `valueDelta` map was used to calculate the symbol value deltas from
the previous iteration. Since the symbol values themselves are also
updated every iteration, the following invariant holds:

```
sa[i].offset == sa[i].d->value + valueDelta[sa[i].d]
```

Note that `sa[i].offset` contains the original value of `sa[i].d` and is
never changed.

This means that the current way of updating symbol values can be
rewritten to not need the `valueDelta` map:

```
sa[i].d->value -= delta - valueDelta.find(sa[i].d)->second;
<=> (replace invariant)
sa[i].d->value -= delta - (sa[i].offset - sa[i].d->value);
<=>
sa[i].d->value = sa[i].d->value - (delta - (sa[i].offset - sa[i].d->value));
<=>
sa[i].d->value = sa[i].d->value - delta + sa[i].offset - sa[i].d->value;
<=>
sa[i].d->value = sa[i].offset - delta;
```

This patch implements this simplification. I believe this improves the
readability of the code as it took me quite some time to understand the
use of `valueDelta`. It might also have a slight performance benefit as
it removes one iteration over all relocations every relax iteration.

Reviewed By: MaskRay

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

22 months ago[clang][Interp] Implement inc/dec operators for floats
Timm Bäder [Fri, 21 Apr 2023 08:41:40 +0000 (10:41 +0200)]
[clang][Interp] Implement inc/dec operators for floats

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

22 months ago[clang][Interp][NFC] Call discard() when discarding ExprWithCleanups
Timm Bäder [Thu, 4 May 2023 06:45:14 +0000 (08:45 +0200)]
[clang][Interp][NFC] Call discard() when discarding ExprWithCleanups

22 months ago[clang][Interp] Handle DiscardResult for DeclRef- and ParenExprs
Timm Bäder [Sat, 8 Apr 2023 05:27:55 +0000 (07:27 +0200)]
[clang][Interp] Handle DiscardResult for DeclRef- and ParenExprs

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

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

22 months ago[mlir][memref] Add helper to make alloca ops independent
Matthias Springer [Thu, 4 May 2023 05:07:19 +0000 (14:07 +0900)]
[mlir][memref] Add helper to make alloca ops independent

Add a helper function that makes dynamic sizes of `memref.alloca` ops independent of a given set of values. This functionality can be used to make dynamic allocations hoistable from loops.

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

22 months ago[flang][OpenMP] Lowering support for atomic capture
Nimish Mishra [Thu, 4 May 2023 04:45:19 +0000 (10:15 +0530)]
[flang][OpenMP] Lowering support for atomic capture

This patch adds lowering support for atomic capture operation. First is
created a region (without any operand) for the atomic capture operation.
Then based on one of the following configurations...

1. [update-stmt, capture-stmt]
2. [capture-stmt, update-stmt]
3. [capture-stmt, write-stmt]
... the lowering proceeds by creating these individual operations inside
the atomic capture's region.

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

Reviewed By: kiranchandramohan

22 months ago[DebugLine] save one debug line entry for empty prologue
Chen Zheng [Thu, 4 May 2023 04:19:28 +0000 (04:19 +0000)]
[DebugLine] save one debug line entry for empty prologue

Some debuggers like DBX on AIX assume the address in debug line
entries is always incremental. But clang generates two entries (entry
for file scope line and entry for prologue end) with same address if
prologue is empty

And if the prologue is empty, seems the first debug line entry for the
function is unnecessary(i.e. removing the first entry won't impact the
behavior in GDB on Linux), so I implement this for all debuggers.

Reviewed By: dblaikie

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

22 months ago[DebugInfo] add test case for D147506, NFC
Chen Zheng [Tue, 4 Apr 2023 06:35:34 +0000 (06:35 +0000)]
[DebugInfo] add test case for D147506, NFC

[DebugLine] save one debug line entry for empty prologue

22 months ago[llvm-objdump] addPltEntries: reduce indentation. NFC
Fangrui Song [Thu, 4 May 2023 04:20:54 +0000 (21:20 -0700)]
[llvm-objdump] addPltEntries: reduce indentation. NFC

22 months ago[flang][OpenMP] Lowering support for lastprivate on unstructured sections
Nimish Mishra [Thu, 4 May 2023 03:52:19 +0000 (09:22 +0530)]
[flang][OpenMP] Lowering support for lastprivate on unstructured sections
construct

This patch adds lowering support for lastprivate privatization on
unstructured construct. Generic lastprivate lowering on sections
involves creating a if operation on the lexically last section block
and updating the lastprivate variable inside it. However, this control
flow is not needed if the section construct is lowered as an
unstructured construct. Hence, this patch modifies the lowering control
flow to not emit an unnecessary scf.if if the section block is lowered
as an unstructured construct.

Reviewed By: kiranchandramohan

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

22 months ago[BOLT][DWARF] Fix handling of loclists_base without location accesses
Alexander Yermolovich [Thu, 4 May 2023 03:49:03 +0000 (20:49 -0700)]
[BOLT][DWARF] Fix handling of loclists_base without location accesses

There are CUs that have DW_AT_loclists_base, but no DW_AT_location in children
DIEs. Pre-bolt it points to a valid offset. We were not updating it, so it ended
up pointing in the middle of a list and caused LLDB to print out errors. Changed
it to point to first location list. I don't think it should matter since there
are no accesses to it anyway.

Reviewed By: maksfb

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

22 months agoFix a warning in D149762 [-Wunused-variable]
NAKAMURA Takumi [Thu, 4 May 2023 03:09:50 +0000 (12:09 +0900)]
Fix a warning in D149762 [-Wunused-variable]

22 months agoMCInstrAnalysis: make GotPltSectionVA x86-32 specific
Fangrui Song [Thu, 4 May 2023 02:21:01 +0000 (19:21 -0700)]
MCInstrAnalysis: make GotPltSectionVA x86-32 specific

GotPltSectionVA is specific to x86-32 PIC PLT entries.
Let's remove the argument from the generic interface.

As a side effect of not requiring .got.plt, this simplification
addresses a subset of https://github.com/llvm/llvm-project/issues/62537
by enabling .plt dumping for some ld.bfd -z now linked x86-32/x86-64 images
without .got.plt

22 months ago[mlir][sparse] Improving error detection/messages for `get{RankedTensor,MemRef}Type...
wren romano [Thu, 4 May 2023 01:20:53 +0000 (18:20 -0700)]
[mlir][sparse] Improving error detection/messages for `get{RankedTensor,MemRef}Type` wrappers

This helps catch some otherwise hard to track down segfaults. N.B., even though `getSparseTensorType` is not touched in this patch, it also gains the new error checking (via `getRankedTensorType`).

Depends On D149805

Reviewed By: aartbik

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

22 months ago[mlir][sparse] Adding a new overload of `getOpaquePointerType`
wren romano [Thu, 4 May 2023 01:10:06 +0000 (18:10 -0700)]
[mlir][sparse] Adding a new overload of `getOpaquePointerType`

(This will be used in future patches, but is split off for easier reviewing)

Reviewed By: aartbik

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

22 months ago[MS ABI] Fix C++ mangling references to declarations.
Bolshakov [Thu, 4 May 2023 00:31:05 +0000 (17:31 -0700)]
[MS ABI] Fix C++ mangling references to declarations.

Several issues have been discovered and (hopefully) fixed here:

- Reference NTTPs should be mangled in the same manner as pointer
ones.

-  Pointer fields of class type NTTPs should be treated in the same
manner as reference ones.

- Pointer-to-member fields of class type NTTPs should be treated
differently compared to pointer-to-member NTTPs. Tests on
pointer-to-member-function NTTP class fields added.

- Correct mangling of pointers to anonymous union members.

- A bug in mangling references to subobjects fixed.

- Mangling array subscripts and base class members in references
to subobjects.

Reference NTTP mangling was done back in 2013
in e8fdc06e0dab2e7b98339425dbe369e27e2092a3, and Microsoft might change
mangling algorithm since then. But class type NTTPs are introduced only
in C++20, and the test was written in
b637148ecb62b900872b34eedd78b923bb43c378.
It is strange if the MS ABI had been realy changed, because Microsoft
claims that they maintain ABI stability since VS 2015. I've tested both
on v142 and v143 MSVC toolsets, and they show the same behavior
on the test cases which are changed in this PR. But
pointer-to-member-function NTTP class field mangling has been actually
changed, because it was erroneous in v142, leading to name collisions.

Moreover, pointer-to-member mangling with conversions across class
hierarchy has been enabled.

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

22 months agoEmit the correct flags for the PROC CodeView Debug Symbol
Daniel Paoliello [Thu, 4 May 2023 00:22:52 +0000 (17:22 -0700)]
Emit the correct flags for the PROC CodeView Debug Symbol

The S_LPROC32_ID and S_GPROC32_ID CodeView Debug Symbols have a flags
field which LLVM has had the values for (in the ProcSymFlags enum) but
has never actually set.

These flags are used by Microsoft-internal tooling that leverages debug
information to do binary analysis.

Modified LLVM to set the correct flags:

- ProcSymFlags::HasOptimizedDebugInfo - always set, as this indicates that
debug info is present for optimized builds (if debug info is not emitted
for optimized builds, then LLVM won't emit a debug symbol at all).
- ProcSymFlags::IsNoReturn and ProcSymFlags::IsNoInline - set if the
function has the NoReturn or NoInline attributes respectively.
- ProcSymFlags::HasFP - set if the function requires a frame pointer (per
TargetFrameLowering::hasFP).

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

22 months ago[llvm-mca] Fix duplicate symbols error
Michael Maitland [Wed, 3 May 2023 20:24:44 +0000 (13:24 -0700)]
[llvm-mca] Fix duplicate symbols error

Parsing instruments and analysis regions causes us to see the same
labels two times since we parse the same file twice under the same
context.

This change creates a seperate context for instrument parsing
and another for analysis region parsing. I will post a follow up
commit once I get some free cycles to parse analysis regions and
instruments in one parsing pass under a single context.

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

22 months ago[RISCV][CodeGen] Support Zdinx on RV64 codegen
Shao-Ce SUN [Wed, 3 May 2023 17:09:52 +0000 (01:09 +0800)]
[RISCV][CodeGen] Support Zdinx on RV64 codegen

This patch was split from D122918 . Co-Author: @liaolucy @realqhc

Reviewed By: craig.topper

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

22 months agoFix MathTransforms library dependencies
Uday Bondhugula [Wed, 3 May 2023 23:21:20 +0000 (04:51 +0530)]
Fix MathTransforms library dependencies

The dependencies were set up improperly likely due to past code
locations. MathTransforms shouldn't depend on VectorUtils which add a
whole bunch of additional dependencies; it instead depends on the SCF
dialect.

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

22 months ago[MLIR][python bindings] Add support for DenseElementsAttr of IndexType
max [Tue, 2 May 2023 20:52:04 +0000 (15:52 -0500)]
[MLIR][python bindings] Add support for DenseElementsAttr of IndexType

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

22 months ago[libc][rpc] Simplify mailbox state tracking
Jon Chesterfield [Wed, 3 May 2023 23:21:18 +0000 (00:21 +0100)]
[libc][rpc] Simplify mailbox state tracking

Removes the redundant Ack/Data bit manipulation.

Represents the inbox/outbox state with one bit instead of two. This will
be useful if we change to a packed representation and otherwise cuts the
runtime state space from 16 to 4.

Further simplification is possible, this patch is intentionally minimal.
- can_{send,recv}_data are now in == out
- {client,server}::try_open can be factored into Process:try_open

This implements the state machine of D148191, modulo differences in atomic
ordering and fences.

Reviewed By: jhuber6

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

22 months ago[WebAssembly] Remove incorrect result from wasm64 store_lane instructions
Thomas Lively [Wed, 3 May 2023 23:00:20 +0000 (16:00 -0700)]
[WebAssembly] Remove incorrect result from wasm64 store_lane instructions

The wasm64 versions of the v128.storeX_lane instructions was incorrectly defined
as returning a v128 value, which resulted in spurious drop instructions being
emitted and causing validation to fail. This was not caught earlier because
wasm64 has been experimental and not well tested. Update the relevant test file
to test both wasm32 and wasm64.

Fixes #62443.

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

22 months ago[flang][openacc] Add proper TODO for reduction lowering
Valentin Clement [Wed, 3 May 2023 22:43:38 +0000 (15:43 -0700)]
[flang][openacc] Add proper TODO for reduction lowering

Reduction clause on loop or compute constructs
is not currently lowered but no TODO message was issued.
Add a proper TODO so the user is informed.

Reviewed By: razvanlupusoru

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

22 months ago[AMDGPU] Add gfx940 to fp64 atomic tests in global ISel
Krzysztof Drewniak [Wed, 3 May 2023 22:06:41 +0000 (22:06 +0000)]
[AMDGPU] Add gfx940 to fp64 atomic tests in global ISel

This changes the test in GlobalISel, which makes it match the test
elsewhere.

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

22 months ago[CoroSplit][DebugInfo][nfc] Use more specialize Map arguments
Felipe de Azevedo Piovezan [Wed, 3 May 2023 14:28:55 +0000 (10:28 -0400)]
[CoroSplit][DebugInfo][nfc] Use more specialize Map arguments

We use a map of Argument->AllocaInst when mapping Arguments to the
AllocaInst created for them.

Said map is declared from "Value" and called a "DbgPtrCache". This
commit:
* replaces Value to the more specialized Argument class, to reflect the
intent better (i.e. we are _always_ mapping Arguments).
* replaces the name "DbgPtrCache" with the more explicit "ArgToAllocaMap",
as it is not clear reading the code what a "DbgPtr" is.

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

22 months ago[libc++][PSTL] Add design docs
Nikolas Klauser [Wed, 3 May 2023 22:25:19 +0000 (15:25 -0700)]
[libc++][PSTL] Add design docs

Reviewed By: ldionne, Mordante, #libc

Spies: grandinj, libcxx-commits, arphaman

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

22 months ago[libc][rpc] Fix the memory ordering in lock.
Jon Chesterfield [Wed, 3 May 2023 22:23:45 +0000 (23:23 +0100)]
[libc][rpc] Fix the memory ordering in lock.

Prevent operation reordering with fence instead of a comment.

The mailboxes are in shared memory and the locks structure in device memory.
If the mailboxes are read and then the lock taken, the lock says nothing
about the current or future state of those mail boxes. The relaxed atomic
fetch_or can be reordered before the relaxed atomic loads of unrelated
variables unless there is a fence preventing this.

Patches both Client::try_open and Server::try_open, one of which is missing
an optimisation and the other is missing the comment, but which otherwise
could be Process::try_open followed by buffer->opcode = opcode in Client.

Reviewed By: jhuber6

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

22 months ago[flang] Removed unnecessary llvm/CodeGen/SelectionDAGNodes.h include.
Slava Zakharin [Wed, 3 May 2023 21:20:10 +0000 (14:20 -0700)]
[flang] Removed unnecessary llvm/CodeGen/SelectionDAGNodes.h include.

Required after D148767 for flang+debug+slibs build.

Reviewed By: chapuni, clementval

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

22 months ago[mlir][GPU] Allow specifying alignment of memory attributions
Krzysztof Drewniak [Tue, 18 Apr 2023 19:48:49 +0000 (19:48 +0000)]
[mlir][GPU] Allow specifying alignment of memory attributions

Add support for argument attributes on workgroup and private
attributions for GPU functions. These arguments are outside the range
of getNumArguments() and get printed separately, so the default
mechanism for function argument attributes can't be used on them.

Having done this, check for the `llvm.align` attribute on workgroup or
private attributions in a `gpu.func` and pass it through to the
relevant allocation op (creating a global or alloca). This allows
people creating kernels that use multiple workgroup buffers to set an
alignment.

(This could, in the future, be a GPU dialect `alignment` attribute,
but I've taken the simpler route of using the LLVM version instead for
simplicity and because I don't know how this might impact backends
like Vulkan)

Reviewed By: nirvedhmeshram

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

22 months ago[libc++][PSTL] Reduce the amount of transitive includes
Nikolas Klauser [Tue, 2 May 2023 16:45:37 +0000 (09:45 -0700)]
[libc++][PSTL] Reduce the amount of transitive includes

Reviewed By: ldionne, #libc

Spies: libcxx-commits, miyuki

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

22 months agoChange if() continue; to an assert if a DBG_VALUE or DBG_VALUE_LIST returns a null...
Shubham Sandeep Rastogi [Wed, 3 May 2023 15:45:14 +0000 (08:45 -0700)]
Change if() continue; to an assert if a DBG_VALUE or DBG_VALUE_LIST returns a null DILocalVariable

A  DBG_VALUE or DBG_VALUE_LIST must always return a non-null
DILocalVariable, the ARMLoadStoreOptimizer code that move’s DBG_VALUE
and DBG_VALUE_LIST instructions if their corresponding loads have been
moved, currently just continues if it finds a DBG_VALUE or
DBG_VALUE_LIST with a null DILocalVariable, change that to an assert.

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

22 months ago[mlir][AMDGPU] Add emulation pass for atomics on AMDGPU targets
Krzysztof Drewniak [Mon, 17 Apr 2023 21:49:02 +0000 (21:49 +0000)]
[mlir][AMDGPU] Add emulation pass for atomics on AMDGPU targets

Not all AMDGPU targets support all atomic operations. For example,
there are not atomic floating-point adds on the gfx10 series. Add a
pass to emulate these operations using a compare-and-swap loop, by
analogy to the generic atomicrmw rewrite in MemrefToLLVM.

This pass is named generally, as in the future we may have a
memref-to-amdgpu that translates constructs like atomicrmw fmax (which
doesn't generally exist in LLVM) to the relevant intrinsics, which may
themselves require emulation.

Since the AMDGPU dialect now has a pass that operates on it, the
dialect's directory structure is reorganized to match other similarly
complex dialects.

The pass should be run before amdgpu-to-rocdl if desired.

This commit also adds f64 support to atomic_fmax.

Depends on D148722

Reviewed By: nirvedhmeshram

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

22 months ago[mlir][AMDGPU] Define atomic compare-and-swap for raw buffers
Krzysztof Drewniak [Mon, 17 Apr 2023 16:55:56 +0000 (16:55 +0000)]
[mlir][AMDGPU] Define atomic compare-and-swap for raw buffers

This commit adds the buffer cmpswap intrinsic to the ROCDL dialect and
its corresponding AMDGPU dialect wrappers.

Reviewed By: nirvedhmeshram

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

22 months agoRevert "[MemProf] Context disambiguation cloning pass [patch 3/4]"
Teresa Johnson [Wed, 3 May 2023 21:07:43 +0000 (14:07 -0700)]
Revert "[MemProf] Context disambiguation cloning pass [patch 3/4]"

This reverts commit bf6ff4fd4b735afffc65f92a4a79f6610e7174c3.

There is a bot failure where we are getting the correct remarks output
but in a different order. I'll need to investigate to see where we are
having nondeterministic behavior.

22 months ago[Clang][Sema] Fix comparison of constraint expressions
Alexander Shaposhnikov [Wed, 3 May 2023 20:38:34 +0000 (20:38 +0000)]
[Clang][Sema] Fix comparison of constraint expressions

This diff switches the approach to comparison of constraint expressions
to the new one based on template args substitution.
It continues the effort to fix our handling of out-of-line definitions
of constrained templates.
This is a recommit of e3b1083e00.

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

22 months ago[SCEV] Add test where loop guards can be used to improve BTC.
Florian Hahn [Wed, 3 May 2023 21:05:30 +0000 (22:05 +0100)]
[SCEV] Add test where loop guards can be used to improve BTC.

22 months ago[clang][deps] Teach dep directive scanner about #pragma clang system_header
Ben Langmuir [Wed, 3 May 2023 19:17:36 +0000 (12:17 -0700)]
[clang][deps] Teach dep directive scanner about #pragma clang system_header

This ensures we get the correct FileCharacteristic during scanning. In a
yet-to-be-upstreamed branch this fixes observable failures, but it's
also good to handle this on principle: the FileCharacteristic is a
property of the file that is observable in the scanner, so there is
nothing preventing us from depending on it.

rdar://108627403

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

22 months ago[MemProf] Context disambiguation cloning pass [patch 3/4]
Teresa Johnson [Thu, 5 Jan 2023 17:55:33 +0000 (09:55 -0800)]
[MemProf] Context disambiguation cloning pass [patch 3/4]

Applies cloning decisions to the IR, cloning functions and updating
calls. For Regular LTO, the IR is updated directly during function
assignment, whereas for ThinLTO it is recorded in the summary index
(a subsequent patch will apply to the IR via the index during the
ThinLTO backend.

The function assignment and cloning proceeds greedily, and we create new
clones as needed when we find an incompatible assignment of function
clones to callsite clones (i.e. when different callers need to invoke
different combinations of callsite clones).

Depends on D140949.

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

22 months ago[InstSimplify] Update to handle new shufflevector semantics
ManuelJBrito [Sun, 30 Apr 2023 12:31:31 +0000 (13:31 +0100)]
[InstSimplify] Update to handle new shufflevector semantics

Simplifying poison mask elements yields poison values.

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

22 months agoReland [Pipeline] Don't limit ArgumentPromotion to -O3
Arthur Eubanks [Thu, 13 Apr 2023 20:25:08 +0000 (13:25 -0700)]
Reland [Pipeline] Don't limit ArgumentPromotion to -O3

This is a cheap pass so there's no need to limit to -O3.
This removes some differences between various pipelines.

Code size regressions should be addressed with
https://reviews.llvm.org/D149768.

Reviewed By: nikic

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

22 months ago[Modules] Move modulemaps to header search directories. NFC intended.
Volodymyr Sapsai [Thu, 9 Mar 2023 04:14:44 +0000 (20:14 -0800)]
[Modules] Move modulemaps to header search directories. NFC intended.

In code we use `#include "llvm/Lib/Header.h"` which is located in
"llvm/include/llvm/Lib/Header.h", so we use "llvm/include/" as a header
search path. We should put modulemaps in the same directory and
shouldn't rely on clang to search in immediate subdirectories.

rdar://106677321

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

22 months agoAccount for whitespace in the test regex
Aaron Ballman [Wed, 3 May 2023 20:04:19 +0000 (16:04 -0400)]
Account for whitespace in the test regex

Yet another amendment to 9bb28a18d962e8f6e3fa8f48bd2c6dc183154d26, this
addresses issues found in:
https://lab.llvm.org/buildbot/#/builders/188/builds/29204

22 months ago[NFC][SLP] Cleanup: Simplify traversal loop in SLPVectorizerPass::vectorizeHorReducti...
Vasileios Porpodas [Fri, 28 Apr 2023 23:33:34 +0000 (16:33 -0700)]
[NFC][SLP] Cleanup: Simplify traversal loop in SLPVectorizerPass::vectorizeHorReduction().

This includes a couple of changes:
1. Moves the code that changes the root node out of the `TryToReduce` lambda and out of the traversal loop.
2. Since that code moved, there isn't much left in `TryToReduce` so the code was inlined.
3. The phi node variable `P` was also being used as a flag that turns on/off the exploration of operands as new seeds. This patch uses a new variable `TryOperandsAsNewSeeds` for this.
4. Simplifies the code executed when vectorization fails.

The logic of the code should be identical to the original, but I may be missing something not caught by tests.

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

22 months agoSpeculative fix for 9bb28a18d962e8f6e3fa8f48bd2c6dc183154d26
Aaron Ballman [Wed, 3 May 2023 19:45:06 +0000 (15:45 -0400)]
Speculative fix for 9bb28a18d962e8f6e3fa8f48bd2c6dc183154d26

22 months agoRe-land "[AMDGPU] Define data layout entries for buffers""
Krzysztof Drewniak [Wed, 3 May 2023 16:21:59 +0000 (16:21 +0000)]
Re-land "[AMDGPU] Define data layout entries for buffers""

Re-land D145441 with data layout upgrade code fixed to not break OpenMP.

This reverts commit 3f2fbe92d0f40bcb46db7636db9ec3f7e7899b27.

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

22 months ago[SLP][NFC]Add ShuffleCostBuilder and generalize BaseShuffleAnalysis::createShuffle...
Alexey Bataev [Tue, 25 Apr 2023 16:37:53 +0000 (09:37 -0700)]
[SLP][NFC]Add ShuffleCostBuilder and generalize BaseShuffleAnalysis::createShuffle function, NFC.

Added basic implementation of ShuffleCostBuilder class in
ShuffleCostEstimator and generalized BaseShuffleAnalysis::createShuffle
function to support emission of Value */InstructionCost for the
vectorization/cost estimation.

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

22 months agoAnother fix for 9bb28a18d962e8f6e3fa8f48bd2c6dc183154d26
Aaron Ballman [Wed, 3 May 2023 19:27:07 +0000 (15:27 -0400)]
Another fix for 9bb28a18d962e8f6e3fa8f48bd2c6dc183154d26

This addresses the issue found in:
https://lab.llvm.org/buildbot/#/builders/245/builds/7882

This time, the issue was that not every platform has the same alignment
values, so those were removed from the test case.

22 months ago[RISCV] Don't overcount FP constants in lowerBUILD_VECTOR
Philip Reames [Wed, 3 May 2023 19:20:21 +0000 (12:20 -0700)]
[RISCV] Don't overcount FP constants in lowerBUILD_VECTOR

If the value count is > 1, we use a splat and thus only materialize the constant once, not once per element.

22 months agoFix test bot breakage from 9bb28a18d962e8f6e3fa8f48bd2c6dc183154d26
Aaron Ballman [Wed, 3 May 2023 19:17:08 +0000 (15:17 -0400)]
Fix test bot breakage from 9bb28a18d962e8f6e3fa8f48bd2c6dc183154d26

This addresses the issue found by:
https://lab.llvm.org/buildbot/#/builders/197/builds/4783
https://lab.llvm.org/buildbot/#/builders/188/builds/29201

22 months ago[llvm][test] Skip physical filesystem test if unsupported
Ben Langmuir [Wed, 3 May 2023 16:17:04 +0000 (09:17 -0700)]
[llvm][test] Skip physical filesystem test if unsupported

We are relying on deleting the working directory to trigger a later
error in getcwd, but some platforms (e.g. Solaris) disallow deleting the
working directory of the process. Skip the test in that case.

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

22 months ago[clang][deps] Make clang-scan-deps write modules in raw format
Ben Langmuir [Tue, 2 May 2023 20:55:46 +0000 (13:55 -0700)]
[clang][deps] Make clang-scan-deps write modules in raw format

We have no use for debug info for the scanner modules, and writing raw
ast files speeds up scanning ~15% in some cases. Note that the compile
commands produced by the scanner will still build the obj format (if
requested), and the scanner can *read* obj format pcms, e.g. from a PCH.

rdar://108807592

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

22 months ago[Demangle] remove unused status param of itaniumDemangle
Nick Desaulniers [Wed, 3 May 2023 18:51:31 +0000 (11:51 -0700)]
[Demangle] remove unused status param of itaniumDemangle

No call sites interpreted this value meaningfully. Simplify this
interface.

Reviewed By: MaskRay

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

22 months ago[VPlan] Add assignSlot(const VPBasicBlock *) (NFC).
Florian Hahn [Wed, 3 May 2023 18:51:09 +0000 (19:51 +0100)]
[VPlan] Add assignSlot(const VPBasicBlock *) (NFC).

Factor out utility to simplify D147964 as sugested.

22 months ago[C2x] Update 'nullptr' implementation based on CD comments
Aaron Ballman [Wed, 3 May 2023 18:06:04 +0000 (14:06 -0400)]
[C2x] Update 'nullptr' implementation based on CD comments

We filed some CD ballot comments which WG14 considered during the
ballot comment resolution meetings in Jan and Feb 2023, and this
updates our implementation based on the decisions reached. Those
decisions were (paraphrased for brevity):

US 9-034 (REJECTED)
  allow (void *)nullptr to be a null pointer constant
US 10-035 (ACCEPTED)
  accept the following code, as in C++:
  void func(nullptr_t); func(0);
US 22-058 (REJECTED)
  accept the following code, as in C++:
  nullptr_t val; (void)(1 ? val : 0); (void)(1 ? nullptr : 0);
US 23-062 (REJECTED)
  reject the following code, as in C++:
  nullptr_t val; bool b1 = val; bool b2 = nullptr;
US 24-061 (ACCEPTED)
  accept the following code, as in C++:
  nullptr_t val; val = 0;
US 21-068 (ACCEPTED)
  accept the following code, as in C++:
  (nullptr_t)nullptr;
GB-071 (ACCEPTED)
  accept the following code, as in C++:
  nullptr_t val; (void)(val == nullptr);

This patch updates the implementation as appropriate, but is primarily
focused around US 10-035, US 24-061, and US 23-062 in terms of
functional changes.

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

22 months ago[clang][dataflow] Change PruneTriviallyFalseEdges for building CFG
Kinuko Yasuda [Wed, 3 May 2023 11:37:44 +0000 (11:37 +0000)]
[clang][dataflow] Change PruneTriviallyFalseEdges for building CFG

Keeping this false could end up with extra iterations on a lot of loops
that aren't real ones (e.g. they could be a do-while-false for macros),
and makes the analyses very slow.

This patch changes the default for
CFG::BuildOptions.PruneTriviallyFalseEdges to true to avoid it.

Reviewed By: ymandel, xazax.hun, gribozavr2

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

22 months ago[ArgumentPromotion] Bail if any callers are minsize
Arthur Eubanks [Wed, 3 May 2023 16:56:22 +0000 (09:56 -0700)]
[ArgumentPromotion] Bail if any callers are minsize

Argument promotion mostly works on functions with more than one caller (otherwise the function would be inlined or is dead), so there's a good chance that performing this increases code size since we introduce loads at every call site. If any caller is marked minsize, bail.

We could compare the number of loads/stores removed from the function with the number of loads introduced in callers, but that's TODO.

Reviewed By: nikic

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

22 months ago[LTO] Add test for dllimport visibility fix
Matthew Voss [Fri, 21 Apr 2023 17:54:55 +0000 (10:54 -0700)]
[LTO] Add test for dllimport visibility fix

Internal testing showed that the change made in commit 62fcfc5a needed
more test coverage. Specifically, the imported function shouldn't be
externally visibile and the whole test needed to be run in regular LTO
mode.

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

22 months ago[libc] Make printf decimal long doubles use hex
Michael Jones [Wed, 12 Apr 2023 22:39:15 +0000 (15:39 -0700)]
[libc] Make printf decimal long doubles use hex

Decimal long doubles are not commonly used, and aren't currently
supported by the algorithm used for decimal float conversions. To avoid
giving incorrect answers, this patch adds a temporary exception to print
long doubles in hexadecimal even when decimal is requested.

Reviewed By: sivachandra

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

22 months ago[libc] add socket function
Michael Jones [Mon, 24 Apr 2023 23:55:54 +0000 (16:55 -0700)]
[libc] add socket function

This patch adds the function "socket" from the header "sys/socket". It's
a simple syscall wrapper, and I plan on adding the related functions in
a followup patch.

Reviewed By: sivachandra

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

22 months ago[mlir][arith] Add narrowing patterns for index casts
Jakub Kuderski [Wed, 3 May 2023 17:55:01 +0000 (13:55 -0400)]
[mlir][arith] Add narrowing patterns for index casts

These rely on the `ValueBounds` interace and its utility function to
compute constant bounds. This allows us to optimize `linalg.index`
values cast to integer types.

Reviewed By: antiagainst

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

22 months agoAllow scripted thread plans to modify the thread stop description when
Jim Ingham [Tue, 2 May 2023 20:41:07 +0000 (13:41 -0700)]
Allow scripted thread plans to modify the thread stop description when
they are completed.

22 months ago[lldb] Remove distribution_id from ArchSpec
Alex Langford [Tue, 2 May 2023 21:48:10 +0000 (14:48 -0700)]
[lldb] Remove distribution_id from ArchSpec

The qHostInfo packet in the gdb-remote communication protocol specifies
that distribution_id can be set, so lldb handles that. But we store that
in the ArchSpec representing the "Host" platform (whatever platform the
debug server is running on). This field is otherwise unused in ArchSpec,
so it would be a lot easier if we stored that information at the
gdb-remote communication layer.

Sidenote: The distribution_id field is currently unused but I did not
want to remove it in case some folks found it useful (e.g. in downstream
forks).

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

22 months ago[RISCV] Pass FeatureBitset to computeTargetABI by const reference. NFC
Craig Topper [Wed, 3 May 2023 17:17:50 +0000 (10:17 -0700)]
[RISCV] Pass FeatureBitset to computeTargetABI by const reference. NFC

22 months ago[Demangle] remove unused params of itaniumDemangle
Nick Desaulniers [Wed, 3 May 2023 16:53:24 +0000 (09:53 -0700)]
[Demangle] remove unused params of itaniumDemangle

No call sites use these parameters, so drop them.
Equivalent to D148940.

Reviewed By: MaskRay

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

22 months ago[analyzer] ArrayBoundCheckerV2: suppress false positives from ctype macros
Donát Nagy [Fri, 28 Apr 2023 16:17:11 +0000 (18:17 +0200)]
[analyzer] ArrayBoundCheckerV2: suppress false positives from ctype macros

The checker alpha.security.ArrayBoundV2 created bug reports in
situations when the (tainted) result of fgetc() or getchar() was passed
to one of the isXXXXX() macros from ctype.h.

This is a common input handling pattern (within the limited toolbox of
the C language) and several open source projects contained code where it
led to false positive reports; so this commit suppresses ArrayBoundV2
reports generated within the isXXXXX() macros.

Note that here even true positive reports would be difficult to
understand, as they'd refer to the implementation details of these
macros.

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

22 months ago[libc] Revert rounding mode changes for hermetic tests
Joseph Huber [Wed, 3 May 2023 16:49:56 +0000 (11:49 -0500)]
[libc] Revert rounding mode changes for hermetic tests

We got rid of the rounding mode here so that the hermetic tests wouldn't
depend on the system fenv.h. But this seemed to cause some bots to
break. Getting rid of this change for now, it should be fine for the CPU
builds.

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

22 months ago[RISCV] Fix intrinsic name in comment for lowerInterleavedLoad/lowerInterleavedStore...
Craig Topper [Wed, 3 May 2023 16:47:53 +0000 (09:47 -0700)]
[RISCV] Fix intrinsic name in comment for lowerInterleavedLoad/lowerInterleavedStore. NFC

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

22 months ago[flang][openacc] Always lower bounds with lb, ub and stride information
Valentin Clement [Wed, 3 May 2023 16:43:32 +0000 (09:43 -0700)]
[flang][openacc] Always lower bounds with lb, ub and stride information

Since we have all the information while lowering, always
add the lowerbound, upperbound and stride information for acc.bounds
create from the Flang frontend.

Reviewed By: razvanlupusoru, jeanPerier

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

22 months ago[libc] Don't use '-nolibc' on the GPU build
Joseph Huber [Wed, 3 May 2023 15:12:34 +0000 (10:12 -0500)]
[libc] Don't use '-nolibc' on the GPU build

We previously changed this to use `nolibc` to allow it to link in
compiler builtins for the CPU build. However, these options are unused
on the GPU and create a lot of noise. Furthermore, we want to use
`nogpulib` to prevent the linking in of the vendor libraries.

Reviewed By: sivachandra

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

22 months ago[libc] Enable the '__support' unit tests to be hermetic
Joseph Huber [Wed, 3 May 2023 14:57:05 +0000 (09:57 -0500)]
[libc] Enable the '__support' unit tests to be hermetic

This patch updates the `__support` unit tests to be built as hermetic
tests. The only tests we needed to disable were because of the use of
`realloc` which is not implemented correctly as it doesn't copy the
memory.

Depends on D149745

Reviewed By: sivachandra

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

22 months ago[libc] Split out FPExceptMatcher from the FP utils
Joseph Huber [Wed, 3 May 2023 13:28:24 +0000 (08:28 -0500)]
[libc] Split out FPExceptMatcher from the FP utils

The FPEceptMatcher.cpp file uses system utilities and includes C++
libraries. This patch pulls it out of the main `FPTestHelpers` target so
we can exclude it from hermetic only tests.

Depends on D149705

Reviewed By: sivachandra

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