platform/upstream/llvm.git
19 months ago[AMDGPU][AsmParser][NFC] Refine immediate operand definitions.
Ivan Kosarev [Thu, 30 Mar 2023 14:11:28 +0000 (15:11 +0100)]
[AMDGPU][AsmParser][NFC] Refine immediate operand definitions.

Reviewed By: dp

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

19 months ago[AMDGPU] Reduce repetition in SMEM instruction definitions
Jay Foad [Thu, 30 Mar 2023 11:24:53 +0000 (12:24 +0100)]
[AMDGPU] Reduce repetition in SMEM instruction definitions

This tries to remove all cases where we repeat the instruction name as
both an identifier (the tablegen name) and as a string (the assembler/
disassembler name). It uses tablegen's new !tolower operator.

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

19 months ago[clang][Interp] Add missing static_assert messages
Timm Bäder [Thu, 30 Mar 2023 13:43:14 +0000 (15:43 +0200)]
[clang][Interp] Add missing static_assert messages

This broke builders, e.g.
https://lab.llvm.org/buildbot/#builders/139/builds/38250

19 months ago[CodeGenPrepare] Increase the limit on the number of instructions to scan
Momchil Velikov [Thu, 30 Mar 2023 13:19:23 +0000 (14:19 +0100)]
[CodeGenPrepare] Increase the limit on the number of instructions to scan

... when finding all memory uses for an address and make it a
parameter.

Now that we have avoided potentially exponential run time of
`FindAllMemoryUses` in D143893. it'd be beneficial to increase the
limit up from 20.

Reviewed By: mkazantsev

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

Change-Id: I3abdf40332ef65e9b2f819ac32ac60e4200ec51d

19 months ago[clang][Interp] Implement function pointers
Timm Bäder [Wed, 11 Jan 2023 11:12:52 +0000 (12:12 +0100)]
[clang][Interp] Implement function pointers

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

19 months ago[CodeGenPrepare] Fix counting uses when folding addresses into memory instructions
Momchil Velikov [Thu, 30 Mar 2023 12:31:45 +0000 (13:31 +0100)]
[CodeGenPrepare] Fix counting uses when folding addresses into memory instructions

The counter of the number of instructions seen in `FindAllMemoryUses`
is reset after returning from a recursive invocation of
`FindAllMemoryUses` to the value it had before the call. In effect,
depending on the shape of the uses graph, the function may scan up to
`2^N-1` instructions where `N` is the scan limit
(`MaxMemoryUsesToScan`).  This does not look intuitive or intended.

This patch changes the counting to just count the scanned
instructions, independent of the shape of the references.

Reviewed By: mkazantsev

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

Change-Id: I99f5de55e84843cf2fbea287d6ae4312fa196240

19 months agoCorrect deferred concepts with NTTP placeholder constraints
Erich Keane [Wed, 29 Mar 2023 19:17:25 +0000 (12:17 -0700)]
Correct deferred concepts with NTTP placeholder constraints

Seemingly we never tested this, but the constraint on a NTTP was being
swtiched to the 'instantiated' version, but constraints need to be
relative to the 'top level', so this was causing us to not be able to
check the constraint on final use.

This patch corrects the issue by making the constraint created with the
un-instantiated version in the case of dependent constraint attachment.

Fixes: #61777

19 months ago[AMDGPU] Add tests on v_interp_p*_f16 with immediate parameters.
Ivan Kosarev [Thu, 30 Mar 2023 12:45:24 +0000 (13:45 +0100)]
[AMDGPU] Add tests on v_interp_p*_f16 with immediate parameters.

19 months ago[amdgpu] Fix broken error detection in LDS lowering
Jon Chesterfield [Thu, 30 Mar 2023 12:42:37 +0000 (13:42 +0100)]
[amdgpu] Fix broken error detection in LDS lowering

std::optional<uint32_t> can be compared to uint32_t without warning, but does
not compare to the value within the optional. It needs to be prefixed *.
Wconversion does not warn about this.
```
bool bug(uint32_t Offset, std::optional<uint32_t> Expect)
{
  return (Offset != Expect);
}
bool deref(uint32_t Offset, std::optional<uint32_t> Expect)
{
  return (Offset != *Expect);
}
```
Both compile without warnings. Wrote the former, intended the latter.

Reviewed By: arsenm

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

19 months ago[Test] Add test showing that SCEV cannot infer simple facts for decrementing AddRecs
Max Kazantsev [Thu, 30 Mar 2023 12:17:13 +0000 (19:17 +0700)]
[Test] Add test showing that SCEV cannot infer simple facts for decrementing AddRecs

19 months ago[MemCpyOpt] Don't fold memcpy.inline into memmove
Mikhail Maltsev [Thu, 30 Mar 2023 12:14:59 +0000 (13:14 +0100)]
[MemCpyOpt] Don't fold memcpy.inline into memmove

The llvm.memcpy.inline intrinsic must be expanded into code that
does not contain any function calls because it is intended for
the implementation of low-level functions like memcpy. Currently the
MemCpyOpt might covert llvm.memcpy.inline into llvm.memmove in
certain circumstances. This patch fixes the issue.

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

Reviewed By: nikic

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

19 months ago[mlir] Fix typos in comments in 1:N type conversion utils. (NFC)
Ingo Müller [Thu, 30 Mar 2023 12:04:23 +0000 (12:04 +0000)]
[mlir] Fix typos in comments in 1:N type conversion utils. (NFC)

Reviewed By: ingomueller-net

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

19 months ago[X86] LowerVectorAllZero - use MOVMSKPS for comparisons coming from vXi32/vXi64 vectors
Simon Pilgrim [Wed, 29 Mar 2023 17:50:45 +0000 (18:50 +0100)]
[X86] LowerVectorAllZero - use MOVMSKPS for comparisons coming from vXi32/vXi64 vectors

Reduces size of all/anyof comparison mask and is more likely to further fold with source vectors.

MOVMSKPD is trickier to match as if we had the CMPEQQ instruction we'd be using the PTEST path

