platform/upstream/llvm.git
15 months ago[InstSimplify] Extend handlng of fp min/max.
Serguei Katkov [Wed, 29 Mar 2023 05:37:03 +0000 (12:37 +0700)]
[InstSimplify] Extend handlng of fp min/max.

Add support the cases like
  m(m(X,Y),m'(X,Y)) => m(X,Y)
where m is one of maxnum, minnum, maximum, minimum and
m' is m or inverse of m.

alive2 correctness check:
maxnum(maxnum,maxnum) https://alive2.llvm.org/ce/z/kSyAzo
maxnum(maxnum,minnum) https://alive2.llvm.org/ce/z/Vra8j2
minnum(minnum,minnum) https://alive2.llvm.org/ce/z/B6h-hW
minnum(minnum,maxnum) https://alive2.llvm.org/ce/z/rG2u_b
maximum(maximum,maximum) https://alive2.llvm.org/ce/z/N2nevY
maximum(maximum,minimum) https://alive2.llvm.org/ce/z/23RFcP
minimum(minimum,minimum) https://alive2.llvm.org/ce/z/spHZ-U
minimum(minimum,maximum) https://alive2.llvm.org/ce/z/Aa-VE8

Reviewed By: dantrushin, RKSimon
Differential Revision: https://reviews.llvm.org/D147137

15 months ago[LTO] Change getThinLTOOutputFile to take StringRef
Fangrui Song [Thu, 27 Apr 2023 03:43:11 +0000 (20:43 -0700)]
[LTO] Change getThinLTOOutputFile to take StringRef

15 months ago[RISCV] Support vector strict rounding operations.
Yeting Kuo [Mon, 17 Apr 2023 07:26:51 +0000 (15:26 +0800)]
[RISCV] Support vector strict rounding operations.

The patch basically models custom lowering of base rounding operations to expand
rounding by coverting to ingter and coverting back to FP. The other one thing
the patch does is to covert sNan of the source to qNan.

Reviewed By: craig.topper

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

15 months ago[ValueTracking] Guaranteed not to be undef if has dereferenceable attribute
luxufan [Thu, 27 Apr 2023 02:40:27 +0000 (10:40 +0800)]
[ValueTracking] Guaranteed not to be undef if has dereferenceable attribute

As LangRef says, "dereferenceable<n> implies noundef".
`isGuaranteedNotToBeUndefOrPoison` should return true if the parameter
has dereferenceable attribute.

Reviewed By: nikic

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

15 months ago[NFC][HWASAN] Move InTaggableRegion
Vitaly Buka [Wed, 26 Apr 2023 23:20:04 +0000 (16:20 -0700)]
[NFC][HWASAN] Move InTaggableRegion

Prepare to use it in all tag related functions.

Reviewed By: thurston

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

15 months agoRevert "[SPARC][MC] Fix encoding of backwards BPr branches"
Vitaly Buka [Thu, 27 Apr 2023 02:41:26 +0000 (19:41 -0700)]
Revert "[SPARC][MC] Fix encoding of backwards BPr branches"

Introduces UB, details in D144012.

This reverts commit 92f1156efc5f762ac3a4cc4eebe62742f6d75789.

15 months ago[HWASAN] Support tagged stack pointer
Vitaly Buka [Wed, 26 Apr 2023 00:48:24 +0000 (17:48 -0700)]
[HWASAN] Support tagged stack pointer

If stack was allocated using regular allocator, it may be tagged
and it will make memToShadow calculate invalid offset.

Also when UAR tag should be the tag of the stack frame pointer.

Reviewed By: eugenis

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

15 months ago[hwasan] Implement __sanitizer_purge_allocator
Vitaly Buka [Wed, 26 Apr 2023 07:50:34 +0000 (00:50 -0700)]
[hwasan] Implement __sanitizer_purge_allocator

Reviewed By: kstoimenov

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

15 months ago[libfuzzer] avoid unneccessary auto-copy
Wu, Yingcong [Thu, 27 Apr 2023 01:59:49 +0000 (18:59 -0700)]
[libfuzzer] avoid unneccessary auto-copy

Avoid an unneccessary auto-copy

Reviewed By: vitalybuka

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

15 months ago[sanitizer] move a pointer dereference after its null check
Wu, Yingcong [Thu, 27 Apr 2023 01:56:30 +0000 (18:56 -0700)]
[sanitizer] move a pointer dereference after its null check

The dereference of pointer `ctx` is not protected by its null check, this could be problematic.

Reviewed By: vitalybuka, MaskRay

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

15 months ago[HWASAN] Fix __sanitizer_get_allocated_{begin,size}
Vitaly Buka [Wed, 26 Apr 2023 06:35:20 +0000 (23:35 -0700)]
[HWASAN] Fix __sanitizer_get_allocated_{begin,size}

HWASAN_ALIASING_MODE needs to untag only
primary allocator pointers.

Reviewed By: kstoimenov, thurston

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

15 months ago[GlobalOpt] Don't replace the aliasee if it has other references.
DianQK [Thu, 27 Apr 2023 00:10:15 +0000 (08:10 +0800)]
[GlobalOpt] Don't replace the aliasee if it has other references.

As long as aliasee has `@llvm.used` or `@llvm.compiler.used` references, we cannot do the related replace or delete operations. Even if it is a Local Linkage, we cannot infer if there is no other use for it, such as asm or other future added cases.

Reviewed By: nikic

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

15 months ago[HWASAN] Fix HwasanReallocate in aliasing mode
Vitaly Buka [Wed, 26 Apr 2023 21:03:49 +0000 (14:03 -0700)]
[HWASAN] Fix HwasanReallocate in aliasing mode

HWASAN_ALIASING_MODE needs to untag only
primary allocator pointers.

Reviewed By: kstoimenov

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

15 months agoAlways emit symbol table when dwarf section exists in COFF
Haohai Wen [Thu, 27 Apr 2023 01:32:44 +0000 (09:32 +0800)]
Always emit symbol table when dwarf section exists in COFF

This also fixes check prefix NO which is pointless in symtab.test

Reviewed By: mstorsjo

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

15 months ago[sanitizer] Correct alignment of x32 __sanitizer_siginfo
H.J. Lu [Wed, 26 Apr 2023 23:34:08 +0000 (16:34 -0700)]
[sanitizer] Correct alignment of x32 __sanitizer_siginfo

Since alignment of x32 siginfo_t is 8 bytes, not 4 bytes, use u64 in
__sanitizer_siginfo_pad to align x32 __sanitizer_siginfo to 8 bytes.

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

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

15 months ago[OpenMP][Flang][Semantics] Add semantics support for USE_DEVICE_PTR clause on OMP...
Raghu Maddhipatla [Thu, 13 Apr 2023 16:33:21 +0000 (11:33 -0500)]
[OpenMP][Flang][Semantics] Add semantics support for USE_DEVICE_PTR clause on OMP TARGET DATA directive.

Initial support for USE_DEVICE_PTR clause on OMP TARGET DATA directive.

Reviewed By: kiranchandramohan

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

15 months ago[lldb] Create a way to force remove commands
walter erquinigo [Thu, 27 Apr 2023 00:09:26 +0000 (19:09 -0500)]
[lldb] Create a way to force remove commands

Some LLDB set ups need to hide certain commands for security reasons, so I'm adding a flag that allows removing non-user commands.

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

15 months ago[clang] Apply -fcoverage-prefix-map reverse order
Gulfem Savrun Yeniceri [Wed, 26 Apr 2023 22:49:09 +0000 (22:49 +0000)]
[clang] Apply -fcoverage-prefix-map reverse order

This patch changes handling multiple -fcoverage-prefix-map options to
match GCC's behavior. GCC applies prefix remappings that are provided
in reverse order (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109591).

Reviewed By: phosek

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

15 months ago[RISCV] Remove the uret instruction.
Craig Topper [Thu, 27 Apr 2023 00:11:58 +0000 (17:11 -0700)]
[RISCV] Remove the uret instruction.

This was part of the N extension which did not make it into
version 1.12 of the privilege specification.

Reviewed By: jrtc27

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

15 months ago[scudo] Fix missing pushing 1 block to BatchClassId
Chia-hung Duan [Tue, 25 Apr 2023 07:32:57 +0000 (07:32 +0000)]
[scudo] Fix missing pushing 1 block to BatchClassId

This was happened rarely. The only case is when a thread is teared down
and it only has one block of BatchClass and the freelist of BatchClass
is empty. The impact is leaking 1 block of BatchClass and which is minor.

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

15 months ago[bazel][NFC] Run buildifier on libc/libc_build_rules.bzl.
Jorge Gorbe Moya [Thu, 27 Apr 2023 00:01:39 +0000 (17:01 -0700)]
[bazel][NFC] Run buildifier on libc/libc_build_rules.bzl.

15 months ago[NFC][sanitizer] Fix typo
Vitaly Buka [Wed, 26 Apr 2023 23:58:37 +0000 (16:58 -0700)]
[NFC][sanitizer] Fix typo

15 months ago[test][HWASAN] XFAIL broken test on aarch64
Vitaly Buka [Wed, 26 Apr 2023 23:57:13 +0000 (16:57 -0700)]
[test][HWASAN] XFAIL broken test on aarch64

15 months agoPass the found declaration to DiagnoseUseOfDecl.
Richard Smith [Wed, 26 Apr 2023 23:53:34 +0000 (16:53 -0700)]
Pass the found declaration to DiagnoseUseOfDecl.

Don't pass in the resolved declaration, because that might be an
inheriting constructor declaration, which should never be used directly
and for which constraint satisfaction checking doesn't work.

Fixes #62361.

15 months ago[llvm-mca][RISCV] Fix checking if data valid in createInstrument
Michael Maitland [Mon, 24 Apr 2023 14:53:56 +0000 (07:53 -0700)]
[llvm-mca][RISCV] Fix checking if data valid in createInstrument

Fixes createInstrument to return instrument when LMUL data is valid, and
return nullptr when LMUL data is not valid for RISCV target.

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

15 months ago[test][HWASAN] Suppress memory leak in getpass
Vitaly Buka [Wed, 26 Apr 2023 23:48:38 +0000 (16:48 -0700)]
[test][HWASAN] Suppress memory leak in getpass

Reported after D149234.

15 months agoRevert "[test][HWASAN] Suppress memory leak in getpass"
Vitaly Buka [Wed, 26 Apr 2023 23:38:24 +0000 (16:38 -0700)]
Revert "[test][HWASAN] Suppress memory leak in getpass"

Does not fix the leak.

This reverts commit 1533478615e998192e227bded9d0e9029474936b.

15 months ago[FuzzMutate] Skip EHPad during mutation and avoid replacing callee with pointer when...
Henry Yu [Wed, 26 Apr 2023 23:43:48 +0000 (16:43 -0700)]
[FuzzMutate] Skip EHPad during mutation and avoid replacing callee with pointer when sinking

This patch addresses 2 problems:

- In `ShuffleBlockStrategy`, when `BB` is an EHPad, `BB.getFirstInsertionPt()` will return `BB.end()`, which cannot be dereferenced and will cause crash in following loop.
- In `isCompatibleReplacement`, a call instruction's callee might be replaced by a pointer, causing 2 subproblems:
  - we cannot guarantee that the pointer is a function pointer (even if it is, we cannot guarantee it matches the signature).
  - after such a replacement, `getCalledFunction` will from then on return `nullptr` (since it's indirect call) which causes Segmentation Fault in the lines below.

This patch fixes the first problem by checking if a block to be mutated is an EHPad in base class `IRMutationStrategy` and skipping mutating it if so.

This patch fixes the second problem by avoiding replacing callee with pointer and adding a null check for indirect calls.

Reviewed By: Peter

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

15 months agoVE: Register null MCTargetStreamer
Matt Arsenault [Sat, 29 Oct 2022 20:01:58 +0000 (13:01 -0700)]
VE: Register null MCTargetStreamer

15 months agoHIP: Directly call fma builtins
Matt Arsenault [Sun, 20 Nov 2022 16:33:14 +0000 (08:33 -0800)]
HIP: Directly call fma builtins

15 months agoEmit unwind information in .debug_frame section when .cfi_sections .debug_frame intri...
Shubham Sandeep Rastogi [Wed, 5 Apr 2023 16:05:06 +0000 (09:05 -0700)]
Emit unwind information in .debug_frame section when .cfi_sections .debug_frame intrinsic is used

The .cfi_sections .debug_frame intrinsic is used to emit .debug_frame
section. This directive tells the assembler to write out a section of
debug frame data. AArch64 is a platform where eh_frame is not needed for
unwind information. Unfortunately, that means that even when the
.cfi_sections .debug_frame intrinsic is used, the compiler skips
emitting the CIE's and FDE's in the debug_frame section. This patch
address that issue by making sure that the emission of CIE's and FDE's
are only skipped if the unwind information does not require a
debug_frame section and is a platform where the eh_frame can be skipped.

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

15 months agoAdd tests to verify behavior of .cfi_sections .debug_frame intrinsic.
Shubham Sandeep Rastogi [Thu, 6 Apr 2023 21:30:27 +0000 (14:30 -0700)]
Add tests to verify behavior of .cfi_sections .debug_frame intrinsic.

There was some lacking test coverage for checking when the
.cfi_sections .debug_frame intrinsic is emitted. On x86_64,
with -fno-exceptions there is no .cfi_sections .debug_frame intrinsic
emitted because there is an unwind table attribute.

On AArch64, with -fno-exceptions, there is no unwind table attribute, so
the .cfi_sections .debug_frame intrinsic is emitted correctly.

Alternatively, with -fexceptions, both AArch64 and x86_64 emit an unwind
table and therefore do not emit a .cfi_sections .debug_frame intrinsic

All this work was done in addition to https://reviews.llvm.org/D139663
patch.

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

15 months ago[test][HWASAN] Suppress memory leak in getpass
Vitaly Buka [Wed, 26 Apr 2023 23:11:30 +0000 (16:11 -0700)]
[test][HWASAN] Suppress memory leak in getpass

Reported after D149234.

15 months ago[test][sanitizer] Reformat the test
Vitaly Buka [Wed, 26 Apr 2023 23:10:30 +0000 (16:10 -0700)]
[test][sanitizer] Reformat the test

15 months ago[libc] Add a new target named LibcHermeticTestMain.
Siva Chandra Reddy [Wed, 26 Apr 2023 22:11:31 +0000 (22:11 +0000)]
[libc] Add a new target named LibcHermeticTestMain.

The existing LibcTestMain has been renamed to LibcUnitTestMain.
Hermetic tests are linked to LibcHermeticTestMain and unit tests are
linked to LibcUnitTestMain.

Reviewed By: jhuber6

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

15 months ago[lldb] Change return type of FileSpec::GetFileNameExtension
Alex Langford [Wed, 26 Apr 2023 22:01:12 +0000 (15:01 -0700)]
[lldb] Change return type of FileSpec::GetFileNameExtension

These don't really need to be in ConstStrings. It's nice that comparing
ConstStrings is fast (just a pointer comparison) but the cost of
creating the ConstString usually already includes the cost of doing a
StringRef comparison anyway, so this is just extra work and extra memory
consumption for basically no benefit.

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

15 months ago[SPARC][MC] Fix encoding of backwards BPr branches
Brad Smith [Wed, 26 Apr 2023 22:53:52 +0000 (18:53 -0400)]
[SPARC][MC] Fix encoding of backwards BPr branches

Make sure that the upper bits of the offset is placed in bits 20-21 of the
instruction word.

This fixes the encoding of backwards (negative offset) BPr branches.

(Previously, the upper two bits of the offset would overwrite parts of the rs1
field, causing it to branch on the wrong register, with the wrong offset)

Reviewed By: arsenm

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

15 months ago[SPARC] Lower BR_CC to BPr on 64-bit target whenever possible
Brad Smith [Wed, 26 Apr 2023 22:50:49 +0000 (18:50 -0400)]
[SPARC] Lower BR_CC to BPr on 64-bit target whenever possible

On 64-bit target, when doing i64 BR_CC where one of the comparison operands is a
constant zero, try to fold the compare and BPcc into a BPr instruction.

For all integers, EQ and NE comparison are available, additionally for signed
integers, GT, GE, LT, and LE is also available.

Reviewed By: arsenm

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

15 months ago[mlir][GPUDialect] Implement memory attributions for LaunchOp
Fabian Mora [Wed, 26 Apr 2023 22:52:37 +0000 (17:52 -0500)]
[mlir][GPUDialect] Implement memory attributions for LaunchOp

Currently memory attributions are not supported for gpu::LaunchOp, this patch implements memory attributions for gpu::LaunchOp and modifies the KernelOutlining pass to make the attributions available in GPUFuncOp.

Reviewed By: makslevental

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

15 months ago[MLIR][python bindings] Add some AttrBuilder and port _exts to use them.
max [Wed, 26 Apr 2023 20:27:07 +0000 (15:27 -0500)]
[MLIR][python bindings] Add some AttrBuilder and port _exts to use them.

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

15 months agoFix CI failure - this depended on constants only defined on arm64 macs
Jason Molenda [Wed, 26 Apr 2023 22:44:39 +0000 (15:44 -0700)]
Fix CI failure - this depended on constants only defined on arm64 macs

15 months ago[Sema]Select correct lexical context during template instantiate
Congcong Cai [Mon, 24 Apr 2023 22:30:58 +0000 (00:30 +0200)]
[Sema]Select correct lexical context during template instantiate

This patch wants to fix inline friend decl like
```
template <class F1> int foo(F1 X);
template <int A1> struct A {
  template <class F1> friend int foo(F1 X) { return A1; }
};

template struct A<1>;
int a = foo(1.0);
```

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

15 months ago[NFC][HWASAN] Move getUARTag into the Entry
Vitaly Buka [Sun, 23 Apr 2023 07:03:58 +0000 (00:03 -0700)]
[NFC][HWASAN] Move getUARTag into the Entry

Reviewed By: kstoimenov, eugenis

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

15 months ago[HWASAN] Remove UAR tag branch !ClUARRetagToZero
Vitaly Buka [Sun, 23 Apr 2023 06:40:50 +0000 (23:40 -0700)]
[HWASAN] Remove UAR tag branch !ClUARRetagToZero

This is leftover from older version of HWASAN.
The current HWASAN assumes that the new stack
frames are tagged with zeroes, which make getNextTagWithCall
or StackTag ^ TagMaskByte unusable.

Reviewed By: kstoimenov, eugenis

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

15 months ago[libc][fix] Also remove the headers for the other flags
Joseph Huber [Wed, 26 Apr 2023 22:07:47 +0000 (17:07 -0500)]
[libc][fix] Also remove the headers for the other flags

Summary:
This patch makes this only apply to the GPU build. This should be
handled more intelligently in the future so it's common between all of t
hem.

15 months ago[lldb] `or` -> `||` in SBDefines.h
Jonas Devlieghere [Wed, 26 Apr 2023 22:00:57 +0000 (15:00 -0700)]
[lldb] `or` -> `||` in SBDefines.h

Address Dave's post-commit review feedback from
https://reviews.llvm.org/D147736#inline-1441914

15 months ago[libc][fix] Only add the hermetic test flags in GPU mode
Joseph Huber [Wed, 26 Apr 2023 21:58:08 +0000 (16:58 -0500)]
[libc][fix] Only add the hermetic test flags in GPU mode

Summary:
This is a little broken, what we really need is a separate target to use
with the hermetic tests, but this is a stop-gap to get the bots green
again.

15 months ago[lldb] Remove finding .Bundle directories in PlatformDarwinKernel
Alex Langford [Wed, 26 Apr 2023 17:54:02 +0000 (10:54 -0700)]
[lldb] Remove finding .Bundle directories in PlatformDarwinKernel

Jason isn't sure what this is used for and isn't aware of a .Bundle
suffix related to kernel debugging. Let's remove it.

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

15 months ago[libc] Partially implement `atexit` on the GPU
Joseph Huber [Wed, 26 Apr 2023 02:34:59 +0000 (21:34 -0500)]
[libc] Partially implement `atexit` on the GPU

The `atexit` function controls registering functions to call at the end
of the program. This is difficult to do in general on the GPU because of
the lack of a real mutex implementation. We primarily provide this for
testing where we can explicitly restrict how the `atexit` registration
functions are called. So we simply create a passthrough Mutex to get
past the usage of it as per @sivachandra's suggestion.

Depends on D149225

Reviewed By: sivachandra

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

15 months ago[libc] Correctly pass 'CXX_STANDARD' to the packaged GPU build
Joseph Huber [Wed, 26 Apr 2023 02:32:22 +0000 (21:32 -0500)]
[libc] Correctly pass 'CXX_STANDARD' to the packaged GPU build

We need to perform the GPU build separately. The `CXX_STANDARD` option
was not being passed properly.

Reviewed By: sivachandra

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

15 months ago[libc] Enable the GPU build to build the UnitTest library
Joseph Huber [Wed, 26 Apr 2023 00:03:43 +0000 (19:03 -0500)]
[libc] Enable the GPU build to build the UnitTest library

The previous patch in D149216 allows us to use the internal `<stdlib.h>`
include for the GPU build. However, we currently don't provide the
memory functions so the header wasn't resolving them. This patch adds
these as entrypoints. They don't cause any entrypoints to be emitted
because they are not implemented, but they provide it in the header so
that we can rely on the test's implementation of them.

Depends on D149216

Reviewed By: sivachandra

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

15 months ago[libc] Add path to include generated headers for hermetic tests
Joseph Huber [Tue, 25 Apr 2023 23:29:35 +0000 (18:29 -0500)]
[libc] Add path to include generated headers for hermetic tests

The generated header files live in the build directory's include path.
When targeting a hermetic build we want to make sure we only use headers
generated by the project itself if availible.

Reviewed By: sivachandra

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

15 months ago[hwasan] Do not memset allocation if it comes from the secondary allocator
Leonard Chan [Wed, 26 Apr 2023 21:48:37 +0000 (21:48 +0000)]
[hwasan] Do not memset allocation if it comes from the secondary allocator

The secondary allocator calls mmap which should return zero-inited pages, so we
don't need to explicitly memset it with zeros. This is similar to what asan's
calloc does.

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

15 months ago[libc][bazel] add file printf targets and support
Michael Jones [Mon, 27 Mar 2023 22:14:17 +0000 (15:14 -0700)]
[libc][bazel] add file printf targets and support

This patch adds targets for printf and fprintf to the bazel build.
Additionally, it adds support for the build system to specify where
files should be written for testing purposes. This was necessary to
enable the fprintf test under bazel.

Reviewed By: sivachandra

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

15 months agoAMDGPU: Remove invalid testcase for enqueue kernel
Matt Arsenault [Fri, 23 Dec 2022 23:33:34 +0000 (18:33 -0500)]
AMDGPU: Remove invalid testcase for enqueue kernel

The call didn't have the right calling convention, but calls to
kernels are supposed to be illegal anyway.

15 months ago[AArch64][SVE] Generate smull/umull instead of sve v2i64 mul
David Green [Wed, 26 Apr 2023 21:12:00 +0000 (22:12 +0100)]
[AArch64][SVE] Generate smull/umull instead of sve v2i64 mul

A neon smull/umull should be preferred over a sve v2i64 mul with two extends.
It will be both less instructions and a lower cost multiply instruction.

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

15 months ago[test][HWASAN] Add hwasan-aliasing
Vitaly Buka [Wed, 26 Apr 2023 21:01:18 +0000 (14:01 -0700)]
[test][HWASAN] Add hwasan-aliasing

Some tests of D149234 deppend on
aliasing mode.

15 months ago[OpenMP][Flang][MLIR] Add lowering of TargetOp for host codegen to LLVM-IR
Jan Sjodin [Wed, 26 Apr 2023 20:39:14 +0000 (16:39 -0400)]
[OpenMP][Flang][MLIR] Add lowering of TargetOp for host codegen to LLVM-IR

Fix uninitialied value use introduced in d3f9388ffb889d2ef512a17b9c4d37d09f03c693

15 months ago[RISCV] Remove CSR names that are not in Privileged Specification 1.12.
Craig Topper [Wed, 26 Apr 2023 20:35:20 +0000 (13:35 -0700)]
[RISCV] Remove CSR names that are not in Privileged Specification 1.12.

These are from the N extension (User-Level Interrupts) which did
not make it into 1.12 of the Privileged Specification.

D117653 also tried to remove some of these, but it was never reviewed.

Reviewed By: jrtc27

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

15 months ago[ELF] Add --remap-inputs= and --remap-inputs-file=
Fangrui Song [Wed, 26 Apr 2023 20:18:55 +0000 (13:18 -0700)]
[ELF] Add --remap-inputs= and --remap-inputs-file=

--remap-inputs-file= can be specified multiple times, each naming a
remap file that contains `from-glob=to-file` lines or `#`-led comments.
('=' is used a separator a la -fdebug-prefix-map=)
--remap-inputs-file= can be used to:

* replace an input file. E.g. `"*/libz.so=exp/libz.so"` can replace a resolved
  `-lz` without updating the input file list or (if used) a response file.
  When debugging an application where a bug is isolated to one single
  input file, this option gives a convenient way to test fixes.
* remove an input file with `/dev/null` (changed to `NUL` on Windows), e.g.
  `"a.o=/dev/null"`. A build system may add unneeded dependencies.
  This option gives a convenient way to test the result removing some inputs.

`--remap-inputs=a.o=aa.o` can be specified to provide one pattern without using
an extra file.
(bash/zsh process substitution is handy for specifying a pattern without using
a remap file, e.g. `--remap-inputs-file=<(printf 'a.o=aa.o')`, but it may be
unavailable in some systems. An extra file can be inconvenient for a build
system.)

Exact patterns are tested before wildcard patterns. In case of a tie, the first
patterns wins. This is an implementation detail that users should not rely on.

Co-authored-by: Marco Elver <elver@google.com>
Link: https://discourse.llvm.org/t/rfc-support-exclude-inputs/70070
Reviewed By: melver, peter.smith

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

15 months ago[gn build] Port 244560329603
LLVM GN Syncbot [Wed, 26 Apr 2023 20:11:45 +0000 (20:11 +0000)]
[gn build] Port 244560329603

15 months ago[libc++][PSTL] Integrate the headers and add a CI job
Nikolas Klauser [Fri, 21 Apr 2023 03:48:10 +0000 (05:48 +0200)]
[libc++][PSTL] Integrate the headers and add a CI job

Reviewed By: ldionne, #libc

Spies: libcxx-commits, arichardson

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

15 months ago[flang] Raise configure-time error when LLVM_ENABLE_EH is set
Patrick McCormick [Wed, 26 Apr 2023 19:49:58 +0000 (13:49 -0600)]
[flang] Raise configure-time error when LLVM_ENABLE_EH is set

flang cannot be built with exceptions enabled. Doing so results in a link-time
error.

This addresses issue #59353 [https://github.com/llvm/llvm-project/issues/59353]

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

15 months agoFix off-by-one error in armv7 mach-o corefile register context
Jason Molenda [Wed, 26 Apr 2023 20:04:38 +0000 (13:04 -0700)]
Fix off-by-one error in armv7 mach-o corefile register context

The sanity check on the size of the register context we found in
the corefile was off by one, so lldb would not add the register
contents.  Add a test case to ensure it doesn't regress.

Differential Revision: https://reviews.llvm.org/D149224
rdar://108306070

15 months ago[test][HWASAN] Regenerate some HWASAN tests
Vitaly Buka [Mon, 24 Apr 2023 04:43:32 +0000 (21:43 -0700)]
[test][HWASAN] Regenerate some HWASAN tests

Example of the command used to update tests:
```
ninja -C <build_dir> opt && llvm/utils/update_test_checks.py \
  --opt-binary <build_dir>/bin/opt llvm/test/Instrumentation/HWAddressSanitizer/X86/alloca.ll
```

Reviewed By: kstoimenov

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

15 months ago[HWASAN] Run sanitizer_common tests
Vitaly Buka [Wed, 26 Apr 2023 06:15:34 +0000 (23:15 -0700)]
[HWASAN] Run sanitizer_common tests

ninja check-sanitizer will run tests with hwasan as well

Reviewed By: kstoimenov

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

15 months ago[test][HWASAN] Add XFAILs for missing hwasan features
Vitaly Buka [Wed, 26 Apr 2023 06:15:34 +0000 (23:15 -0700)]
[test][HWASAN] Add XFAILs for missing hwasan features

Reviewed By: thurston

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

15 months ago[lldb] Skip Watchpoint/ExpressionLanguage.test on Windows
Alex Langford [Wed, 26 Apr 2023 19:38:53 +0000 (12:38 -0700)]
[lldb] Skip Watchpoint/ExpressionLanguage.test on Windows

This test fails on the aarch64-windows bots unfortunately. Mark as
unsupported.

Context: https://lab.llvm.org/buildbot/#/builders/219/builds/2389

15 months agoFix Clang sphinx bot
Aaron Ballman [Wed, 26 Apr 2023 19:29:02 +0000 (15:29 -0400)]
Fix Clang sphinx bot

Addresses the issue found in:
https://lab.llvm.org/buildbot/#/builders/92/builds/43413

15 months agoFix the diagnostic about attribute placement for scoped enumerations
ipriyanshi1708 [Wed, 26 Apr 2023 19:18:40 +0000 (15:18 -0400)]
Fix the diagnostic about attribute placement for scoped enumerations

Fixed the error message for attribute placement. Earlier it was showing
'place it after "enum"' but it should be 'place it after "enum class"'
which I have fixed in this patch.

Fixes https://github.com/llvm/llvm-project/issues/61660
Differential Revision: https://reviews.llvm.org/D147989

15 months ago[MLIR][python bindings] Reimplement `replace_all_uses_with` on `PyValue`
max [Wed, 26 Apr 2023 14:55:27 +0000 (09:55 -0500)]
[MLIR][python bindings] Reimplement `replace_all_uses_with` on `PyValue`

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

15 months ago[Clang][AIX] Add back error for -fprofile-sample-generate/use on AIX
Zarko Todorovski [Wed, 26 Apr 2023 17:43:12 +0000 (13:43 -0400)]
[Clang][AIX] Add back error for -fprofile-sample-generate/use on AIX

D148177 also removed the error for sampling based profiling which is not currently
supported on AIX. Adding that error back.

Reviewed By: qiongsiwu1

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

15 months ago[LV] Add extra uniformity tests with LSHR and AND.
Florian Hahn [Wed, 26 Apr 2023 18:51:34 +0000 (19:51 +0100)]
[LV] Add extra uniformity tests with LSHR and AND.

Extra tests for D148841 based on the tests added in
95539186c82604f783.

15 months ago{Flang][OpenMP] Add support for ior, ieor, and iand reduction in worksharing-loop
do [Wed, 26 Apr 2023 18:02:52 +0000 (14:02 -0400)]
{Flang][OpenMP] Add support for ior, ieor, and iand reduction in worksharing-loop

Adds support for .ior., .ieor., and .iand. reductions.

Reviewed By: kiranchandramohan

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

15 months ago[RISCV] Fix spelling 'Floating Pont' -> 'Floating Point'. NFC
Craig Topper [Wed, 26 Apr 2023 18:24:35 +0000 (11:24 -0700)]
[RISCV] Fix spelling 'Floating Pont' -> 'Floating Point'. NFC

15 months ago[NFC][Clang]Remove a reference on argument since 'Name' is not modified'
Mingming Liu [Wed, 26 Apr 2023 17:55:43 +0000 (10:55 -0700)]
[NFC][Clang]Remove a reference on argument since 'Name' is not modified'

Reviewed By: nickdesaulniers

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

15 months agoRemove the empty analysis diagnostics file
Aaron Ballman [Wed, 26 Apr 2023 18:17:13 +0000 (14:17 -0400)]
Remove the empty analysis diagnostics file

This file hasn't had any diagnostics in it since 2012, so I think we're
safe to remove this file.

15 months ago[RISCV] Add version of generateImmOutOfRangeError that takes an SMLoc.
Craig Topper [Wed, 26 Apr 2023 18:00:54 +0000 (11:00 -0700)]
[RISCV] Add version of generateImmOutOfRangeError that takes an SMLoc.

Have the ErrorInfo version call it after looking up ErrorInfo in
the Operands.

Use the new function in a few places that don't have ErrorInfo and
were also generating out of range messages.

15 months ago[HWASAN] Fix TLS + signal handling related crash
Kirill Stoimenov [Mon, 24 Apr 2023 19:25:45 +0000 (19:25 +0000)]
[HWASAN] Fix TLS + signal handling related crash

When a signal is raised before HWASAN has a chance to initialize it's TLS entry the program crashes. This only happens when hwasan-with-tls is true, which is default value. This patch fixes the problem by disabling signals during thread initialization time.

Reviewed By: vitalybuka

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

15 months ago[bazel][mlir] fix for d3f9388ff
Emilio Cota [Wed, 26 Apr 2023 17:47:00 +0000 (13:47 -0400)]
[bazel][mlir] fix for d3f9388ff

15 months ago[RISCV][CSKY][Loong] Pass Twine by const reference instead of by value. NFC
Craig Topper [Wed, 26 Apr 2023 17:41:57 +0000 (10:41 -0700)]
[RISCV][CSKY][Loong] Pass Twine by const reference instead of by value. NFC

I think RISCV was the original here and the CSKY and Loong copied it.

15 months agoInstCombine: Use computeKnownFPClass in is.fpclass combines and pass AC
Matt Arsenault [Mon, 10 Apr 2023 23:35:19 +0000 (19:35 -0400)]
InstCombine: Use computeKnownFPClass in is.fpclass combines and pass AC

The various isKnownNever* calls can be merged into one. This also introduces
the new ability to remove zero/sub/normal checks. Also start passing the
AssumptionCache arguments.

15 months ago[llvm-gsymutil] Switch to OptTable
Alex Brachet [Wed, 26 Apr 2023 16:54:38 +0000 (16:54 +0000)]
[llvm-gsymutil] Switch to OptTable

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

15 months ago[flang] Restore stack after allocas created by TargetRewrite.
Slava Zakharin [Tue, 25 Apr 2023 23:59:46 +0000 (16:59 -0700)]
[flang] Restore stack after allocas created by TargetRewrite.

This resolves issues with running out of stack on examples like
https://fortran-lang.discourse.group/t/modern-fortran-sample-code/2019/18
reported by @clementval.

When target rewrite creates alloca(s) around a call, we need to insert
stacksave/stackrestore to free the allocated stack. Better performant
code may be achieved by placing the alloca(s) outside of loops,
but the placement has to behave correctly with regards to OpenMP/OpenACC/etc.
dialect operations that have special representation for "private"
objects. This is a concervative fix for correctness issue.

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

15 months ago[lldb] Add support for specifying language when setting watchpoint by expression
Alex Langford [Mon, 24 Apr 2023 23:58:18 +0000 (16:58 -0700)]
[lldb] Add support for specifying language when setting watchpoint by expression

This is useful in contexts where you have multiple languages in play:
You may be stopped in a frame for language A, but want to set a watchpoint
with an expression using language B. The current way to do this is to
use the setting `target.language` while setting the watchpoint and
unset it after the watchpoint is set, but that's kind of clunky and
somewhat error-prone. This should add a better way to do this.

rdar://108202559

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

15 months ago[RISCV] Make Zicntr and Zihpm imply Zicsr.
Craig Topper [Wed, 26 Apr 2023 17:11:14 +0000 (10:11 -0700)]
[RISCV] Make Zicntr and Zihpm imply Zicsr.

Zicntr and Zihpm are names for groups of CSRs so they should imply
that CSRs exist.

Reviewed By: asb, kito-cheng

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

15 months ago[RISCV] Accept zicntr and zihpm command line options
Craig Topper [Wed, 26 Apr 2023 17:11:07 +0000 (10:11 -0700)]
[RISCV] Accept zicntr and zihpm command line options

This change adds the definition of the two extensions, but does not either a) make any register definitions conditional on them or b) enabled the extensions by default.

