platform/upstream/llvm.git
20 months ago[VP] Reorder is_int_min_poison/is_zero_poison operand before mask for vp.abs/ctlz...
Yeting Kuo [Wed, 22 Feb 2023 06:50:11 +0000 (14:50 +0800)]
[VP] Reorder is_int_min_poison/is_zero_poison operand before mask for vp.abs/ctlz/cttz.

The patch ensures last two operands of vp.abs/ctlz/cttz are mask and evl.

Reviewed By: craig.topper

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

20 months agoRevert "[NFC] Make FPClassTest a bitmask enumeration"
Serge Pavlov [Thu, 23 Feb 2023 05:53:27 +0000 (12:53 +0700)]
Revert "[NFC] Make FPClassTest a bitmask enumeration"

This reverts commit e7613c1d9b259bdf2b0b06b4169d9a10dd553406.

GCC issues an error:

In file included from /home/buildbot/as-builder-4/lld-x86_64-ubuntu-fast/llvm-project/llvm/unittests/ADT/BitmaskEnumTest.cpp:9:
/home/buildbot/as-builder-4/lld-x86_64-ubuntu-fast/llvm-project/llvm/include/llvm/ADT/BitmaskEnum.h:66:22: error: explicit specialization of template<class E, class Enable> struct llvm::is_bitmask_enum outside its namespace must use a nested-name-specifier [-fpermissive]
   66 |   template <> struct is_bitmask_enum<Enum> : std::true_type {};                \
      |                      ^~~~~~~~~~~~~~~~~~~~~
/home/buildbot/as-builder-4/lld-x86_64-ubuntu-fast/llvm-project/llvm/unittests/ADT/BitmaskEnumTest.cpp:30:1: note: in expansion of macro LLVM_DECLARE_ENUM_AS_BITMASK
   30 | LLVM_DECLARE_ENUM_AS_BITMASK(Flags2, V4);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

20 months ago[NFC] Make FPClassTest a bitmask enumeration
Serge Pavlov [Wed, 22 Feb 2023 07:20:04 +0000 (14:20 +0700)]
[NFC] Make FPClassTest a bitmask enumeration

This is recommit of 2e416cdd52, reverted in 8555ab2fcd, because GCC
complains on extra qualification. The macro LLVM_DECLARE_ENUM_AS_BITMASK
does not specify llvm:: anymore, so the macro must occur in the namespace
llvm. Documentation updated accordingly. The original commit message is below.

With this change bitwise operations are allowed for FPClassTest
enumeration, it must simplify using this type. Also some functions
changed to get argument of type FPClassTest instead of unsigned.

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

20 months ago[OpenMP] Improve LIT tests on composite target constructs
Animesh Kumar [Mon, 20 Feb 2023 09:26:28 +0000 (14:56 +0530)]
[OpenMP] Improve LIT tests on composite target constructs

This commit improves the "target_teams_distribute_paralle
l_for_simd_codegen.cpp" and "target_teams_distribute_redu
ction_codegen.cpp" tests based upon some of the execution
tests present in the SOLLVE tests. Based on SOLLVE, a new
test "target_task_affinity_codegen.cpp" is also being
added. These tests are required to be added because the
existing tests do not test the combination of directives
these will be testing.

Link to SOLLVE page: https://github.com/SOLLVE/sollve_vv

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

20 months ago[TextAPI] Add support for TBDv5 Files to nm & tapi-diff
Cyndy Ishida [Thu, 23 Feb 2023 01:13:14 +0000 (17:13 -0800)]
[TextAPI] Add support for TBDv5 Files to nm & tapi-diff

This includes handling of new attributes for symbols & rpath.
In the event that an older format file is compared to tbd_v5, ignore these new attributes.

Reviewed By: ributzka

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

20 months ago[BOLT][X86][NFC] Simplify the code of X86MCPlusBuilder::getAliasSized
Shengchen Kan [Wed, 22 Feb 2023 11:39:29 +0000 (19:39 +0800)]
[BOLT][X86][NFC] Simplify the code of X86MCPlusBuilder::getAliasSized

Reviewed By: Amir

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

20 months ago[MC][CodeGen] Define R_RISCV_PLT32 and lower dso_local_equivalent to it
Leonard Chan [Thu, 23 Feb 2023 01:26:27 +0000 (01:26 +0000)]
[MC][CodeGen] Define R_RISCV_PLT32 and lower dso_local_equivalent to it

This introduces R_RISCV_PLT32, PC-relative data relocation that takes
the 32-bit relative offset to a function or its PLT entry from its
relocation location.

This is needed to support relative vtables on RISCV.

Github PR: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/363

The lld handling of this reloc is D143115.

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

20 months ago[LogicCombine] Restore the logic-combine.ll to before optimzed; NFC
chenglin.bi [Thu, 23 Feb 2023 01:00:25 +0000 (09:00 +0800)]
[LogicCombine] Restore the logic-combine.ll to before optimzed; NFC

20 months ago[LogicCombine] Rename test file complex-logic.ll to logic-combine.ll; NFC
chenglin.bi [Thu, 23 Feb 2023 00:56:55 +0000 (08:56 +0800)]
[LogicCombine] Rename test file complex-logic.ll to logic-combine.ll; NFC

20 months ago[bazel] Remove unused dependency on libxml2
Aaron Siddhartha Mondal [Thu, 23 Feb 2023 00:52:02 +0000 (01:52 +0100)]
[bazel] Remove unused dependency on libxml2

The Bazel configs don't set `LLVM_ENABLE_LIBXML2`, so this was never usable to
begin with.

On systems without static `libxml2.a` this made `lld` runtime-dependent on an
unused, non-hermetic `libxml2.so`.

Reviewed By: MaskRay, GMNGeoffrey

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

20 months ago[libc] Prevent printf index mode crashes
Michael Jones [Fri, 10 Feb 2023 22:36:30 +0000 (14:36 -0800)]
[libc] Prevent printf index mode crashes

The posix standard defines an alternate mode for printf where the
conversions also have an index that describes which argument to select.
Due to how variadic arguments work in C, to reach the nth argument all
n-1 previous arguments must be read with their correct types. If the
format string does not specify the types for a continuous set of
arguments, then the arguments after the discontinuity cannot be safely
read. This patch causes all conversions requesting an argument that
comes after a gap be treated as raw (i.e. the conversion string is
printed literally).