19 months ago[X86] combineVectorShiftImm - fold (shift (logic X, C2), C1) -> (logic (shift X,...
Simon Pilgrim [Wed, 29 Mar 2023 16:04:17 +0000 (17:04 +0100)]
[X86] combineVectorShiftImm - fold (shift (logic X, C2), C1) -> (logic (shift X, C1), (shift C2, C1))

Helps expose a number of cases that we could/should reassociate - if only the vector constants hadn't already been lowered :(

It also forms a number of additional VPTERNLOG nodes, bringing together logic ops that had been stuck on either side of a shift op

19 months ago[include-cleaner] Ignore builtin symbols in the WalkAST.
Haojian Wu [Thu, 30 Mar 2023 10:31:41 +0000 (12:31 +0200)]
[include-cleaner] Ignore builtin symbols in the WalkAST.

There is no need to add headers for builtin symbols.

Additionally, there is a bonus benefit which help eliminate some bugs -- builtin
functions are modeled as implicit FunctionDecls in the clang AST, which results in
them being treated as normal FunctionDecls in the implementation of the include-cleaner
(going through the path: ast-node -> decl -> source location -> header).
And, the source location of these built-in symbols' AST nodes is not precise (e.g. points to the first call site),
which leads to subtle behavior that inserts a header of the call site.

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

19 months ago[MLIR][LLVM] Allowlist more side-effecting operations in LLVM inliner.
Johannes de Fine Licht [Thu, 30 Mar 2023 11:41:21 +0000 (11:41 +0000)]
[MLIR][LLVM] Allowlist more side-effecting operations in LLVM inliner.

These operations do not on their own require special handling to be
inlined, and can just be inlined as is.

Reviewed By: gysit

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

19 months ago[clang][Interp] Support destructors
Timm Bäder [Mon, 6 Mar 2023 18:05:54 +0000 (19:05 +0100)]
[clang][Interp] Support destructors

Emit destructors for non-primitive (array) variables on scope ends.

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

19 months ago[libc++] Use the stdlib=<LIB> Lit feature instead of use_system_cxx_lib
Louis Dionne [Sat, 18 Mar 2023 17:34:29 +0000 (13:34 -0400)]
[libc++] Use the stdlib=<LIB> Lit feature instead of use_system_cxx_lib

The use_system_cxx_lib Lit feature was only used for back-deployment
testing. However, one immense hole in that setup was that we didn't
have a proper way to test Apple's own libc++ outside of back-deployment,
which was embodied by the fact that we needed to define _LIBCPP_DISABLE_AVAILABILITY
when testing (see change in libcxx/utils/libcxx/test/params.py).

This led to the apple-system testing configuration not checking for
availability markup, which is obviously quite bad since the library
we ship actually has availability markup.

Using stdlib=<VENDOR>-libc++ instead to encode back-deployment restrictions
on tests is simpler and it makes it possible to naturally support tests
such as availability markup checking even in the tip-of-trunk Apple-libc++
configuration.

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

19 months ago[lldb-server/linux] Use waitpid(-1) to collect inferior events
Pavel Labath [Mon, 27 Mar 2023 15:39:55 +0000 (17:39 +0200)]
[lldb-server/linux] Use waitpid(-1) to collect inferior events

This is a follow-up to D116372, which had a rather unfortunate side
effect of making the processing of a single SIGCHLD quadratic in the
number of threads -- which does not matter for simple applications, but
can get really bad for applications with thousands of threads.

This patch fixes the problem by implementing the other possibility
mentioned in the first patch -- doing waitpid(-1) centrally and then
routing the events to the correct process instance. The "uncollected"
threads are held in the process factory class -- which I've renamed to
Manager for this purpose, as it now does more than creating processes.

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

19 months ago[AMDGPU] TableGen syntax cleanups
Jay Foad [Thu, 30 Mar 2023 10:24:39 +0000 (11:24 +0100)]
[AMDGPU] TableGen syntax cleanups

19 months ago[NFC] Fix potential for use-after-free in DumpModuleInfoAction
Mariya Podchishchaeva [Thu, 30 Mar 2023 10:04:28 +0000 (06:04 -0400)]
[NFC] Fix potential for use-after-free in DumpModuleInfoAction

Since each `DumpModuleInfoAction` can now contain a pointer to a
`raw_ostream`, saving there a poiter that owned by a local `unique_ptr`
may cause use-after-free. Clarify ownership and save a `shared_ptr`
inside of `DumpModuleInfoAction` instead.
Found by static analyzer.

Reviewed By: tahonermann, aaron.ballman

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

19 months agoRevert "[LSR] Preserve LCSSA when rewriting instruction with PHI user"
Nico Weber [Thu, 30 Mar 2023 10:40:16 +0000 (06:40 -0400)]
Revert "[LSR] Preserve LCSSA when rewriting instruction with PHI user"

This reverts commit 8ff4832679e1ff2d2a1cfaa45bb5cb995b0685a1.
Breaks tests, see https://reviews.llvm.org/D146811#4232839

19 months ago[mlir][transform] Fix typo in TrackingListener
Matthias Springer [Thu, 30 Mar 2023 10:08:20 +0000 (12:08 +0200)]
[mlir][transform] Fix typo in TrackingListener

This was an oversight in D147206. The function should not have been made
`const` (just like the other `notify...` functions).

19 months ago[clangd] Map references from include'd files to directives
Kadir Cetinkaya [Wed, 29 Mar 2023 11:09:39 +0000 (13:09 +0200)]
[clangd] Map references from include'd files to directives

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

19 months ago[AMDGPU] Remove two unused ComplexRendererFns
Jay Foad [Thu, 30 Mar 2023 09:43:37 +0000 (10:43 +0100)]
[AMDGPU] Remove two unused ComplexRendererFns

These were left over after https://reviews.llvm.org/D98663

19 months ago[mlir] Fix folding into tensor.pad op.
Alexander Belyaev [Thu, 30 Mar 2023 09:26:09 +0000 (11:26 +0200)]
[mlir] Fix folding into tensor.pad op.

When low/high padding is folded in padOp, there should be inserted a
tensor.cast back to the original result type. Right now, there is a no-op
tensor.cast from new type to new type...

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

19 months ago[AArch64] Extend icmp bitcast to vecreduce fold to comparison with -1
Nikita Popov [Tue, 21 Mar 2023 11:14:44 +0000 (12:14 +0100)]
[AArch64] Extend icmp bitcast to vecreduce fold to comparison with -1

D130163 added support for folding
setcc (iN (bitcast (vNi1 X))), 0, (eq|ne) to
setcc (iN (zext (i1 (vecreduce_or (vNi1 X))))), 0, (eq|ne).

There is a conjugate fold for comparison with -1 which uses
vecreduce_and and sext instead.

Proof: https://alive2.llvm.org/ce/z/Zz--xy

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

19 months ago[mlir][transform] Add optional error checking to TrackingListener
Matthias Springer [Thu, 30 Mar 2023 08:18:10 +0000 (10:18 +0200)]
[mlir][transform] Add optional error checking to TrackingListener

Derived classes can implement `notifyPayloadReplacementNotFound` for custom error checking.

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

19 months ago[mlir] Apply ClangTidy readability fix (NFC).
Adrian Kuegel [Thu, 30 Mar 2023 08:43:15 +0000 (10:43 +0200)]
[mlir] Apply ClangTidy readability fix (NFC).

19 months ago[flang][hlfir] disable region simplification in HLFIR pipeline
Jean Perier [Thu, 30 Mar 2023 07:48:45 +0000 (09:48 +0200)]
[flang][hlfir] disable region simplification in HLFIR pipeline

Block merging is disabled with FIR: some FIR value should not be promoted
to block arguments, and the region simplification block merging is
promoting all SSA value types to block argument when two blocks are
similar except for the usage these values.

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

19 months ago[LSR] Preserve LCSSA when rewriting instruction with PHI user
Dmitry Makogon [Fri, 24 Mar 2023 13:42:30 +0000 (20:42 +0700)]
[LSR] Preserve LCSSA when rewriting instruction with PHI user

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

LoopStrengthReduce may sometimes break LCSSA form when applying a rewrite
for an instruction used in a PHI.
It happens if:
 - The PHI is in a loop exit block,
 - The edge from the corresponding exiting block to that exit is critical,
 - The PHI has at least two inputs coming from loop blocks,
 - and the rewritten instruction is inserted in the loop.

In such case we split the critical edge and then replace PHI inputs
with the rewritten instruction. However ExitBlock is no longer
a loop exit, so LCSSA form is broken.

This patch fixes it by collecting all inserted instructions for PHIs
whose parent block is not a loop exit and then forming LCSSA for them.

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

19 months ago[CodeGen] Remove redundent instructions generated by combineAddrModes.
Peter Rong [Tue, 28 Mar 2023 12:14:23 +0000 (05:14 -0700)]
[CodeGen] Remove redundent instructions generated by combineAddrModes.

CodeGenPare may optimize memory access modes.
During such optimization, it might create a new instruction representing combined value.
Later, If the optimization failed, the generated value is not removed and remains a dead instruction.

Normally this won't be a problem as dead code will be eliminated later.
However, in this case (Issue 58538), the generated instruction may trigger an infinite loop.
The infinite loop involves `sinkCmpExpression`, where it tries to optimize the placeholder generated by us.
(See the test case detailed in the issue)

To fix this, we remove the unnecessary placeholder immediately when we abort the optimization.
`AddressingModeCombiner` will keep track of the placeholder, and remove it if it is an inserted placeholder and has no uses.
This patch fixes https://github.com/llvm/llvm-project/issues/58538, a test is also included.

Reviewed By: skatkov

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

19 months ago[RISCV] isDigit instead of isdigit for consistency. NFC
Craig Topper [Thu, 30 Mar 2023 07:10:36 +0000 (00:10 -0700)]
[RISCV] isDigit instead of isdigit for consistency. NFC

There are several other calls to isDigit in RISCVISAInfo.cpp

19 months ago[symbolizer] Additional tests for invalid address handling
Serge Pavlov [Thu, 30 Mar 2023 06:29:48 +0000 (13:29 +0700)]
[symbolizer] Additional tests for invalid address handling

These tests check GNU-compatible output if llvm-symbolizer is called with
the option --output-style=GNU and LLVM-style output if llvm-addr2line is
called with --output-style=LLVM.

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

19 months agoUse Dense{Map,Set}::contains (NFC)
Kazu Hirata [Thu, 30 Mar 2023 06:01:11 +0000 (23:01 -0700)]
Use Dense{Map,Set}::contains (NFC)

19 months ago[RISCV] Replace std::string with StringRef in RISCVISAInfo. NFC
Craig Topper [Thu, 30 Mar 2023 05:22:57 +0000 (22:22 -0700)]
[RISCV] Replace std::string with StringRef in RISCVISAInfo. NFC

We're just slicing off part of an existing StringRef. No need to
allocate any new storage.

19 months ago[WASM] Precommit WebAssemblyISelLowering.cpp format changes for D147198
Peter Rong [Thu, 30 Mar 2023 05:17:59 +0000 (22:17 -0700)]
[WASM] Precommit WebAssemblyISelLowering.cpp format changes for D147198

Signed-off-by: Peter Rong <PeterRong96@gmail.com>
19 months ago[compiler-rt] Fix cross-compiling detection
Hau Hsu [Thu, 30 Mar 2023 04:47:33 +0000 (12:47 +0800)]
[compiler-rt] Fix cross-compiling detection

Previously the detection compares "CMAKE_SYSTEM_NAME" and
"CMAKE_TARGET_SYSTEM_NAME", which only contains OS names like "Linux".
This is not sufficient when cross-compiling for different target CPUs.

This patch uses CMAKE_CROSSCOMPILING, which sets automatically by CMake
when cross compiling.

Reviewed By: smeenai, phosek

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

19 months ago[DWARFLinker] Honor verbose flag for input verification
Jonas Devlieghere [Thu, 30 Mar 2023 04:51:45 +0000 (21:51 -0700)]
[DWARFLinker] Honor verbose flag for input verification

Fix an inconsistency between input and output verification in dsymutil.
Previously, output verification would be controlled by the verbose flag,
while input verification would unconditionally dump to stdout. Make
input and output verification behave the same by printing verification
error to stderr in verbose mode only.

19 months ago[RISCV] Use StringRef(&C, 1) instead of std::string(1, C).
Craig Topper [Thu, 30 Mar 2023 04:37:26 +0000 (21:37 -0700)]
[RISCV] Use StringRef(&C, 1) instead of std::string(1, C).

We're calling functions that take a StringRef. We can create one
from a single character variable without using std::string.

19 months ago[ARM] Use isNullConstant and isOneConstant (NFC)
Kazu Hirata [Thu, 30 Mar 2023 04:50:34 +0000 (21:50 -0700)]
[ARM] Use isNullConstant and isOneConstant (NFC)

19 months ago[GuardWidening] Freeze the introduced use. Re-land.
Serguei Katkov [Thu, 30 Mar 2023 03:21:31 +0000 (10:21 +0700)]
[GuardWidening] Freeze the introduced use. Re-land.

Non-determenism is fixed.

Guard widening optimization is able to move the condition from one
guard to the previous one. As a result if the condition is poison
and orginal second guard is never executed but the first one does,
we introduce undefined behavior which was not observed in original
program.

To resolve the issue we must freeze the condition we are moving.
However optimization itself does not know how to work with freeze.
Additionally optimization is written in incremental way.
For example we have three guards
G1(base + 8 < L)
G2(base + 16 < L)
G3(base + 24 < L)

On the first step GW will combine G1 and G2 as
G1(base + 8 < L && freeze(base + 16 < L))
G2(true)
G3(base + 24 < L)

while combining G1 and G3 base appears to be different.

To keep optimization enabled after freezing the moving condition, the
freeze instruction is pushed as much as possible and later all uses
of freezed values are replaced with frozen version.

This is similar what instruction combining does but more aggressevely.

19 months ago[lld][ELF][NFC] Simplify method "Thunk *elf::addThunk()"
Ben Shi [Thu, 30 Mar 2023 03:34:19 +0000 (11:34 +0800)]
[lld][ELF][NFC] Simplify method "Thunk *elf::addThunk()"

Reviewed By: MaskRay

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

19 months ago[MCP] Do not try forward non-existent sub-register of a copy
Sergei Barannikov [Sun, 26 Mar 2023 23:22:46 +0000 (02:22 +0300)]
[MCP] Do not try forward non-existent sub-register of a copy

In this example:
```
$d14 = COPY killed $d18
$s0 = MI $s28
```

$s28 is a sub-register of $d14. However, $d18 does not have
sub-registers and thus cannot be forwarded. Previously, this resulted
in $noreg being substituted in place of the use of $s28, which later
led to an assertion failure.

Fixes https://github.com/llvm/llvm-project/issues/60908, a regression
that was introduced in D141747.

Reviewed By: arsenm

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

19 months ago[MachineScheduler] Rename postprocessDAG to postProcessDAG. NFC
jacquesguan [Fri, 24 Mar 2023 10:18:25 +0000 (18:18 +0800)]
[MachineScheduler] Rename postprocessDAG to postProcessDAG. NFC

Rename postprocessDAG to camel case.

Reviewed By: foad

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

19 months agoHandle the unexpected inputs for pass HardwareLoops
Wang, Xin10 [Thu, 30 Mar 2023 02:33:57 +0000 (10:33 +0800)]
Handle the unexpected inputs for pass HardwareLoops

For a function TryConvertLoop in pass HardwareLoops, wrong input arguments will
lead to crash. There will be 3 cases.
In line 342, compiler want to get something from
HWLoopInfo.CountType, which depends on if argument Bitwidth is given, if not,
will crash.
In Function isHardwareLoopCandidate, it dereference CountType too.
In Function InsertLoopDec, it dereference LoopDecrement.
They all could lead to crash. This patch add condition to this pass, when we meet unexpected inputs then skip
the pass.

Reviewed By: samparker, fhahn

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

19 months agoRevert "Reland "[hwasan] Provide aliases for c allocation functions for Fuchsia"
Leonard Chan [Thu, 30 Mar 2023 01:38:05 +0000 (01:38 +0000)]
Revert "Reland "[hwasan] Provide aliases for c allocation functions for Fuchsia"

This reverts commit 5bb826d569ccd80e28aedd682db39b8cddd44e53.

We suspect this is leading to the segfaults for tests run on
aarch64+android+hwasan:
https://lab.llvm.org/buildbot/#/builders/77/builds/26025/steps/21/logs/stdio

19 months ago[mlir][sparse] avoid creating temporary unordered COO buffer when reshape sparse...
Peiming Liu [Thu, 30 Mar 2023 01:01:13 +0000 (01:01 +0000)]
[mlir][sparse] avoid creating temporary unordered COO buffer when reshape sparse tensor.

Reviewed By: aartbik, wrengr

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

19 months ago[SYCL] Always set NoUnwind attribute for SYCL.
Harald van Dijk [Thu, 30 Mar 2023 01:18:52 +0000 (02:18 +0100)]
[SYCL] Always set NoUnwind attribute for SYCL.

Like CUDA and OpenCL, the SYCL specification says that throwing and
catching exceptions in device functions is not supported, so this change
extends the logic for adding the NoUnwind attribute to SYCL.

The existing convergent.cpp test, which tests that the convergent
attribute is added to functions by default, is renamed and reused to
test that the nounwind attribute is added by default. This test now has
-fexceptions added to it, which the driver adds by default as well.

The obvious question here is why not simply change the driver to remove
-fexceptions. This change follows the direction given by the TODO
comment because removing -fexceptions would also disable the
__EXCEPTIONS macro, which should reflect whether exceptions are enabled
on the host, rather than on the device, to avoid conflicts in types
shared between host and device.

Reviewed By: bader

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

19 months ago[mlir][sparse] Preliminary code changes for ExprId, LatPointId, LatSetId newtypes
wren romano [Fri, 24 Mar 2023 23:03:56 +0000 (16:03 -0700)]
[mlir][sparse] Preliminary code changes for ExprId, LatPointId, LatSetId newtypes

This commit contains several code changes which are ultimately required for converting the varions `Merger` identifiers from typedefs to newtypes.  The actual implementation of the newtypes themselves has been split off into separate commits, in hopes of simplifying the review process.

Depends On D146561

Reviewed By: aartbik

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

19 months ago[mlir][arith] Add expansion pattern for ext/trunc of bf16
Robert Suderman [Thu, 30 Mar 2023 00:49:01 +0000 (00:49 +0000)]
[mlir][arith] Add expansion pattern for ext/trunc of bf16

bf16 has a trivial truncation/extension behavior with F32 that
can be described in elementary arith operations. Include some
expansions to efficiently convert.

Reviewed By: jpienaar

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

19 months ago[DAG][RISCV] Allow scalable vector ISD::STRICT_FP_ROUND and support vector ISD::STRIC...
Yeting Kuo [Wed, 29 Mar 2023 05:22:54 +0000 (13:22 +0800)]
[DAG][RISCV] Allow scalable vector ISD::STRICT_FP_ROUND and support vector ISD::STRICT_FP_ROUND for RISC-V.

The patch customized lower vector type ISD::STRICT_FP_ROUND to RISCVISD::STRICT_FP_ROUND.

Reviewed By: craig.topper

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

19 months agoRevert "[libc++] Add minor test for polymorphic_allocator.construct with mixed argume...
Haowei Wu [Thu, 30 Mar 2023 00:07:31 +0000 (17:07 -0700)]
Revert "[libc++] Add minor test for polymorphic_allocator.construct with mixed argument pair"

This reverts commit b66a6e4b104b245ed448e3dea944fa7e842a96b2 which
breaks runtime tests.

19 months ago[gn build] Port 167e8f8b6b11
LLVM GN Syncbot [Wed, 29 Mar 2023 23:24:32 +0000 (23:24 +0000)]
[gn build] Port 167e8f8b6b11

19 months ago[InstrProf] Minimal Block Coverage
Ellis Hoag [Wed, 29 Mar 2023 19:58:42 +0000 (12:58 -0700)]
[InstrProf] Minimal Block Coverage

This diff implements minimal block coverage instrumentation. When the `-pgo-block-coverage` option is used, basic blocks will be instrumented for block coverage using single byte booleans. The coverage of some basic blocks can be inferred from others, so not every basic block is instrumented. In fact, we found that only ~60% of basic blocks need to be instrumented. These differences lead to less size overhead when compared to instrumenting block counts. For example, block coverage on the clang binary has an overhead of 20 Mi (17%) compared to 56 Mi (47%) with block counts.

Even though block coverage profiles have less precision than block count profiles, they can still be used to guide optimizations. In `PGOUseFunc` we use block coverage to populate edge weights such that BFI gives nonzero counts to only covered blocks. We do this by 1) setting the entry count of covered functions to a large value, i.e., 10000 and 2) populating edge weights using block coverage. In the next diff https://reviews.llvm.org/D125743 we use BFI to guide the machine outliner to avoid outlining covered blocks. This `-pgo-block-coverage` option provides a trade off of generating less precise profiles for faster and smaller instrumented binaries.

