platform/upstream/llvm.git
17 months ago[docs] Clarify that CoC docs are under a CC-BY license.
Kristof Beyls [Wed, 12 Apr 2023 13:01:00 +0000 (15:01 +0200)]
[docs] Clarify that CoC docs are under a CC-BY license.

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

17 months ago[AMDGPU] Add backend support for new PAL ELF Metadata 3.0
David Stuttard [Mon, 20 Feb 2023 17:11:22 +0000 (17:11 +0000)]
[AMDGPU] Add backend support for new PAL ELF Metadata 3.0

PAL Metadata 3.0 introduces an explicit structure in metadata for the
programmable registers written out by the compiler backend.
Rather than using opaque registers which can change between different
architectures and requires encoding the bitfield information in the backend,
which may change between versions.

This is the initial minimal implementation that enables the use of PAL Metadata
3.0.

The change itself should be NFC for non-PAL, although the way RSRC2 register is
handled has been changed slightly.

The test is fairly minimal, but checks that the metadata format looks as
expected and verifies a couple of special cases such as tgid_[xyz]_en handling
and PsInputAddr/Ena which also change to explicit fields.

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

17 months ago[LangRef][Local] dereferenceable metadata violation is UB
Nikita Popov [Thu, 13 Apr 2023 08:38:56 +0000 (10:38 +0200)]
[LangRef][Local] dereferenceable metadata violation is UB

I believe !dereferencable violation is immediate undefined behavior,
but this was not explicitly spelled out in LangRef. We already
assume that !dereferenceable is implicitly !noundef and cannot
return poison in isGuaranteedNotToBeUndefOrPoison().

The reason why we made dereferenceable implicitly noundef is that
the purpose of this metadata is to allow speculation, and that
would not be legal on a potential poison pointer.

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

17 months ago[InstSimplify] Remove unused ORE argument (NFC)
Nikita Popov [Fri, 14 Apr 2023 08:35:17 +0000 (10:35 +0200)]
[InstSimplify] Remove unused ORE argument (NFC)

17 months ago[AMDGPU] Don't S_MOV_B32 into $scc
Diana Picus [Wed, 12 Apr 2023 09:52:44 +0000 (11:52 +0200)]
[AMDGPU] Don't S_MOV_B32 into $scc

The peephole optimizer tries to replace
```
%n:sgpr_32 = S_MOV_B32 x
$scc = COPY %n
```
with a `S_MOV_B32` directly into `$scc`.

This crashes because `S_MOV_B32` cannot take `$scc` as input.

We currently generate code like this from GlobalISel when lowering a
G_BRCOND with a constant condition. We should probably look into
removing this kind of branch altogether, but until then we should at
least not crash.

This patch fixes the issue by making sure we don't apply the peephole
optimization when trying to move into a physical register that
doesn't belong to the correct register class.

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

17 months ago[Coroutines] Directly remove unnecessary lifetime intrinsics
Nikita Popov [Thu, 13 Apr 2023 15:34:30 +0000 (17:34 +0200)]
[Coroutines] Directly remove unnecessary lifetime intrinsics

The insertSpills() code will currently skip lifetime intrinsic users
when replacing the alloca with a frame reference. Rather than
leaving behind the dead lifetime intrinsics working on the old
alloca, directly remove them. This makes sure the alloca can be
dropped as well.

I noticed this as a regression when converting tests to opaque
pointers. Without opaque pointers, this code didn't really do
anything, because there would usually be a bitcast in between.
The lifetimes would get rewritten to the frame pointer. With
opaque pointers, this code now triggers and leaves behind users
of the old allocas.

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

17 months ago [sanitizer] adapt for 75f1f158812dabc03e70697b6b9c272230bce63d
Krasimir Georgiev [Fri, 14 Apr 2023 08:18:43 +0000 (08:18 +0000)]
 [sanitizer] adapt for 75f1f158812dabc03e70697b6b9c272230bce63d

 No functional changes intended.

17 months ago[mlir][llvm] Move the LLVM dialect definition (NFC).
Tobias Gysi [Fri, 14 Apr 2023 07:10:15 +0000 (07:10 +0000)]
[mlir][llvm] Move the LLVM dialect definition (NFC).

The revision separates out the LLVM dialect definition in a separate
tablegen file and ensures the LLVMOpBase.td can include the attributes
defined by LLVMAttrDefs.td. The change allows us to use LLVM dialect
attributes in the definition of the intrinsic and memory operation
base classes, e.g. to represent alias analysis metadata using
attributes.

Reviewed By: Dinistro

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

17 months agoRevert "[clang-format] Handle object instansiation in if-statements"
Tobias Hieta [Fri, 14 Apr 2023 07:44:35 +0000 (09:44 +0200)]
Revert "[clang-format] Handle object instansiation in if-statements"

This reverts commit 70de684d44135b4025d92b2b36ad387cf5ab8b5a.

This causes a regression as described in #61785

17 months ago[llvm-exegesis] Fix -Wc++98-compat-extra-semi in BenchmarkRunner.cpp (NFC)
Jie Fu [Fri, 14 Apr 2023 07:46:09 +0000 (15:46 +0800)]
[llvm-exegesis] Fix -Wc++98-compat-extra-semi in BenchmarkRunner.cpp (NFC)

/data/llvm-project/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp:66:2: error: extra ';' outside of a function is incompatible with C++98 [-Werror,-W
c++98-compat-extra-semi]
};
 ^
1 error generated.

17 months ago[llvm-exegesis] Refactor common parts out of FunctionExecutorImpl
Aiden Grossman [Fri, 14 Apr 2023 07:19:10 +0000 (07:19 +0000)]
[llvm-exegesis] Refactor common parts out of FunctionExecutorImpl

This patch refactors some code out of FunctionExecutorImpl into the base
class that should be common across all implementations of
FunctionExecutor. Particularly, this patch factors out
accumulateCounterValues, and also factors out runAndSample, moving
implementation specific code into a new runWithCounter function. This
makes adding new implementations of FunctinExecutor easier.

Reviewed By: gchatelet

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

17 months ago[clangd] Fix test failure in initialize-params.test
Nathan Ridge [Fri, 14 Apr 2023 07:25:40 +0000 (03:25 -0400)]
[clangd] Fix test failure in initialize-params.test

17 months ago[llvm-exegesis][NFC] remove runAndMeasure
Aiden Grossman [Fri, 14 Apr 2023 07:05:37 +0000 (07:05 +0000)]
[llvm-exegesis][NFC] remove runAndMeasure

This completes the FIXME listed in FunctionExecutor in regards to
deprecating this function. It simply makes the appropriate call into
runAndSample and grabs the first counter value. This patch completely
removes the function, moving that logic into the callers (currently only
uopsBenchmarkRunner). This makes creating new FunctionExecutors easier
as an implementation no longer needs to worry about this detail.