This is somewhat analogous to https://reviews.llvm.org/D143953, but with some key differences.  The best discussion I can find on status is here: https://github.com/riscv/riscv-profiles/issues/43.  These were removed between document version 2.1 and 2.2, but were not defined as new extensions in 2.2.  That addition came later - in March 2022.

According to https://drive.google.com/file/d/1qa57pePesOiDOrNzxuuGFhCL4Rbi9AYB/view these were ratified in March 2023.

Reviewed By: asb, reames

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

15 months agoAMDGPU: Reduce number of calls to computeKnownFPClass and pass all arguments
Matt Arsenault [Tue, 11 Apr 2023 20:08:42 +0000 (16:08 -0400)]
AMDGPU: Reduce number of calls to computeKnownFPClass and pass all arguments

Makes assumes work for this case.

15 months ago[OpenMP][Flang][MLIR] Add lowering of TargetOp for host codegen to LLVM-IR
Jan Sjodin [Mon, 3 Apr 2023 14:46:21 +0000 (10:46 -0400)]
[OpenMP][Flang][MLIR] Add lowering of TargetOp for host codegen to LLVM-IR

This patch adds lowering of TargetOps for the host. The lowering outlines the
target region function and uses the OpenMPIRBuilder support functions to emit
the function and call. Code generation for offloading will be done in later
patches.