The `BlockCoverageInference` class defines the algorithm to find the minimal set of basic blocks that need to be instrumented for coverage. This is different from the Kirchhoff circuit law optimization that is used for edge **counts** because that does not work for block **coverage**. The reason for this is that edge counts can be added together to find a missing count while block coverage cannot since they store boolean values. So we need a new algorithm to find which blocks must be instrumented.

The details on this algorithm can be found in this paper titled "Minimum Coverage Instrumentation": https://arxiv.org/abs/2208.13907

Special thanks to Julian Mestre for creating this block coverage inference algorithm.

Binary size of `clang` using `-O2`:

* Base
  * `.text`: 65.8 Mi
  * Total: 119 Mi
* IRPGO (`-fprofile-generate -mllvm -disable-vp -mllvm -debug-info-correlate`)
  * `.text`: 93.0 Mi
  * `__llvm_prf_cnts`: 14.5 Mi
  * Total: 175 Mi
* Minimal Block Coverage (`-fprofile-generate -mllvm -disable-vp -mllvm -debug-info-correlate -mllvm -pgo-block-coverage`)
  * `.text`: 82.1 Mi
  * `__llvm_prf_cnts`: 1.38 Mi
  * Total: 139 Mi

Reviewed By: spupyrev, kyulee

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

19 months ago[Debuginfod][CMake] Don't build a defunct llvm-debuginfod
Daniel Thornburgh [Wed, 29 Mar 2023 21:08:37 +0000 (14:08 -0700)]
[Debuginfod][CMake] Don't build a defunct llvm-debuginfod

