Ivan Kosarev [Thu, 30 Mar 2023 12:45:24 +0000 (13:45 +0100)]
[AMDGPU] Add tests on v_interp_p*_f16 with immediate parameters.
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
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
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
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
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
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
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
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
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
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
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
Jay Foad [Thu, 30 Mar 2023 10:24:39 +0000 (11:24 +0100)]
[AMDGPU] TableGen syntax cleanups
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
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
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).
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
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
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
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
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
Adrian Kuegel [Thu, 30 Mar 2023 08:43:15 +0000 (10:43 +0200)]
[mlir] Apply ClangTidy readability fix (NFC).
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
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
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
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
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
Kazu Hirata [Thu, 30 Mar 2023 06:01:11 +0000 (23:01 -0700)]
Use Dense{Map,Set}::contains (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.
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>
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
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.
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.
Kazu Hirata [Thu, 30 Mar 2023 04:50:34 +0000 (21:50 -0700)]
[ARM] Use isNullConstant and isOneConstant (NFC)
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.
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
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
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
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
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
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
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
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
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
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
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.
LLVM GN Syncbot [Wed, 29 Mar 2023 23:24:32 +0000 (23:24 +0000)]
[gn build] Port
167e8f8b6b11
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
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
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
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
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.
LLVM GN Syncbot [Wed, 29 Mar 2023 22:16:57 +0000 (22:16 +0000)]
[gn build] Port
4c10a6122edf
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
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
Jonas Devlieghere [Wed, 29 Mar 2023 21:53:58 +0000 (14:53 -0700)]
[lldb] Unify target triples across compiler and linker invocations
rdar://
107364766
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
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).
David Blaikie [Wed, 29 Mar 2023 19:55:45 +0000 (19:55 +0000)]
DwarfDebug: Minor condition cleanups
Sink/share a few common conditions.
Heejin Ahn [Wed, 29 Mar 2023 20:33:36 +0000 (13:33 -0700)]
[WebAssembly] Fix SmallVector warning
Fixes a build warning caused by D146744.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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.
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
LLVM GN Syncbot [Wed, 29 Mar 2023 18:50:19 +0000 (18:50 +0000)]
[gn build] Port
3be6c4d413f6
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.
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
Doru Bercea [Wed, 29 Mar 2023 16:34:03 +0000 (12:34 -0400)]
Make all additions matter in private mapping test.
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
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.
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
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
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
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.
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
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
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
Jakub Kuderski [Wed, 29 Mar 2023 16:49:32 +0000 (12:49 -0400)]
[mlir][arith] Fold `index_cast[ui]` of vectors
Handle the splat and dense case.
I saw this pattern show up in a couple recent SPIR-V-specific bug
report.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D147109
Benjamin Kramer [Wed, 29 Mar 2023 16:49:04 +0000 (18:49 +0200)]
[docs] Fix a typo (malicously-crafter)
Florian Hahn [Wed, 29 Mar 2023 16:47:41 +0000 (17:47 +0100)]
[LV] Add test cases for global struct dereferencability.
Currently LLVM fails to determine that conditional loads in
@accesses_to_struct_dereferenceable are dereferenceable unconditionally.
Walter Gray [Wed, 29 Mar 2023 16:27:07 +0000 (09:27 -0700)]
Fix ArgsAsWritten being null for ConceptSpecializationExpr in certain
circumstances when parsing ASTs
Fix ArgsAsWritten being null for ConceptSpecializationExpr in certain
circumstances when parsing ASTs
ASTStmtWriter::VisitConceptSpecializationExpr specifically expects
getTemplateArgsAsWritten() to return true, which it wasn't when parsed
by ASTContext.cpp in certain edge cases.
Fixes: #61486
Differential Revision: https://reviews.llvm.org/D146678
Matthew Voss [Wed, 29 Mar 2023 16:36:46 +0000 (09:36 -0700)]
[PS4][clang] Limit ThinLTO parallelism when requested
Pass the correct option to the linker when "-flto-jobs=" is passed to
the driver.
Sindhu Chittireddy [Wed, 22 Mar 2023 03:38:45 +0000 (20:38 -0700)]
[NFC] Fix uninitalized member variable use in ASTReader::ParseTargetOptions()
Kiran Chandramohan [Wed, 29 Mar 2023 16:07:23 +0000 (16:07 +0000)]
[Flang][OpenMP] Issue error for assumed-size array in Map clause
Error only applies if it is a whole array. Page 157 in OpenMP 5.2
standard.
Reviewed By: TIFitis
Differential Revision: https://reviews.llvm.org/D147142