Reviewed By: gchatelet

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

17 months ago[clang] Add test for CWG1894 and CWG2199
Vlad Serebrennikov [Fri, 14 Apr 2023 07:14:36 +0000 (10:14 +0300)]
[clang] Add test for CWG1894 and CWG2199

[[https://wg21.link/p1787 | P1787]]: CWG1894 and its duplicate CWG2199 are resolved per Richard’s proposal for [[ https://listarchives.isocpp.org/cgi-bin/wg21/message?wg=core&msg=28415 | “dr407 still leaves open questions about typedef / tag hiding” ]], using generic conflicting-declaration rules even for typedef, and discarding a redundant typedef-name when looking up an elaborated-type-specifier.
Wording: See changes to [dcl.typedef], [basic.lookup.elab], and [basic.lookup]/4.

Generic conflicting-declaration rules are specified in changes to [basic.scope.scope]. [[ https://cplusplus.github.io/CWG/issues/407.html | CWG407]], [[ https://cplusplus.github.io/CWG/issues/1894.html | CWG1894 ]], and [[ https://cplusplus.github.io/CWG/issues/2199.html | CWG2199 ]] discuss how elaborated type specifiers interact with typedefs, using directives, and using declarations. Since existing test for CWG407 covers examples provided in CWG1894 and CWG2199, and does it in accordance with P1787, I reused parts of it.

Reviewed By: #clang-language-wg, cor3ntin

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

17 months ago[clangd] Inactive regions support via dedicated protocol
Nathan Ridge [Tue, 5 Apr 2022 07:19:15 +0000 (03:19 -0400)]
[clangd] Inactive regions support via dedicated protocol

This implements the server side of the approach discussed at
https://github.com/clangd/vscode-clangd/pull/193#issuecomment-1044315732

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

17 months ago[JITLink][RISCV] Handle R_RISCV_CALL_PLT fixups
Job Noorman [Fri, 14 Apr 2023 07:11:08 +0000 (09:11 +0200)]
[JITLink][RISCV] Handle R_RISCV_CALL_PLT fixups

In the default link configuration, PLT stubs are created automatically
for R_RISCV_CALL_PLT relocations and the relocation itself is
transformed to R_RISCV_CALL (PerGraphGOTAndPLTStubsBuilder_ELF_riscv).
Only the latter is later handled when applying fixups and the former is
simply ignored.

This patch proposes to handle R_RISCV_CALL_PLT anyway when applying
fixups to support custom configurations that do not need automatic PLT
creation. An example of this is BOLT where PLT entries from the input
binary are reused (D147544).

Reviewed By: StephenFan

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

17 months ago[MLGO] Change MBB Profile Dump from using MBB numbers to MBB IDs
Aiden Grossman [Fri, 14 Apr 2023 06:55:35 +0000 (06:55 +0000)]
[MLGO] Change MBB Profile Dump from using MBB numbers to MBB IDs

Currenty, setting the -mbb-profile-dump dumps a CSV file with blocks
inside an individual function identified by their MBB numbers. This
patch changes the MBBs to be identified by their ID which is set at MBB
creation and not changed afterwards, making it inherently stable
throughout the backend. This alleviates concerns with the MBB IDs
changing between the profile dump and what ends up in the final object
file. The MBBs inside the SHT_LLVM_BB_ADDR_MAP sections are also
identified using their MBB ID rather than number, so if we want to match
them up we need to identify the MBBs here by number.

Reviewed By: mtrofin, rahmanl

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

17 months ago[bazel] Remove remnant HAVE_LSEEK64 after 5cd554303ead0f8891eee3cd6d25cb07f5a7bf67
Fangrui Song [Fri, 14 Apr 2023 06:54:08 +0000 (23:54 -0700)]
[bazel] Remove remnant HAVE_LSEEK64 after 5cd554303ead0f8891eee3cd6d25cb07f5a7bf67

17 months ago[flang] fix fir.array_coor of fir.box with component references
Jean Perier [Fri, 14 Apr 2023 06:47:25 +0000 (08:47 +0200)]
[flang] fix fir.array_coor of fir.box with component references

When dealing with "derived_array(j)%component" where derived_array
is not a contiguous array, but for which we know the extent, lowering
generates a fir.array_coor op on a !fir.box<!fir.array<cst x T>> with
a fir.slice containing "j" in the component path.

Codegen first computes "derived_array(j)" address using the byte
strides inside the descriptor, and then computes the offset of "j"
from that address with a second GEP.
The type of the address in that second GEP matters since "j" is passed
in the GEP via an index indicating its component position in the type.

The code was using the LLVM type of "derived_array" instead of
"derived_array(j)".
In general, with fir.box, the extent ("cst" above) is unknown and those
types match. But if the extent of "derived_array" is a compile time
constant, its LLVM type will be [cst x T] instead of T*, and the produced
GEP will compute the address of the nth T instead of the nth component
inside T leading to undefined behaviors.

Fix this by computing the element type for the second GEP.

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

17 months ago[flang] Change TYPE(*) arrays passing convention
Jean Perier [Fri, 14 Apr 2023 06:43:33 +0000 (08:43 +0200)]
[flang] Change TYPE(*) arrays passing convention

- Fix the BIND(C) assumed-shape case: TYPE(*) assumed shape are passed
  via CFI_cdesc_t according to Fortran 2018 standard 18.3.6 point 2 (5).
- Align the none BIND(C) case with the BIND(C) case. There is little
  point passing TYPE(*) assumed size via descriptor, use a simple
  address. C710 ensures there is no way the knowledge of the actual
  type will be required when manipulating the dummy.

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

17 months ago[flang] Fold IS_CONTIGUOUS for TYPE(*) when possible
Jean Perier [Fri, 14 Apr 2023 06:42:15 +0000 (08:42 +0200)]
[flang] Fold IS_CONTIGUOUS for TYPE(*) when possible

TYPE(*) arguments fell through in IS_CONTIGUOUS folding
because they are not Expr<SomeType>. Expose entry point for
symbols in IsContiguous and use that.

The added test revealed that IS_CONTIGUOUS was folded to
false for assumed rank arguments. Fix this: the contiguity of
assumed rank without the CONTIGUOUS argument can only be
verified at runtime.

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

17 months ago[symbolizer] Change error message if module not found
Serge Pavlov [Fri, 14 Apr 2023 06:03:28 +0000 (13:03 +0700)]
[symbolizer] Change error message if module not found

If llvm-symbolize did not find module, the error looked like:

    LLVMSymbolizer: error reading file: No such file or directory

This message does not follow common practice: LLVMSymbolizer is not an
utility name. Also the message did not not contain the name of missed file.

With this change the error message looks differently:

    llvm-symbolizer: error: 'abc': No such file or directory

This format is closer to messages produced by other utilities and allow
proper coloring.

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

17 months ago[IRCE][NFC] Refactor parseRangeCheckICmp to compute SCEVs instead of Values
Max Kazantsev [Fri, 14 Apr 2023 05:24:32 +0000 (12:24 +0700)]
[IRCE][NFC] Refactor parseRangeCheckICmp to compute SCEVs instead of Values

The motivation is to make an opportunity to compute and return
expressions after parsing ICmp into a range check (e.g. Length + 1).

Patch by Aleksandr Popov!

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

17 months ago[compiler-rt] Fix signed shift overflows in absvdi2.c, absvsi2.c, negvdi2.c and negvsi2.c
Karl-Johan Karlsson [Fri, 14 Apr 2023 05:44:44 +0000 (07:44 +0200)]
[compiler-rt] Fix signed shift overflows in absvdi2.c, absvsi2.c, negvdi2.c and negvsi2.c

When compiling compiler-rt with -fsanitize=undefined and running testcases you
end up with the following warnings:

UBSan: absvdi2.c:21:23: left shift of 1 by 63 places cannot be represented in type 'di_int' (aka 'long long')
UBSan: absvsi2.c:21:23: left shift of 1 by 31 places cannot be represented in type 'si_int' (aka 'long')
UBSan: negvdi2.c:20:32: left shift of 1 by 63 places cannot be represented in type 'di_int' (aka 'long long')
UBSan: negvsi2.c:20:32: left shift of 1 by 31 places cannot be represented in type 'si_int' (aka 'long')

This can be avoided by doing the shift in a matching unsigned variant of the
type.

This was found in an out of tree target.

Reviewed By: MaskRay

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

17 months agoRe-land 'ASan: move allocator base to avoid conflict with high-entropy ASLR for x86...
Thurston Dang [Thu, 13 Apr 2023 23:55:01 +0000 (23:55 +0000)]
Re-land 'ASan: move allocator base to avoid conflict with high-entropy ASLR for x86-64 Linux'

D147984 was reverted because it broke lit tests on Mac. This revision is based on D147984
but maintains the old behavior for Apple.

Note that, per the follow-up discussion with MaskRay in D147984, this patch excludes Apple
but includes other platforms (e.g., aarch64, MIPS64) and OSes (e.g., FreeBSD, S390X), not just
x86-64 Linux.

Original commit message from D147984:

Users have discovered [*] that when CONFIG_ARCH_MMAP_RND_BITS == 32,
it will frequently conflict with ASan's allocator on x86-64 Linux, because the
PIE program segment base address of 0x555555555554 plus an ASLR shift of up to
((2**32) * 4K == 0x100000000000) will sometimes exceed ASan's hardcoded
base address of 0x600000000000. We fix this by simply moving the allocator base
to 0x500000000000, which is below the PIE program segment base address. This is
cleaner than trying to move it to another location that is sandwiched between
the PIE program and library segments, because if either of those grow too large,
it will collide with the allocator region.

Note that we will never need to change this base address again (unless we want to increase
the size of the allocator), because ASLR cannot be set above 32-bits for x86-64 Linux (the
PIE program segment and library segments would collide with each other; see also
ARCH_MMAP_RND_BITS_MAX in https://github.com/torvalds/linux/blob/master/arch/x86/Kconfig).

[*] see https://b.corp.google.com/issues/276925478
and https://groups.google.com/a/google.com/g/chrome-os-gardeners/c/BbfzCP3dEeo/m/h3C_vVUxCQAJ

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

17 months ago[lld][WebAssembly] stub objects: Fix handling of LTO libcall dependencies
Sam Clegg [Thu, 13 Apr 2023 18:41:27 +0000 (11:41 -0700)]
[lld][WebAssembly] stub objects: Fix handling of LTO libcall dependencies

This actually simplifies the code by performs a pre-pass of the stub
objects prior to LTO.

This should be the final change needed before we can make the switch
on the emscripten side: https://github.com/emscripten-core/emscripten/pull/18905

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

17 months ago[TableGen] Allow references to class template arguments in defvar
wangpc [Fri, 14 Apr 2023 03:07:29 +0000 (11:07 +0800)]
[TableGen] Allow references to class template arguments in defvar

We can't refer to template arguments for defvar statements in class
definitions, or it will report some errors like:

```
error: Variable not defined: 'xxx'.
```

The key point here is we used to pass nullptr to `ParseValue` in
`ParseDefvar`. As a result, we can't refer to template arguments
since `CurRec` is nullptr in `ParseIDValue`.

So we add an argument `CurRec` to `ParseDefvar` and provide it
when parsing defvar statements in class definitions.

Reviewed By: tra, simon_tatham

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

17 months ago[libc++] Fix `generate_ignore_format.sh` and regenerate the file.
varconst [Fri, 14 Apr 2023 03:07:18 +0000 (20:07 -0700)]
[libc++] Fix `generate_ignore_format.sh` and regenerate the file.

The script incorrectly produced double slashes in paths, e.g.
`libcxx/src//thread.cpp`.

17 months ago[lldb][test] Fix -Wsign-compare in RegisterFlagsTest.cpp (NFC)
Jie Fu [Fri, 14 Apr 2023 01:47:21 +0000 (09:47 +0800)]
[lldb][test] Fix -Wsign-compare in RegisterFlagsTest.cpp (NFC)

/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1526:11: error: comparison of integers of different signs: 'const unsigned long long' and 'const int' [-Werror,-Wsign-compare]
  if (lhs == rhs) {
      ~~~ ^  ~~~
/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1553:12: note: in instantiation of function template specialization 'testing::internal::CmpHelperEQ<unsigned long long, int>' requested here
    return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
           ^
/data/llvm-project/lldb/unittests/Target/RegisterFlagsTest.cpp:128:3: note: in instantiation of function template specialization 'testing::internal::EqHelper::Compare<unsigned long long, int, nullptr>' requested here
  ASSERT_EQ(0x12345678ULL, rf.ReverseFieldOrder(0x12345678));
  ^
/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:2056:32: note: expanded from macro 'ASSERT_EQ'
                               ^
/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:2040:54: note: expanded from macro 'GTEST_ASSERT_EQ'
  ASSERT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
                                                     ^
1 error generated.

17 months agoRevert "[flang] REAL(KIND=3) and COMPLEX(KIND=3) descriptors"
V Donaldson [Fri, 14 Apr 2023 01:33:29 +0000 (18:33 -0700)]
Revert "[flang] REAL(KIND=3) and COMPLEX(KIND=3) descriptors"

This reverts commit 17a4fcecf40ee5191ab05b27a58ac37e5f57261d.

17 months ago[RISCV] Support vector strict_fsetcc/fsetccs.
Yeting Kuo [Mon, 10 Apr 2023 01:25:52 +0000 (09:25 +0800)]
[RISCV] Support vector strict_fsetcc/fsetccs.

The patch supports vector strict_fsetcc/fsetccs. Instead of revserving fflags,
the method to implement scalar quiet compares, the patch implement quiet
compares by masking the signaling compares when either input is NaN [0].

[0]: https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#vector-floating-point-compare-instructions

Reviewed By: craig.topper

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

17 months ago[flang] REAL(KIND=3) and COMPLEX(KIND=3) descriptors
V Donaldson [Wed, 12 Apr 2023 19:15:27 +0000 (12:15 -0700)]
[flang] REAL(KIND=3) and COMPLEX(KIND=3) descriptors

Update descriptor generation to correctly set the `type` field for
REAL(3) and COMPLEX(3) objects.

17 months ago[lldb] Use ObjectFileJSON to create modules for interactive crashlogs
Jonas Devlieghere [Thu, 13 Apr 2023 23:27:53 +0000 (16:27 -0700)]
[lldb] Use ObjectFileJSON to create modules for interactive crashlogs

Create an artificial module using a JSON object file when we can't
locate the module and dSYM through dsymForUUID (or however
locate_module_and_debug_symbols is implemented). By parsing the symbols
from the crashlog and making them part of the JSON object file, LLDB can
symbolicate frames it otherwise wouldn't be able to, as there is no
module for it.

For non-interactive crashlogs, that never was a problem because we could
simply show the "pre-symbolicated" frame from the input. For interactive
crashlogs, we need a way to pass the symbol information to LLDB so that
it can symbolicate the frames, which is what motivated the JSON object
file format.

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

17 months agoGenerate staging `MachineValueType.h` (partially) from `ValueTypes.td`
NAKAMURA Takumi [Sun, 26 Mar 2023 10:53:05 +0000 (19:53 +0900)]
Generate staging `MachineValueType.h` (partially) from `ValueTypes.td`

- Implement `VTEmitter` as `llvm-tblgen -gen-vt`.
- Create a copy of `llvm/Support/MachineValueType.h` into `unittests/Support`.
  It includes `GenVT.inc` generated by `VTEmitter`.
- Implement `MVTTest` in `SupportTests`. It checks equivalence between
  `llvm/Support/MachineValueType.h` and the generated header.

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

17 months agoCopy `llvm/Support/MachineValueType.h` into `unittests/Support` for D146906
NAKAMURA Takumi [Sun, 26 Mar 2023 10:52:05 +0000 (19:52 +0900)]
Copy `llvm/Support/MachineValueType.h` into `unittests/Support` for D146906

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

17 months ago[flang] Fix -Wmismatched-tags warning of NonTbpDefinedIoTable (NFC)
Jie Fu [Thu, 13 Apr 2023 23:13:58 +0000 (07:13 +0800)]
[flang] Fix -Wmismatched-tags warning of NonTbpDefinedIoTable (NFC)

/Users/jiefu/llvm-project/flang/runtime/non-tbp-dio.h:41:1: error: 'NonTbpDefinedIoTable' defined as a struct here but previously declared as a class; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Werror,-Wmismatched-tags]
struct NonTbpDefinedIoTable {
^
/Users/jiefu/llvm-project/flang/include/flang/Runtime/io-api.h:26:1: note: did you mean struct here?
class NonTbpDefinedIoTable;
^~~~~
struct
1 error generated.

17 months ago[flang][openacc] Lower serial and serial loop construct
Valentin Clement [Thu, 13 Apr 2023 22:35:45 +0000 (15:35 -0700)]
[flang][openacc] Lower serial and serial loop construct

Lower the parse tree to acc dialects operations. Make use
of the parallel construct lowering and make it suitable
for all compute constructs lowering.

Reviewed By: PeteSteinfeld

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

17 months ago[flang] Rework handling of non-type-bound user-defined I/O
Peter Klausler [Thu, 13 Apr 2023 17:28:19 +0000 (10:28 -0700)]
[flang] Rework handling of non-type-bound user-defined I/O

A fairly recent introduction of runtime I/O APIs called OutputDerivedType()
and InputDerivedType() didn't cover NAMELIST I/O's need to access
non-type-bound generic interfaces for user-defined derived type I/O
when those generic interfaces are defined in some scope other than the
one that defines the derived type.

The patch adds a new data structure shared between lowering
and the runtime that can represent all of the cases that can
arise with non-type-bound defined I/O.  It can represent
scopes in which non-type-bound defined I/O generic interfaces
are inaccessible, too, due to IMPORT statements.

The data structure is now an operand to OutputDerivedType() and
InputDerivedType() as well as a data member in the NamelistGroup
structure.

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

17 months ago[Demangle] Remove uses of llvm::itanium_demangle::StringView::{dropBack,dropFront...
Fangrui Song [Thu, 13 Apr 2023 22:09:24 +0000 (15:09 -0700)]
[Demangle] Remove uses of llvm::itanium_demangle::StringView::{dropBack,dropFront}. NFC

Make it easier to migrate StringView to std::string_view.

17 months ago[Flang][OpenMP] Add support for logical neqv reduction in worksharing-loop
do [Thu, 13 Apr 2023 22:02:46 +0000 (18:02 -0400)]
[Flang][OpenMP] Add support for logical neqv reduction in worksharing-loop

Adds support for .neqv. reductions with logical types.

Reviewed By: kiranchandramohan

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

17 months ago[mlir][openacc] Accept acc.serial has parent of acc.yield op
Valentin Clement [Thu, 13 Apr 2023 21:35:02 +0000 (14:35 -0700)]
[mlir][openacc] Accept acc.serial has parent of acc.yield op

acc.serial op is modeled on the acc.parallel op.
acc.yield operation must then accept acc.serial has a parent
operation.

Reviewed By: PeteSteinfeld, razvanlupusoru

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

17 months ago[llvm-profdata] Fixed various issue with Sample Profile Reader
William Huang [Wed, 12 Apr 2023 00:49:05 +0000 (00:49 +0000)]
[llvm-profdata] Fixed various issue with Sample Profile Reader

Fixed various undefind behaviors with current Sample Profile Reader when reading unusual input. Furthermore, add the following rule on allowing multiple name table sections (current Reader has conflicted code handling such case):

When a new name table section is read (in the order sections are read), the names in the previous name table are cleared. Any subsequent sections referring to function names will index into the most recent read name table.

Also changed name table index to uint64_t to be consistent since there's a mix of using uint32_t and uint64_t.

Reviewed By: snehasish, huangjd

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

17 months ago[lldb] Use the host's target triple in TestObjectFileJSON
Jonas Devlieghere [Thu, 13 Apr 2023 21:19:39 +0000 (14:19 -0700)]
[lldb] Use the host's target triple in TestObjectFileJSON

Use the target's triple when adding JSON modules in TestObjectFileJSON.
This should fix the test failure on non-Darwin bots.

17 months ago[lldb] Make ObjectFileJSON loadable as a module
Jonas Devlieghere [Thu, 13 Apr 2023 20:02:45 +0000 (13:02 -0700)]
[lldb] Make ObjectFileJSON loadable as a module

This patch adds support for creating modules from JSON object files.
This is necessary for the crashlog use case where we don't have either a
module or a symbol file. In that case the ObjectFileJSON serves as both.

The patch adds support for an object file type (i.e. executable, shared
library, etc). It also adds the ability to specify sections, which is
necessary in order specify symbols by address. Finally, this patch
improves error handling and fixes a bug where we wouldn't read more than
the initial 512 bytes in GetModuleSpecifications.

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

17 months ago[VPlan] Switch to checking sinking legality for recurrences in VPlan.
Florian Hahn [Thu, 13 Apr 2023 21:00:51 +0000 (22:00 +0100)]
[VPlan] Switch to checking sinking legality for recurrences in VPlan.

Building on D142885 and D142589, retire the SinkAfter map from the
recurrence handling code. It is replaced by checking whether it is
possible to sink all users of a recurrence directly in VPlan. This
results in simpler code overall and allows to handle additional cases
(see the improvements in @test_crash).

Depends on D142885.
Depends on D142589.

Reviewed By: Ayal

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

17 months agoReland "[compiler-rt] Fix scudo build on ARM"
Leandro Lupori [Fri, 27 Jan 2023 18:34:00 +0000 (18:34 +0000)]
Reland "[compiler-rt] Fix scudo build on ARM"

This reverts commit 5abef0bdbe9237b5728215bb7cd915ffb960e5c3 and
fixes Fuchsia AArch64 cross-compile.

17 months ago[mlir][Vector] Add a masked vectorization of tensor.pad
Nicolas Vasilache [Thu, 13 Apr 2023 15:27:40 +0000 (08:27 -0700)]
[mlir][Vector] Add a masked vectorization of tensor.pad

This revision takes advantage of masking support to introduce a vectorized
version of pad that does not require lowering to lower-level form.

Lowering to lower-level form (if/else + generate + fill + copy + insert_slice)
creates unnecessary complexity that can be completely sidestepped by using
masked vectorization properly.

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

17 months ago[AArch64] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds
Fangrui Song [Thu, 13 Apr 2023 19:40:55 +0000 (12:40 -0700)]
[AArch64] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds

17 months ago[LV] Add exit users for recurrences in test, fix names.
Florian Hahn [Thu, 13 Apr 2023 19:23:56 +0000 (20:23 +0100)]
[LV] Add exit users for recurrences in test, fix names.

Add users of exit values for recurrences to make sure exit value
generation will be checked in a follow-up change.

Also adjusts/fixes naming in the test.

17 months ago[mlir][Vector] Add a vector.materialize_masks transform operation
Nicolas Vasilache [Thu, 13 Apr 2023 19:19:22 +0000 (12:19 -0700)]
[mlir][Vector] Add a vector.materialize_masks transform operation

17 months ago[LoopIdiomRecognize] Remove NUW flag from SCEV in getTripCount.
Craig Topper [Thu, 13 Apr 2023 18:53:43 +0000 (11:53 -0700)]
[LoopIdiomRecognize] Remove NUW flag from SCEV in getTripCount.

Based on the conversation in D147355.

Reviewed By: nikic

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

17 months agoAttributor: Add baseline tests for nofpclass changes
Matt Arsenault [Tue, 11 Apr 2023 18:20:05 +0000 (14:20 -0400)]
Attributor: Add baseline tests for nofpclass changes

17 months agoValueTracking: Add some more uitofp/sitofp tests
Matt Arsenault [Thu, 13 Apr 2023 15:42:35 +0000 (11:42 -0400)]
ValueTracking: Add some more uitofp/sitofp tests

Before computeKnownFPClass had a use, these were
only covered by unit tests and didn't cover vectors.

17 months ago[runtimes][asan] Fix swapcontext interception
Ivan Trofimov [Fri, 3 Feb 2023 08:29:00 +0000 (00:29 -0800)]
[runtimes][asan] Fix swapcontext interception

Resetting oucp's stack to zero in swapcontext interception is incorrect,
since it breaks ucp cleanup after swapcontext returns in some cases:

Say we have two contexts, A and B, and we swapcontext from A to B, do
some work on Bs stack and then swapcontext back from B to A. At this
point shadow memory of Bs stack is in arbitrary state, but since we
can't know whether B will ever swapcontext-ed to again we clean up it's
shadow memory, because otherwise it remains poisoned and blows in
completely unrelated places when heap-allocated memory of Bs context
gets reused later (see https://github.com/llvm/llvm-project/issues/58633
for example). swapcontext prototype is swapcontext(ucontext* oucp,
ucontext* ucp), so in this example A is oucp and B is ucp, and i refer
to the process of cleaning up Bs shadow memory as ucp cleanup.

About how it breaks:
Take the same example with A and B: when we swapcontext back from B to A
the oucp parameter of swapcontext is actually B, and current trunk
resets its stack in a way that it becomes "uncleanupable" later. It
works fine if we do A->B->A, but if we do A->B->A->B->A no cleanup is
performed for Bs stack after B "returns" to A second time. That's
exactly what happens in the test i provided, and it's actually a pretty
common real world scenario.

Instead of resetting oucp's we make use of uc_stack.ss_flags to mark
context as "cleanup-able" by storing stack specific hash. It should be
safe since this field is not used in [get|make|swap]context functions
and is hopefully never meaningfully used in real-world scenarios (and i
haven't seen any).

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

Reviewed By: vitalybuka

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

17 months agoValueTracking: Add baseline test for computeKnownFPClass for sin/cos
Matt Arsenault [Sat, 8 Apr 2023 23:13:56 +0000 (19:13 -0400)]
ValueTracking: Add baseline test for computeKnownFPClass for sin/cos

17 months agoValueTracking: Add cannotBeOrderedLessThanZero to KnownFPClass
Matt Arsenault [Wed, 12 Apr 2023 14:35:13 +0000 (10:35 -0400)]
ValueTracking: Add cannotBeOrderedLessThanZero to KnownFPClass

Eventually we should be able to replace the existing
CannotBeOrderedLessThanZero.

17 months agoValueTracking: Address todo for nan fmul handling in computeKnownFPClass
Matt Arsenault [Sat, 8 Apr 2023 19:24:33 +0000 (15:24 -0400)]
ValueTracking: Address todo for nan fmul handling in computeKnownFPClass

If both operands can't be zero or nan, the result can't be nan.

17 months agoValueTracking: Handle no-nan check for computeKnownFPClass for fmul
Matt Arsenault [Sat, 8 Apr 2023 18:35:15 +0000 (14:35 -0400)]
ValueTracking: Handle no-nan check for computeKnownFPClass for fmul

Copy the logic from isKnownNeverNaN for fadd/fsub. Leave the
extension to handle the zero case for a future change.

17 months agoValueTracking: Add baseline test for fmul computeKnownFPClass handling
Matt Arsenault [Sat, 8 Apr 2023 22:37:16 +0000 (18:37 -0400)]
ValueTracking: Add baseline test for fmul computeKnownFPClass handling

17 months ago[X86] Only fold PTEST->TESTP on AVX targets
Simon Pilgrim [Thu, 13 Apr 2023 18:39:47 +0000 (19:39 +0100)]
[X86] Only fold PTEST->TESTP on AVX targets

While PTEST is a SSE41 instruction, TESTPS/TESTPD was only added for AVX

17 months ago[X86] Split 128 and 256-bit PTEST combines
Simon Pilgrim [Thu, 13 Apr 2023 18:31:17 +0000 (19:31 +0100)]
[X86] Split 128 and 256-bit PTEST combines

We are missing SSE41 test coverage (and in fact have a bug with a PTEST->TESTP fold that is only valid on AVX).

17 months ago[SLP][NFC]Remove extra semicolons after function definitions, NFC
Alexey Bataev [Thu, 13 Apr 2023 18:30:25 +0000 (11:30 -0700)]
[SLP][NFC]Remove extra semicolons after function definitions, NFC

17 months ago[flang][openacc] Add proper TODO for the block construct
Valentin Clement [Thu, 13 Apr 2023 18:32:35 +0000 (11:32 -0700)]
[flang][openacc] Add proper TODO for the block construct

Trigger the not yet implemented message for
block constructs that are not lowered.

Reviewed By: PeteSteinfeld, razvanlupusoru

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

17 months ago[-Wunsafe-buffer-usage] A follow-up fix to 762af11d4c5d0bd1e76f23a07087773db09ef17d
Ziqing Luo [Thu, 13 Apr 2023 18:22:45 +0000 (11:22 -0700)]
[-Wunsafe-buffer-usage] A follow-up fix to 762af11d4c5d0bd1e76f23a07087773db09ef17d

Add -triple=arm-apple to the test `SemaCXX/warn-unsafe-buffer-usage-fixits-pre-increment.cpp`

17 months agoRevert "[Modules] Remove unnecessary check when generating name lookup table in ASTWr...
Fangrui Song [Thu, 13 Apr 2023 18:17:35 +0000 (11:17 -0700)]
Revert "[Modules] Remove unnecessary check when generating name lookup table in ASTWriter"

This reverts commit bc95f27337c7ed77c28e713c855272848f01802a, originally db987b9589be1eb604fcb74c85b410469e31485f.
clang/test/Modules/pr61065.cppm is retained to make relands show less diff.

There are other module-related issues that were not caught, related to
false positive errors like
"error: no matching constructor for initialization of 'union (anonymous union at ..."

Reopen #61065

17 months agoFix warnings in InstrProfTest.cpp
Ellis Hoag [Thu, 13 Apr 2023 17:58:29 +0000 (10:58 -0700)]
Fix warnings in InstrProfTest.cpp

The warnings were introduced in https://reviews.llvm.org/D148150

Reviewed By: snehasish

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

17 months ago[Test][Sanitizer][atos] Disable atos-symbolized-recovery test
Blue Gaston [Thu, 13 Apr 2023 18:10:21 +0000 (11:10 -0700)]
[Test][Sanitizer][atos] Disable atos-symbolized-recovery test

This test tests uses undefined behavior and is proving to be
very flakey. I am disabling for now.

Radar to add a new test: rdar://108003900

rdar://107846128

17 months ago[mlir][math] Expand math.round to truncate, compare and increment.
Balaji V. Iyer [Thu, 13 Apr 2023 17:58:14 +0000 (17:58 +0000)]
[mlir][math] Expand math.round to truncate, compare and increment.

Round functions are pushed directly to libm. This is problematic for
situations where libm is not available. This patch will decompose the
roundf function by adding 0.5 to positive number to input
(subtracting for negative) following by a truncate.

Reviewed By: rsuderman

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

17 months ago[CostModel][X86] Add latency/code-size/size-latency test coverage for integer add...
Simon Pilgrim [Thu, 13 Apr 2023 18:00:35 +0000 (19:00 +0100)]
[CostModel][X86] Add latency/code-size/size-latency test coverage for integer add/sub saturation intrinsics

17 months ago[Matrix] Fix IsSupported check in lowerDotProduct.
Florian Hahn [Thu, 13 Apr 2023 18:00:30 +0000 (19:00 +0100)]
[Matrix] Fix IsSupported check in lowerDotProduct.

The check incorrectly checks the RHS while LHS is transformed later.
Update to check LHS, which fixes a crash in the newly added test cases.

17 months ago[nfc][asan] Reformat the file
Vitaly Buka [Thu, 13 Apr 2023 17:58:33 +0000 (10:58 -0700)]
[nfc][asan] Reformat the file

17 months ago[lldb] Fix library layering after D145574
Fangrui Song [Thu, 13 Apr 2023 17:55:15 +0000 (10:55 -0700)]
[lldb] Fix library layering after D145574

17 months ago[lld][RISCV] Implement GP relaxation for R_RISCV_HI20/R_RISCV_LO12_I/R_RISCV_LO12_S.
Craig Topper [Thu, 13 Apr 2023 17:39:47 +0000 (10:39 -0700)]
[lld][RISCV] Implement GP relaxation for R_RISCV_HI20/R_RISCV_LO12_I/R_RISCV_LO12_S.

This implements support for relaxing these relocations to use the GP
register to compute addresses of globals in the .sdata and .sbss
sections.

This feature is off by default and must be enabled by passing
--relax-gp to the linker.

The GP register might not always be the "global pointer". It can
be used for other purposes. See discussion here
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/371

Reviewed By: MaskRay

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

17 months ago[CostModel][X86] Add SSE2 test coverage to integer add/sub saturation tests
Simon Pilgrim [Thu, 13 Apr 2023 17:42:06 +0000 (18:42 +0100)]
[CostModel][X86] Add SSE2 test coverage to integer add/sub saturation tests

17 months ago[InstrProf][Temporal] Add weight field to traces
Ellis Hoag [Wed, 12 Apr 2023 17:21:38 +0000 (10:21 -0700)]
[InstrProf][Temporal] Add weight field to traces

As discussed in [0], add a `weight` field to temporal profiling traces found in profiles. This allows users to use the `--weighted-input=` flag in the `llvm-profdata merge` command to weight traces from different scenarios differently.

Note that this is a breaking change, but since [1] landed very recently and there is no way to "use" this trace data, there should be no users of this feature. We believe it is acceptable to land this change without bumping the profile format version.

[0] https://reviews.llvm.org/D147812#4259507
[1] https://reviews.llvm.org/D147287

Reviewed By: snehasish

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

17 months ago[lld][WebAssembly] Trace export of symbols when specified with --trace-symbol. NFC
Sam Clegg [Thu, 13 Apr 2023 02:33:12 +0000 (19:33 -0700)]
[lld][WebAssembly] Trace export of symbols when specified with --trace-symbol. NFC

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

17 months ago[mlir][openacc] Add acc.serial operation
Valentin Clement [Thu, 13 Apr 2023 17:35:37 +0000 (10:35 -0700)]
[mlir][openacc] Add acc.serial operation

The acc.serial operation models the OpenACC serial construct.
The serial construct defines a region of a program that is to be
executed sequentially on the current device.
The operation is modelled on the acc.parallel operation and will
receive similar updates when the data operands operations will
be implemented.

Reviewed By: PeteSteinfeld

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

17 months agoInternalize AllocationBegin functions after D147005
Fangrui Song [Thu, 13 Apr 2023 17:28:58 +0000 (10:28 -0700)]
Internalize AllocationBegin functions after D147005

Reviewed By: thurston

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

17 months ago[SLP]Introduce gather cost estimation function.
Alexey Bataev [Wed, 12 Apr 2023 17:36:57 +0000 (10:36 -0700)]
[SLP]Introduce gather cost estimation function.

Introduced BoUpSLP::ShuffleCostEstimator::gather function as an initial
implementation of the gather/buildvector cost estimation for buildvector
nodes. It will allow to use general codegen infrastructure for better
cost estimation + it improves the cost estimation for the
gathers/buildvectors.

Improved part of D110978.

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

17 months ago[mlir][openacc][NFC] Use assembly format for acc.parallel
Valentin Clement [Thu, 13 Apr 2023 17:14:37 +0000 (10:14 -0700)]
[mlir][openacc][NFC] Use assembly format for acc.parallel

Remove the custoom parser and printer for the acc.parallel
operation and use the assembly format directly.

Reviewed By: PeteSteinfeld, razvanlupusoru

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

17 months ago[CostModel][X86] Add latency/code-size/size-latency target costs for minnum/maxnum...
Simon Pilgrim [Thu, 13 Apr 2023 17:07:03 +0000 (18:07 +0100)]
[CostModel][X86] Add latency/code-size/size-latency target costs for minnum/maxnum intrinsics

Using the latest version of the script from D103695 to compare costmodel vs llvm-mca statistics.

Avoids using the default costs, which was assuming libm calls.

17 months ago[clang][ExtractAPI] Complete declaration fragments for TagDecl types defined in a...
ruturaj4 [Thu, 13 Apr 2023 12:48:30 +0000 (13:48 +0100)]
[clang][ExtractAPI] Complete declaration fragments for TagDecl types defined in a typedef

enums and structs declared inside typedefs have incorrect declaration fragments, where the typedef keyword and other syntax is missing.

For the following struct:

typedef struct Test {
    int hello;
} Test;
The produced declaration is:

"declarationFragments": [
  {
    "kind": "keyword",
    "spelling": "struct"
  },
  {
    "kind": "text",
    "spelling": " "
  },
  {
    "kind": "identifier",
    "spelling": "Test"
  }
],
instead the declaration fragments should represent the following

typedef struct Test {
    …
} Test;

This patch removes the condition in SymbolGraphSerializer.cpp file and completes declaration fragments

Reviewed By: dang

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

17 months ago[mlir][scf] Make whileOp builder funcs optional
Ivan Butygin [Wed, 12 Apr 2023 15:35:50 +0000 (17:35 +0200)]
[mlir][scf] Make whileOp builder funcs optional

Create empty block without the terminator in this case.

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

17 months ago[flang][runtime] Reset the left tab limit when flushing output
Peter Klausler [Wed, 12 Apr 2023 19:32:37 +0000 (12:32 -0700)]
[flang][runtime] Reset the left tab limit when flushing output

When flushing output to a non-positionable tty or socket file, reset the
left tab limit.  Otherwise, non-advancing output to that file will contain
an increasing amount of leading spaces in each flush.  Also, detect
newline characters in stream output, and treat them as record
advancement.

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

17 months ago[StackProtector] don't check stack protector before calling nounwind functions
Nick Desaulniers [Thu, 13 Apr 2023 16:30:19 +0000 (09:30 -0700)]
[StackProtector] don't check stack protector before calling nounwind functions

https://reviews.llvm.org/rGd656ae28095726830f9beb8dbd4d69f5144ef821
introduced a additional checks before calling noreturn functions in
response to this security paper related to Catch Handler Oriented
Programming (CHOP):
https://download.vusec.net/papers/chop_ndss23.pdf
See also:
https://bugs.chromium.org/p/llvm/issues/detail?id=30

This causes stack canaries to be inserted in C code which was
unexpected; we noticed certain Linux kernel trees stopped booting after
this (in functions trying to initialize the stack canary itself).
https://github.com/ClangBuiltLinux/linux/issues/1815

There is no point checking the stack canary like this when exceptions
are disabled (-fno-exceptions or function is marked noexcept) or for C
code.  The GCC patch for this issue does something similar:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=a25982ada523689c8745d7fb4b1b93c8f5dab2e7

Android measured a 2% regression in RSS as a result of d656ae280957 and
undid it globally:
https://android-review.googlesource.com/c/platform/build/soong/+/2524336

Reviewed By: xiangzhangllvm

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

17 months ago[CostModel][X86] Add latency/code-size test coverage for minnum/maxnum intrinsics
Simon Pilgrim [Thu, 13 Apr 2023 16:21:15 +0000 (17:21 +0100)]
[CostModel][X86] Add latency/code-size test coverage for minnum/maxnum intrinsics

And improve test coverage for the existing size-latency tests to match

17 months ago[llvm-readobj] fix unit test failure on 32bit machines
Antoine Moynault [Thu, 13 Apr 2023 16:27:13 +0000 (16:27 +0000)]
[llvm-readobj] fix unit test failure on 32bit machines

Several bots are failing on 32-bit since https://reviews.llvm.org/D145761 was merged
  https://lab.llvm.org/buildbot/#/builders/178/builds/4384

It seems due to the use of uintptr_t (32bit here) for storing 64 bit values.

Issue is fixed by replacing to uint64_t (as suggested by DavidSpickett).

Reviewed By: jhenderson

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

17 months agoRevert "[COFF] Add MC support for emitting IMAGE_WEAK_EXTERN_ANTI_DEPENDENCY symbols"
Arthur Eubanks [Thu, 13 Apr 2023 16:09:18 +0000 (09:09 -0700)]
Revert "[COFF] Add MC support for emitting IMAGE_WEAK_EXTERN_ANTI_DEPENDENCY symbols"

This reverts commit fffdb7eac58b4efde5e23c1281e7a7f93a42d280.

Causes crashes, see https://reviews.llvm.org/D145208

17 months ago[mlir][math] Expand math.exp2 to use math.exp.
Balaji V. Iyer [Thu, 13 Apr 2023 15:54:21 +0000 (15:54 +0000)]
[mlir][math] Expand math.exp2 to use math.exp.

Exp2 functions are pushed directly to libm. This is problematic for
situations where libm is not available. This patch will expand the exp2
function to use exp2 with the input multiplied by ln2 (natural log).

Reviewed By: rsuderman

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

17 months agoInstSimplify: Regenerate checks in a test
Matt Arsenault [Thu, 13 Apr 2023 16:05:05 +0000 (12:05 -0400)]
InstSimplify: Regenerate checks in a test

For some reason this was missing the "Assertions have been autogenerated"
comment so were getting spurious diffs in a future change.

17 months ago[SLP] Compute min/max scalar reduction costs using min/max intrinsics instead of...
Simon Pilgrim [Thu, 13 Apr 2023 15:59:35 +0000 (16:59 +0100)]
[SLP] Compute min/max scalar reduction costs using min/max intrinsics instead of expanded cmp+sel

By default these will expand back to cmp/sel, but some targets (X86) has optimized costs for scalar integer min/max patterns which are lower than the default expansion (pre-SSE41 is particularly weak for vector min/max support).

Differential Revision: [SLP] Compute min/max scalar reduction costs using min/max intrinsics instead of expanded cmp+sel

17 months ago[AMDGPU] Allow use of TTMP registers in AMDGPUResourceUsageAnalysis
Jay Foad [Thu, 13 Apr 2023 14:53:09 +0000 (15:53 +0100)]
[AMDGPU] Allow use of TTMP registers in AMDGPUResourceUsageAnalysis

With architected SGPRs, workgroup IDs are passed into a compute shader
in TTMP registers. Allow for this in AMDGPUResourceUsageAnalysis instead
of failing an assertion.

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

17 months ago[AMDGPU] Avoid else-after-return in isLegalAddressingMode. NFC.
Jay Foad [Thu, 13 Apr 2023 15:52:03 +0000 (16:52 +0100)]
[AMDGPU] Avoid else-after-return in isLegalAddressingMode. NFC.

17 months ago[AArch64] Add more efficient vector bitcast for AArch64
Lawrence Benson [Thu, 13 Apr 2023 15:44:09 +0000 (16:44 +0100)]
[AArch64] Add more efficient vector bitcast for AArch64

Adds a DAG combine checks for vector comparisons followed by a bitcast to a
scalar value. Previously, this resulted in an expand.  Now, this is done with a
constant number of instructions that take one bit per vector value (via an AND
mask) and perfom a horizontal add to get a single value. This is especially
useful for Clang's __builtin_convertvector() to a bool vector.

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

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

17 months ago[IR] llvm::createMinMaxOp - create integer min/max intrinsics instead of icmp/sel
Simon Pilgrim [Thu, 13 Apr 2023 15:40:37 +0000 (16:40 +0100)]
[IR] llvm::createMinMaxOp - create integer min/max intrinsics instead of icmp/sel

Based off D148215, when expanding a min/max reduction we should be creating min/max intrinsics directly instead of relying on instcombine to fold them back together.

This patch handles integer min/max cases. Hopefully we can add floating point support soon (at least for fastmath/nnan cases) - but we're missing some of the plumbing to pass the correct FMF to the intrinsic at the moment.

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

17 months ago[lldb] Add 'CHECK' to class-type-nullptr-deref.s test.
Caroline Tice [Wed, 12 Apr 2023 18:13:25 +0000 (11:13 -0700)]
[lldb] Add 'CHECK' to class-type-nullptr-deref.s test.

This test previously relied on just segfaulting or not. This commit adds
a CHECK statement to the test.

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

17 months agoUse `bytes`, not `str`, to return C++ strings to Python.
Chris Jones [Thu, 13 Apr 2023 15:05:26 +0000 (17:05 +0200)]
Use `bytes`, not `str`, to return C++ strings to Python.

`str` must be valid UTF-8, which is not guaranteed for C++ strings.

Reviewed By: ftynse

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

17 months ago[libcxx][AIX] Reverting XFAILs for test cases after OS update
Nicole Rabjohn [Thu, 13 Apr 2023 15:01:47 +0000 (11:01 -0400)]
[libcxx][AIX] Reverting XFAILs for test cases after OS update

These test cases were fixed with AIX 73TL1, and are currently passing on AIX machines with that fix. This fix has also been backported to the 7.2 service line. These were tested on a machine with AIX 7.2 TL 5 SP4 installed.

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

17 months ago[Coverage] Handle invalid end location of an expression/statement.
Zequan Wu [Tue, 28 Mar 2023 16:55:47 +0000 (12:55 -0400)]
[Coverage] Handle invalid end location of an expression/statement.

Fix a crash when an expression/statement can have valid start location but invalid end location in some situations. For example: https://github.com/llvm/llvm-project/blob/llvmorg-16.0.1/clang/lib/Sema/SemaExprCXX.cpp#L1536

This confuses `CounterCoverageMappingBuilder` when popping a region from region
stack as if the end location is a macro or include location.

Reviewed By: hans, aaron.ballman

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

17 months ago[clangd] Use FileEntryRef for canonicalizing filepaths.
Utkarsh Saxena [Thu, 13 Apr 2023 10:47:52 +0000 (12:47 +0200)]
[clangd] Use FileEntryRef for canonicalizing filepaths.

Using FileEntry for retrieving filenames give the name used for the last access. FileEntryRef gives the first access name.

Last access name is suspected to change with unrelated changes in clang or the underlying filesystem. First access name gives more stability to the name and makes it easier to track.

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