platform/upstream/llvm.git
2 years ago[ELF][AArch64] Fix unneeded thunk for branches to hidden undefined weak
Fangrui Song [Thu, 14 Apr 2022 18:32:29 +0000 (11:32 -0700)]
[ELF][AArch64] Fix unneeded thunk for branches to hidden undefined weak

Similar to D119787 for PPC64.

A hidden undefined weak may change its binding to local before some
`isUndefinedWeak` code, so some `isUndefinedWeak` code needs to be changed to
`isUndefined`. The undefined non-weak case has been errored, so just using
`isUndefined` is fine.

The Linux kernel recently has a usage that a branch from 0xffff800008491ee0
references a hidden undefined weak symbol `vfio_group_set_kvm`.
It relies on the behavior that a branch to undefined weak resolving to the next
instruction, otherwise it'd see spurious relocation out of range errors.

Fixes https://github.com/ClangBuiltLinux/linux/issues/1624

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

2 years ago[InstCombine] canonicalize select with signbit test
Sanjay Patel [Thu, 14 Apr 2022 18:02:56 +0000 (14:02 -0400)]
[InstCombine] canonicalize select with signbit test

This is part of solving issue #54750 - in that example
we have both forms of the compare and do not recognize
the equivalence.

2 years agoRevert "[NVPTX] Disable parens for identifiers starting with '$'"
Andrew Savonichev [Thu, 14 Apr 2022 18:25:31 +0000 (21:25 +0300)]
Revert "[NVPTX] Disable parens for identifiers starting with '$'"

This reverts commit 78d70a1c976934587e6d4c5698c348b8f09d9d96.

Failed on Mips32:
https://lab.llvm.org/buildbot#builders/109/builds/36628

   # CHECK: # fixup A - offset: 0, value: ($tmp0), kind: fixup_Mips_26
   <stdin>:580:2: note: possible intended match here
   # fixup A - offset: 0, value: $tmp0, kind: fixup_Mips_26

2 years ago[flang] Always encode multi-byte output in UTF-8
Peter Klausler [Fri, 1 Apr 2022 21:18:02 +0000 (14:18 -0700)]
[flang] Always encode multi-byte output in UTF-8

A recent change to implement UTF-8 encoding should have
made the encoding conditional only for CHARACTER(KIND=1)
to enable UTF-8 output vs. Latin-1 or whatever.  UTF-8 output
of wider CHARACTER kinds should not be conditional (until we choose
to support UCS-16, maybe).  So wider CHARACTER kinds are being
emitted with extra zero bytes; this patch fixes them.

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

2 years ago[clang-tidy] Add portability-std-allocator-const check
Fangrui Song [Thu, 14 Apr 2022 18:13:41 +0000 (11:13 -0700)]
[clang-tidy] Add portability-std-allocator-const check

Report use of `std::vector<const T>` (and similar containers of const
elements). These are now allowed in standard C++ due to undefined
`std::allocator<const T>`. They do not compile with libstdc++ or MSVC.
Future libc++ will remove the extension (D120996).
See docs/clang-tidy/checks/portability-std-allocator-const.rst for detail.

I have attempted clean-up in a large code base. Here are some statistics:

* 98% are related to the container `std::vector`, among `deque/forward_list/list/multiset/queue/set/stack/vector`.
* 24% are related to `std::vector<const std::string>`.
* Both `std::vector<const absl::string_view>` and `std::vector<const int>` contribute 2%. The other contributors spread over various class types.

The check can be useful to other large code bases and may serve as an example
for future libc++ strictness improvement.

Note: on MSVC where -fdelayed-template-parsing is the default, the check cannot
catch cases in uninstantiated templates.

Reviewed By: sammccall

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

2 years ago[NVPTX] Disable parens for identifiers starting with '$'
Andrew Savonichev [Mon, 11 Apr 2022 18:33:04 +0000 (21:33 +0300)]
[NVPTX] Disable parens for identifiers starting with '$'

ptxas fails to parse such syntax:

    mov.u64 %rd1, ($str);
    fatal   : Parsing error near '$str': syntax error

A new MCAsmInfo option was added because InParens parameter of
MCExpr::print is not sufficient to disable parens
completely. MCExpr::print resets it to false for a recursive call in
case of unary or binary expressions.

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

2 years ago[LLDB][NativePDB] Fix a crash when S_DEFRANGE_SUBFIELD_REGISTER descirbes a simple...
Zequan Wu [Fri, 1 Apr 2022 22:40:56 +0000 (15:40 -0700)]
[LLDB][NativePDB] Fix a crash when S_DEFRANGE_SUBFIELD_REGISTER descirbes a simple type

When a variable is simple type and has 64 bits, the debug info may look like the following when targeting 32bit windows. The variable's content is split into two 32bits registers.
```
480 | S_LOCAL [size = 12] `x`
      type=0x0013 (__int64), flags = param
492 | S_DEFRANGE_SUBFIELD_REGISTER [size = 20]
      register = EAX, may have no name = true, offset in parent = 0
      range = [0001:0073,+7), gaps = []
512 | S_DEFRANGE_SUBFIELD_REGISTER [size = 20]
      register = ECX, may have no name = true, offset in parent = 4
      range = [0001:0073,+7), gaps = []
```

Reviewed By: labath

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

2 years ago[LLDB][NativePDB] Fix inline line info in line table
Zequan Wu [Thu, 14 Apr 2022 17:58:17 +0000 (10:58 -0700)]
[LLDB][NativePDB] Fix inline line info in line table

It fixes the following case:
```
0602      line 1 (+1)
0315      code 0x15 (+0x15)
0B2B      code 0x20 (+0xB) line 2 (+1)
0602      line 3 (+1)
0311      code 0x31 (+0x11)
...
```

Inline ranges should have following mapping:
`[0x15, 0x20) -> line 1`
`[0x20, 0x31) -> line 2`
Inline line entries:
`0x15, line 1`, `0x20, line 2`, `0x31, line 3`.

Reviewed By: labath

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

2 years ago[lldb] Port Process::PrintWarning* to use the new diagnostic events
Jonas Devlieghere [Thu, 14 Apr 2022 17:46:57 +0000 (10:46 -0700)]
[lldb] Port Process::PrintWarning* to use the new diagnostic events

Port the two Process::PrintWarning functions to use the new diagnostic
events through Debugger::ReportWarning. I kept the wrapper function in
the process, but delegated the work to the Module. Consistent with the
current code, the Module ensures the warning is only printed once per
module.

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