llvm-debuginfod intrinsically requires cpp-httplib to operate, so
exclude the target if it's unavailable. Right now the tool walks off an
llvm_unreachable.

Reviewed By: phosek

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

19 months ago[libc] Add LIBC_INLINE macro to RPC implementation
Joseph Huber [Wed, 29 Mar 2023 20:24:58 +0000 (15:24 -0500)]
[libc] Add LIBC_INLINE macro to RPC implementation

These were required by the llvmlibc linter.

Reviewed By: sivachandra

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

19 months ago[RISCV] Add helper function for RVV intrinsics in getTgtMemIntrinsic. NFC
Craig Topper [Wed, 29 Mar 2023 22:34:25 +0000 (15:34 -0700)]
[RISCV] Add helper function for RVV intrinsics in getTgtMemIntrinsic. NFC

Preparation for adding the other RVV load/store intrinsics we use
for the C API.

Reviewed By: asb, kito-cheng

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

19 months agoFix https://lab.llvm.org/buildbot/#/builders/77/builds/26020. D147092
Leonard Chan [Wed, 29 Mar 2023 22:28:44 +0000 (22:28 +0000)]
Fix https://lab.llvm.org/buildbot/#/builders/77/builds/26020. D147092
broke this build since I forgot to wrap the moved struct in the
`__sanitizer` namespace so uptr wasn't refering to __sanitizer::uptr.

