469330 Commits

Author SHA1 Message Date
Chuanqi Xu
97615ed2f0 Revert "[Coroutines] Add an O(n) algorithm for computing the cross suspend point"
This reverts commit bb4121e65251275b5b16a63423c2bb2be79aeebb. Sorry for
forgetting adding Differential Revision information. It may worth
reverting this one and commit it again given this is a relative big
patch.
2023-07-27 17:27:45 +08:00
witstorm95
bb4121e652 [Coroutines] Add an O(n) algorithm for computing the cross suspend point
information.

Fixed https://github.com/llvm/llvm-project/issues/62348

Propagate cross suspend point information by visiting CFG.

Just only go through two times at most, you can get all the cross
suspend point information.

Before the patch:

```
n: 20000
4.31user 0.11system 0:04.44elapsed 99%CPU (0avgtext+0avgdata
552352maxresident)k
0inputs+8848outputs (0major+126254minor)pagefaults 0swaps

n: 40000
11.24user 0.40system 0:11.66elapsed 99%CPU (0avgtext+0avgdata
1788404maxresident)k
0inputs+17600outputs (0major+431105minor)pagefaults 0swaps

n: 60000
21.65user 0.96system 0:22.62elapsed 99%CPU (0avgtext+0avgdata
3809836maxresident)k
0inputs+26352outputs (0major+934749minor)pagefaults 0swaps

n: 80000
37.05user 1.53system 0:38.58elapsed 99%CPU (0avgtext+0avgdata
6602396maxresident)k
0inputs+35096outputs (0major+1622584minor)pagefaults 0swaps

n: 100000
51.87user 2.67system 0:54.54elapsed 99%CPU (0avgtext+0avgdata
10210736maxresident)k
0inputs+43848outputs (0major+2518945minor)pagefaults 0swaps

```
After the patch:

```
n: 20000
3.17user 0.16system 0:03.33elapsed 100%CPU (0avgtext+0avgdata
551736maxresident)k
0inputs+8848outputs (0major+126192minor)pagefaults 0swaps

n: 40000
6.10user 0.42system 0:06.54elapsed 99%CPU (0avgtext+0avgdata
1787848maxresident)k
0inputs+17600outputs (0major+432212minor)pagefaults 0swaps

n: 60000
9.13user 0.89system 0:10.03elapsed 99%CPU (0avgtext+0avgdata
3809108maxresident)k
0inputs+26352outputs (0major+931280minor)pagefaults 0swaps

n: 80000
12.44user 1.57system 0:14.02elapsed 99%CPU (0avgtext+0avgdata
6603432maxresident)k
0inputs+35096outputs (0major+1624635minor)pagefaults 0swaps

n: 100000
16.29user 2.28system 0:18.59elapsed 99%CPU (0avgtext+0avgdata
10212808maxresident)k
0inputs+43848outputs (0major+2522200minor)pagefaults 0swaps

```
2023-07-27 17:25:32 +08:00
Sameer Sahasrabuddhe
7c760b224b Restore "[GlobalISel] GIntrinsic subclass to represent intrinsics in Generic Machine IR"
Some opcodes in generic MIR represent calls to intrinsics, where the intrinsic
ID is the first non-def operand to the instruction. These are now represented as
a subclass of GenericMachineInstr, and the method MachineInstr::getIntrinsicID()
is now moved to this subclass GIntrinsic.

Some target-defined instructions behave like GMIR intrinsics, and have an
Intrinsic::ID operand. But they should not be recognized as generic intrinsics,
and should not use GIntrinsic::getIntrinsicID(). Separated these out by
introducing a new AMDGPU::getIntrinsicID().

Reviewed By: arsenm, Pierre-vh

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

