498716 Commits

Author SHA1 Message Date
Eli Friedman
15397583e3
Revert "[polly] Port polly tests to use NPM" (#92215)
Reverts llvm/llvm-project#90632.

Causing failures on buildbots that dynamically load polly. Reverting
while we sort it out.
2024-05-14 22:04:50 -07:00
Matt Arsenault
847c83f7cc
InstCombine: Process addrspacecast uses in PointerReplacer (#91953)
This was looking through an addrspacecast, and not finding a later
unfoldable cast to another address space. Fixes improperly deleting
a required alloca + memcpy and introducing an illegal addrspacecast.
    
This also required fixing some worklist management issues with
addrspacecast, and assuming that only memcpy sources could need
replacement.
    
Regresses one test function, but this looks like it optimized
before by accident. It never saw the pointer use by the call
to readonly_callee, which should require insertion of a new cast.
    
Fixes #68120
2024-05-15 07:02:31 +02:00
rahulana-quic
74d91d9ace
[polly] Port polly tests to use NPM (#90632)
Even as the NPM has been in use by Polly for a while now, the
majority of the tests continue using the LPM passes. This patch
ports the tests to use the NPM passes (for example, by replacing
a flag such as -polly-detect with -passes=polly-detect following
the NPM syntax for specifying passes) with some exceptions for
some missing features in the new passes. Additionally, the lit
substitution %loadPolly is replaced by the substitution of what
was %loadNPMPolly and %loadNPMPolly is removed.
2024-05-14 21:47:31 -07:00
Luke Lau
77047e3cd2
[RISCV] Make vsetvli in test not loop invariant. NFC (#92094)
The middle end will remove the inner vsetvli otherwise, and it's more
typical to set the AVL to the remaining VL.

This also prevents the test from showing up as a regression in #91319
2024-05-15 12:32:26 +08:00
Cyuria
d3455f4ddd
[libc][docs] Fix outdated code review section, as per #91934 (#92051)
As in the title, fixes #91934
2024-05-15 00:13:05 -04:00
Robin Caloudis
a71e2b9d0f
[libc][errno] Remove non asm generic error number (#92172)
The following small thing caught my eye:

1) `EILSEQ` is not part of the generic asm error number macros. See the
[full list of generic asm errno
codes](4b95dc8736/include/uapi/asm-generic/errno-base.h).
AFAIK the generic asm errno numbers are common between different
operating systems and architectures. `EILSEQ` is not part of this common
set of errno's.

2) `EILSEQ`'s value is wrong. During the addition of `EILSEQ` in
https://reviews.llvm.org/D151129, the value `35` was probably chosen as
its the consecutive number. This is not correct. The actual values can
be looked up for example here:
* [For Linux
kernel](https://github.com/search?q=repo%3Atorvalds%2Flinux+EILSEQ&type=code&p=1):
`EILSEQ = 84` (uapi; i.e. x86_64), `EILSEQ = 88` (mips), `EILSEQ = 47`
(parisc)
* [For Darwin
kernel](https://github.com/apple-oss-distributions/xnu/blob/main/bsd/sys/errno.h#L237):
`EILSEQ = 92`
2024-05-15 00:02:46 -04:00
Luke Lau
1a58e88690
[RISCV] Move RISCVInsertVSETVLI to after phi elimination (#91440)
Split off from #70549, this patch moves RISCVInsertVSETVLI to after phi
elimination where we exit SSA and need to move to LiveVariables.

The motivation for splitting this off is to avoid the large scheduling
diffs from moving completely to after regalloc, and instead focus on
converting the pass to work on LiveIntervals.

The two main changes required are updating VSETVLIInfo to store VNInfos
instead of MachineInstrs, which allows us to still check for PHI defs in
needVSETVLIPHI, and fixing up the live intervals of any AVL operands
after inserting new instructions.

On O3 the pass is inserted after the register coalescer, otherwise we
end up with a bunch of COPYs around eliminated PHIs that trip up
needVSETVLIPHI.

Co-authored-by: Piyou Chen <piyou.chen@sifive.com>
2024-05-15 11:44:32 +08:00
Owen Pan
72b2c37de6 [clang-format][NFC] Clean up TokenAnnotator::mustBreakBefore() 2024-05-14 20:31:53 -07:00
epitavy
2ece5cc2bb
[ExceptionDemo] Correct and update example ExceptionDemo (#69485)
The ExceptionDemo example was no longer compiling (since llvm 14 at
least). The PR makes the example work with the current API and also
transition from MCJIT to ORC.
Fixes #63702
2024-05-15 08:39:11 +05:30
Mehdi Amini
eb103104ef Revert "[Serialization] Read the initializer for interesting static variables before consuming it"
This reverts commit 11b059145d177ee287c7ada9864addf8d083c160.

The premerge bot is broken.
2024-05-14 19:53:38 -07:00
Freddy Ye
13b265c7b5
[X86][MC] Support Intel FRED and LKGS instructions. (#91909)
Spec reference: https://cdrdv2.intel.com/v1/dl/getContent/678938
2024-05-15 10:40:16 +08:00
Chuanqi Xu
11b059145d [Serialization] Read the initializer for interesting static variables before consuming it
Close https://github.com/llvm/llvm-project/issues/91418

Since we load the variable's initializers lazily, it'd be problematic
if the initializers dependent on each other. So here we try to load the
initializers of static variables to make sure they are passed to code
generator by order. If we read any thing interesting, we would consume
that before emitting the current declaration.
2024-05-15 10:29:49 +08:00
Nikita Popov
6642cc60a2 [SCEV] Add tests for ule/sle exit counts (NFC) 2024-05-15 11:10:46 +09:00
Nikita Popov
71fbbb69d6 [IR] Move GlobalValue::getGUID() out of line (NFC)
Avoid including MD5.h in a core IR header.
2024-05-15 10:49:25 +09:00
AtariDreams
4d1ecf1923
[Transforms] Preserve inbounds attribute of transformed GEPs when flattening loops (#86961)
When flattening the loop, if the GEP was inbound, it should stay
inbound, because the only thing that changed is how the pointers are
calculated, not the elements being accessed.

Proof: https://alive2.llvm.org/ce/z/dApMpQ
2024-05-15 10:26:23 +09:00
Mircea Trofin
03c7458a36
Revert "[ctx_profile] Profile reader and writer" (#92199)
Reverts llvm/llvm-project#91859

Buildbot failures.
2024-05-14 18:07:58 -07:00
Mircea Trofin
dfdc3dcbe7
[ctx_profile] Profile reader and writer (#91859)
Utility converting a profile coming from `compiler_rt` to bitstream, and
a reader.

`PGOCtxProfileWriter::write` would be used as the `Writer` parameter for
`__llvm_ctx_profile_fetch` API. This is expected to happen in user code,
for example in the RPC hanler tasked with collecting a profile, and
would look like this:

```
// set up an output stream "Out", which could contain other stuff
{
  // constructing the Writer will start the section, in Out, containing
  // the collected contextual profiles.
  PGOCtxProfWriter Writer(Out);
  __llvm_ctx_profile_fetch(&Writer, +[](void* W, const ContextNode &N) {
    reinterpret_cast<PGOCtxProfWriter*>(W)->write(N);
  });
  // Writer going out of scope will finish up the section.
}
```

The reader produces a data structure suitable for maintenance during IPO
transformations.
2024-05-14 18:01:23 -07:00
Joseph Huber
c5cd049566 [Clang][Fixup] Fix deleted constructor on older compilers 2024-05-14 18:43:42 -05:00
Joseph Huber
4a17e86f27
[LinkerWrapper] Add an overriding option for debugging (#91984)
Summary:
One of the downsides of the linker wrapper is that it made debugging
more difficult. It is very powerful in that it can resolve a lot of
input matching and library handling that could not be done before.
However, the old method allowed users to simply copy-paste the script
files to modify the output and test it.

This patch attempts to make it easier to debug changes by letting the
user override all the linker inputs. That is, we provide a user-created
binary that is treated like the final output of the device link step.
The intended use-case is for using `-save-temps` to get some IR, then
modifying the IR and sticking it back in to see if it exhibits the old
failures.
2024-05-14 18:39:48 -05:00
Craig Topper
e417e61532 [RISCV][LegalizeTypes] Add additional test coverage for type promotion of VP_FSHL/FSHR. NFC
There's a special path when the promoted type has an element size
more than twice the size of the original type.
2024-05-14 16:25:07 -07:00
Joe Nash
3ca428c090
[AMDGPU][True16] Add VOP1Inst_t16_with_profiles class (#92184)
NFC. Makes the VOP1Inst_t16 interface more generic to support future
instructions cleanly.
2024-05-14 18:29:16 -04:00
VincentWu
844355a8cb
[RISC-V] remove I ext when E ext has been enabled (#92070)
After patch https://github.com/llvm/llvm-project/pull/88805

`I` Ext will be added automatically when we running the command like 
`./build/bin/llc -mtriple=riscv32 -mattr=+e -target-abi ilp32e
-verify-machineinstrs llvm/test/CodeGen/RISCV/zcmp-additional-stack.ll`

it will generate 
```
	.text
	.attribute	4, 16
	.attribute	5, "rv32i2p1_e2pe"
	.file	"zcmp-additional-stack.ll"
	.globl	func                            # -- Begin function func
	.p2align	1
	.type	func,@function
```

This patch reset the I ext in FeatureBit when `+e` has been specify
2024-05-15 08:26:45 +10:00
Alexander Yermolovich
99fad7ebd8
[BOLT][DWARF] Update DW_AT_comp_dir/DW_AT_dwo_name for DWO TUs (#91486)
Type unit DIE generated by clang contains DW_AT_comp_dir/DW_AT_dwo_name.
This was added to clang to help LLDB to figure out where type unit come
from when accessing an entry in a .debug_names accelerator table and
type units in .dwp file.

When BOLT writes out .dwo files it changes the name of them. User can
also specify directory of where they can be written out. Added support
to BOLT to update those attributes.
2024-05-14 15:08:45 -07:00
GeorgeHuyubo
5bf653ca42
Revert "Read and store gnu build id from loaded core file" (#92181)
Reverts llvm/llvm-project#92078
2024-05-14 14:36:17 -07:00
GeorgeHuyubo
536abf827b
Read and store gnu build id from loaded core file (#92078)
As we have debuginfod as symbol locator available in lldb now, we want
to make full use of it.
In case of post mortem debugging, we don't always have the main
executable available.
However, the .note.gnu.build-id of the main executable(some other
modules too), should be available in the core file, as those binaries
are loaded in memory and dumped in the core file.

We try to iterate through the NT_FILE entries, read and store the gnu
build id if possible. This will be very useful as this id is the unique
key which is needed for querying the debuginfod server.

Test:
Build and run lldb. Breakpoint set to
https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp#L147
Verified after this commit, module_uuid is the correct gnu build id of
the main executable which caused the crash(first in the NT_FILE entry)
2024-05-14 14:35:35 -07:00
Michael Maitland
67beebfcb9
[TableGen][SubtargetEmitter] Refactor hasReadOfWrite to CodeGenProcModel (#92032)
SubtargetEmitter::GenSchedClassTables takes a CodeGenProcModel, but
calls hasReadOfWrite which loops over all ProcModels. We move
hasReadOfWrite to CodeGenProcModel and remove the loop over all
ProcModels. This leads to a 144% speedup on the RISC-V backend of our
downstream.
2024-05-14 17:15:19 -04:00
Keith Smiley
f918c056f0
[lldb] Allow env override for LLDB_ARGDUMPER_PATH (#91688)
This mirrors the LLDB_DEBUGSERVER_PATH environment variable and allows
you to have lldb-argdumper in a non-standard location and still use it
at runtime.
2024-05-14 13:43:04 -07:00
Florian Mayer
f83df080a8
[NFC] add comment to keep RegState in sync with doc (#92170) 2024-05-14 13:35:04 -07:00
Philip Reames
baca93fc83 [LSR] Tweak debug output to always print initial cost 2024-05-14 13:34:20 -07:00
Peiming Liu
fb8f492a1c
[mlir][sparse] clone a empty sparse tensor when fuse convert into pro… (#92158)
…ducer.
2024-05-14 13:26:49 -07:00
Krystian Stasiowski
1202837302
Reapply "[Clang] Unify interface for accessing template arguments as written for class/variable template specializations (#81642)" (#91393)
Reapplies #81642, fixing the crash which occurs when running the lldb test suite.
2024-05-14 16:09:57 -04:00
Amara Emerson
d4c86e7f3e
[AArch64][SME] Fix frame lowering not using a base pointer for SME functions. (#91643)
The existing code is checking for the presence of the +sve subtarget
feature
when deciding to use a base pointer for the function, but this check
doesn't
work when only +sme is used.

rdar://126878490
2024-05-14 13:00:19 -07:00
Fangrui Song
4cfe347c10 [clangd] Fix -Wunused-but-set-variable after #82396 2024-05-14 12:58:49 -07:00
Florian Hahn
cf5db39907
[LV] Add tests with trip counts containing UDIV expressions.
Add test cases for
https://github.com/llvm/llvm-project/issues/89958.
2024-05-14 20:28:27 +01:00
Keith Smiley
18ba0cc26e
[github] Add keith to bazel owners (NFC) (#92164)
I'm interested in being CC'd on these changes
2024-05-14 12:24:32 -07:00
Keith Smiley
332f5e7113
[compiler-rt][ORC] Remove unused cmake variables (NFC) (#87742) 2024-05-14 12:24:12 -07:00
Joseph Huber
302db1ab5a
[Offload] Do not link every target for JIT (#92013)
Summary:
The offload library supports basic JIT functionality, however we
currently link against every single target even though only AMDGPU and
NVPTX are supported. This somewhat bloats the dynamic library list, so
we should constrain it to what's actually used.
2024-05-14 13:57:34 -05:00
Florian Hahn
179efe5abc
[LAA] Delay applying loop guards until after isSafeDependenceDistance.
Applying the loop guards to the distance may prevent
isSafeDependenceDistance from determining NoDep, unless loop guards are
also applied to the backedge-taken-count.

Instead of applying the guards to both Dist and the
backedge-taken-count, just apply them after handling
isSafeDependenceDistance and constant distances; there is no benefit to
applying the guards before then.

This fixes a regression flagged by @bjope due to
ecae3ed958481cba7d60868cf3504292f7f4fdf5.
2024-05-14 19:47:24 +01:00
Zequan Wu
5adfcb0750
Allow passing creduce options through creduce-clang-crash.py (#92141)
This change allows us to pass creduce options to creduce-clang-crash.py
script. With this, `--n` is no longer needed to specify the number of
cores, so removed the flag.

The motivation is
https://github.com/llvm/llvm-project/pull/87933#issuecomment-2109463497
suggests that disabling creduce renaming passes helps people to further
reduce crash manually.
2024-05-14 14:40:33 -04:00
Florian Mayer
80f8ae3f84
[NFC] add explanation to register flags doc (#91803) 2024-05-14 11:34:27 -07:00
Felix Schneider
acd100747f
[mlir][test] Extend InferIntRangeInterface test Ops to arbitrary ints (#91850)
This PR is in preparation to some extensions to the
`InferIntRangeInterface` around the `nsw` and `nuw` flags supported in
the `arith` dialect and LLVM.

We provide some common inference logic for `index` and `arith` in
`InferIntRangeCommon.h` but our Test Ops are currently fixed to `Index`
Types. As we test the range inference for arith Ops, especially around
the overflow behaviour, it's handy to have native support for the
typical integer types in the test Ops.

This patch
1. Changes the Attributes of `test.with_bounds` ops from `Index` to
`APInt` which matches the internal representation in
`ConstantIntRanges`.
2. Allows the use of `AnyInteger` in addition to `Index` for the
operands and results of the test Ops. This now requires explicit
specification of the type in the IR, where before `Index` was implicit.
3. Requires bounds Attrs to be specified in the precision of the SSA
value, eliminating any implicit truncation or extension. (*Could this
lead to problems?*)
2024-05-14 20:33:16 +02:00
PiJoules
19008d3218
[llvm] Support fixed point multiplication on AArch64 (#84237)
Prior to this, fixed point multiplication would lead to this assertion
error on AArhc64, armv8, and armv7.

```
 _Accum f(_Accum x, _Accum y) { return x * y; }

// ./bin/clang++ -ffixed-point /tmp/test2.cc -c -S -o - -target aarch64 -O3
clang++: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:10245: void llvm::TargetLowering::forceExpandWideMUL(SelectionDAG &, const SDLoc &, bool, EVT, const SDValue, const SDValue, const SDValue, const SDValue, SDValue &, SDValue &) const: Assertion `Ret.getOpcode() == ISD::MERGE_VALUES && "Ret value is a collection of constituent nodes holding result."' failed.
```

This path into forceExpandWideMUL should only be taken if we don't
support [US]MUL_LOHI or MULH[US] for the operand size (32 in this case).
But we should also check if we can just leverage regular wide
multiplication. That is, extend the operands from 32 to 64, do a regular
64-bit mul, then trunc and shift. These ops are certainly available on
aarch64 but for wider types.
2024-05-14 11:23:45 -07:00
Oleg Shyshkov
f89b1b8a68 [mlir][bazel] Fix bazel build. 2024-05-14 20:14:32 +02:00
Florian Hahn
67d840b60f
[VPlan] Relax over-aggressive assertion in VPTransformState::get().
There are cases where a vector value has some users that demand the
the single scalar value only (NeedsScalar), while other users demand the
vector value (see attached test cases). In those cases, the NeedsScalar
users should only demand the first lane.

Fixes https://github.com/llvm/llvm-project/issues/91883.
2024-05-14 19:10:49 +01:00
Alex Bradbury
90109d4448
[RISCV] Improve constant materialisation for stores of i8 negative constants (#92131)
This follows the same pattern as 20e62658735a1b03ecadc. Although we
can't reduce the number of instructions used, if we are able to use a
sign-extended 6-bit immediate then the 16-bit c.li instruction can be
selected (thus saving code size). Although this _could_ be gated so it
only happens if C is enabled, I've opted not to because at worst it's
neutral and it doesn't seem helpful to add unnecessary divergence
between the RVC and non-RVC paths.
2024-05-14 19:08:04 +01:00
Alex Bradbury
de14b749fe [RISCV][test] Precommit tests for byte store of -1
Although we can't reduce the number of instructions, if we selected `li
rd, -1` instead then this could be encoded in a 16-bit instruction.
2024-05-14 19:03:46 +01:00
Mircea Trofin
39d123f58a
[nfc] const-ify IntOrString::equalsLower (#92152) 2024-05-14 10:39:05 -07:00
Florian Hahn
86f655cb4e
[LAA] Add tests showing unnecessary RT check due to applying loop guards
Test courtesy to @bjope showing a regression due to
ecae3ed958481cba7d60868cf3504292f7f4fdf5.
2024-05-14 18:27:37 +01:00
Krystian Stasiowski
97e35e0098
Revert "[Clang][Sema] Earlier type checking for builtin unary operators (#90500)" (#92149)
This reverts commit 8019cbbbbc94658d133583f7be6cd0023d30b0f3.
2024-05-14 13:22:01 -04:00
Piotr Zegar
54435b5df3
[clang-tidy] Ignore implicit casts with errors in bugprone-implicit-widening-of-multiplication-result (#92025)
When expression got errors (missing typedef) and clang-tidy is compiled
with asserts enabled, then we crash in this check on assert because type
with errors is visible as an dependent one. This is issue caused by
invalid input.

But as there is not point to crash in such case and generate additional
confusion, such expressions with errors will be now ignored.

Fixes #89515, #55293
2024-05-14 19:17:47 +02:00