19 months ago[gn build] Port 4c10a6122edf
LLVM GN Syncbot [Wed, 29 Mar 2023 22:16:57 +0000 (22:16 +0000)]
[gn build] Port 4c10a6122edf

19 months ago[RISCV] Move allWUsers from RISCVInstrInfo to RISCVOptWInstrs.
Craig Topper [Wed, 29 Mar 2023 22:09:51 +0000 (15:09 -0700)]
[RISCV] Move allWUsers from RISCVInstrInfo to RISCVOptWInstrs.

It was only in RISCVInstrInfo because it was used by 2 passes, but those
passes have been merged in D147173.

Reviewed By: asb

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

19 months ago[RISCV] Merge SExtWRemoval and StripWSuffix into a single pass.
Craig Topper [Wed, 29 Mar 2023 21:59:20 +0000 (14:59 -0700)]
[RISCV] Merge SExtWRemoval and StripWSuffix into a single pass.

These run together in the pipeline and are the only users of
TII.hasAllWUsers. Merging them will allow us to move hasAllWUsers
back from TII.

Reviewed By: asb

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

19 months ago[lldb] Unify target triples across compiler and linker invocations
Jonas Devlieghere [Wed, 29 Mar 2023 21:53:58 +0000 (14:53 -0700)]
[lldb] Unify target triples across compiler and linker invocations

rdar://107364766

19 months ago[libc++] Add minor test for polymorphic_allocator.construct with mixed argument pair
Louis Dionne [Wed, 29 Mar 2023 21:01:18 +0000 (17:01 -0400)]
[libc++] Add minor test for polymorphic_allocator.construct with mixed argument pair