This restores commit baa3386edb11a2f9bcadda8cf58d56f3707c39fa.
Originally reverted in d0f7850b01cf17e50a4f4b00e3b84dded94df6b8.
2023-07-27 14:49:17 +05:30
Simon Pilgrim
4cd7d8e30a [clang] UnsafeBufferUsage.cpp - fix MSVC "not all control paths return a value" warning. NFC. 2023-07-27 10:17:57 +01:00
David Green
beabfe747b [AArch64] Sink splat to fmlal intrinsics
Similar to other neon index instructions, it is beneficial to sink the splat to
the instruction for fmlal in order for it to create the index.
2023-07-27 10:07:01 +01:00
Jianjian GUAN
5d6d6493ff [RISCV][NFC] Simplify lowerVPOp.
This patch is similar to https://reviews.llvm.org/D153948, using helper function to get ISD and information.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D154411
2023-07-27 16:42:20 +08:00
Nikita Popov
0d677c81c4 [InstCombine] Add test for PR64114 (NFC) 2023-07-27 10:11:48 +02:00
Nikita Popov
90d825be70 Reapply [ConstantFold] Avoid creation of undesirable binop
This was reverted together with another commit due to a test
conflict. Reapply without functional changes.

-----

When commuting the operands, don't create a constant expression
for undesirable binops. Only invoke the constant folding function
in that case.
2023-07-27 09:48:54 +02:00
YAMAMOTO Takashi
47ba908a5e [lld][WebAssembly] Fix func reloc for internal GOT with extended-const
Differential Revision: https://reviews.llvm.org/D155542
2023-07-27 00:46:00 -07:00
Alexandros Lamprineas
2e00eba232 [FuncSpec][NFC] Remove SSA copy intrinsics in the unittests.
Those are added by the SCCP Solver before invoking the Specializer.
They need to be removed otherwise the destructor of PredicateInfo
complains.

Differential Revision: https://reviews.llvm.org/D156365
2023-07-27 08:37:33 +01:00
Balázs Kéri
f4438385d4 [clang][ASTImporter] Fix import of recursive field initializer.
Import of field initializers with circular reference was not working,
this is fixed now.

Fixes issue #63120

Reviewed By: steakhal

Differential Revision: https://reviews.llvm.org/D155574
2023-07-27 09:34:34 +02:00
David Green
509cb33469 [AArch64] Correct the regtype of indexed fmlal
The indexed fmlal should use a low numbered register for the index operand,
which this fixes by making it V128_lo.

Fixes 64104

Differential Revision: https://reviews.llvm.org/D156296
2023-07-27 08:27:03 +01:00
David Green
e012c5cfac [AArch64] Add test showing incorrect register usage of FMLAL. NFC
See D156296
2023-07-27 07:39:10 +01:00
Timm Bäder
2a6cfc4baa [clang][Interp] Try to fix a test on Windows
This seems to fail on Windows:
Interp\literals.cpp Line 946: cast to smaller integer type 'long' from 'char *'
2023-07-27 08:34:15 +02:00
Konstantin Varlamov
194e2ba125 [CMake] Use LLVM_ENABLE_ASSERTIONS to enable the hardened mode in libc++.
Use the new libc++ hardened mode instead of the deprecated safe mode.

Reviewed By: benlangmuir

Differential Revision: https://reviews.llvm.org/D156377
2023-07-26 23:09:23 -07:00
David CARLIER
e3f935c7f8 [Fuzzer] SetThreadName implementation for Windows
Api available since Windows Server 2016/Windows 10 1607.

Reviewers: vitalybuka

Reviewed-By: vitalybuka

Differential Revision: https://reviews.llvm.org/D156317
2023-07-27 06:55:00 +01:00
eopXD
20e87e2f79 [Clang][RISCV] Bump rvv intrinsics version to v0.12
The LLVM now supports v0.12 of the RVV intrinsics. Users can use the macro
riscv_v_intrinsic to distinguish what kind of intrinsics is supported in
the compiler.

Please refer to tag descriptions under

