walter erquinigo [Wed, 3 May 2023 02:12:43 +0000 (21:12 -0500)]
[lldb] Make some functions useful to REPLs public
`StartEventHandlerThread` and `StopEventHandlerThread` are available to the SwiftREPL even though they are protected because SwiftREPL is a friend class of Debugger. I'm developing my own REPL and having access to these functions, including `FlushProcessOutput`, is desirable.
Differential Revision: https://reviews.llvm.org/D149717
Ilya Kuklin [Thu, 4 May 2023 19:36:25 +0000 (12:36 -0700)]
[MSP430] Get the DWARF pointer size from MCAsmInfo instead of DataLayout.
This change will allow to put code pointers in DWARF info fields that are larger than actual pointer size, e.g. 16-bit pointers into 32-bit fields.
The need for this came up while creating support for MSP430 in LLDB. MSP430-GCC already generates DWARF info with 32-bit fields, so this change is necessary for LLDB to maintain compatibility with both GCC and LLVM binaries. Moreover, right now in LLDB there is no support for having DWARF pointer size different from ELF header type, e.g. 16-bit DWARF info within ELF32, and it seems there is no such thing as ELF16.
Since other mainline targets are made to have the same pointer size in both MCAsmInfo and DataLayout, there is no need to change anything there.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D148042
William Huang [Tue, 2 May 2023 22:35:04 +0000 (22:35 +0000)]
[llvm-profdata] Change default output format of llvm-profdata to ExtBinary
ExtBinary is compatible to, and more superior than Binary format, which is the current default output format. In the long run we are looking to only support ExtBinary format and Text format (for visual inspection), and drop Binary format as well. Since Binary format was the default, we expect many users are still using it, so let's change the default output format first, and hopefully the usage decreases over time
Reviewed By: davidxl, hoy
Differential Revision: https://reviews.llvm.org/D149700
Joseph Huber [Thu, 4 May 2023 19:12:43 +0000 (14:12 -0500)]
[libc] Remove support for atomic test due to failing on sm_60
This test fails on sm_60 because of the atomics codegen. We test atomics
indirectly with the `rpc` so we still have coverage.
Differential Revision: https://reviews.llvm.org/D149887
Siva Chandra Reddy [Thu, 4 May 2023 19:09:19 +0000 (19:09 +0000)]
Revert "[libc] Improve the add_libc_test rule."
This reverts commit
fb6faf4798b1cb327e719898e2ea6eff7f597c49 as the
aarch64 builders are failing.
Siva Chandra Reddy [Wed, 3 May 2023 08:00:37 +0000 (08:00 +0000)]
[libc] Improve the add_libc_test rule.
A target for the test named ${fq_target_name} has been added. It depends
on ${fq_target_name}.__unit__ and ${fq_target_name}.__hermetic__ as
relevant.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D149730
Tom Stellard [Thu, 4 May 2023 18:52:22 +0000 (11:52 -0700)]
docs: Document policy around GitHub branches
See discussion in #56643.
Reviewed By: rengolin, jhenderson, ldionne
Differential Revision: https://reviews.llvm.org/D147276
NagaChaitanya Vellanki [Thu, 4 May 2023 18:35:42 +0000 (11:35 -0700)]
[clang][ExtractAPI] Add semicolon to function declaration fragments
Add missing semicolon at the end of function declarations to fragments
Reviewed By: dang
Differential Revision: https://reviews.llvm.org/D149737
Nikolas Klauser [Tue, 2 May 2023 22:08:46 +0000 (15:08 -0700)]
[libc++][PSTL] Replace _PSTL_ASSERT with _LIBCPP_ASSERT
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D149605
Shafik Yaghmour [Thu, 4 May 2023 18:23:16 +0000 (11:23 -0700)]
Fix build bots due to missing a commit thay change 2b to 23
Fixing build bot breaks due to
b4692f29263006c7ea519c7b11c9082384f0af53
Alexandre Ganea [Thu, 4 May 2023 17:01:13 +0000 (13:01 -0400)]
[llvm-objdump][COFF] Skip empty export entries when dumping the export table
Before this patch, export entries with empy RVA were displayed in the output. In some cases, when the module had exports with sparse ordinals, `llvm-objdump` used to print a lot of `0 0` lines.
We now skip over these empty entries in the output, just as `dumpbin` or binutils `objdump` does.
Differential Revision: https://reviews.llvm.org/D149610
Michael Liao [Thu, 4 May 2023 18:27:33 +0000 (14:27 -0400)]
[clang] Fix another case where CPlusPlus2b is still used.
Michael Liao [Thu, 4 May 2023 18:22:38 +0000 (14:22 -0400)]
[clang] Fix build after https://reviews.llvm.org/D149553
- `CXXPre2bCompat` is referenced somewhere after being removed.
- More warning messages on c++2b need refining
Joseph Huber [Thu, 4 May 2023 16:22:38 +0000 (11:22 -0500)]
[libc] Maintain proper alignment for the hermetic tests malloc
We use a bump pointer to implement malloc for the hermetic tests.
Currently, we bump the pointer up by any amount. This means that calling
`malloc(1)` will misalign the buffer so any following `malloc(8)`
accesses will not be aligned. This causes problems in architectures
which require alignment.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D149863
Arthur Eubanks [Thu, 4 May 2023 18:17:55 +0000 (11:17 -0700)]
[gn build] Fix tblgen CodeGen dependencies
Matches the CMake build, otherwise we're rebuilding tblgen (and everything else) when there's a change almost anywhere in LLVM.
Felipe de Azevedo Piovezan [Thu, 4 May 2023 16:30:59 +0000 (12:30 -0400)]
[MIRParser][nfc] Factor out code parsing debug MD nodes
This commit splits a function that both parses MD nodes from YAML into
DI{Expr,Loc,Variable} objects AND adds an entry to the MF variable table, so
that each of those jobs is done separately.
It will enable subsequent patches to reuse the MD node parsing code.
Differential Revision: https://reviews.llvm.org/D149870
Valentin Clement [Thu, 4 May 2023 18:15:04 +0000 (11:15 -0700)]
[flang][openacc] Lower data clause on compute construct to data operand ops
This patch lowers the data clause on the OpenACC compute construct
to their corresponding acc data operand operation.
The decomposition is the same as in D149673.
Note that `private` and `firstprivate` are not lowered to data operand operation as they do not have one and will likely have dedicated design/process.
Depends on D149673
Reviewed By: razvanlupusoru, jeanPerier
Differential Revision: https://reviews.llvm.org/D149785
Florian Hahn [Thu, 4 May 2023 18:12:02 +0000 (19:12 +0100)]
[VPlan] Remove setEntry to avoid leaks when replacing entry.
Update the HCFG builder to directly connect the created CFG to the
existing Plan's entry. This allows removing `setEntry`, which can cause
leaks when the existing entry is replaced.
Should fix
https://lab.llvm.org/buildbot/#/builders/5/builds/33455/steps/13/logs/stdio
Mehdi Amini [Thu, 4 May 2023 16:40:56 +0000 (09:40 -0700)]
Restore mlir-opt `--run-reproducer` option to opt-in running a reproducer
When tooling out there produces a reproducer that is archived, the first thing
a user is likely to expect is to process this as they do with any MLIR file.
However https://reviews.llvm.org/D126447 changed the behavior of mlir-opt to
eliminate the `--run-reproducer` option and instead automatically run it when
present in the input file. This creates a discrepancy in how mlir-opt behaves
when fed with an input file, and is surprising for users.
The explicit passing of `--run-reproducer` to express user-intent seems more
in line with what is expected from `mlir-opt`.
Reviewed By: rriddle, jpienaar
Differential Revision: https://reviews.llvm.org/D149820
Shafik Yaghmour [Thu, 4 May 2023 18:05:25 +0000 (11:05 -0700)]
[Clang] Updating handling of defaulted comparison operators to reflect changes from P2448R2
Prior to P2448R2 we were more aggressive in diagnosing ill-formed
constexpr functions. Many of these restrictions were relaxed and now it
is not required for defaulted comparison operators to call constexpr
functions.
This behavior is extended to before C++23 and diagnostic for it's use
can be enabled w/ -pedantic or -Wc++2b-default-comp-relaxed-constexpr
This fixes: https://github.com/llvm/llvm-project/issues/61238
Differential Revision: https://reviews.llvm.org/D146090
Dave Lee [Thu, 4 May 2023 17:58:48 +0000 (10:58 -0700)]
[lldb] Remove unused g_objc_Tagged_ISA constants (NFC)
Last use removed in
f7420453e80b9294273009efcebaceac2383269e.
Mark de Wever [Sun, 30 Apr 2023 19:23:30 +0000 (21:23 +0200)]
[libc++][test] Selects proper C++23 field.
D149553 changes the name of the LangOptions member. This change allows
libc++ to work with either name.
Reviewed By: philnik, #libc
Differential Revision: https://reviews.llvm.org/D149554
Valentin Clement [Thu, 4 May 2023 17:36:41 +0000 (10:36 -0700)]
[flang][openacc] Lower data construct operand to data operand operations
This patch lowers the data clause on the OpenACC data construct
to their corresponding acc data operand operation.
The copy clause is decomposed into acc.copyin before and acc.copyout after
the acc.data operation.
The copyout close is decomposed into acc.create before and acc.copyout after
the acc.data operation.
The attach clause is decomposed into acc.attach before and acc.detach after
the acc.data operation.
Depends on D149601
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D149673
Jon Chesterfield [Thu, 4 May 2023 17:33:19 +0000 (12:33 -0500)]
[libc][rpc] Pass lane_mask into lock functions
Will be necessary for correct locking on volta.
API-only change to help with rebasing the rest of the stack on this.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D149871
Amir Ayupov [Wed, 3 May 2023 23:40:29 +0000 (16:40 -0700)]
[BOLT] Remove redundant dumps in AsmDump
Dumping jump table and tail call fdata is covered by subsequent iteration over
successors.
Reviewed By: #bolt, maksfb
Differential Revision: https://reviews.llvm.org/D149799
Peiming Liu [Thu, 4 May 2023 17:20:44 +0000 (17:20 +0000)]
[mlir][sparse] fix build error.
Reviewed By: aartbik, vzakhari
Differential Revision: https://reviews.llvm.org/D149874
Mark de Wever [Sun, 30 Apr 2023 13:27:00 +0000 (15:27 +0200)]
[clang] Use -std=c++23 instead of -std=c++2b
During the ISO C++ Committee meeting plenary session the C++23 Standard
has been voted as technical complete.
This updates the reference to c++2b to c++23 and updates the __cplusplus
macro.
Drive-by fixes c++1z -> c++17 and c++2a -> c++20 when seen.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D149553
David Stone [Thu, 4 May 2023 17:06:53 +0000 (13:06 -0400)]
[clang][Sema][NFC] Move `EnterExpressionEvaluationContext` to its own file
Sema.h is huge. This makes a small reduction to it by moving
EnterExpressionEvaluationContext into a new header, since it is an
independent component.
Differential Revision: https://reviews.llvm.org/D149796
Alexey Lapshin [Thu, 4 May 2023 16:13:29 +0000 (18:13 +0200)]
Fix test bot breakage from
06b617064a997574df409c7d846b6f6b492f5124
This addresses the issue found by: https://lab.llvm.org/buildbot#builders/178/builds/4571
Alexey Bataev [Thu, 4 May 2023 16:03:02 +0000 (09:03 -0700)]
[SLP]Fix a crash trying finding insert point for GEP nodes with non-gep
insts.
If the vectorizable GEP node is built, which should not be scheduled,
and at least one node is a non-gep instruction, need to insert the
vectorized instructions before the last instruction in the list, not
before the first one, otherwise the instructions may be emitted in the
wrong order.
Fangrui Song [Thu, 4 May 2023 16:42:25 +0000 (09:42 -0700)]
MS inline asm: remove obsolete code adding AOK_SizeDirective (e.g. dword ptr)
The AOK_SizeDirective part from
5b37c181291210bedfbb7a6af5d51229f3652ef0
(2014-08) seems unneeded nowadays (the root cause has likely been fixed
elsewhere). The part abuses that `call dword ptr foo` assembles the same way as `call
foo` in Intel syntax, which is going to be fixed (changed) by D149579.
The generated object files for
CodeGen/ms-inline-asm{,-functions,-variables,-static-variable}.c and
CodeGenCXX/ms-inline-asm-fields.cpp are unchanged
(-mno-incremental-linker-compatible) with just this patch. When D149579 is
subsequently applied, the FIXME part of `kptr` in
CodeGen/ms-inline-asm-functions.c will be fixed.
Differential Revision: https://reviews.llvm.org/D149695
Teresa Johnson [Thu, 4 May 2023 16:37:25 +0000 (09:37 -0700)]
Revert "Restore "[MemProf] Context disambiguation cloning pass [patch 3/4]""
This reverts commit
bfe7205975a63a605ff3faacd97fe4c1bf4c19b3, and follow
on fix
e3e6bc699574550f2ed1de07f4e5bcdddaa65557, due to some remaining
instability exposed by the bot enabling expensive checks:
https://lab.llvm.org/buildbot/#/builders/42/builds/9842
Valentin Clement [Thu, 4 May 2023 16:39:04 +0000 (09:39 -0700)]
[flang][openacc] Lower copyout, detach and delete to data exit operations
Add support to lower data exit operations and use it for the
copyout, detach and delete clause on the `!$acc exit data` construct.
This patch refactor the data entry op creation so most part of the code
can be shared with the data exit op.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D149601
Mehdi Amini [Thu, 4 May 2023 16:35:25 +0000 (09:35 -0700)]
Remove obsolete patch for arcanist: this is already in the upstream project now
Nikolas Klauser [Tue, 2 May 2023 22:01:00 +0000 (15:01 -0700)]
[libc++][PSTL] Move all the OpenMP conditionals into a single block
All the used OpenMP pragmas are available with OpenMP 4.0, so they can all share a single conditional block.
Reviewed By: ldionne, #libc
Spies: yaxunl, sstefan1, guansong, jplehr, libcxx-commits, sunshaoce
Differential Revision: https://reviews.llvm.org/D149603
Fangrui Song [Thu, 4 May 2023 16:21:18 +0000 (09:21 -0700)]
EntryExitInstrumenter: skip naked functions
The asm in a naked function may reasonably expect the argument registers and the
return address register (if present) to be live.
When using -pg and -finstrument-functions, functions are instrumented by adding
a function call to `_mcount/__cyg_profile_func_enter/__cyg_profile_func_enter_bare`/etc,
which will clobber these registers. If the return address register is clobbered,
the function will be unable to return to the caller, possibly causing an
infinite loop.
```
__attribute__((naked)) void g() {
#if defined(__arm__)
__asm__("bx lr");
#else
__asm__("ret");
#endif
}
int main() { g(); }
```
It seems that the only one reasonable way to handle the combination is to
disable instrumenting for naked functions.
GCC PR: https://gcc.gnu.org/PR109707
Close https://github.com/llvm/llvm-project/issues/62504
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D149721
Slava Zakharin [Thu, 4 May 2023 15:47:28 +0000 (08:47 -0700)]
[flang][hlfir] Generate explicit HLFIR type cast for implicit logical<->integer conversion.
hlfir.assign, in general, ends up calling the Assign runtime that asserts
that the types of LHS and RHS match. In case of implicit logical<->integer
conversions (allowed as an extension) the operands of hlfir.assign
have non-matching types. This change makes sure that the lowering
produces explicit type cast (either as a scalar fir.convert or
as a hlfir.elemental producing array expression).
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D149765
Peiming Liu [Mon, 17 Apr 2023 20:09:47 +0000 (20:09 +0000)]
[mlir][sparse] group tensor id and levels into pairs in loop emitter
This addressed some unresolved comments in https://reviews.llvm.org/D142930
Reviewed By: aartbik, wrengr
Differential Revision: https://reviews.llvm.org/D148565
Nikolas Klauser [Wed, 3 May 2023 21:42:21 +0000 (14:42 -0700)]
[libc++][PSTL][NFC] Fix the naming in the SIMD backend
Reviewed By: ldionne, #libc
Spies: sstefan1, jplehr, libcxx-commits, miyuki
Differential Revision: https://reviews.llvm.org/D149787
Akash Banerjee [Tue, 2 May 2023 17:21:12 +0000 (18:21 +0100)]
[OpenMP][OMPIRBuilder] Migrate MapCombinedInfoTy from Clang to OpenMPIRBuilder
This patch migrates the MapCombinedInfoTy from Clang codegen to OpenMPIRBuilder.
Differential Revision: https://reviews.llvm.org/D149666
Florian Hahn [Thu, 4 May 2023 15:29:49 +0000 (16:29 +0100)]
[VPlan] Clean up preheader block after
b85a402dd899fc.
Fix a leak introduced in
b85a402dd899fc and flagged by LSan
https://lab.llvm.org/buildbot#builders/5/builds/33452
Joseph Huber [Thu, 4 May 2023 15:16:54 +0000 (10:16 -0500)]
[libc][Docs] Add warning about running GPU tests with parallelism
Now that a large amount of GPU tests can be run in parallel, we should
document spurious failures. It is a well-known issue that launching many
GPU applications in parallel can lead to various problems, the worst of
which being an indefinite hang.
Differential Revision: https://reviews.llvm.org/D149857
Siyuan Zhu [Thu, 4 May 2023 14:59:07 +0000 (16:59 +0200)]
[ValueTracking] add UGT/UGE and SGT/SGE in `isImpliedCondOperands`
Partially `fix` https://github.com/llvm/llvm-project/issues/62441.
Extend isImpliedCondOperands() to handle ugt/uge and sgt/sge predicates.
alive2 proof: https://alive2.llvm.org/ce/z/jLFDAv and
https://alive2.llvm.org/ce/z/Z8idUd
Differential Revision: https://reviews.llvm.org/D149510
Siyuan Zhu [Thu, 4 May 2023 14:57:38 +0000 (16:57 +0200)]
[InstSimplify] Test case for icmp imply (NFC)
ugt/uge/sgt/sge test for the extension to isImpliedCondOperands
case from issue 62441 and 61393:
(X >> Z) <=(u) Y ==> X <=(to u) Y and (X > Y +_{nuw} 1) ==> X != Y
Differential Revision: https://reviews.llvm.org/D149512
Alvin Wong [Sat, 22 Apr 2023 18:13:48 +0000 (02:13 +0800)]
[compiler-rt][interception][win] Add error messages for some errors
Depends on D149002
Differential Revision: https://reviews.llvm.org/D149346
Alvin Wong [Sat, 29 Apr 2023 22:51:48 +0000 (06:51 +0800)]
[compiler-rt][interception][asan][win] Improve error reporting
Add a callback from interception to allow asan on Windows to produce
better error messages. If an unrecoverable error occured when
intercepting functions, print a message before terminating.
Additionally, when encountering unknown instructions, a more helpful
message containing the address and the bytes of the unknown instruction
is now printed to help identify the issue and make it easier to propose
a fix.
Depends on D149549
Differential Revision: https://reviews.llvm.org/D149002
Alvin Wong [Sat, 22 Apr 2023 18:04:16 +0000 (02:04 +0800)]
[compiler-rt][interception][win] Don't crash on unknown instructions
Do not treat unknown instructions as a fatal error. In most cases,
failure to intercept a function is reported by the caller, though
requires setting verbosity to 1 or higher to be visible.
Better error message reporting for asan will be added in a separate
patch.
Differential Revision: https://reviews.llvm.org/D149549
Alvin Wong [Sat, 22 Apr 2023 12:54:33 +0000 (20:54 +0800)]
[compiler-rt][asan][win] Intercept exceptions for i686 MinGW
The i686-w64-windows-gnu target does not use SEH (which MSVC uses),
but DWARF-2 exception handling or possibly sjlj depending on the
toolchain build options. On this target we have to actually intercept
functions in libc++ and libunwind which handles throwing exceptions.
This fixes the `TestCases/intercept-rethrow-exception.cpp` test.
The x86_64-w64-windows-gnu target already works because it uses SEH
which is handled by intercepting RaiseException, so this change does not
affect x86_64.
Depends on https://reviews.llvm.org/D148990
Differential Revision: https://reviews.llvm.org/D148991
Alvin Wong [Sat, 22 Apr 2023 11:26:08 +0000 (19:26 +0800)]
[compiler-rt][interception][win] Add more assembly patterns
These assembly patterns are needed to intercept some libc++ and
libunwind functions built by Clang for i686-w64-windows-gnu target.
Differential Revision: https://reviews.llvm.org/D148990
Louis Dionne [Tue, 2 May 2023 21:50:06 +0000 (17:50 -0400)]
[libc++] Add missing test for std::hash<std::filesystem::path>
Differential Revision: https://reviews.llvm.org/D149696
Teresa Johnson [Thu, 4 May 2023 14:32:50 +0000 (07:32 -0700)]
[MemProf] Need to require asserts for tests that use -stats
Follow up to
bfe7205975a63a605ff3faacd97fe4c1bf4c19b3 to require asserts
which is needed for the use of -stats. This showed up in the following
bot failure: https://lab.llvm.org/buildbot/#/builders/91/builds/16760
Yeting Kuo [Thu, 4 May 2023 06:59:03 +0000 (14:59 +0800)]
[DAGCombiner] Use generalized pattern match for visitFSUBForFMACombine.
The patch makes visitFSUBForFMACombine serve vp.fsub too. It helps DAGCombiner
to fuse vp.fsub and vp.fmul patterns to vp.fma.
Reviewed By: luke
Differential Revision: https://reviews.llvm.org/D149821
Aaron Ballman [Thu, 4 May 2023 13:40:35 +0000 (09:40 -0400)]
Add the experiemental interpreter to the open project page
This also fixes a missing close li tag as a drive-by
Joseph Huber [Fri, 28 Apr 2023 09:33:44 +0000 (04:33 -0500)]
[libc] Enable running libc unit tests on NVPTX
The previous patches added the necessary support for global constructors
used to register tests. This patch enables the NVPTX target to build
and run the unit tests on the GPU. Currently this only tests the ctype
tests, but adding more should be straightforward from here on.
This ran all the ctest unit tests when run on an sm_70.
Depends on D149517 D149527
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D149532
Eric Kilmer [Thu, 4 May 2023 13:23:47 +0000 (13:23 +0000)]
[CMake] Install FindLibEdit find module
This is a follow-up to D147153 and addresses CMake warnings about not
finding LibEdit find module when another project uses LLVM as a
dependency.
Fixes https://github.com/llvm/llvm-project/issues/62300
Reviewed By: Dinistro
Differential Revision: https://reviews.llvm.org/D148993
Teresa Johnson [Wed, 3 May 2023 23:09:53 +0000 (16:09 -0700)]
Restore "[MemProf] Context disambiguation cloning pass [patch 3/4]"
This reverts commit
6fbf022908c104a380fd1854fb96eafc64509366, restoring
commit
bf6ff4fd4b735afffc65f92a4a79f6610e7174c3 with a fix for a bot
failure due to a previously unstable iteration order.
Differential Revision: https://reviews.llvm.org/D141077
Martin Braenne [Wed, 3 May 2023 13:20:31 +0000 (13:20 +0000)]
[clang][dataflow][NFC] Eliminate unnecessary helper `stripReference()`.
`QualType::getNonReferenceType()` does the same thing.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D149744
Luo, Yuanke [Thu, 4 May 2023 12:58:21 +0000 (20:58 +0800)]
[Coverity] Improper use of negtive value.
The `Iteration` value may be -1 which would cause incorrect loop count
when pass the value to buildSqrtNROneConst or buildSqrtNRTwoConst.
Evgenii Kudriashov [Thu, 4 May 2023 12:25:31 +0000 (20:25 +0800)]
[X86] Support llvm.{min,max}imum.f{16,32,64}
Addresses https://github.com/llvm/llvm-project/issues/53353
Reviewed By: RKSimon, pengfei
Differential Revision: https://reviews.llvm.org/D145634
Evgenii Kudriashov [Thu, 4 May 2023 12:25:51 +0000 (20:25 +0800)]
[NFC][X86] Remove cfi instructions and unused attributes from half.ll test
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D149114
Florian Hahn [Thu, 4 May 2023 13:00:13 +0000 (14:00 +0100)]
[VPlan] Introduce new entry block to VPlan for early SCEV expansion.
This patch adds a new preheader block the VPlan to place SCEV expansions
expansions like the trip count. This preheader block is disconnected
at the moment, as the bypass blocks of the skeleton are not yet modeled
in VPlan.
The preheader block is executed before skeleton creation, so the SCEV
expansion results can be used during skeleton creation. At the moment,
the trip count expression and induction steps are expanded in the new
preheader. The remainder of SCEV expansions will be moved gradually in
the future.
D147965 will update skeleton creation to use the steps expanded in the
pre-header to fix #58811.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D147964
Jon Chesterfield [Thu, 4 May 2023 12:58:24 +0000 (13:58 +0100)]
[libc][rpc] Factor try_lock, unlock into functions on Process
Reduces line noise and localises changes needed for volta
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D149845
Théo Degioanni [Thu, 4 May 2023 12:44:07 +0000 (12:44 +0000)]
[mlir][mem2reg] Add support for mem2reg in MemRef.
This patch implements the mem2reg interfaces for MemRef types. This only supports scalar memrefs of a small list of types. It would be beneficial to create more interfaces for default values before expanding support to more types. Additionally, I am working on an upcoming revision to bring SROA to MLIR that should help with non-scalar memrefs.
Reviewed By: gysit, Mogball
Differential Revision: https://reviews.llvm.org/D149441
Marius Brehler [Thu, 4 May 2023 12:38:14 +0000 (12:38 +0000)]
[mlir][emitc][nfc] Update ApplyOp example
NAKAMURA Takumi [Thu, 4 May 2023 12:27:08 +0000 (21:27 +0900)]
Move LLT::dump()'s impl to LowLevelType.cpp
Suggested by @jobnoorman
https://reviews.llvm.org/D148767#4317848
LLVM GN Syncbot [Thu, 4 May 2023 12:14:42 +0000 (12:14 +0000)]
[gn build] Port
f05ce9045af4
Joseph Huber [Fri, 28 Apr 2023 14:33:44 +0000 (09:33 -0500)]
[libc] Support global constructors and destructors on NVPTX
This patch adds the necessary hacks to support global constructors and
destructors. This is an incredibly hacky process caused by the primary
fact that Nvidia does not provide any binary tools and very little
linker support. We first had to emit references to these functions and
their priority in D149451. Then we dig them out of the module once it's
loaded to manually create the list that the linker should have made for
us. This patch also contains a few Nvidia specific hacks, but it passes
the test, albeit with a stack size warning from `ptxas` for the
callback. But this should be fine given the resource usage of a common
test.
This also adds a dependency on LLVM to the NVPTX loader, which hopefully doesn't
cause problems with our CUDA buildbot.
Depends on D149451
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/D149527
Joseph Huber [Fri, 28 Apr 2023 11:16:05 +0000 (06:16 -0500)]
[NVPTX] Add NVPTXCtorDtorLoweringPass to handle global ctors / dtors
This patch mostly adapts the existing AMDGPUCtorDtorLoweringPass for use
by the Nvidia backend. This pass transforms the ctor / dtor list into a
kernel call that can be used to invoke those functinos. Furthermore, we
emit globals such that the names and addresses of these constructor
functions can be found by the driver. Unfortunately, since NVPTX has no
way to emit variables at a named section, nor a functioning linker to
provide the begin / end symbols, we need to mangle these names and have
an external application find them.
This work is related to the work in D149398 and D149340.
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/D149451
Nicolai Hähnle [Wed, 3 May 2023 20:30:50 +0000 (22:30 +0200)]
AMDGPU: Precommit test showing codegen weakness
The code sequence on gfx9 has a lot of useless v_bfi instructions.
Differential Revision: https://reviews.llvm.org/D149840
Jon Chesterfield [Thu, 4 May 2023 12:09:34 +0000 (13:09 +0100)]
[libc][rpc] Fold can send/recv into buffer_unavailable
Left out of D149788 to simplify the diff
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D149807
Martin Braenne [Thu, 4 May 2023 11:36:13 +0000 (11:36 +0000)]
[clang-tidy] bugprone-use-after-move: Ctor arguments should be sequenced if ctor call is written as list-initialization.
See
https://timsong-cpp.github.io/cppwp/n4868/dcl.init#list-4
This eliminates a false positive in bugprone-use-after-move; this newly added
test used to be falsely classified as a use-after-move:
```
A a;
S3 s3{a.getInt(), std::move(a)};
```
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D148110
Timm Bäder [Thu, 4 May 2023 10:57:37 +0000 (12:57 +0200)]
[clang][Interp][NFC] Fix allocateLocalPrimitive parameter name
This is passed on to Program::createDescriptor, where it is used as a
value for IsConst.
Joseph Huber [Wed, 3 May 2023 14:19:11 +0000 (09:19 -0500)]
[libc] Enable running libc unit tests on AMDGPU
The previous patches added the necessary support for global constructors
used to register tests. This patch enables the AMDGPU target to build
and run the unit tests on the GPU. Currently this only tests the `ctype`
tests, but adding more should be straightforward from here on.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D149517
Laszlo Kindrat [Wed, 3 May 2023 14:01:22 +0000 (10:01 -0400)]
[ADT] Introduce `map_to_vector` helper
The following pattern is common in the llvm codebase, as well as in downstream projects:
```
llvm::to_vector(llvm::map_range(container, lambda))
```
This patch introduces a shortcut for this called `map_to_vector`.
This template depends on both `llvm/ADT/SmallVector.h` and `llvm/ADT/STLExtras.h`, and since these are both relatively large and do not depend on each other, the `map_to_vector` helper is placed in a new header under `llvm/ADT/SmallVectorExtras.h`. Only a handful of use cases have been updated to use the new helper.
Differential Revision: https://reviews.llvm.org/D145390
Jacob Crawley [Tue, 2 May 2023 10:15:54 +0000 (10:15 +0000)]
[flang][hlfir] lower hlfir.product into fir runtime call
The shared code for lowering the sum and product operations in
flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp have
been moved into a new class HlfirReductionIntrinsicConverion.
Depends on: D148719
Differential Revision: https://reviews.llvm.org/D149644
Jacob Crawley [Wed, 19 Apr 2023 14:16:35 +0000 (14:16 +0000)]
[flang] lower product intrinsic to hlfir.product operation
Carries out the initial lowering of the product intrinsic into HLFIR
following a similar method to sum, the --use-hlfir-intrinsic-ops flag
in test/Lower/HLFIR/expr-box is set to false so that the tests will
pass until hlfir.product is lowered into fir.call
Depends on: D147624
Differential Revision: https://reviews.llvm.org/D148719
Jacob Crawley [Wed, 5 Apr 2023 11:48:53 +0000 (11:48 +0000)]
[flang] add hlfir.product operation
Adds a HLFIR operation for the PRODUCT intrinsic according to
the design set out in flang/doc/HighLevelFIR.md
Since the PRODUCT intrinsic is essentially identical to SUM
in terms of its arguments and result characteristics in the
Fortran Standard, the operation definition and subsequent
tests also take the same form.
Differential Revision: https://reviews.llvm.org/D147624
Donát Nagy [Wed, 26 Apr 2023 13:58:46 +0000 (15:58 +0200)]
[analyzer][NFC] Use std::optional instead of custom "empty" state
This commit eliminates the uninitialized error state from the class
RegionRawOffsetV2 (which is locally used by the Clang Static Analyzer
checker alpha.security.ArrayBoundV2) and replaces its use with
std::optional.
Motivated by https://reviews.llvm.org/D148355#inline-1437928
Moreover, the code of RegionRawOffsetV2::computeOffset() is rearranged
to clarify its behavior. The helper function getValue() was eliminated
by picking a better initial value for the variable Offset; two other
helper functions were replaced by the lambda function Calc() because
this way it doesn't need to take the "context" objects as parameters.
This reorganization revealed some surprising (but not outright buggy)
behavior that's marked by a FIXME and will be revisited in a separate
commit.
Differential Revision: https://reviews.llvm.org/D149259
Luke Lau [Wed, 3 May 2023 09:25:05 +0000 (10:25 +0100)]
[RISCV] Fix extract_vector_elt on i1 at idx 0 being inverted
It looks like the intention here is to truncate a XLenVT -> i1, in
which case we should be emitting snez instead of sneq if I'm understanding
correctly.
Reviewed By: jacquesguan, frasercrmck
Differential Revision: https://reviews.llvm.org/D149732
Timm Bäder [Tue, 2 May 2023 10:06:48 +0000 (12:06 +0200)]
[docs] Hide collaboration and include graphs in doxygen docs
They don't convey any useful information and make the documentation
unnecessarily hard to read.
Differential Revision: https://reviews.llvm.org/D149641
Tom Weaver [Thu, 4 May 2023 10:21:21 +0000 (11:21 +0100)]
Revert "[DebugInfo] add test case for D147506, NFC"
This reverts commit
6a808270e8a9becc07857240ebbf6731743a4485.
This test was added after https://reviews.llvm.org/D147506 was comittted which
has been reverted pending a buildbot fix for:
https://lab.llvm.org/buildbot/#/builders/247/builds/4125
Mats Petersson [Wed, 26 Apr 2023 16:20:10 +0000 (17:20 +0100)]
[flang]Add test for 2D loop versioning test
Another test based on review comments added late in the review.
This one confirms that the multiplication and addition of the outer
index to the inner index and thus form the 2D index.
Reviewed By: tblah
Differential Revision: https://reviews.llvm.org/D149265
Tom Weaver [Thu, 4 May 2023 10:08:58 +0000 (11:08 +0100)]
Revert "[DebugLine] save one debug line entry for empty prologue"
This reverts commit
b48a8233f5e230e46182bf5c523ceb6a04cec8f5.
This change caused https://lab.llvm.org/buildbot/#/builders/247/builds/4125
to start failing, please address the failures before resubmitting.
gregrodgers [Wed, 19 Apr 2023 21:14:40 +0000 (16:14 -0500)]
[OpenMP][libomptarget][AMDGPU] Enable active HSA wait state
Adds HSA timeout hint of 2 seconds to the AMDGPU nextgen-plugin to improve
performance of small kernels.
The HSA runtime may stay in HSA_WAIT_STATE_ACTIVE for up to the timeout
value before switching to HSA_WAIT_STATE_BLOCKED. This can improve
latency from which small kernels can benefit.
The value was determined via experimentation w/ different benchmarks.
The timeout value can be overriden using the environment variable
LIBOMPTARGET_AMDGPU_STREAM_BUSYWAIT with a value in microseconds.
Original author: Greg Rodgers <Gregory.Rodgers@amd.com>
Contributions from: JP Lehr <JanPatrick.Lehr@amd.com>
Differential Revision: https://reviews.llvm.org/D148808
Colin Ogilvie [Thu, 4 May 2023 09:48:51 +0000 (02:48 -0700)]
[clang-format] Correctly limit formatted ranges when specifying qualifier alignment
The qualifier alignment fixer appeared to ignore any ranges specified for limiting formatting.
This change ensures that it only formats affected lines to avoid unexpected changes.
Fixes #54888.
Differential Revision: https://reviews.llvm.org/D149643
Jon Chesterfield [Thu, 4 May 2023 09:52:44 +0000 (10:52 +0100)]
[libc][rpc] Treat pointers as arrays consistently
Noticed in passing. Either way compiles.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D149808
Luke Lau [Wed, 3 May 2023 17:06:02 +0000 (18:06 +0100)]
[RISCV] Use setcc to truncate results in widenVectorOpsToi8
To avoid an unnecessary vand.vi
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D149771
Alexey Lapshin [Fri, 21 Apr 2023 14:25:41 +0000 (16:25 +0200)]
[Support][Parallel] Change check for nested TaskGroups.
This patch changes check for nested TaskGroups so that it allows
parallel execution for TaskGroups. Following pattern would not work
parallelly with current check:
std::function<void()> Fn = [&]() {
parallel::TaskGroup tg;
tg.spawn([&]() { });
};
ThreadPool Pool;
Pool.async(Fn);
Pool.async(Fn);
Pool.wait();
One of the TaskGroup would work sequentially as current check
verifies overall number of TaskGroup. Two not nested
TaskGroups can work parallelly but current check prevents this.
Also this patch avoids parallel mode for TaskGroup
in parallel::strategy.ThreadsRequested == 1 case.
This patch is a followup of discussion from D142318
Differential Revision: https://reviews.llvm.org/D148984
Simon Pilgrim [Thu, 4 May 2023 09:26:30 +0000 (10:26 +0100)]
[DAG] computeKnownBits - remove old ashr TODO comment
KnownBits::ashr now uses the minimum shift amount to try and extend the sign bit
Sergio Afonso [Mon, 1 May 2023 10:59:37 +0000 (11:59 +0100)]
[Flang][Driver][NFC] Improve -emit-obj unit tests
Instead of looking for the existence of a `ret` instruction after disassembly
as a way to check that the right ISA is present in the produced binary, check
instead the ELF header of the file. This is a more reliable solution, since the
alternative can easily result in false positives.
Differential Revision: https://reviews.llvm.org/D149578
Adrian Kuegel [Thu, 4 May 2023 08:09:53 +0000 (10:09 +0200)]
[mlir][Bazel] Update BUILD.bazel file for
cc4703745ffa398b66f985b483cb8b61eb2ed425
Differential Revision: https://reviews.llvm.org/D149823
Florian Hahn [Thu, 4 May 2023 08:25:59 +0000 (09:25 +0100)]
[LV] Use VPValue for SCEV expansion in fixupIVUsers.
The step is already expanded in the VPlan. Use this expansion instead.
This is a step towards modeling fixing up IV users in VPlan.
It also fixes a crash casued by SCEV-expanding the Step expression in
fixupIVUsers, where the IR is in an incomplete state
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D147963
Timm Bäder [Thu, 4 May 2023 05:09:24 +0000 (07:09 +0200)]
[clang][Interp][NFC] Remove unnecessary include from State.h
Forward-declare OptionalDiagnostic instead. And turn a few comments in
to doc comments.
Timm Bäder [Sat, 22 Apr 2023 12:18:09 +0000 (14:18 +0200)]
[clang][Interp][NFC] Use const references to Floating
in the static functions. Since a Floating is backed by an APFloat, we
don't want to copy that around if it's not necessary.
Jean Perier [Thu, 4 May 2023 08:00:23 +0000 (10:00 +0200)]
[flang][hlfir] Add assignment mask operations
Add hlfir.forall_mask, hlfir.where, and hlfir.elsewhere operations that
are operations that holds (optionally for hlfir.elsewhere) the
evaluation of a logical mask that controls the evaluation of nested
operations.
They allow representing Fortran forall control mask, as well as where
and eslewhere statements/constructs.
They use the OrderedAssignmentTreeOpInterface since they can all be used
inside Forall and their masks should be fully evaluated for all the
index-value set induced by parent Forall before any of the nested
operations in their body is evaluated.
I initially tried making them into a single operation with some attributes
to make a difference, but I felt this made the verifier/parser/printer and
usages messier/tricky compared to making three distinct operations that
represent the three Fortran feature in a vanilla way.
Differential Revision: https://reviews.llvm.org/D149754
Jean Perier [Thu, 4 May 2023 07:56:12 +0000 (09:56 +0200)]
[flang][hlfir] Add hlfir.forall and its OrderAssignmentTreeOpInterface
This patch adds the hlfir.forall operation and the
OrderAssignmentTreeOpInterface that allows representing Fortran forall.
It uses regions to keep Fortran expression evaluation independent from
each other in the IR. Forall assignments inside hlfir.forall are
represented with hlfir.region_assign which also keeps the IR generated
for each expressions independently.
The goal of this representation is to provide a representation that is
straightforward to generate from Fortran parse tree without any analysis, while
providing enough structure information so that an optimization pass can decide
how to schedule, and save if needed, the evaluations of the Forall and Where
expression and statements. It allows the data dependency analysis to be done at
the HLFIR level.
The OrderAssignmentTreeOpInterface allows ensuring that the Forall/Where
tree structure is kept in the IR. It will allow visiting this tree in
the IR without hard coding the operation structures in the pass.
Differential Revision: https://reviews.llvm.org/D149734
Mikael Holmen [Thu, 4 May 2023 07:30:46 +0000 (09:30 +0200)]
[FuzzMutate] Remove unused variable [NFC]
gcc warned with
../lib/FuzzMutate/RandomIRBuilder.cpp:319:28: warning: unused variable 'PtrTy' [-Wunused-variable]
319 | if (PointerType *PtrTy = dyn_cast<PointerType>(I.getType()))
| ^~~~~
Mikael Holmen [Thu, 4 May 2023 07:29:02 +0000 (09:29 +0200)]
[clangd] Remove unused variable [NFC]
gcc warned with
../../clang-tools-extra/clangd/Protocol.cpp:481:23: warning: unused variable 'ChangeAnnotation' [-Wunused-variable]
481 | if (const auto& ChangeAnnotation =
| ^~~~~~~~~~~~~~~~
Timm Bäder [Tue, 2 May 2023 09:34:39 +0000 (11:34 +0200)]
[clang][Interp][NFC] Don't cast primitive types to the same type
We might classify different clang types to the same interp types, so
skip the cast in that case.
No test attached since this is already exercised a few times in the
existing tests.
Timm Bäder [Tue, 2 May 2023 06:47:36 +0000 (08:47 +0200)]
[clang][Interp][NFC] Make Pointer::block() const