19 months agoDWARF: Enable "ranges always" under Split DWARF by default
David Blaikie [Wed, 29 Mar 2023 19:57:09 +0000 (19:57 +0000)]
DWARF: Enable "ranges always" under Split DWARF by default

Given the intent of Split DWARF is to minimize .o file size it seems
like adequate signal that it's worth a minor tradeoff in .dwo size to
significantly reduce .o size (though it doesn't reduce linked executable
size - the cost is mostly in the static relocations resolved by the
linker).

19 months agoDwarfDebug: Minor condition cleanups
David Blaikie [Wed, 29 Mar 2023 19:55:45 +0000 (19:55 +0000)]
DwarfDebug: Minor condition cleanups

Sink/share a few common conditions.

19 months ago[WebAssembly] Fix SmallVector warning
Heejin Ahn [Wed, 29 Mar 2023 20:33:36 +0000 (13:33 -0700)]
[WebAssembly] Fix SmallVector warning

Fixes a build warning caused by D146744.

19 months ago[clang-format] JSON Add ability to add a space before the colon
mydeveloperday [Wed, 29 Mar 2023 20:28:40 +0000 (21:28 +0100)]
[clang-format] JSON Add ability to add a space before the colon

I've seen a couple of request for extra Json formatting to match prettier capability.

Reviewed By: owenpan

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

19 months ago[clang-format] NFC ensure Style operator== remains sorted for ease of editing
mydeveloperday [Wed, 29 Mar 2023 20:24:37 +0000 (21:24 +0100)]
[clang-format] NFC ensure Style operator== remains sorted for ease of editing

{D144170} didn't go via the normal clang-format reviewers and we'd have pointed out that this list of options remains sorted.

Reviewed By: owenpan

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

19 months ago[include-cleaner] Visit the VarDecl in ASTWalker.
Haojian Wu [Wed, 29 Mar 2023 10:46:14 +0000 (12:46 +0200)]
[include-cleaner] Visit the VarDecl in ASTWalker.

Fixes https://github.com/clangd/clangd/issues/1554

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

19 months ago[Sema] Stop stripping CV quals from *this captures in lambdas
Roy Jacobson [Tue, 14 Mar 2023 19:25:54 +0000 (21:25 +0200)]
[Sema] Stop stripping CV quals from *this captures in lambdas

It appears we've been incorrectly stripping CV qualifiers when capturing `this` by value inside lambdas.
This patch simply removes the CV stripping code as discussed.

Closes https://github.com/llvm/llvm-project/issues/50866

Reviewed By: #clang-language-wg, cor3ntin, aaron.ballman

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

19 months ago[libc] fix strtointeger behavior on max values
Michael Jones [Wed, 29 Mar 2023 17:42:23 +0000 (10:42 -0700)]
[libc] fix strtointeger behavior on max values

Previously the check to just return MAX or MIN used the caclulated
number being the maximum absolute value. This was right in every case
except for an unsigned conversion being passed its maximum value with a
negative sign on the front. This should return -MAX, but was returning
just MAX.

Reviewed By: lntue

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

19 months ago[RISCV] Support emulated TLS
Vitaly Cheptsov [Wed, 29 Mar 2023 19:55:51 +0000 (20:55 +0100)]
[RISCV] Support emulated TLS