Reviewed By: kiranchandramohan, jdoerfert, agozillon

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

15 months agoValueTracking: Add baseline computeKnownFPClass tests for minimum/maximum
Matt Arsenault [Mon, 10 Apr 2023 13:24:51 +0000 (09:24 -0400)]
ValueTracking: Add baseline computeKnownFPClass tests for minimum/maximum

15 months agoValueTracking: Fix computeKnownFPClass handling for copysign
Matt Arsenault [Tue, 25 Apr 2023 16:16:21 +0000 (12:16 -0400)]
ValueTracking: Fix computeKnownFPClass handling for copysign

We need to expand the set of possible classes to the opposite
sign for the first operand if we don't know the sign of the second
operand.

15 months ago[InlineAsm][AArch64]Add backend support for flag output parameters
Mingming Liu [Sun, 23 Apr 2023 19:23:33 +0000 (12:23 -0700)]
[InlineAsm][AArch64]Add backend support for flag output parameters

- The set of flag is from https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Flag-Output-Operands

Before:
- ARM64 GCC supports flag output constraints, while Clang doesn't parse condition code, as shown in https://gcc.godbolt.org/z/7jzMEK796
- LLVM ISel won't lower them either (as shown in https://gcc.godbolt.org/z/Pv4PPf56c)