2 years ago[lldb] Prevent crash when adding a stop hook with --shlib
Jonas Devlieghere [Thu, 14 Apr 2022 17:45:11 +0000 (10:45 -0700)]
[lldb] Prevent crash when adding a stop hook with --shlib

Currently, lldb crashes when adding a stop hook with --shlib because we
unconditionally use the target in SymbolContextSpecifier::AddSpecification.
This patch prevents the crash and add a test.

rdar://68524781

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

2 years agoUse descriptive register names for readability (NFC).
Martin Sebor [Thu, 14 Apr 2022 17:59:04 +0000 (11:59 -0600)]
Use descriptive register names for readability (NFC).

2 years ago[BOLT][perf2bolt] Fix base address calculation for shared objects
Maksim Panchenko [Thu, 14 Apr 2022 02:39:39 +0000 (19:39 -0700)]
[BOLT][perf2bolt] Fix base address calculation for shared objects

When processing profile data for shared object or PIE, perf2bolt needs
to calculate base address of the binary based on the map info reported
by the perf tool. When the mapping data provided is for the second
(or any other than the first) segment and the segment's file offset
does not match its memory offset, perf2bolt uses wrong assumption
about the binary base address.

Add a function to calculate binary base address using the reported
memory mapping and use the returned base for further address
adjustments.

Reviewed By: yota9

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

2 years ago[libc++] Adds a missing include.
Mark de Wever [Thu, 14 Apr 2022 17:27:04 +0000 (19:27 +0200)]
[libc++] Adds a missing include.

This fixes the modular build.

2 years ago[flang] Defer all function result type processing
Peter Klausler [Thu, 31 Mar 2022 15:50:18 +0000 (08:50 -0700)]
[flang] Defer all function result type processing

When a type specification appears in the prefix of a FUNCTION statement,
defer its processing as late as possible so that any symbols in the
tpe specification can be resolved in the function's scope to local
declarations, including use-associated symbols.  f18 was already doing
this deferral in a limited form for derived types, and this patch
makes it work for intrinsic type parameter values as well.

In short, "real(kind(x)) function foo(x)" now works as it should.

"As late as possible" means the end of the specification part, or
the first appearance of the function result name in the specification
part.

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

2 years agoRevert "[IROutliner] Ensure that phi values that are passed in as arguments are remap...
Andrew Litteken [Thu, 14 Apr 2022 17:23:33 +0000 (12:23 -0500)]
Revert "[IROutliner] Ensure that phi values that are passed in as arguments are remapped as arguments"

Failing test due to typo

This reverts commit d6eb480afbc038871570fa053d772c913cd77a61.

2 years ago[IROutliner] Ensure that phi values that are passed in as arguments are remapped...
Andrew Litteken [Mon, 21 Mar 2022 20:56:50 +0000 (15:56 -0500)]
[IROutliner] Ensure that phi values that are passed in as arguments are remapped as arguments

Issue: https://github.com/llvm/llvm-project/issues/54430

For incoming values of phi nodes added to an outlined function to accommodate different exit paths in the function, when a value is a constant that is passed into the outlined function as an argument, we find the corresponding value in the first extracted function used to fill the overall outlined function. When this value is an argument, the corresponding value used will be the old value, prior to outlining. This patch maintains a mapping from these values to arguments, and uses this mapping to update the added phi node accordingly.

Reviewers: paquette

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

2 years ago[PS4] Fix a couple of typos
Paul Robinson [Thu, 14 Apr 2022 17:14:01 +0000 (10:14 -0700)]
[PS4] Fix a couple of typos

2 years ago[IROutliner] Ensure that incoming blocks of PHINodes are included in the unique numbe...
Andrew Litteken [Mon, 21 Mar 2022 20:56:22 +0000 (15:56 -0500)]
[IROutliner] Ensure that incoming blocks of PHINodes are included in the unique numbering gneration for phi nodes for each exit path

Issue: https://github.com/llvm/llvm-project/issues/54431

PHINodes that need to be generated to accommodate a PHINode outside the region due to different output paths need to have their own numbering to determine the number of output schemes required to properly handle all the outlined regions. This numbering was previously only determined by the order and values of the incoming values, as well as the parent block of the PHINode. This adds the incoming blocks to the calculation of a hash value for these PHINodes as well, and the supporting infrastructure to give each block in a region a corresponding canonical numbering.

Reviewer: paquette

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

2 years ago[mlir][nvgpu] Add NVGPU dialect (architectural specific gpu dialect)
Thomas Raoux [Thu, 7 Apr 2022 07:14:39 +0000 (07:14 +0000)]
[mlir][nvgpu] Add NVGPU dialect (architectural specific gpu dialect)

This introduce a new dialect for vendro specific ptx operations. This
also adds the first operation ldmatrix as an example. More operations
will be added in follow up patches.
This new dialect is meant to be a bridge between GPU and Vector
dialectis and NVVM dialect.

This is based on the RFC proposed here:
https://discourse.llvm.org/t/rfc-add-nv-gpu-dialect-hw-specific-extension-of-gpu-dialect-for-nvidia-gpus/61466/8

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

2 years ago[clang-format] Skip preprocessor lines when finding the record lbrace
Arthur Eubanks [Wed, 13 Apr 2022 21:36:30 +0000 (14:36 -0700)]
[clang-format] Skip preprocessor lines when finding the record lbrace

With D117142, we would now format

```
struct A {
#define A
  void f() { a(); }
#endif
};
```

into

```
struct A {
#ifdef A
  void f() {
    a();
  }
#endif
};
```

because we were looking for the record lbrace without skipping preprocess lines.

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

Reviewed By: curdeius, owenpan

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

2 years ago[SVE] Refactor MGATHER lowering for unsupported passthru values.
Paul Walker [Tue, 12 Apr 2022 17:28:51 +0000 (18:28 +0100)]
[SVE] Refactor MGATHER lowering for unsupported passthru values.

Handle unsupported passthru values before lowering the gather to
target specific nodes. This is a simplification that's on the road
to moving more of MGATHER lowering into td based isel.

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

2 years ago[SimplifyCFG] Try to fold switch with single result value and power-of-2 cases to...
chenglin.bi [Thu, 14 Apr 2022 16:10:00 +0000 (00:10 +0800)]
[SimplifyCFG] Try to fold switch with single result value and power-of-2 cases to mask+select

When switch with 2^n cases go to one result, check if the 2^n cases can be covered by n bit masks.
If yes we can use "and condition, ~mask" to simplify the switch