https://github.com/riscv-non-isa/rvv-intrinsic-doc/tags

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D156394
2023-07-26 22:54:40 -07:00
eopXD
7cb81c1b8c [Clang][RISCV] Remove RVV intrinsics vread_csr,vwrite_csr
As proposed in riscv-non-isa/rvv-intrinsic-doc#249, removing the interface.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D156321
2023-07-26 22:33:41 -07:00
LLVM GN Syncbot
7029e74643 [gn build] Port a496c8be6e63 2023-07-27 05:20:38 +00:00
eopXD
25e1d61013 [RISCV] Correct policy operand for RVV ISel patterns with merge operand as implicit_def (NFC)
The trailing TU_MU suffixes was added in D154625. The trailing policy
operand for these patterns has no real affect, as the vsetvli insertion
pass omits the trailing policy operand when the merge operand is
undefined.

This patch is essentially an NFC. However, the policy implied for these
patterns is actually TA_MA. This patch corrects them to avoid confusion.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D156342
2023-07-26 22:17:16 -07:00
Vitaly Buka
a496c8be6e Revert "[CodeGen]Allow targets to use target specific COPY instructions for live range splitting"
And dependent commits.

Details in D150388.

This reverts commit 825b7f0ca5f2211ec3c93139f98d1e24048c225c.
This reverts commit 7a98f084c4d121244ef7286bc6503b6a181d446e.
This reverts commit b4a62b1fa546312d882fa12dfdcd015177d66826.
This reverts commit b7836d856206ec39509d42529f958c920368166b.

No conflicts in the code, few tests had conflicts in autogenerated CHECKs:
llvm/test/CodeGen/Thumb2/mve-float32regloops.ll
llvm/test/CodeGen/AMDGPU/fix-frame-reg-in-custom-csr-spills.ll

Reviewed By: alexfh

Differential Revision: https://reviews.llvm.org/D156381
2023-07-26 22:13:32 -07:00
Jim Lin
fa140fe211 [RISCV] Simplify tablegen for XCV mac and mul instructions. NFC.
CVInstMac reuses RVInstR that has the same encoding fields.

Add a new class CVInst16I that has specific encoding fields, and two
new class CVInstMac16I and CVInstMul16I that inherite CVInst16I with
different outs and ins.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D156335
2023-07-27 13:04:44 +08:00
Paulo Matos
d6b73f5625 [SPIRV][NFC] Fix typo in SPV_KHR_16bit_storage extension name
Simple fix for a extension name typo. NFC.

Differential Revision: https://reviews.llvm.org/D156231
2023-07-27 06:52:27 +02:00
Sameer Sahasrabuddhe
d0f7850b01 Revert "[GlobalISel] GIntrinsic subclass to represent intrinsics in Generic Machine IR"
This reverts commit baa3386edb11a2f9bcadda8cf58d56f3707c39fa.

The changes did not cover all occurrences of the deteleted function
MachineInstr::getIntrinsicID().
2023-07-27 10:14:24 +05:30
Sameer Sahasrabuddhe
baa3386edb [GlobalISel] GIntrinsic subclass to represent intrinsics in Generic Machine IR
Some opcodes in generic MIR represent calls to intrinsics, where the intrinsic
ID is the first non-def operand to the instruction. These are now represented as
a subclass of GenericMachineInstr, and the method MachineInstr::getIntrinsicID()
is now moved to this subclass GIntrinsic.

Some target-defined instructions behave like GMIR intrinsics, and have an
Intrinsic::ID operand. But they should not be recognized as generic intrinsics,
and should not use GIntrinsic::getIntrinsicID(). Separated these out by
introducing a new AMDGPU::getIntrinsicID().

Reviewed By: arsenm, Pierre-vh

Differential Revision: https://reviews.llvm.org/D155556
2023-07-27 10:00:45 +05:30
Sameer Sahasrabuddhe
b14e30f10d [LLVM] refactor GenericSSAContext and its specializations
Fix the GenericSSAContext template so that it actually declares all the
necessary typenames and the methods that must be implemented by its
specializations SSAContext and MachineSSAContext.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D156288
2023-07-27 09:54:50 +05:30
Alfred Persson Forsberg
fe9c3c7868 [libc] _INCLUDE_SCUDO: check for compiler-rt in enabled RUNTIMES too
Previously including SCUDO in a libc build with runtimes/ as root was
not possible since this code only checked for compiler-rt enabled via
LLVM_ENABLED_PROJECTS.