After:
- Given flag output constraints in LLVM IR, condition code is parsed and flag output is lowered to 'cset'.
- Clang parse is not added in this patch.

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

15 months ago[AMDGPU] Add GFX11 ds_min_f32 / ds_max_f32 tests
Jay Foad [Wed, 26 Apr 2023 16:09:12 +0000 (17:09 +0100)]
[AMDGPU] Add GFX11 ds_min_f32 / ds_max_f32 tests

15 months ago[Headers] Revise conditional for rdrand64_step
Paul Robinson [Wed, 26 Apr 2023 15:55:51 +0000 (08:55 -0700)]
[Headers] Revise conditional for rdrand64_step

Downstream doc tooling doesn't like an #if between the doc and the
function prototype. This change also guarantees that the prototype
stays the same for 32/64 bit users.

15 months ago[RISCV] Make SCS prologue interrupt safe on RISC-V
Paul Kirth [Mon, 24 Apr 2023 21:03:21 +0000 (21:03 +0000)]
[RISCV] Make SCS prologue interrupt safe on RISC-V

Prior to this patch the SCS prologue used the following instruction
sequence.

```
s[w|d]  ra, 0(gp)
addi    gp, gp, [4|8]
```

The problem with this sequence is that an interrupt occurring between the
store and the increment could clobber the value just written to the SCS.