case 0 2 4 6 -> and condition, -7
https://alive2.llvm.org/ce/z/jjH_0N

case 0 2 8 10 -> and condition, -11
https://alive2.llvm.org/ce/z/K7E-2V

case 2 4 8 12 -> and (sub condition, 2), -11
https://alive2.llvm.org/ce/z/CrxbYg

Fix one case of https://github.com/llvm/llvm-project/issues/39957

Reviewed By: spatel

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

2 years ago[flang] Fix combining cases of USE association & generic interfaces
Peter Klausler [Wed, 30 Mar 2022 18:51:50 +0000 (11:51 -0700)]
[flang] Fix combining cases of USE association & generic interfaces

Fortran admits a few ways to have multiple symbols with the
same name in the same scope.  Two of them involve generic
interfaces (from INTERFACE or GENERIC, the syntax doesn't matter);
these are allowed to inhabit a scope with either a derived type or
a subprogram that is also a specific procedure of the generic.
(But not both a derived type and a subprogram; they could not
cohabit a scope anyway, generic or not.)

In cases of USE association, f18 needs to be capable of combining
use-associated generic interfaces with other use-associated entities.
Two generics get merged (this case was nearly correct); a generic
and a derived type can merge into a GenericDetails with a shadowed
derivedType(); and a generic can replace or ignore a use-associated
procedure of the same name so long as that procedure is already
one of its specifics.

Further, these modifications to the use-associated generic
interface must be made to a local copy of the symbol.  The previous
code was messing directly with the symbol in the module's scope.

The fix is basically a reimplementation of the member function
DoAddUse() in name resolution.

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

2 years ago[AArch64] Add mayRaiseFPException to appropriate instructions
John Brawn [Thu, 4 Nov 2021 12:19:12 +0000 (12:19 +0000)]
[AArch64] Add mayRaiseFPException to appropriate instructions

This is mostly handled by adding "let mayRaiseFPException = 1" before
the definition of the relevant instruction classes, but there are a
couple of complications:
 * When we have a multiclass where currently some instantiations are
   of instructions that can raise an exception and others aren't we
   need to split that into two multiclasses, one inheriting from the
   other using a multiclass parameter to enable exceptions.
 * In a couple of places in the globalisel instruction selector we
   need to manually set the NoFPExcept flag. There's also another
   place that looks like it should need it, but that code is never hit
   for those opcodes due to them being handled by the generic
   instruction selector, so I've instead just removed them from the
   switch.

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

2 years ago[AArch64] Adjust aarch64 constrained intrinsics tests and un-XFAIL
John Brawn [Tue, 25 Jan 2022 17:09:44 +0000 (17:09 +0000)]
[AArch64] Adjust aarch64 constrained intrinsics tests and un-XFAIL

Remove the checking of the generated asm, as that's already tested
elsewhere, and adjust some tests that were expecting the wrong
intrinsic to be generated.

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

2 years ago[AArch64] Lowering and legalization of strict FP16
John Brawn [Thu, 9 Dec 2021 12:39:29 +0000 (12:39 +0000)]
[AArch64] Lowering and legalization of strict FP16

For strict FP16 to work correctly needs some changes in lowering and
legalization:
 * SelectionDAGLegalize::PromoteNode was missing handling for some
   strict fp opcodes.
 * Some of the custom lowering of strict fp operations needed to be
   adjusted to work with FP16.
 * Custom lowering needed to be added for round-to-int operations.

With this, and the previous patches for the rest of the strict fp
isel, we can set IsStrictFPEnabled = true.

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

2 years ago[FPEnv][InstSimplify] Fold fsub -0.0, -X ==> X
Kevin P. Neal [Fri, 8 Apr 2022 15:47:54 +0000 (11:47 -0400)]
[FPEnv][InstSimplify] Fold fsub -0.0, -X ==> X

Currently the fsub optimizations in InstSimplify don't know how to fold
-0.0 - (-X) to X when the constrained intrinsics are used. This adds partial
support. The rest of the support will come later with work on the IR
matchers.

This review is split out from D107285.

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

2 years ago[gn build] Port 1fdf952deeb9
LLVM GN Syncbot [Thu, 14 Apr 2022 15:22:09 +0000 (15:22 +0000)]
[gn build] Port 1fdf952deeb9

2 years ago[HLSL] Add Semantic syntax, and SV_GroupIndex
Chris Bieneman [Wed, 30 Mar 2022 19:20:15 +0000 (14:20 -0500)]
[HLSL] Add Semantic syntax, and SV_GroupIndex

HLSL has a language feature called Semantics which get attached to
declarations like attributes and are used in a variety of ways.

One example of semantic use is here with the `SV_GroupIndex` semantic
which, when applied to an input for a compute shader is pre-populated
by the driver with a flattened thread index.

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

# Conflicts:
# clang/include/clang/Basic/Attr.td
# clang/include/clang/Basic/AttrDocs.td

2 years ago[gn build] Port e471ba3d0122
LLVM GN Syncbot [Thu, 14 Apr 2022 14:51:17 +0000 (14:51 +0000)]
[gn build] Port e471ba3d0122

2 years ago[Object] Add binary format for bundling offloading metadata
Joseph Huber [Fri, 25 Mar 2022 15:02:29 +0000 (11:02 -0400)]
[Object] Add binary format for bundling offloading metadata

We need to embed certain metadata along with a binary image when we wish
to perform a device-linking job on it. Currently this metadata was
embedded in the section name of the data itself. This worked, but made
adding new metadata very difficult and didn't work if the user did any
sort of section linking.

This patch introduces a custom binary format for bundling offloading
metadata with a device object file. This binary format is fundamentally
a simple string map table with some additional data and an embedded
image. I decided to use a custom format rather than using an existing
format (ELF, JSON, etc) because of the specialty use-case of this. We
need a simple binary format that can be concatenated without requiring
other external dependencies.

This extension will make it easier to extend the linker wrapper's
capabilties with whatever data is necessary. Eventually this will allow
us to remove all the external arguments passed to the linker wrapper and
embed it directly in the host's linker so device linking behaves exactly
like host linking.

Reviewed By: JonChesterfield

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

2 years ago[OpenMP] Make offloading sections have the SHF_EXCLUDE flag
Joseph Huber [Sat, 2 Apr 2022 21:55:00 +0000 (17:55 -0400)]
[OpenMP] Make offloading sections have the SHF_EXCLUDE flag

Offloading sections can be embedded in the host during codegen via a
section. This section was originally marked as metadata to prevent it
from being loaded, but these sections are completely unused at runtime
so the linker should automatically drop them from the final executable
or shard library. This flag adds support for the SHF_EXCLUDE flag in
target lowering and uses it.

Reviewed By: JonChesterfield, MaskRay

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

2 years ago[flang] Improve appearance of message attachments
Peter Klausler [Fri, 1 Apr 2022 19:46:04 +0000 (12:46 -0700)]
[flang] Improve appearance of message attachments

Error messages can have a list of attachments; these are used to point
to related source locations, supply additional information, and to
encapsulate error messages that were *not* emitted in a given context
to explain why a warning was justified.

This patch adds a message severity ("Because") for that last case,
and extends to AttachTo() API to provide a means for overriding
the severity of an attached message.

Some existing message attachments had their severities adjusted,
now that we're printing them.  And operator==() for Message was
cleaned up while debugging after I noticed that it was recursively
O(N**2) and subject to returning a false positive.

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

2 years ago[libc++] Fix undefined behavior in `std::filebuf`
Fabian Wolff [Thu, 14 Apr 2022 14:17:24 +0000 (16:17 +0200)]
[libc++] Fix undefined behavior in `std::filebuf`

Fixes https://github.com/llvm/llvm-project/issues/49267.
Fixes https://github.com/llvm/llvm-project/issues/49282.
Fixes https://github.com/llvm/llvm-project/issues/49789.

Reviewed By: ldionne

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

2 years ago[AArch64] Move v4i8 concat load lowering to a combine.
David Green [Thu, 14 Apr 2022 14:19:33 +0000 (15:19 +0100)]
[AArch64] Move v4i8 concat load lowering to a combine.

The existing code was not updating the uses of loads that it recreated,
leading to incorrect chains which could break the ordering between
nodes. This moves the code to a combine instead, and makes sure we
update the chain references. This does mean it happens earlier -
potentially before the concats are simplified. This can lead to
inefficiencies in the codegen, which will be fixed in followups.

2 years ago[NVPTX] Fix barrier.ll LIT test
Andrew Savonichev [Sun, 10 Apr 2022 19:33:48 +0000 (22:33 +0300)]
[NVPTX] Fix barrier.ll LIT test

The second parameter should be a multiple of the warp size (32).

PTX ISA spec, s9.7.12.1. Parallel Synchronization and Communication
Instructions: bar, barrier

barrier.sync{.aligned}      a{, b};

Operand b specifies the number of threads participating in the
barrier. If no thread count is specified, all threads in the CTA
participate in the barrier. When specifying a thread count, the value
must be a multiple of the warp size.

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

2 years ago[NVPTX] Avoid dots in global names
Andrew Savonichev [Thu, 31 Mar 2022 17:03:30 +0000 (20:03 +0300)]
[NVPTX] Avoid dots in global names

It seems that ptxas cannot parse them:
ptxas fatal: Parsing error near '.2': syntax error

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

2 years ago[NVPTX] .attribute(.managed) is only supported for sm_30 and PTX 4.0
Andrew Savonichev [Thu, 31 Mar 2022 20:50:34 +0000 (23:50 +0300)]
[NVPTX] .attribute(.managed) is only supported for sm_30 and PTX 4.0

PTX ISA spec, s5.4.8. Variable Attribute Directive: .attribute

PTX ISA Notes
Introduced in PTX ISA version 4.0.

Target ISA Notes
.managed attribute requires sm_30 or higher.

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

2 years ago[NVPTX] shfl.sync is introduced in PTX 6.0
Andrew Savonichev [Thu, 31 Mar 2022 18:16:30 +0000 (21:16 +0300)]
[NVPTX] shfl.sync is introduced in PTX 6.0

PTX ISA spec, s9.7.8.6. Data Movement and Conversion Instructions:
shfl.sync

PTX ISA Notes
Introduced in PTX ISA version 6.0.

Target ISA Notes
Requires sm_30 or higher.

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

2 years ago[NVPTX] 64-bit atom.{and,or,xor,min,max} require sm_32 or higher
Andrew Savonichev [Thu, 31 Mar 2022 16:30:41 +0000 (19:30 +0300)]
[NVPTX] 64-bit atom.{and,or,xor,min,max} require sm_32 or higher

PTX ISA spec, s9.7.12.4. Parallel Synchronization and Communication
Instructions: atom

Target ISA Notes
64-bit atom.{and,or,xor,min,max} require sm_32 or higher.

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

2 years ago[gn build] Port 58d9ab70aef3
LLVM GN Syncbot [Thu, 14 Apr 2022 13:37:28 +0000 (13:37 +0000)]
[gn build] Port 58d9ab70aef3

2 years ago[libc++][ranges] Implement ranges::minmax and ranges::minmax_element
Nikolas Klauser [Wed, 13 Apr 2022 20:59:09 +0000 (22:59 +0200)]
[libc++][ranges] Implement ranges::minmax and ranges::minmax_element

Reviewed By: var-const, #libc, ldionne

Spies: sstefan1, ldionne, BRevzin, libcxx-commits, mgorny

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

2 years ago[flang] Fix intrinsic interface for DIMAG/DCONJG
PeixinQiao [Thu, 14 Apr 2022 13:34:00 +0000 (21:34 +0800)]
[flang] Fix intrinsic interface for DIMAG/DCONJG

The intrinsics DREAL, DIMAG, and DCONJG are from Fortran 77 extensions.
For DREAL, the type of argument is extended to any complex. For DIMAG
and DCONJG, the type of argument for them should be complex(8). For DIMAG,
the result type should be real(8). For DCONJG, the result type should be
complex(8). Fix the intrinsic interface for them and add test cases for
the semantic checks and the lowering.

Reviewed By: Jean Perier

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

2 years ago[flang] Fix float-number representation bug
PeixinQiao [Thu, 14 Apr 2022 13:28:30 +0000 (21:28 +0800)]
[flang] Fix float-number representation bug

The float number is represented as (-1)^s * 1.f * 2^(-127) for 32-bit,
where s is the signed flag, f is the mantissa. When the exponent bits
are all zeros, the float number is represented as (-1)^s * 0.f *2^(-126)
for 32-bit, in which case, the intPart is '0'.

Reviewed By: Jean Perier

https://reviews.llvm.org/D123673

2 years ago[mlir] fix compiler warnings
Alex Zinenko [Thu, 14 Apr 2022 13:25:42 +0000 (15:25 +0200)]
[mlir] fix compiler warnings

-Wsign-compare and -Wunsued-value in the recently introduced code.

2 years ago[gn build] Port dd47ab750b58
LLVM GN Syncbot [Thu, 14 Apr 2022 13:21:19 +0000 (13:21 +0000)]
[gn build] Port dd47ab750b58

2 years agoRevert "[clang-tidy] Add portability-std-allocator-const check"
Nico Weber [Thu, 14 Apr 2022 13:20:51 +0000 (09:20 -0400)]
Revert "[clang-tidy] Add portability-std-allocator-const check"

This reverts commit 73da7eed8fac84c9005518740f12d58389998d95.
Breaks check-clang-tools on Windows, see comment on
https://reviews.llvm.org/D123655

2 years ago[gn build] Port 73da7eed8fac
LLVM GN Syncbot [Thu, 14 Apr 2022 13:06:13 +0000 (13:06 +0000)]
[gn build] Port 73da7eed8fac

2 years agoRevert "[gn build] Port 73da7eed8fac"
Nico Weber [Thu, 14 Apr 2022 13:05:11 +0000 (09:05 -0400)]
Revert "[gn build] Port 73da7eed8fac"

This reverts commit bd4463bebfe8545c8e626fc7828beac3509b656f.
Breaks check-clang-tools on Windows, see comment on
https://reviews.llvm.org/D123655

2 years ago[mlir][vector] Cast away leading one dims for insert ops
Lei Zhang [Thu, 14 Apr 2022 12:56:47 +0000 (08:56 -0400)]
[mlir][vector] Cast away leading one dims for insert ops

Reviewed By: ThomasRaoux

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

2 years ago[mlir][vector] Fold splat constant transpose
Lei Zhang [Thu, 14 Apr 2022 12:51:18 +0000 (08:51 -0400)]
[mlir][vector] Fold splat constant transpose

Reviewed By: ThomasRaoux

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

2 years ago[PS4] NFC refactor of PS4 toolchain class, prep for PS5
Paul Robinson [Mon, 11 Apr 2022 19:06:41 +0000 (12:06 -0700)]
[PS4] NFC refactor of PS4 toolchain class, prep for PS5

2 years ago[X86] Adjust fsetcc/fmin/fmax costs to match SoG (Issue #54889)
Simon Pilgrim [Thu, 14 Apr 2022 12:27:27 +0000 (13:27 +0100)]
[X86] Adjust fsetcc/fmin/fmax costs to match SoG (Issue #54889)

znver1/2 models were incorrectly modelling these as 3 cycle latency instructions on the wrong pipe and znver1 ymm variants also require double pumping.

Now matches AMD SoG, Agner and instlatx64 numbers.

Thanks to @fabian-r for the report

2 years ago[Clang][AArch64][SVE] Add shift operators for SVE vector types
David Truby [Thu, 7 Apr 2022 12:56:37 +0000 (13:56 +0100)]
[Clang][AArch64][SVE] Add shift operators for SVE vector types

This patch enables shift operators on SVE vector types, as well as
supporting vector-scalar shift operations.
Shifts by a scalar that is wider than the contained type in the
vector are permitted but as in the C standard if the value is larger
than the width of the type the behavior is undefined.

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

2 years ago[Clang][AArch64][SVE] Allow subscript operator for SVE types
David Truby [Wed, 30 Mar 2022 15:18:07 +0000 (16:18 +0100)]
[Clang][AArch64][SVE] Allow subscript operator for SVE types

Undefined behaviour is just passed on to extract_element when the
index is out of bounds. Subscript on svbool_t is not allowed as
this doesn't really have meaningful semantics.

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

2 years ago[mlir] Introduce Transform dialect
Alex Zinenko [Thu, 14 Apr 2022 11:16:48 +0000 (13:16 +0200)]
[mlir] Introduce Transform dialect

This dialect provides operations that can be used to control transformation of
the IR using a different portion of the IR. It refers to the IR being
transformed as payload IR, and to the IR guiding the transformation as
transform IR.

The main use case for this dialect is orchestrating fine-grain transformations
on individual operations or sets thereof. For example, it may involve finding
loop-like operations with specific properties (e.g., large size) in the payload
IR, applying loop tiling to those and only those operations, and then applying
loop unrolling to the inner loops produced by the previous transformations. As
such, it is not intended as a replacement for the pass infrastructure, nor for
the pattern rewriting infrastructure. In the most common case, the transform IR
will be processed and applied to payload IR by a pass. Transformations
expressed by the transform dialect may be implemented using the pattern
infrastructure or any other relevant MLIR component.

This dialect is designed to be extensible, that is, clients of this dialect are
allowed to inject additional operations into this dialect using the newly
introduced in this patch `TransformDialectExtension` mechanism. This allows the
dialect to avoid a dependency on the implementation of the transformation as
well as to avoid introducing dialect-specific transform dialects.

See https://discourse.llvm.org/t/rfc-interfaces-and-dialects-for-precise-ir-transformation-control/60927.

Reviewed By: nicolasvasilache, Mogball, rriddle

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

2 years ago[mlir] Split intrinsics out of LLVMOps.td
Alex Zinenko [Wed, 13 Apr 2022 16:29:47 +0000 (18:29 +0200)]
[mlir] Split intrinsics out of LLVMOps.td

Move the operations that correspond to LLVM IR intrinsics in a separate .td
file. This makes it easier to maintain the intrinsics and decreases the compile
time of LLVMDialect.cpp by ~25%.

Depends On D123310

Reviewed By: wsmoses, jacquesguan

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

2 years ago[mlir] initial support for opaque pointers in the LLVM dialect
Alex Zinenko [Wed, 13 Apr 2022 16:29:17 +0000 (18:29 +0200)]
[mlir] initial support for opaque pointers in the LLVM dialect

LLVM IR has introduced and is moving forward with the concept of opaque
pointers, i.e. pointer types that are not carrying around the pointee type.
Instead, memory-related operations indicate the type of the data being accessed
through the opaque pointer. Introduce the initial support for opaque pointers
in the LLVM dialect:

  - `LLVMPointerType` to support omitting the element type;
  - alloca/load/store/gep to support opaque pointers in their operands and
    results; this requires alloca and gep to store the element type as an
    attribute;
  - memory-related intrinsics to support opaque pointers in their operands;
  - translation to LLVM IR for the ops above is no longer using methods
    deprecated in LLVM API due to the introduction of opaque pointers.

Unlike LLVM IR, MLIR can afford to support both opaque and non-opaque pointers
at the same time and simplify the transition. Translation to LLVM IR of MLIR
that involves opaque pointers requires the LLVMContext to be configured to
always use opaque pointers.

Reviewed By: wsmoses

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

2 years ago[SVE] Add support for non-element-type sized scaling when lowering MGATHER/MSCATTER.
Paul Walker [Wed, 13 Apr 2022 00:14:40 +0000 (01:14 +0100)]
[SVE] Add support for non-element-type sized scaling when lowering MGATHER/MSCATTER.

The lowering code did not use the scale operand of MGATHER/MSCATTER
nodes, but instead assumed scaled indices were always scaled based
on the element type of the memory type. This patch adds the missing
support by rewritting the nodes as unscaled variants.

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

2 years ago[VPlan] Turn external defs in Value -> VPValue mapping.
Florian Hahn [Thu, 14 Apr 2022 10:03:08 +0000 (12:03 +0200)]
[VPlan] Turn external defs in Value -> VPValue mapping.

This addresses an existing TODO by keeping a mapping of external IR
Value * definitions wrapped in VPValues for use in a VPlan.

Reviewed By: Ayal

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

2 years ago[flang] Fix ICE for sqrt(0.0) evaluation
Mike Kashkarov [Tue, 5 Apr 2022 14:09:54 +0000 (17:09 +0300)]
[flang] Fix ICE for sqrt(0.0) evaluation

    During real range reduction to [0.5, 4) with

           SQRT(2**(2a) * x) = SQRT(2**(2a)) * SQRT(x) = 2**a * SQRT(x)

    we fall into inf. recursion if IsZero() == true.

    Explicitly handle SQRT(0.0) instead of additional checks during folding. Also
    add helpers for +0.0/-0.0 generation to clean up a bit.

Reviewed By: klausler

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

2 years ago[flang] Do not ICE on out-of-range data statement designator
Mike Kashkarov [Tue, 5 Apr 2022 14:09:43 +0000 (17:09 +0300)]
[flang] Do not ICE on out-of-range data statement designator

Print error message instead of assert trigger.

Reviewed By: klausler

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

2 years ago[flang] Allow IMPLICIT NONE(EXTERNAL) with GenericDetails
Mike Kashkarov [Mon, 28 Feb 2022 23:16:47 +0000 (02:16 +0300)]
[flang] Allow IMPLICIT NONE(EXTERNAL) with GenericDetails

Restrictions of IMPLICIT NONE(EXTERNAL) prohibits usage of c_associated from
iso_c_binding (with explicit interface) without external definiton - relax
associated check.

Reviewed By: klausler

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

2 years agoApply clang-tidy fixes for llvm-qualified-auto in VectorTransforms.cpp (NFC)
Mehdi Amini [Sun, 3 Apr 2022 23:37:05 +0000 (23:37 +0000)]
Apply clang-tidy fixes for llvm-qualified-auto in VectorTransforms.cpp (NFC)

2 years agoApply clang-tidy fixes for performance-for-range-copy in SCF.cpp (NFC)
Mehdi Amini [Sun, 3 Apr 2022 23:19:13 +0000 (23:19 +0000)]
Apply clang-tidy fixes for performance-for-range-copy in SCF.cpp (NFC)

2 years ago[flang][driver] Add support for `-mmlir`
Andrzej Warzynski [Thu, 7 Apr 2022 09:47:23 +0000 (09:47 +0000)]
[flang][driver] Add support for `-mmlir`

The semantics of `-mmlir` are identical to `-mllvm`. The only notable
difference is that `-mmlir` options should be forwarded to MLIR rather
than LLVM.

Note that MLIR llvm::cl options are lazily constructed on demand (see
the definition of options in PassManagerOptions.cpp). This means that:
  * MLIR global options are only visible when explicitly initialised and
    displayed only when using `-mmlir --help`,
  * Flang and LLVM global options are always visible and displayed when
    using either `-mllvm -help` or `-mmlir --help`.

In other words, `-mmlir --help` is a superset of `-mllvm --help`. This is not
ideal, but we'd need to refactor all option definitions in Flang and
LLVM to improve this. I suggesting leaving this for later.

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

2 years ago[gn build] Port 6ba1b9075dc1
LLVM GN Syncbot [Thu, 14 Apr 2022 09:08:24 +0000 (09:08 +0000)]
[gn build] Port 6ba1b9075dc1

2 years agoReland "[AST] Add a new TemplateKind for template decls found via a using decl.""
Haojian Wu [Tue, 12 Apr 2022 13:51:16 +0000 (15:51 +0200)]
Reland "[AST] Add a new TemplateKind for template decls found via a using decl.""

This is the template version of https://reviews.llvm.org/D114251.

This patch introduces a new template name kind (UsingTemplateName). The
UsingTemplateName stores the found using-shadow decl (and underlying
template can be retrieved from the using-shadow decl). With the new
template name, we can be able to find the using decl that a template
typeloc (e.g. TemplateSpecializationTypeLoc) found its underlying template,
which is useful for tooling use cases (include cleaner etc).

This patch merely focuses on adding the node to the AST.

Next steps:
- support using-decl in qualified template name;
- update the clangd and other tools to use this new node;
- add ast matchers for matching different kinds of template names;

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

2 years ago[AMDGPU] Remove redundand RequiredAlignment assignment. NFCI.
Stanislav Mekhanoshin [Wed, 13 Apr 2022 18:17:10 +0000 (11:17 -0700)]
[AMDGPU] Remove redundand RequiredAlignment assignment. NFCI.

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

2 years ago[flang] Fix DYLIB builds
Andrzej Warzynski [Thu, 14 Apr 2022 08:40:02 +0000 (08:40 +0000)]
[flang] Fix DYLIB builds

https://reviews.llvm.org/D123211 broke builds that set both
`LLVM_BUILD_LLVM_DYLIB` and `LLVM_LINK_LLVM_DYLIB` (see [1]). This patch
fixes that.

The build failure was caused by the fact that the LLVMPasses library,
which is an LLVM "component", was listed directly as link-time
dependency. Instead, one should use `LINK_COMPONENTS` in CMake files. I
made an identical mistake recently and then subsequently fixed it in
https://reviews.llvm.org/D121461 - please visit that revision for more
detail.

I'm merging this without a review. The change is straightforward, we
recently discussed it and I was able to confirm locally that it fixes
the build issue.

[1] https://lab.llvm.org/buildbot/#/builders/177/builds/4619

2 years ago[clang][lex] NFCI: Use FileEntryRef in PPCallbacks::InclusionDirective()
Jan Svoboda [Mon, 11 Apr 2022 10:10:05 +0000 (12:10 +0200)]
[clang][lex] NFCI: Use FileEntryRef in PPCallbacks::InclusionDirective()

This patch changes type of the `File` parameter in `PPCallbacks::InclusionDirective()` from `const FileEntry *` to `Optional<FileEntryRef>`.

With the API change in place, this patch then removes some uses of the deprecated `FileEntry::getName()` (e.g. in `DependencyGraph.cpp` and `ModuleDependencyCollector.cpp`).

Reviewed By: dexonsmith, bnbarham

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

2 years ago[AMDGPU] Add a test for flat scratch SVS addressing
Jay Foad [Mon, 11 Apr 2022 15:11:43 +0000 (16:11 +0100)]
[AMDGPU] Add a test for flat scratch SVS addressing

2 years agoRevert "[AArch64] Async unwind - Adjust unwind info in AArch64LoadStoreOptimizer"
Momchil Velikov [Thu, 14 Apr 2022 08:33:40 +0000 (09:33 +0100)]
Revert "[AArch64] Async unwind - Adjust unwind info in AArch64LoadStoreOptimizer"

This reverts commit ecbf32dd88fc91b4fe709dc14bb3493dda6e8854.

It's possible this patch is the reason for an asertion failure
`!NodePtr->isKnownSentinel()` in `AArch64LoadStoreOpt::mergeUpdateInsn`
(https://lab.llvm.org/buildbot/#/builders/185/builds/1555) reverting while I
investigate.

2 years ago[RISCV] Remove sext_inreg+riscv_grev/riscv_gorc isel patterns
Lian Wang [Tue, 12 Apr 2022 03:42:29 +0000 (03:42 +0000)]
[RISCV] Remove sext_inreg+riscv_grev/riscv_gorc isel patterns

Reviewed By: craig.topper

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

2 years ago[RISCV][NFC] Refactor patterns for Multiply Add instructions
Lian Wang [Fri, 8 Apr 2022 09:28:21 +0000 (09:28 +0000)]
[RISCV][NFC] Refactor patterns for Multiply Add instructions

Reviewed By: craig.topper, frasercrmck

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

2 years ago[MLIR] Fix missing return statement warning in PatternMatch.h
Uday Bondhugula [Thu, 14 Apr 2022 02:30:50 +0000 (08:00 +0530)]
[MLIR] Fix missing return statement warning in PatternMatch.h

Fix missing return statement warning in PatternMatch.h. NFC.

```
mlir/include/mlir/IR/PatternMatch.h:983:3: warning: no return statement in
function returning non-void [-Wreturn-type]
```

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

2 years ago[AMDGPU][NFC] Organize code around reserving VGPR32 for AGPR copy.
hsmahesha [Thu, 14 Apr 2022 07:21:02 +0000 (12:51 +0530)]
[AMDGPU][NFC] Organize code around reserving VGPR32 for AGPR copy.

This is an NFC patch in preparation to fix a bug related to always
reserving VGPR32 for AGPR copy.

Reviewed By: rampitec

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

2 years ago[AMDGPU] Try to avoid inserting duplicate s_inst_prefetch
Carl Ritson [Thu, 14 Apr 2022 07:06:17 +0000 (16:06 +0900)]
[AMDGPU] Try to avoid inserting duplicate s_inst_prefetch

Check for existing s_inst_prefetch instructions when
configuring prefetches during loop alignment.

Reviewed By: rampitec, foad

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

2 years ago[MLIR][GPU] Add canonicalization patterns for folding simple gpu.wait ops.
Arnab Dutta [Thu, 14 Apr 2022 06:00:07 +0000 (11:30 +0530)]
[MLIR][GPU] Add canonicalization patterns for folding simple gpu.wait ops.

* Fold away redundant %t = gpu.wait async + gpu.wait [%t] pairs.

* Fold away %t = gpu.wait async ... ops when %t has no uses.

* Fold away gpu.wait [] ops.

* In case of %t1 = gpu.wait async [%t0], replace all uses of %t1
  with %t0.

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

2 years agoRevert "[sanitizer] Don't run malloc hooks for stacktraces"
Vitaly Buka [Thu, 14 Apr 2022 06:42:50 +0000 (23:42 -0700)]
Revert "[sanitizer] Don't run malloc hooks for stacktraces"

Msan crashes on clang-s390x-linux bot

This reverts commit d3531fc7f0053a7fe68317521ee6491da6e36733.

2 years ago[Driver] Sort Generic_GCC::IsIntegratedAssemblerDefault, NFC
Brad Smith [Thu, 14 Apr 2022 06:38:08 +0000 (02:38 -0400)]
[Driver] Sort Generic_GCC::IsIntegratedAssemblerDefault, NFC

2 years ago[Driver] Fix -fpascal-strings on Darwin
Fangrui Song [Thu, 14 Apr 2022 06:00:57 +0000 (23:00 -0700)]
[Driver] Fix -fpascal-strings on Darwin

2 years ago[gn build] Port 73da7eed8fac
LLVM GN Syncbot [Thu, 14 Apr 2022 05:36:21 +0000 (05:36 +0000)]
[gn build] Port 73da7eed8fac

2 years ago[clang-tidy] Add portability-std-allocator-const check
Fangrui Song [Thu, 14 Apr 2022 05:35:11 +0000 (22:35 -0700)]
[clang-tidy] Add portability-std-allocator-const check

Report use of ``std::vector<const T>`` (and similar containers of const
elements). These are now allowed in standard C++ due to undefined
``std::allocator<const T>``. They do not compile with libstdc++ or MSVC.
Future libc++ will remove the extension (D120996).
See docs/clang-tidy/checks/portability-std-allocator-const.rst for detail.

I have attempted clean-up in a large code base. Here are some statistics:

* 98% are related to the container `std::vector`, among `deque/forward_list/list/multiset/queue/set/stack/vector`.
* 24% are related to `std::vector<const std::string>`.
* Both `std::vector<const absl::string_view>` and `std::vector<const int>` contribute 2%. The other contributors spread over various class types.

The check can be useful to other large code bases and may serve as an example
for future libc++ strictness improvement.

Reviewed By: sammccall

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

2 years agoLowerSwitch: Avoid inserting NewDefault block
Ruiling Song [Tue, 12 Apr 2022 03:25:33 +0000 (11:25 +0800)]
LowerSwitch: Avoid inserting NewDefault block

The NewDefault was used to simplify the updating of PHI nodes, but it
causes some inefficiency for target that will run structurizer later. For
example, for a simple two-case switch, the extra NewDefault is causing
unstructured CFG like:

        O
       / \
      O   O
     / \ / \
    C1  ND C2
     \  |  /
      \ | /
        D

The change is to avoid the ND(NewDefault) block, that is we will get a
structured CFG for above example like:

        O
       / \
      /   \
     O     O
    / \   / \
   C1  \ /  C2
    \-> D <-/

The IR change introduced by this patch should be trivial to other targets,
so I am doing this unconditionally.

Fall-through among the cases will also cause unstructured CFG, but it need
more work and will be addressed in a separate change.

Reviewed by: arsenm

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

2 years agotest: Don't depend on behavior of switch lower in one test. NFC
Ruiling Song [Tue, 12 Apr 2022 12:50:44 +0000 (20:50 +0800)]
test: Don't depend on behavior of switch lower in one test. NFC

This is a preliminary change to update the test so that it does not
depend on how switch-case will be lowered. The following change will
lower switch-case more optimally that will make the test no longer
valid.

Reviewed by: arsenm

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

2 years ago[Driver] Simplify some hasFlag patterns with addOptInFlag/addOptOutFlag. NFC
Fangrui Song [Thu, 14 Apr 2022 05:00:44 +0000 (22:00 -0700)]
[Driver] Simplify some hasFlag patterns with addOptInFlag/addOptOutFlag. NFC

2 years ago[flang] Respect left tab limit with Tn editing after ADVANCE='NO'
Peter Klausler [Thu, 31 Mar 2022 23:46:02 +0000 (16:46 -0700)]
[flang] Respect left tab limit with Tn editing after ADVANCE='NO'

Correct the implementation of non-advancing I/O after some testing
to ensure that T tab edit descriptors are not allowed to back up
into positions of a record prior to where it stood at the beginning
of the I/O statement.

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

2 years ago[mlir] Introduce ml_program dialect.
Stella Laurenzo [Thu, 14 Apr 2022 03:16:04 +0000 (20:16 -0700)]
[mlir] Introduce ml_program dialect.

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

2 years agoRevert "[clang] Implement Change scope of lambda trailing-return-type"
Richard Smith [Thu, 14 Apr 2022 04:34:08 +0000 (21:34 -0700)]
Revert "[clang] Implement Change scope of lambda trailing-return-type"

This reverts commit c729d5be781a8e80137c11ab28aa14d9ace148db.

This change breaks thread safety annotations on lambdas.

2 years agoRISCV] Add clang builtins for CLZ instruction.
joker881 [Wed, 13 Apr 2022 12:38:36 +0000 (20:38 +0800)]
RISCV] Add clang builtins for CLZ instruction.

add intrinsic for CLZ

Reviewed By: craig.topper

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

2 years ago[Darwin][ASan][Sanitizer] Fixes Sanitizer NonUnique Identifier to Account for Mac...
Blue Gaston [Wed, 13 Apr 2022 20:17:05 +0000 (13:17 -0700)]
[Darwin][ASan][Sanitizer] Fixes Sanitizer NonUnique Identifier to Account for Mac arm64 architectures.

    Current check assumes iOS as the only Apple devices running arm64.
    ```#if SANITIZER_MAC && !(defined(__arm64__) && SANITIZER_IOS)```
    Stops Apple Silicon from being flagged as requiring unique RTTI.
    This introduced unexpected behavior within the sanitizer.

    rdar://91446703

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

2 years ago[NFC] Generically resolve body in FunctionOpInterface verifyBody.
Stella Laurenzo [Thu, 14 Apr 2022 03:13:18 +0000 (20:13 -0700)]
[NFC] Generically resolve body in FunctionOpInterface verifyBody.

Since the actual implementation class can arbitrarily shadow parts of the FunctionOpInterface exported API, access the body generically instead of via the use of the interface being defined.

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

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

2 years ago[Clang] Move Hexagon / VE IAS enabling to Generic_GCC::IsIntegratedAssemblerDefault...
Brad Smith [Thu, 14 Apr 2022 03:53:25 +0000 (23:53 -0400)]
[Clang] Move Hexagon / VE IAS enabling to Generic_GCC::IsIntegratedAssemblerDefault, NFC

Reviewed By: MaskRay

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

2 years ago[cmake] Loosen multi-distribution restrictions
Shoaib Meenai [Thu, 14 Apr 2022 01:28:27 +0000 (18:28 -0700)]
[cmake] Loosen multi-distribution restrictions

We've found that there are cases where it's useful to be able to include
the same target in multiple distributions (e.g. if you want a
distribution that's a superset of another distribution, for convenience
purposes), and that there are cases where the distribution of a target
and its umbrella can legitimately differ (e.g. the LTO library would
commonly be distributed alongside your tools, but it also falls under
the llvm-libraries umbrella, which would commonly be distributed
separately). Relax the restrictions while providing an option to restore
them (which is mostly useful to ensure you aren't accidentally placing
targets in the wrong distributions).

There could be further refinements here (e.g. excluding a target from an
umbrella if it's explicitly included in some other distribution, or
having variables to control which targets are allowed to be duplicated
or placed in a separate distribution than their umbrellas), but we can
punt on those until there's an actual need.

2 years ago[MLIR][Presburger] change some `push_back`s to `emplace_back`s
Arjun P [Thu, 14 Apr 2022 02:20:17 +0000 (03:20 +0100)]
[MLIR][Presburger] change some `push_back`s to `emplace_back`s

2 years ago[MLIR][Presburger] change some post-increments/decrements to pre-increments/decrements
Arjun P [Thu, 14 Apr 2022 02:19:03 +0000 (03:19 +0100)]
[MLIR][Presburger] change some post-increments/decrements to pre-increments/decrements

2 years ago[RISCV][NFC] Use addExpr() instead of createExpr()
wangpc [Thu, 14 Apr 2022 02:47:08 +0000 (10:47 +0800)]
[RISCV][NFC] Use addExpr() instead of createExpr()

It seems to be neater.

Reviewed By: asb

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

2 years ago[HWASan] symbolize: use buildid index for locals.
Florian Mayer [Tue, 12 Apr 2022 23:25:40 +0000 (16:25 -0700)]
[HWASan] symbolize: use buildid index for locals.

Reviewed By: eugenis

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

2 years ago[flang] Error handling for out-of-range CASE values
Peter Klausler [Thu, 31 Mar 2022 22:59:27 +0000 (15:59 -0700)]
[flang] Error handling for out-of-range CASE values

Catch and nicely describe errors in CASE range values
that are out of range for the type of the SELECT CASE.

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