Reviewed By: thesamesam

Differential Revision: https://reviews.llvm.org/D156388
2023-07-27 05:11:54 +01:00
Pravin Jagtap
1462053608 [AMDGPU] Propagate constants for llvm.amdgcn.wave.reduce.umin/umax
Reviewed By: arsenm, #amdgpu

Differential Revision: https://reviews.llvm.org/D156077
2023-07-26 23:46:01 -04:00
wangpc
a32023edbc [RISCV][NFC] Change type of isOrdered to boolean
The name is `isOrdered` but it's a string actually, which is a bit
confusing. We change its type to `bit` and get the order string via
its value.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D156306
2023-07-27 11:08:33 +08:00
Christopher Ferris
867f2d9e5c [scudo] Make Options a reference for functions.
Modify all places that use the Options structure to be a const
reference. The underlying structure is a u32 so making it a
reference doesn't really do anything. However, if the structure
changes in the future it already works and avoids future coders
wondering why a structure is being passed by value. This also
makes it clear that the Options should not be modified in those functions.

Reviewed By: Chia-hungDuan

Differential Revision: https://reviews.llvm.org/D156372
2023-07-26 18:21:39 -07:00
Arthur Eubanks
ae2ebc24e1 [gn build] Enable builtins on Windows 2023-07-26 18:19:03 -07:00
Rashmi Mudduluru
a6ae740e74 [-Wunsafe-buffer-usage] Add a facility for debugging low fixit coverage
Differential Revision: https://reviews.llvm.org/D154880
2023-07-26 17:07:36 -07:00
Florian Mayer
9a67c6beb2 [NFC] [HWASan] simplify code
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D156382
2023-07-26 17:05:19 -07:00
Amy Huang
27dab4d305 Reland "Try to implement lambdas with inalloca parameters by forwarding without use of inallocas."t
This reverts commit 8ed7aa59f489715d39d32e72a787b8e75cfda151.

Differential Revision: https://reviews.llvm.org/D154007
2023-07-26 16:13:36 -07:00
Vitaly Buka
63458d92e5 [asan] Block signals only on platforms with implementation
Followup to D156299.
2023-07-26 16:13:24 -07:00
Mehdi Amini
d1edc7feb4 Add more numbers about MLIR binary sizes with the example binaries (NFC) 2023-07-26 16:13:14 -07:00
Jeffrey Tan
ca84935293 Fix lldb-vscode frame id integer overflow
This patch fixes a 32bit integer overflow in lldb-vscode.
The current implementation of frame_id does `(thread_index << 19 | frame_index)`. Since thread_index is a 32 bit integer this leaves only 32 - 19 == 13 bits available for the thread_index. As a result, lldb-vscode can only handle 2^13 == 8192 threads. Normally, this would be sufficient, but we have seen crazy process having +12000 threads, causing the frame_id algorithm above to integer overflow during casting.

The patch fixes the overflow by up casting to 64 bit integer first before bit shifiting.

Differential Revision: https://reviews.llvm.org/D156375
2023-07-26 16:12:41 -07:00
Nitin John Raj
474cf4feb7 [RISCV][GlobalISel] Test legalization of binary logical instructions with wider types
Without any additional tweaking, we can successfully legalize for wider
types (i64, i96 for rv32; i128, i192 for rv64) that are integer
multiples of XLen.

Reviewed By: arsenm, craig.topper

Differential Revision: https://reviews.llvm.org/D155639
2023-07-26 15:37:13 -07:00
Florian Hahn
cc39866436
[LV] Reorganize and extend in-loop reduction tests.
Split off min-max in-loop reduction tests into separate file and extend
them by adding tests with
 * min & max intrinsics
 * fmuladd with permuted operands
 * min & max select tests with permuted operands.