As discussed earlier in the [GitHub
issue](https://github.com/llvm/llvm-project/issues/59500), currently
LLVM generates invalid code when emulated TLS is used. There were
attempts to resolve this previously (D102527), but they were not merged
because the component owners raised concerns about emulated TLS
efficiency.

The current state of the art is that:

- OpenBSD team, which raised the initial issue, simply has [patches
  downstream](https://github.com/openbsd/src/blob/a0747c9/gnu/llvm/llvm/lib/Target/RISCV/RISCVISelLowering.cpp#L2850-L2852).
- Our team, which raised the GH issue, has patches downstream as well.
  We also do not use `malloc` or any [dynamic
allocations](https://github.com/llvm/llvm-project/issues/59500#issuecomment-1349046835)
with emulated TLS, so the concerns raised in the original issue does not
apply to us.
- GCC compatibility is broken, because GCC supports emulated TLS.
- RISC-V is the only architecture in LLVM that does not support emulated
  TLS, and work is being done to at least warn the users about it
(D143619).

With all these in mind I believe it is important to address the
consumers' needs especially given that there is little to no maintenance
downsides.

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

19 months ago[mlir][Vector] Add canonicalization pattern for vector.transpose(vector.constant_mask)
Diego Caballero [Wed, 29 Mar 2023 19:20:22 +0000 (19:20 +0000)]
[mlir][Vector] Add canonicalization pattern for vector.transpose(vector.constant_mask)

We already had vector.transpose(vector.create_mask) ->
vector.create_mask. This patch adds the constant mask version of it.

Reviewed By: nicolasvasilache

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

19 months ago[mlir][Vector] Add mapIterationSpaceDimToAllOperandDims to Linalg interface
Diego Caballero [Wed, 29 Mar 2023 19:09:41 +0000 (19:09 +0000)]
[mlir][Vector] Add mapIterationSpaceDimToAllOperandDims to Linalg interface

This is a variant of the existing `mapIterationSpaceDimToOperandDim`.
We have a local use downstream.

Reviewed By: nicolasvasilache

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

19 months ago[mlir][Vector] Enable masked vectorization of linalg.fill
Diego Caballero [Wed, 29 Mar 2023 19:19:24 +0000 (19:19 +0000)]
[mlir][Vector] Enable masked vectorization of linalg.fill

linalg.fill was already vectorizable with masks but not supported in the
dynamic pre-checks.

Reviewed By: nicolasvasilache

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

19 months ago[mlir][Vector] Remove lhs and rhs masks from vector.contract
Diego Caballero [Wed, 29 Mar 2023 19:16:12 +0000 (19:16 +0000)]
[mlir][Vector] Remove lhs and rhs masks from vector.contract

This patch removes the historical lhs and rhs masks in vector.contract,
now that vector.mask supports vector.contract and the lhs and rhs masks
are barely supported by all the vector.contract lowerings and
transformations.

Reviewed By: nicolasvasilache

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

19 months ago[WebAssembly] Do nothing when sinking to same place
Heejin Ahn [Fri, 24 Mar 2023 18:49:08 +0000 (11:49 -0700)]
[WebAssembly] Do nothing when sinking to same place

In `DebugValueManager`, if a `Def` is requested to be sunk to the same
place (i.e., `Insert` is right after `Def`, not counting `DBG_VALUE`s)
currently we still do the sink. This can result in unnecessary creation
of `DBG_VALUE $noreg`. See comments for details. This CL detects this
case and do nothing and return, so we don't end up creating unnecessary
undef `DBG_VALUE`s.

Reviewed By: dschuff

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

19 months ago[WebAssembly] Redesign DebugValueManager
Heejin Ahn [Wed, 30 Nov 2022 23:37:08 +0000 (15:37 -0800)]
[WebAssembly] Redesign DebugValueManager

The current `DebugValueManager`, which is mostly used in `RegStackify`,
simply sinks `DBG_VALUE`s along when a def instruction sinks.
(`RegStackify` only does sinks; it doesn't do hoists.)

But this simple strategy can result in incorrect combinations of
variables' values which would have not been possible in the original
program. In this case, LLVM's policy is to make the value unavailable,
so they will be shown as 'optimized out', rather than showing inaccurate
debug info. Especially, when an instruction sinks, its original
`DBG_VALUE` should be set to undef. This is well illustrated in the
third example in
https://llvm.org/docs/SourceLevelDebugging.html#instruction-scheduling.

This CL rewrites `DebugValueManager` with this principle in mind. When
sinking an instruction, it sinks its eligible `DBG_VALUE`s with it, but
also leaves undef `DBG_VALUE`s in the original place to make those
variables' values undefined.

Also, unlike the current version, we sink only an eligible subset of
`DBG_VALUE`s with a def instruction. See comments in the code for
details.

In case of cloning, because the original def is still there, we don't
set its `DBG_VALUE`s to undef. But we clone only an eligible subset of
`DBG_VALUE`s here as well.

One consequence of this change is that now we do sinking and cloning of
the def instruction itself within the `DebugValueManager`'s `sink` and
`clone` methods. This is necessary because the `DebugValueManager` needs
to know the original def's location before sinking and cloning in order
to scan other interfering `DBG_VALUE`s between the original def and the
insertion point. If we want to separate these two, we need to call
`DebugValueManager`'s `sink` and `clone` methods //before//
sinking/cloning the def instruction, which I don't think is a good
design alternative either, because the user of this class needs to pay
extra attention when using it.

Because this change is fixing the existing inaccuracy of the current
debug info, this reduces the variable info coverage in debug info, but
not by a large margin. In Emscripten core benchmarks compiled with
`-O1`, the coverage goes from 56.6% down to 55.2%, which I doubt will be
a noticeable drop. The compilation time doesn't have any meaningful
difference either with this change.

Reviewed By: dschuff

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

19 months ago[libc] Re-enable wctob with fixes
Michael Jones [Tue, 21 Mar 2023 18:12:05 +0000 (11:12 -0700)]
[libc] Re-enable wctob with fixes

The stdio test failures were due to headers potentially not being built
in the correct order. This should set up the dependencies correctly.

Reviewed By: sivachandra

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

19 months ago[WebAssembly] Use ArrayRef/SmallVectorImpl in parameters (NFC)
Heejin Ahn [Fri, 24 Mar 2023 19:09:22 +0000 (12:09 -0700)]
[WebAssembly] Use ArrayRef/SmallVectorImpl in parameters (NFC)

It is recommended to use `SmallVectorImpl`/`ArrayRef` over
`SmallVector<TypeName, N>` for function parameters:
https://llvm.org/docs/ProgrammersManual.html#llvm-adt-smallvector-h

Reviewed By: dschuff

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

19 months ago[WebAssembly] Select call_indirect for alloca calls
Heejin Ahn [Tue, 28 Mar 2023 08:01:21 +0000 (01:01 -0700)]
[WebAssembly] Select call_indirect for alloca calls

Currently calling stack locations is selected using `CALL` in ISel,
resulting in an invalid code and crashing in AsmPrinter. FastISel
correctly selects it will `CALL_INDIRECT`.

Fixes the problem reported in D146781.

Reviewed By: tlively, HerrCai0907

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

19 months ago[AMDGPU] Do not fix implicit vcc operand on INLINEASM
Jay Foad [Wed, 29 Mar 2023 14:06:53 +0000 (15:06 +0100)]
[AMDGPU] Do not fix implicit vcc operand on INLINEASM

An INLINEASM can have an implicit def of vcc. It is not appropriate for
fixImplicitOperands to change this to vcc_lo on wave32.

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

19 months ago[AMDGPU] Consistently use v2i16 for packed bf16 inputs. NFC.
Jay Foad [Wed, 29 Mar 2023 12:10:19 +0000 (13:10 +0100)]
[AMDGPU] Consistently use v2i16 for packed bf16 inputs. NFC.

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

19 months ago[libc] Use LTO for AMDGPU compilation and linking
Joseph Huber [Wed, 29 Mar 2023 19:19:08 +0000 (14:19 -0500)]
[libc] Use LTO for AMDGPU compilation and linking

Summary:
The AMDGPU ABI isn't stable or well defined. For that reson we prefer to
rely on LTO to ensure that multiple files get linked correctly.
Currently the internal targets used for testing mix LLVM-IR and
assembly. We should be consistent here.

19 months agoMark test added in D141824 as unsupported for PS4/PS5 as those platforms require...
Douglas Yung [Wed, 29 Mar 2023 19:09:28 +0000 (12:09 -0700)]
Mark test added in D141824 as unsupported for PS4/PS5 as those platforms require an external linker that is not present.

19 months ago[clang-format] NFC ensure clang-format is itself clang-formatted
mydeveloperday [Wed, 29 Mar 2023 19:01:03 +0000 (20:01 +0100)]
[clang-format] NFC ensure clang-format is itself clang-formatted

Some patch in the past introduce this non clang-formatted change

19 months ago[gn build] Port 3be6c4d413f6
LLVM GN Syncbot [Wed, 29 Mar 2023 18:50:19 +0000 (18:50 +0000)]
[gn build] Port 3be6c4d413f6

19 months ago[Flang][OpenMP] Update test case to track an issue
Kavitha Natarajan [Wed, 29 Mar 2023 18:40:16 +0000 (00:10 +0530)]
[Flang][OpenMP] Update test case to track an issue

Adding CHECK-NOT for the MAX intrinsic implementation for which
reduction operation is not generated. Issue #61808 created to
track the same.

19 months ago[MLIR] NFC. Expose/move MDG out of Affine fusion into Affine Analysis
Uday Bondhugula [Wed, 29 Mar 2023 18:27:13 +0000 (23:57 +0530)]
[MLIR] NFC. Expose/move MDG out of Affine fusion into Affine Analysis

Move out MemRefDependenceGraph analysis structure out of LoopFusion into
the Affine Analysis library. This had been a long pending TODO. Moving
MDG out allows its use in other affine passes as well as allows building
custom affine fusion passes downstream while reusing upstream fusion
utilties. The file LoopFusion.cpp had also become lengthy and this
change makes things more modular. This change is a pure NFC and is a
code movement.

NFC.

Reviewed By: springerm

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

19 months agoMake all additions matter in private mapping test.
Doru Bercea [Wed, 29 Mar 2023 16:34:03 +0000 (12:34 -0400)]
Make all additions matter in private mapping test.

19 months agoRevert "Revert "Revert ExtractAPI from https://reviews.llvm.org/D146656""
Mitch Phillips [Wed, 29 Mar 2023 18:36:44 +0000 (11:36 -0700)]
Revert "Revert "Revert ExtractAPI from https://reviews.llvm.org/D146656""

This reverts commit 79116475124112051625b1a0665e35c861bb13fd.

Broke the ASan bots. See more information in
https://reviews.llvm.org/rG79116475124112051625b1a0665e35c861bb13fd

19 months agoRevert "[clang][ExtractAPI] Add queried symbol to parent contexts in libclang"
Mitch Phillips [Wed, 29 Mar 2023 18:35:59 +0000 (11:35 -0700)]
Revert "[clang][ExtractAPI] Add queried symbol to parent contexts in libclang"

This reverts commit 1cfe1e732ad8e8148f6fa8fc0f0c86f4b965d567.

Depends on reverted commit 158a431227a876306fe5838936413dd51588d0c6. See
https://reviews.llvm.org/rG79116475124112051625b1a0665e35c861bb13fd for
more information, this broke the ASan bots.

19 months ago[MSCV][dllexport/dllimport][PS] Allow UniqueExternal linkage classes with dllexport...
Wolfgang Pieb [Mon, 13 Mar 2023 17:45:20 +0000 (17:45 +0000)]
[MSCV][dllexport/dllimport][PS] Allow UniqueExternal linkage classes with dllexport/dllimport

MSVC allows instantiations of exported or imported template classes with template
parameters that have internal linkage. Clang now allows it in Microsoft mode and for
the Playstation platform. This partially addresses issue 56068.

Note that MSVC also allows explicit dllexport/dllimport attributes on classes
with internal linkage (e.g. local classes or classes declared in anonymous name spaces).
Clang continues to reject such declarations.

Reviewed By: hans

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

19 months ago[Flang][OpenMP] Fix crash in MAX intrinsic reduction
Kavitha Natarajan [Wed, 29 Mar 2023 15:35:42 +0000 (21:05 +0530)]
[Flang][OpenMP] Fix crash in MAX intrinsic reduction

This patch fixes a crash that appear in an OpenMP MAX intrinsic
reduction when the reduction is not expressed using MAX intrinsic
function. Updated flang/test/Lower/OpenMP/wsloop-reduction-max.f90
test case with additional way of expressing MAX reduction.

Reviewed By: kiranchandramohan

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

19 months ago[OpenMP][MLIR] Add Flags attribute to OMP OffloadModuleInterface
Andrew Gozillon [Wed, 29 Mar 2023 15:45:59 +0000 (10:45 -0500)]
[OpenMP][MLIR] Add Flags attribute to OMP OffloadModuleInterface

The intent of this attribute is for it to be applied to a module and
then hold information on runtime library (RTL) flags given to
Flang (or other OpenMP frontend) that should be lowered down to
LLVM-IR for devices as LLVM globals. The following related
flags are:

-fopenmp-target-debug
-fopenmp-assume-threads-oversubscription
-fopenmp-assume-teams-oversubscription
-fopenmp-assume-no-nested-parallelism
-fopenmp-assume-no-thread-state

These exist within Clang and are lowered into the IR when
offloading for device. This attribute allows this infromation
to be carried down from the Flang frontend to the
LLVM/OpenMP Dialect to LLVM-IR translation phase
and then be lowered to LLVM-IR.

Reviewers: kiranchandramohan

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

19 months ago[Flang][Driver][OpenMP] Fix omp-frontend-forwarding.f90 failure on windows
Andrew Gozillon [Wed, 29 Mar 2023 15:37:18 +0000 (10:37 -0500)]
[Flang][Driver][OpenMP] Fix omp-frontend-forwarding.f90 failure on windows

Failing due to forgetting the .exe suffix the clang-offload-packager
receives on windows.

19 months ago[RISCV] Made v(f)(w)red* pseudoinstructions SEW-aware
Nitin John Raj [Wed, 29 Mar 2023 00:46:16 +0000 (17:46 -0700)]
[RISCV] Made v(f)(w)red* pseudoinstructions SEW-aware

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

19 months agoReland "[hwasan] Provide aliases for c allocation functions for Fuchsia
Leonard Chan [Wed, 29 Mar 2023 17:34:16 +0000 (17:34 +0000)]
Reland "[hwasan] Provide aliases for c allocation functions for Fuchsia

This reverts commit 3b4cb1e96c645bb833fe710856479c31383859bb.

Reland D145718 but unconditionally define __sanitizer_mallinfo which is
exposed as part of the hwasan interface.

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

19 months ago[compiler-rt] Move __sanitizer_mallinfo to separate header
Leonard Chan [Wed, 29 Mar 2023 17:08:22 +0000 (17:08 +0000)]
[compiler-rt] Move __sanitizer_mallinfo to separate header

mallinfo is platform-specific and not specified by either posix or the C
standard, but the hwasan interface unconditionally exposes
__sanitizer_mallinfo which returns a struct __sanitizer_struct_mallinfo
which is defined in sanitizer_platform_limits_posix.h, so this should
also be available for fuchsia to provide __sanitizer_mallinfo. Fuchsia
doesn't need the rest of what's in sanitizer_platform_limits_posix.h so
we can just move it to its own header.

Exposing this and not forcing it to hide behind
SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO fixes the test failures found
after landing D145718.

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