https://reviews.llvm.org/D84414#inline-813203 pointed out a similar
issues that could have affected the epilogue.

This patch changes the instruction sequence in the prologue to:

```
addi    gp, gp, [4|8]
s[w|d]  ra, -[4|8](gp)
```

The downside to this is that there is now a data dependency between the
add and the store.

Reviewed By: asb

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

15 months ago[flang] Recognize unused dummy arguments during lowering with HLFIR.
Slava Zakharin [Wed, 26 Apr 2023 05:03:57 +0000 (22:03 -0700)]
[flang] Recognize unused dummy arguments during lowering with HLFIR.

So far we've relied on AllocaOp to represent the dummy arguments
not declared for the current entry. With HLFIR we have to account
for hlfir::DeclareOp.

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

15 months ago[IR] Add interface to remove a CallBase string function attribute
Teresa Johnson [Wed, 26 Apr 2023 13:35:12 +0000 (06:35 -0700)]
[IR] Add interface to remove a CallBase string function attribute

Adds an interface to remove a string function attribute attached to a
CallBase, and a corresponding unittest.

This was extracted from D141077, and will be used by a follow on patch
that removes memprof attributes when needed.

Reviewed By: snehasish

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

15 months ago[libc][Docs] Begin improving documentation for the GPU libc
Joseph Huber [Tue, 25 Apr 2023 21:23:07 +0000 (16:23 -0500)]
[libc][Docs] Begin improving documentation for the GPU libc

This patch updates some of the documentation for the GPU libc project.
There is a lot of work still to be done, but this sets the general
outline.

Reviewed By: jdoerfert

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

15 months ago[dataflow] HTMLLogger - show the value of the current expr
Sam McCall [Fri, 21 Apr 2023 19:03:43 +0000 (21:03 +0200)]
[dataflow] HTMLLogger - show the value of the current expr

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

15 months agoMake debug counters available in non-assert builds as well
Mehdi Amini [Wed, 26 Apr 2023 05:21:34 +0000 (22:21 -0700)]
Make debug counters available in non-assert builds as well

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