Adds extra test coverage as suggested in D155845.
2023-07-26 23:23:14 +01:00
Matt Arsenault
63dbe7e808 HIP: Use __builtin_sqrt instead of routing through ocml sqrt for f64
llvm.sqrt.f64 now works correctly and should be called directly.

https://reviews.llvm.org/D156366
2023-07-26 18:11:49 -04:00
Razvan Lupusoru
52a0b6a662 [openacc] Add acc routine support to acc dialect
Adds representation for `acc routine` under new operation named
`acc.routine`. This operation is associated with a function symbol.
It also gets its own compiler generated synthetic symbol name so
that it can be referenced from the associated function. The clauses
associated with the `acc routine` directive are captured in the
`acc.routine` op.

The linking between the `func.func` and its `acc.routine` declaration
is done through the `acc.routine_info` attribute. In practice, a
single `acc routine` is associated with a function. But the spec does
not specifically restrict this - thus the 1:N relationship between
`func.func` and `acc.routine` allowed in the dialect. Additionally, it
makes sense that multiple acc routines could be used for a single
function depending on loop context - to allow flexible parallelization.

Most acc routine clauses are supported including `gang`, `gang(dim:)`,
`vector`, `worker`, `seq`, `nohost`, and `bind`. The only one not
supported is `device_type`. This is because most other clauses also
miss this and the effort to add support for it needs to be coordinated
and consistent.

Reviewed By: clementval, vzakhari

Differential Revision: https://reviews.llvm.org/D156281
2023-07-26 15:06:39 -07:00
Florian Mayer
12982d250d [NFC] [HWASan] remove unused include 2023-07-26 14:34:31 -07:00
Matt Arsenault
d4a6b05681 AutoUpgrade: Use consume_front 2023-07-26 17:29:19 -04:00
Mark de Wever
97d60af0d3 [libc++] Renames nasty_macro test.
The name is not really descriptive, renamed the file and improved the
diagnostics.

As a drive-by fixes one macro to generate a diagnostic.

Reviewed By: #libc, jloser, philnik

Differential Revision: https://reviews.llvm.org/D156051
2023-07-26 23:18:09 +02:00
Fangrui Song
08247d7071 [Driver][test] Fix continuation lines from debug-options.c
Without RUN: in the continuation lines, they just test a quirk of -###
that clang returns with 0.
2023-07-26 13:47:39 -07:00
Jeff Niu
e76ac8074f [llvm][orc] Consider other ELF init sections as well
ELF object files can contain `.ctors` and `.dtors` sections that also
participate as initializers.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D154802
2023-07-26 13:44:41 -07:00
Vitaly Buka
b55f05a3f2 [NFC][hwasan] Don't tag secondary allocations on free
OnUnmap will tag it to zero anyway.

Reviewed By: fmayer

Differential Revision: https://reviews.llvm.org/D156282
2023-07-26 13:36:10 -07:00
Maksim Panchenko
1e4ee588fb [BOLT] Accept function start as valid jump table entry
Jump tables may contain a function start address. One real-world example
is when a target basic block contains a recursive tail call that is
later optimized/folded into a jump table target.

While analyzing a jump table, we treat start address similar to an
address past the end of the containing function (a result of
__builtin_unreachable), i.e. we require another "regular" entry for the
heuristic to proceed.

Reviewed By: Amir

Differential Revision: https://reviews.llvm.org/D156206
2023-07-26 13:25:08 -07:00
Vitaly Buka
e00e0b6fb0 [asan] Block signals when starting threads
Async signals may crash the process if AsanThread is not fully
initialized. We do the same for other sanitizers already.

Can't have good reproducer for test. We see this in internal test with prob 1e-6.

Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D156299
2023-07-26 13:03:40 -07:00
Vitaly Buka
fd16d46536 [NFC][asan] Replace start_routine_ and arg_ with opaque start_data_ field
start_data_ is platform specific.

Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D156298
2023-07-26 12:59:20 -07:00