Reviewed By: sivachandra

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

20 months ago[InstCombine] add one-use check to prevent creating an instruction in shuffle-of...
Sanjay Patel [Thu, 23 Feb 2023 00:10:12 +0000 (19:10 -0500)]
[InstCombine] add one-use check to prevent creating an instruction in shuffle-of-binop

This fold was added with https://reviews.llvm.org/D135876 ,
but we missed the one-use check.

This might be the root cause for issue #60632.

20 months ago[InstCombine] add test for splat-of-binop; NFC
Sanjay Patel [Wed, 22 Feb 2023 23:28:00 +0000 (18:28 -0500)]
[InstCombine] add test for splat-of-binop; NFC

This shows a missing extra use check.

20 months ago[mlir] Partially revert removal of old `fold` method
Markus Böck [Wed, 22 Feb 2023 23:06:21 +0000 (00:06 +0100)]
[mlir] Partially revert removal of old `fold` method

Mehdi noted in https://reviews.llvm.org/D144391 that given the low cost of keeping the old `fold` method signature working and the difficulty of writing a `FoldAdaptor` oneself, it'd be nice to keep the support for the sake of Ops written manually in C++.
This patch therefore partially reverts the removal of the old `fold` method by still allowing the old signature to be used. The active use of it is still discouraged and ODS will always generate the new method using `FoldAdaptor`s.

I'd also like to note that the previous ought to have broken some manually defined `fold` methods in-tree that are defined here: https://github.com/llvm/llvm-project/blob/23bcd6b86271f1c219a69183a5d90654faca64b8/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h#L245 It seems like these are not part of the regressions tests however...

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

20 months ago[llvm][TextAPI] Clean up minor bugs in YAML TextStub
Cyndy Ishida [Wed, 22 Feb 2023 21:43:04 +0000 (13:43 -0800)]
[llvm][TextAPI] Clean up minor bugs in YAML TextStub

* Always print out maccatalyst in format
* Traverse symbols via InterfaceFile symbol APIs
* Properly track addition of flags.

Reviewed By: ributzka

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

20 months ago[LSR] Fix incorrect check in 73cd3d4391ad47ae7
David Green [Wed, 22 Feb 2023 23:42:21 +0000 (23:42 +0000)]
[LSR] Fix incorrect check in 73cd3d4391ad47ae7

I missed that the test needed a icelake-server cpu to fail, and left a testing
"false &&" in the if condition. Hopefully this is now the correct fix.

20 months ago[lldb] Fix -Wformat in DWARFDebugAranges.cpp (NFC)
Jie Fu [Wed, 22 Feb 2023 23:28:38 +0000 (07:28 +0800)]
[lldb] Fix -Wformat in DWARFDebugAranges.cpp (NFC)

/data/llvm-project/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp:79:66: error: format specifies type 'unsigned int' but the argument has type 'lldb_private::RangeData<unsigned long, unsigned int, unsigned long>::DataType' (aka 'unsigned long') [-Werror,-Wformat]
      LLDB_LOGF(log, "0x%8.8x: [0x%" PRIx64 " - 0x%" PRIx64 ")", entry->data,
                        ~~~~~                                    ^~~~~~~~~~~
                        %8.8lx
/data/llvm-project/lldb/include/lldb/Utility/Log.h:348:27: note: expanded from macro 'LLDB_LOGF'
      log_private->Printf(__VA_ARGS__);                                        \
                          ^~~~~~~~~~~
1 error generated.

20 months ago[LSR] Prevent creating SCEVs of addrecs from mismatching loops
David Green [Wed, 22 Feb 2023 22:50:37 +0000 (22:50 +0000)]
[LSR] Prevent creating SCEVs of addrecs from mismatching loops

LSR can include Regs of AddRec SCEVs from different loops, which do not combine
well when added in Scalar Evolution. As they should never produce constant
differences so we can just guard against trying to create them.

Fixes #60927

20 months ago[scudo] Ensure all blocks are put in the correct group
Chia-hung Duan [Thu, 16 Feb 2023 19:46:11 +0000 (19:46 +0000)]
[scudo] Ensure all blocks are put in the correct group

While populating new blocks, we didn't always put them into their own
groups because that needs additional sort for an almost-sorted new
blocks array. However, ensuring all blocks are placed in the right group
enables the fast identifying of unused pages in a group by simply
accouting the number of free blocks are there. Therefore, this commit is
used to set up the invariant for future optimizations.

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

20 months ago[scudo] Fix the logic of pushing blocks of BatchClass
Chia-hung Duan [Thu, 16 Feb 2023 19:44:34 +0000 (19:44 +0000)]
[scudo] Fix the logic of pushing blocks of BatchClass

BatchClass is used to manage the free blocks for each size class. It's a
little bit tricky when it has to manage the free blocks of BatchClass.
In general, BatchClass block records the addresses of free blocks. In
order not to waste additional block to record the blocks in BatchClass,
it's self contained, i.e., it'll record its own address. The safety is
maintained by 2 preconditions,

  1. If a block is used to record other BatchClass blocks, it'll also
     record the address itself
  2. While allocating free blocks, all the recorded blcoks will be
     allocated together, which means there's no partial allocation

This CL fixes the violation of 1. and then we can push the free blocks
without having to push them in batches.

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

20 months ago[mlir] Fix typo causing build error
Jeff Niu [Wed, 22 Feb 2023 22:05:50 +0000 (14:05 -0800)]
[mlir] Fix typo causing build error

20 months ago[mlir] Add a SharedSymbolTableCollection class
Jeff Niu [Tue, 21 Feb 2023 17:55:52 +0000 (09:55 -0800)]
[mlir] Add a SharedSymbolTableCollection class

This class wraps a `SymbolTableCollection` to allow shared access to the
collection of symbol tables (but not the individual symbol tables). This
can be used, for example, in a pass that shards work among symbols that
requires symbol lookups.

Reviewed By: rriddle

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

20 months ago[MLIR,OpenMP,Flang] Add Conversion to LLVM for Section Op
Kiran Chandramohan [Wed, 22 Feb 2023 17:49:12 +0000 (17:49 +0000)]
[MLIR,OpenMP,Flang] Add Conversion to LLVM for Section Op

Fixes #60911

Reviewed By: psoni2628

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

20 months ago[AST] Add 'break;' to the last case in two switches. NFC
Craig Topper [Wed, 22 Feb 2023 21:42:40 +0000 (13:42 -0800)]
[AST] Add 'break;' to the last case in two switches. NFC

Makes it easier for the switch to be extended in the future.

20 months ago[Clang] Adjust triviality computation in QualType::isTrivialType to C++20 cases.
Roy Jacobson [Wed, 22 Feb 2023 21:20:18 +0000 (23:20 +0200)]
[Clang] Adjust triviality computation in QualType::isTrivialType to C++20 cases.

Up to C++20, hasDefaultConstructor and !hasNonTrivialDefaultConstructor together implied
hasTrivialDefaultConstructor. In C++20, a constructor might be ineligible and can set
hasDefaultConstructor without setting hasNonTrivialDefaultConstructor.

Fix this by querying hasTrivialDefaultConstructor instead of hasDefaultConstructor.

I'd like to backport this to Clang 16.
I only change isTrivialType and in a way that should only affect code that uses
constrained constructors, so I think this is relatively safe to backport.

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

Reviewed By: aaron.ballman

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

20 months ago[lldb] Warn when Mach-O files have overlapping segments
Alex Langford [Wed, 22 Feb 2023 01:20:23 +0000 (17:20 -0800)]
[lldb] Warn when Mach-O files have overlapping segments

I recently came across a binary that for some reason had overlapping
sections. When debugging it, LLDB was able to get information about one
of the sections but not the other because SectionLoadList assumes that
each address maps to exactly one section. We have the capability to warn
about this, but it was not turned on.

rdar://105751700

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

20 months ago[RISCV] Be more explicit string replacements in RISCVInstrInfoVPseudos.td. NFC
Craig Topper [Wed, 22 Feb 2023 20:53:57 +0000 (12:53 -0800)]
[RISCV] Be more explicit string replacements in RISCVInstrInfoVPseudos.td. NFC

Instead of replacing "F16", "F32", "F64" anywhere in the string.
Only replace them when proceeded by a "_", "_V", or "_W".

This allows F16/F32/F64 to appear in the instruction name.
This is needed for some vendor instructions in our downstream. We
may be upstreaming them in the future.

20 months ago[RISCV] Replaced !subst chain with !foldl
Nitin John Raj [Wed, 22 Feb 2023 20:18:05 +0000 (12:18 -0800)]
[RISCV] Replaced !subst chain with !foldl

Reviewed By: craig.topper, MaskRay

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

20 months ago[mlir][sparse] unconditionally use IndexType for sparse_tensor.specifier
Peiming Liu [Wed, 22 Feb 2023 18:44:00 +0000 (18:44 +0000)]
[mlir][sparse] unconditionally use IndexType for sparse_tensor.specifier

Reviewed By: aartbik

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

20 months ago[mlir] Complety remove old `fold` API
Markus Böck [Mon, 20 Feb 2023 13:42:17 +0000 (14:42 +0100)]
[mlir] Complety remove old `fold` API

Last part of https://discourse.llvm.org/t/rfc-a-better-fold-api-using-more-generic-adaptors/67374

All active users that I am aware of have already switched. Any remaining users will be forced to adopt their code after this patch has landed.

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

20 months ago[BOLT][NFC] Return struct from evaluateX86MemoryOperand
Amir Ayupov [Wed, 22 Feb 2023 20:05:58 +0000 (12:05 -0800)]
[BOLT][NFC] Return struct from evaluateX86MemoryOperand

Simplify `MCPlusBuilder::evaluateX86MemoryOperand`: make it return a struct
with memory operand analysis struct `X86MemOperand`.

Reviewed By: #bolt, rafauler

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

20 months agoReland "[TextAPI] Implement TBDv5 Writer"
Cyndy Ishida [Wed, 22 Feb 2023 18:00:07 +0000 (10:00 -0800)]
Reland "[TextAPI] Implement TBDv5 Writer"

Create writer for new JSON format.
The new JSON format allows practically all attributes to be defined per
target in a universal library however the internal representation only
allows one for the time being. For now the write will always write those
attributes as default available for all targets (install name,
compatability & current version, swift abi, flags e.g. flatnamepace &
app exenstion safety)

rdar://102076911

Reviewed By: ributzka

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

20 months ago[RISCV] Expand tab characters. NFC
Craig Topper [Wed, 22 Feb 2023 19:38:04 +0000 (11:38 -0800)]
[RISCV] Expand tab characters. NFC

20 months ago[mlir][tensor] Fix transpose permutation in tensor.pack generalization pattern
Quinn Dawkins [Mon, 20 Feb 2023 19:49:38 +0000 (14:49 -0500)]
[mlir][tensor] Fix transpose permutation in tensor.pack generalization pattern

The generalization pattern for tensor.pack was inverting the
innerDimsPos permutation when normalizing. Thus, the transpose op
produced by the generalization would be incorrect.

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

20 months ago[LSAN] Make sure HWASAN tests are linked with lld
Kirill Stoimenov [Fri, 17 Feb 2023 19:33:20 +0000 (19:33 +0000)]
[LSAN] Make sure HWASAN tests are linked with lld

Reviewed By: vitalybuka

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

20 months agoRevert "[TextAPI] Implement TBDv5 Writer"
Cyndy Ishida [Wed, 22 Feb 2023 19:39:23 +0000 (11:39 -0800)]
Revert "[TextAPI] Implement TBDv5 Writer"

This reverts commit 8217932aabcb271df7eb30e069fdace904299cba.

Breaks buildbots.

20 months ago[TextAPI] Implement TBDv5 Writer
Cyndy Ishida [Wed, 22 Feb 2023 18:00:07 +0000 (10:00 -0800)]
[TextAPI] Implement TBDv5 Writer

Create writer for new JSON format.
The new JSON format allows practically all attributes to be defined per
target in a universal library however the internal representation only
allows one for the time being. For now the write will always write those
attributes as default available for all targets (install name,
compatability & current version, swift abi, flags e.g. flatnamepace &
app exenstion safety)

rdar://102076911

Reviewed By: ributzka

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

20 months ago[LLDB] Enable 64 bit debug/type offset
Alexander Yermolovich [Wed, 22 Feb 2023 19:30:52 +0000 (11:30 -0800)]
[LLDB] Enable 64 bit debug/type offset

This came out of from https://discourse.llvm.org/t/dwarf-dwp-4gb-limit/63902
With big binaries we can have .dwp files where .debug_info.dwo section can grow
beyond 4GB. We would like to support this in LLVM and in LLDB.

The plan is to enable manual parsing of cu/tu index in DWARF library
(https://reviews.llvm.org/D137882), and then
switch internal index data structure to 64 bit.
For the second part is to enable 64bit offset support in LLDB with
this patch.

Reviewed By: labath

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

20 months ago[mlir][linalg] Vectorize tensor.extract using contiguous loads
Andrzej Warzynski [Thu, 29 Dec 2022 10:22:28 +0000 (10:22 +0000)]
[mlir][linalg] Vectorize tensor.extract using contiguous loads

This patch implements vectorization of tensor.extract for n-D tensor (n
>= 2) using contiguous load operations, i.e. `vector.transfer_read`. This
is a follow-up of https://reviews.llvm.org/D137660 in which gather loads
were used, i.e. `vector.gather`.

It is always safe to use gather load operations when the underlying
memory pattern is contiguous, but not vice-verse. At the moment, the
following conditions have to be met for contiguous loads to be
generated:
  1. The _output tensor_ must be a 1-D vector with the trailing dim > 1,
     e.g. `tensor<1x1x4xi32`,
  2. The trailing dim in the _input tensor_ must be > 1, e.g.
     `tensor<1x1x4i32>` would be fine, but not `tensor<1x4x1xi32>`.
If these conditions are not satisfied, gather loads are generated
instead.

Condition 1 guarantees that the iteration space of the corresponding
`linalg.generic` Op is relatively simple. That makes analysing the
indices for `tensor.extract` rather straightforward.

Condition 2 is mostly there to avoid weird vectorisation patterns
resulting in vectors like: `vector<1x1x1xi32>`. In practice, tensors
like `tensor<1x4x1xi32>` should be collapsed to `tensor<1x4xi32>` before
vectorisation, but that's beyond the scope of this patch.

If needed, both conditions can be relaxed. I've not been able to find a
good motivating example for these, hence skipping. For reference,
`tosa.resize` (lowered to Linalg) was the driving example used here.

As a bonus, the test from "vectorization-unsupported.mlir" is moved to
"vectorization.mlir" with proper CHECK lines added.

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

Co-authored-by: Diego Caballero <diegocaballero@google.com>
20 months ago[libc] Partially implement 'quick_exit' for the GPU
Joseph Huber [Mon, 20 Feb 2023 19:42:08 +0000 (13:42 -0600)]
[libc] Partially implement 'quick_exit' for the GPU

This patch adds a partial implementation of `quick_exit` for the GPU
target. This is mainly done to test object libraries for the GPU and
will be expanded later. This will simply cause the threads to terminate
on the GPU without returning an error code. This functionality will be
added later to facilitate unit tests.

Reviewed By: sivachandra

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

20 months ago[Serialization] Don't warn when a deserialized category is equivalent to an existing...
Volodymyr Sapsai [Thu, 16 Feb 2023 01:02:28 +0000 (17:02 -0800)]
[Serialization] Don't warn when a deserialized category is equivalent to an existing one.

A single class allows multiple categories to be defined for it. But if
two of such categories have the same name, we emit a warning. It's not a
hard error but a good indication of a potential mistake.

With modules, we can end up with the same category in different modules.
Diagnosing such a situation has little value as the categories in
different modules are equivalent and don't reflect the usage of the same
name for different purposes. When we deserialize a duplicate category,
compare it to an existing one and warn only when the new one is
different.

rdar://104582081

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

20 months ago[DAGCombine] Fix an ICE in combineMinNumMaxNum(...)
Cameron McInally [Wed, 22 Feb 2023 18:36:11 +0000 (10:36 -0800)]
[DAGCombine] Fix an ICE in combineMinNumMaxNum(...)

65420c8041f4 introduced an ICE in combineMinNumMaxNum(...) when
combineMinNumMaxNumImpl(...) returns an SDValue(). Make sure to check that a
value is returned before trying to perform an FNEG on it.

GitHub Issue: #60924

Reviewed By: arsenm

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

20 months ago[RISCV] XTHeadMemPair: Fix invalid mempair combine for types other than i32/i64
Manolis Tsamis [Wed, 22 Feb 2023 18:57:01 +0000 (19:57 +0100)]
[RISCV] XTHeadMemPair: Fix invalid mempair combine for types other than i32/i64

A mistake in the control flow of performMemPairCombine resulted in paired
loads/stores for types that were not supported by the instructions (i8/i16).
These loads/stores could not match the constraints of the patterns defined
in the THead td file and the compiler would throw a 'Cannot select' error.

This is now fixed and two new test functions have been added in xtheadmempair.ll
which would previously crash the compiler. The compiler was additionally tested
with a wide range of benchmarks and no issues were observed.

Reviewed By: craig.topper

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

20 months ago[libc] Implement ntohl and ntohs
Raman Tenneti [Wed, 22 Feb 2023 18:32:09 +0000 (10:32 -0800)]
[libc] Implement ntohl and ntohs

Per spec:

https://pubs.opengroup.org/onlinepubs/9699919799/functions/ntohl.html
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ntohs.html

Co-authored-by: Jeff Bailey <jbailey@google.com>
Reviewed By: sivachandra

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

20 months ago[clang-format] Fix format of my last patch
Vitaly Buka [Wed, 22 Feb 2023 18:11:41 +0000 (10:11 -0800)]
[clang-format] Fix format of my last patch

20 months ago[OpenMP] Target memory allocator fallback to default when no device available
Nawrin Sultana [Tue, 21 Feb 2023 23:17:57 +0000 (17:17 -0600)]
[OpenMP] Target memory allocator fallback to default when no device available

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

20 months ago[RISCV] Reorganize deinterleave lowering for reuse [nfc]
Philip Reames [Wed, 22 Feb 2023 17:45:57 +0000 (09:45 -0800)]
[RISCV] Reorganize deinterleave lowering for reuse [nfc]

Not entirely sure we'll end up reusing the body of the transform, but personally I find this structure easier to follow anyways.

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

20 months agoRevert "[IRMover] Remove UB implying parameter attributes when necessary"
Arthur Eubanks [Wed, 22 Feb 2023 17:40:22 +0000 (09:40 -0800)]
Revert "[IRMover] Remove UB implying parameter attributes when necessary"

This reverts commit 451799bb8261bde52bbfef226d019caf1d82aa42.

Causes crashes, see D139209

20 months ago[libc] Fix amdgpu startup code flags
Joseph Huber [Wed, 22 Feb 2023 17:36:12 +0000 (11:36 -0600)]
[libc] Fix amdgpu startup code flags

Summary:
Currently AMDGPU only barely supports cross-TU ELF linking. Full linking
is usually done via LTO. This requires passing the architecture to the
link job. This is done automatically via `-flto` since D144505. Add this
to the link options.

20 months agoRevert "[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag"
Petr Hosek [Wed, 22 Feb 2023 17:32:07 +0000 (17:32 +0000)]
Revert "[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag"

This reverts commit efae3174f09560353fb0f3d528bcbffe060d5438 since
it broke the standalone Flang build.

20 months ago[AMDGPU] Improve the lowering of raw_buffer_load_{i8,i16} and struct_buffer_load_...
Konstantina Mitropoulou [Fri, 17 Feb 2023 22:16:39 +0000 (14:16 -0800)]
[AMDGPU] Improve the lowering of raw_buffer_load_{i8,i16} and struct_buffer_load_{i8,i16} intrinsics

Currently, raw_buffer_load_{i8,i16} and struct_buffer_load_{i8,i16}
intrinsics are lowered as buffer_load_{u8,u16}. This patch combines
buffer_load_{u8,u16} and sign extension instructions in order to
generate buffer_load_{i8,i16} instructions.

Reviewed By: foad

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

20 months ago[Assignment Tracking] Only set module flag if pass modifies a function
OCHyams [Wed, 22 Feb 2023 16:29:44 +0000 (16:29 +0000)]
[Assignment Tracking] Only set module flag if pass modifies a function

The module flag "debug-info-assignment-tracking" is set by the
declare-to-assign pass to indicate that assignment tracking is enabled. This
patch changes declare-to-assign to only set the flag if it makes a
modification. This lets the compiler avoid doing extra work for no benefit,
such as is currently the case if assignment tracking is requested for a build
with line tables only (-gmlt) or a build without debug info.

Reviewed By: scott.linder

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

20 months ago[AMDGPU] Don't set src mods on permlane16
Joe Nash [Tue, 21 Feb 2023 21:14:27 +0000 (16:14 -0500)]
[AMDGPU] Don't set src mods on permlane16

v_permlane16_b32 and v_permlanex16_b32 should not set abs and neg src
modifiers on any input, but they can set op_sel on src0 or src1 to
represent fi or bc when desired. The ISel patterns were setting
the src_modifier bits to -1, effectively setting abs and neg as well,
whenever it was intended to set op_sel, due to an error in ISel. ISel
should now correctly only set the op_sel bits.

Reviewed By: arsenm

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

20 months ago[Assignment Tracking] Choose better passes for RemoveRedundantDbgInstrs call
OCHyams [Wed, 22 Feb 2023 14:23:08 +0000 (14:23 +0000)]
[Assignment Tracking] Choose better passes for RemoveRedundantDbgInstrs call

Enabling assignment tracking without this patch, a significant amount of
additional compiler run time comes from the RemoveRedundantDbgInstrs call in
InstCombine. This patch reduces compiler run time by choosing better places to
call RemoveRedundantDbgInstrs.

In non-assignment-tracking builds, RemoveRedundantDbgInstrs is called by
InstCombine if LowerDbgDeclare makes a change (i.e. it is _sometimes_
called). In assignment tracking builds LowerDbgDeclare doesn't do anything. We
still need to clean up redundant intrinsics to avoid a large performance hit
due to the number of instructions, so the current approach is to have
InstCombine _always_ call RemoveRedundantDbgInstrs.

Instrumenting the compiler to run RemoveRedundantDbgInstrs after every pass and
dump the numbers and building CTMark/tramp3d-v4 indicates that SROA and
LoopVectorize give us a bigger bang (number removed) for buck (times pass is
run).

The compile time tracker reports that this patch reduces the number of
instructions retired building CTMark projects by an average of 1.1%.

Reviewed By: scott.linder

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

20 months ago[AMDGPU] Move splitMUBUFOffset from AMDGPUBaseInfo to SIInstrInfo
Jay Foad [Wed, 22 Feb 2023 15:51:29 +0000 (15:51 +0000)]
[AMDGPU] Move splitMUBUFOffset from AMDGPUBaseInfo to SIInstrInfo

Moving this out of AMDGPUBaseInfo enforces that AMDGPUBaseInfo should
not be calling into GCNSubtarget.

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

20 months ago[libc++][format] Removes transitive type_traits.
Mark de Wever [Tue, 21 Feb 2023 16:31:44 +0000 (17:31 +0100)]
[libc++][format] Removes transitive type_traits.

Reviewed By: #libc, philnik

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

20 months ago[clang][doc] Removes obsolete comment.
Mark de Wever [Tue, 21 Feb 2023 16:26:52 +0000 (17:26 +0100)]
[clang][doc] Removes obsolete comment.

After reading about the documentation improvements on LLVM weekly this
part seems obsolete.

Reviewed By: ChuanqiXu

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

20 months ago[Clang] Add options in LTO mode when cross compiling for AMDGPU
Joseph Huber [Tue, 21 Feb 2023 17:42:22 +0000 (11:42 -0600)]
[Clang] Add options in LTO mode when cross compiling for AMDGPU

The AMDGPU toolchain support directly compiling GPU images using
cross-compilation such as `clang --target=amdgcn-amd-amdhsa foo.c`.
However, when attempting to link bitcode this does not work because the
`-mcpu` options are not forwarded to the linker among others. This patch
simply adds them so that `clang --target=amdgcn-amd-amdhsa foo.c -flto`
works correctly.

Reviewed By: JonChesterfield

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

20 months ago[SCEV] Remove unused alignof/offsetof print special cases (NFC)
Nikita Popov [Wed, 22 Feb 2023 15:58:29 +0000 (16:58 +0100)]
[SCEV] Remove unused alignof/offsetof print special cases (NFC)

These shouldn't really reach SCEV without being folded away first,
and we don't have any tests that hit these cases.

The sizeof case does occur with scalable types.

20 months ago[CUDA][SPIRV] Match builtin types and __GCC_ATOMIC_XXX_LOCK_FREE macros on host/device
ShangwuYao [Tue, 14 Feb 2023 22:05:41 +0000 (22:05 +0000)]
[CUDA][SPIRV] Match builtin types and __GCC_ATOMIC_XXX_LOCK_FREE macros on host/device

This change matches the CUDA/SPIRV behavior with CUDA/NVPTX, and makes some builtin types
and __GCC_ATOMIC_XXX_LOCK_FREE macros the same between the host and device. This is only
done when host triple is provided and known, otherwise the behavior is unchanged.

Reviewed By: yaxunl

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

20 months ago[flang] Fix build after D143339
Matthias Springer [Wed, 22 Feb 2023 14:25:57 +0000 (15:25 +0100)]
[flang] Fix build after D143339

This change silences a compiler warning: `base class should be explictily initialized in the copy constructor`.

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

20 months ago[AMDGPU] Improved wide multiplies
Jessica Del [Tue, 21 Feb 2023 08:40:07 +0000 (09:40 +0100)]
[AMDGPU] Improved wide multiplies

These checks show optimized instructions if an operand is known to be
(partially) zero.

Change-Id: Ie2f6d0d3ee9d5b279d1f4c1dd0787492e39cc77a

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

20 months ago[GlobalOpt] Add struct for parts during GlobalSRA (NFC)
Nikita Popov [Fri, 15 Jul 2022 14:36:46 +0000 (16:36 +0200)]
[GlobalOpt] Add struct for parts during GlobalSRA (NFC)

This is in preparation for https://reviews.llvm.org/D129857.

20 months ago[mlir][IR][NFC] Rename RewriterBase::replaceUseIf to replaceUsesWithIf
Matthias Springer [Wed, 22 Feb 2023 15:12:27 +0000 (16:12 +0100)]
[mlir][IR][NFC] Rename RewriterBase::replaceUseIf to replaceUsesWithIf

This is for consistency with `Value::replaceUsesWithIf`.

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

20 months ago[clangd] Publish diagnostics with stale preambles
Kadir Cetinkaya [Tue, 21 Feb 2023 08:44:25 +0000 (09:44 +0100)]
[clangd] Publish diagnostics with stale preambles

This patch achieves this by building an AST and invoking main file
callbacks on each update, in addition to preamble updates.

It means we might have some extra AST builds now (e.g. if an update was
with a stale preamble and there were no reads on it, we would only build
an AST once we had the fresh preamble. Now we'll build 2, once with the
stale preamble and another with the fresh one, but we'll have one more
diagnostics cycle in between.).

This patch preserves forward progress of diagnostics by always using the
latest main file contents when emitting diagnostics after preamble
builds. It also guarantees eventual consistency:
- if an update doesn't invalidate preamble, we'll emit diagnostics with
  fresh preamble already.
- if an update invalidates preamble, we'll first emit diagnostics with
  stale contents, and then once the preamble build finishes it'll emit
  diagnostics (as preamble has changed) with newest version.

This has implications on parsing callbacks, as previously onMainAST
callback was called at most once, now it can be called up to 2 times.
All of the existing clients can already deal with callback firing
multiple times.

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

20 months ago[clangd] Provide patched diagnostics with preamble patch
Kadir Cetinkaya [Wed, 1 Feb 2023 18:26:10 +0000 (19:26 +0100)]
[clangd] Provide patched diagnostics with preamble patch

Translates diagnostics from baseline preamble to relevant modified
contents.

Translation is done by looking for a set of lines that have the same
contents in diagnostic/note/fix ranges inside baseline and modified
contents.

A diagnostic is preserved if its main range is outside of main file or
there's a translation from baseline to modified contents. Later on fixes
and notes attached to that diagnostic with relevant ranges are also
translated and preserved.

Depends on D143095

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

20 months ago[clangd] Respect preamble-patch when handling diags
Kadir Cetinkaya [Wed, 1 Feb 2023 18:10:03 +0000 (19:10 +0100)]
[clangd] Respect preamble-patch when handling diags

Depends on D143093

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

20 months ago[clangd] #undef macros inside preamble patch
Kadir Cetinkaya [Wed, 1 Feb 2023 17:37:46 +0000 (18:37 +0100)]
[clangd] #undef macros inside preamble patch

That way we can stop generating false macro redefinition diagnostics.

Depends on D142890

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

20 months ago[clangd] Add config option for fast diagnostics mode
Kadir Cetinkaya [Mon, 30 Jan 2023 07:06:41 +0000 (08:06 +0100)]
[clangd] Add config option for fast diagnostics mode

Also wire it up for use with patched preambles and introduce test cases
for behaviour we'd like to improve.

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

20 months ago[mlir] Add missing patterns for lowering to Libm.
Alexander Belyaev [Wed, 22 Feb 2023 14:37:28 +0000 (15:37 +0100)]
[mlir] Add missing patterns for lowering to Libm.

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

20 months ago[mlir][bufferization] Consider defaultMemorySpace when bufferizing FuncOp
Maya Amrami [Wed, 22 Feb 2023 07:48:32 +0000 (09:48 +0200)]
[mlir][bufferization] Consider defaultMemorySpace when bufferizing FuncOp

The function arguments and results type will have the default memory space.

Reviewed By: springerm

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

20 months ago[gn build] Port 200034978b95
LLVM GN Syncbot [Wed, 22 Feb 2023 14:32:18 +0000 (14:32 +0000)]
[gn build] Port 200034978b95

20 months ago[flang][hlfir] Insert casts in hlfir.associate rewrites
Jean Perier [Wed, 22 Feb 2023 14:25:43 +0000 (15:25 +0100)]
[flang][hlfir] Insert casts in hlfir.associate rewrites

When the associated expression came from a moved variable, the
type of the moved variable may not exactly match the hlfir.associate
result and cannot be re-used directly. Insert fir.convert/fir.box_addr
as needed.

Reviewed By: clementval

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

20 months ago[AMDGPU] Fix an assertion failure when folding into src2 of V_FMAC_F16
Jay Foad [Wed, 22 Feb 2023 13:39:58 +0000 (13:39 +0000)]
[AMDGPU] Fix an assertion failure when folding into src2 of V_FMAC_F16

D139469 "[AMDGPU] Enable OMod on more VOP3 instructions" caused an
assertion failure when trying to fold into src2 of V_FMAC_F16. It would
temporarily convert the instruction to V_FMA_F16_gfx9 and add an opsel
operand, but if the fold still failed then it would forget to remove the
opsel operand.

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

20 months ago[MemProf] Add printing utilities for MemProf summary structures
Teresa Johnson [Sat, 18 Feb 2023 02:10:02 +0000 (18:10 -0800)]
[MemProf] Add printing utilities for MemProf summary structures

Split out of D140908 as suggested, and added unit testing.

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

20 months ago[libc++][NFC] Replace typedef with using declarations in <__atomic/*>
Nikolas Klauser [Fri, 17 Feb 2023 12:07:52 +0000 (13:07 +0100)]
[libc++][NFC] Replace typedef with using declarations in <__atomic/*>

Reviewed By: Mordante, #libc

Spies: arichardson, libcxx-commits

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

20 months ago[Local][SimplifyCFG][GVN] Handle !nontemporal in combineMetadata
Daniel Woodworth [Wed, 22 Feb 2023 12:38:53 +0000 (13:38 +0100)]
[Local][SimplifyCFG][GVN] Handle !nontemporal in combineMetadata

SimplifyCFG currently drops !nontemporal metadata when sinking
common instructions. With this change, SimplifyCFG and similar
transforms will preserve !nontemporal metadata as long as it is
set on both original instructions.

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

20 months ago[BOLT] Fix data reoder for aarch64
Vladislav Khmelevsky [Wed, 15 Feb 2023 13:18:37 +0000 (17:18 +0400)]
[BOLT] Fix data reoder for aarch64

Use proper relocation for aarch64

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

20 months ago[gn build] Port 3b8c0b342e16
LLVM GN Syncbot [Wed, 22 Feb 2023 12:33:42 +0000 (12:33 +0000)]
[gn build] Port 3b8c0b342e16

20 months ago[RISCV] Add new pass to transform undef to pseudo for vector values.
Piyou Chen [Wed, 22 Feb 2023 12:02:06 +0000 (04:02 -0800)]
[RISCV] Add new pass to transform undef to pseudo for vector values.

RISC-V vector instruction has register overlapping constraint for certain
instructions, and will cause illegal instruction trap if violated, we use
early clobber to model this constraint, but it can't prevent register allocator
allocated same or overlapped if the input register is undef value, so convert
IMPLICIT_DEF to temporary pseudo could prevent that happen, it's not best way
to resolve this. Ideally we should model the constraint right, but before we
model the constraint right, it's the approach to prevent that happen.

See also: https://github.com/llvm/llvm-project/issues/50157

Reviewed By: craig.topper

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

20 months ago[AArch64] Lower all fp zero buildvectors through BUILD_VECTOR.
David Green [Wed, 22 Feb 2023 11:26:41 +0000 (11:26 +0000)]
[AArch64] Lower all fp zero buildvectors through BUILD_VECTOR.

Just like with integers, we can treat zero fp buildvector as legal so that they
can be recognized in tablegen patterns using immAllZerosV.

20 months ago[AArch64] Fix N2 SchedModel element-to-element INS latencies
Sjoerd Meijer [Tue, 21 Feb 2023 16:00:52 +0000 (16:00 +0000)]
[AArch64] Fix N2 SchedModel element-to-element INS latencies

The instruction regexp "^INSv" for the insert gen-reg-to-element was also
matching the element-to-element instruction, which only has a latency of 2 and
not 5, so we were getting that wrong.

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

20 months ago[gn build] Port 850dab0f2537
LLVM GN Syncbot [Wed, 22 Feb 2023 10:24:28 +0000 (10:24 +0000)]
[gn build] Port 850dab0f2537

20 months ago[RISCV] Add vendor-defined XTheadSync (Multi-core synchronization) extension
Manolis Tsamis [Wed, 22 Feb 2023 09:58:50 +0000 (10:58 +0100)]
[RISCV] Add vendor-defined XTheadSync (Multi-core synchronization) extension

The vendor-defined XTheadSync (no comparable standard extension exists
at the time of writing) extension adds multi-core synchronization
instructions.

It is supported by the C9xx cores (e.g., found in the wild in the
Allwinner D1) by Alibaba T-Head.

The current (as of this commit) public documentation for this
extension is available at:
  https://github.com/T-head-Semi/thead-extension-spec/releases/download/2.2.2/xthead-2023-01-30-2.2.2.pdf

Support for these instructions has already landed in GNU Binutils:
  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=547c18d9bb95571261dbd17f4767194037eb82bd

Depends on D144496

Reviewed By: craig.topper

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

20 months ago[LV][RISCV] Don't interleave scalable vector loops
Luke Lau [Tue, 21 Feb 2023 14:56:22 +0000 (14:56 +0000)]
[LV][RISCV] Don't interleave scalable vector loops

It's less clear with scalable vectors than fixed length vectors that
interleaving exposes more ILP, as scalable vectors can be thought of a
sort of hardware form of interleaving, especially with larger LMULs.
This also addresses the unexpected additional unrolling that occurs when
using larger LMULs in the loop vectorizer.

Reviewed By: craig.topper

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

20 months ago[LV][NFC] Use ElementCount for getMaxInterleaveFactor
Luke Lau [Tue, 21 Feb 2023 13:00:18 +0000 (13:00 +0000)]
[LV][NFC] Use ElementCount for getMaxInterleaveFactor

In order to allow targets to disable interleaving for scalable vectors, pass the entire VF's ElementCount to getMaxInterleaveFactor.
This is based off of the approach used here: https://repo.hca.bsc.es/gitlab/rferrer/llvm-epi/-/commit/8d36708507b3c378078b9fe364bc548354aaec86

The plan would then be to disable interleaving on scalable VFs on RISC-V in a follow up patch.
See https://reviews.llvm.org/D143723#4132349

Reviewed By: reames

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

20 months ago[WebAssembly] pmin/pmax fixes
Samuel Parker [Tue, 21 Feb 2023 10:52:27 +0000 (10:52 +0000)]
[WebAssembly] pmin/pmax fixes

Reverse the operand ordering to ? rhs : lhs.

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

20 months ago[RISCV] Add vendor-defined XTheadCmo (Cache Management Operations) extension
Manolis Tsamis [Wed, 22 Feb 2023 09:36:42 +0000 (10:36 +0100)]
[RISCV] Add vendor-defined XTheadCmo (Cache Management Operations) extension

The vendor-defined XTHeadCmo (there are some similarities with the
Zicbom standard extension) extension adds cache management instructions.

It is supported by the C9xx cores (e.g., found in the wild in the
Allwinner D1) by Alibaba T-Head.

The current (as of this commit) public documentation for this
extension is available at:
  https://github.com/T-head-Semi/thead-extension-spec/releases/download/2.2.2/xthead-2023-01-30-2.2.2.pdf

Support for these instructions has already landed in GNU Binutils:
  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=a9ba8bc2d396fb8ae2b892f3bc6be8cdfe4b555c

Reviewed By: craig.topper

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

20 months ago[BOLT][AArch64] Replace NOP with adrp in AdrRelaxationPass to preserve relative offsets.
Denis Revunov [Wed, 18 Jan 2023 14:15:25 +0000 (09:15 -0500)]
[BOLT][AArch64] Replace NOP with adrp in AdrRelaxationPass to preserve relative offsets.

Avoid replacing one adr instruction with two adrp+add by utilizing linker-provided nops
when they are present. By doing so we preserve relative offsets of next instructions
in a function which reduces chances to break undetected jump tables. This commit makes
release-mode lld-linked clang, lld and etc work after BOLT.

Reviewed By: rafauler, yota9

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

20 months ago[FunctionAttrs] Move nosync inference into inferAttrsFromFunctionBodies() (NFC)
Nikita Popov [Wed, 22 Feb 2023 09:23:11 +0000 (10:23 +0100)]
[FunctionAttrs] Move nosync inference into inferAttrsFromFunctionBodies() (NFC)

There doesn't appear to be any reason why this attribute is
inferred separately from other ones that use AttributeInferer.

20 months ago[mlir] RewriterBase::Listener: Add notifyOperationModified callback
Matthias Springer [Wed, 22 Feb 2023 09:41:22 +0000 (10:41 +0100)]
[mlir] RewriterBase::Listener: Add notifyOperationModified callback

This callback is triggered by `finalizeRootUpdate`. This allows listeners to listen for in-place op modifications without creating a new RewriterBase subclass.

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

20 months ago[mlir][SCF][Utils][NFC] Make some utils public for better reuse
Matthias Springer [Wed, 22 Feb 2023 09:33:09 +0000 (10:33 +0100)]
[mlir][SCF][Utils][NFC] Make some utils public for better reuse

These functions will be used in a subsequent change. Also some minor refactoring.

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

20 months ago[mlir] GreedyPatternRewriteDriver: Support optional Listener
Matthias Springer [Wed, 22 Feb 2023 09:25:37 +0000 (10:25 +0100)]
[mlir] GreedyPatternRewriteDriver: Support optional Listener

Allow an optional `RewriterBase::Listener` to be attached to greedy pattern rewrites, so that clients can listen for IR modifications.

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

20 months ago[NFC] Class for building MultilibSet
Michael Platings [Tue, 7 Feb 2023 11:23:46 +0000 (11:23 +0000)]
[NFC] Class for building MultilibSet

The functionality in MultilibSet for creating it is tied to its current
implementation. Putting that code in a separate class is an enabler for
changing the MultilibSet implementation.

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

20 months ago[Clang] Improve hermeticity of clang_rt tests
Michael Platings [Wed, 22 Feb 2023 08:43:35 +0000 (08:43 +0000)]
[Clang] Improve hermeticity of clang_rt tests

Specifying --sysroot prevents libclang_rt from being located in standard
library directories.

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

20 months ago[AArch64] Fix abs(sub nsw) -> absd
Ricardo Jesus [Mon, 20 Feb 2023 16:44:40 +0000 (16:44 +0000)]
[AArch64] Fix abs(sub nsw) -> absd

This partially reverts a regression introduced in 8f25e382c5b1 for
AArch64 targets. In particular, we restore the logic of `(abs (sub nsw
x, y)) -> abds(x, y)` for all targets except X86, which keeps the logic
introduced in 8f25e382c5b1. See also https://reviews.llvm.org/D142288.

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

20 months ago[Lex] Fix a crash in updateConsecutiveMacroArgTokens.
Haojian Wu [Tue, 14 Feb 2023 23:39:10 +0000 (00:39 +0100)]
[Lex] Fix a crash in updateConsecutiveMacroArgTokens.

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

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

20 months ago[TableGen] Emit static const globals in getOperandType
Michael Liao [Wed, 22 Feb 2023 08:36:36 +0000 (03:36 -0500)]
[TableGen] Emit static const globals in getOperandType

- That saves the overhead of operand type querying.

20 months ago[clang] Add the check of membership for the issue #58674 and improve the lookup process
Liming Liu [Sun, 12 Feb 2023 01:08:13 +0000 (09:08 +0800)]
[clang] Add the check of membership for the issue #58674 and improve the lookup process

This patch includes the commit 01adf96ebc86 and a fix of unhandled declaration
references.

When looking up base classes, Clang first checks whether a base class is a
template and takes the specialized template based on it. However, the base class
might be instantiated, and the above behavior can lose information.

This patch fixes the problem by first checking whether a base class is a record
declaration, so the instantiated one will be taken.

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

20 months ago[FunctionAttrs] Slightly clean up returned attr inference (NFC)
Nikita Popov [Wed, 22 Feb 2023 08:31:12 +0000 (09:31 +0100)]
[FunctionAttrs] Slightly clean up returned attr inference (NFC)

Use hasAttrSomewhere() and directly return Argument from the
helper.