When matching callsite profile info, we synthesize VP metadata for
matched indirect calls from the CalleeGuids recorded with the CallSite
profile info. However, those are the callee guids of the leaf-most frame
in the callsite. In cases where we match to a portion of the frames, not
including the leaf, the callee guid should instead be synthesized from
the next leaf-most frame in the list.
This addresses the case where indirect call promotion was applied in the
profiled binary during SamplePGO matching in a ThinLTO backend, where we
didn't have VP metadata.
`ConversionPatternRewriter::replaceUsesWithIf` does not support the
`allUsesReplaced` flag and asserts that it's not set. However the
`ValueRange` overload of `RewriterBase::replaceUsesWithIf` always passes
this flag when calling the virtual overload of `replaceUsesWithIf`. This
means calls made to `RewriterBase::replaceUsesWithIf` from a
`ConversionPattern` crash, whether the `allUsesReplaced` flag is set or
not.
This change tweaks `RewriterBase::replaceUsesWithIf` to only pass that
flag if the callee has set it.
This fixes an assertion failure in `SelectionDAG::getNode` on AArch64
during Type Legalization.
The crash is triggered by an `ANY_EXTEND_VECTOR_INREG` operation
involving small vector types (e.g., v16i1).
The crash occurs when the Type Legalizer processes a vector extend
operation where the input vector uses small elements, specifically in
the case of a ShuffleVector that generates a mask vector.
1. **Original Node**: `any_extend_vector_inreg (v16i1) -> v2i16`. (This
is physically valid: 16 bits < 32 bits).
2. **Promotion Issue**: When both the input and result types are
promoted for legality:
* The **Result** (`v2i16`) is promoted to a larger legal type, e.g.,
`v2i32` (**64 bits**).
* The **Input** (`v16i1`) is promoted to `v16i8` (**128 bits**) due to
the necessary scalar promotion of `i1` to `i8`.
3. The legalizer then attempts to create the new node:
`any_extend_vector_inreg (v16i8) -> v2i32`.
4. Since $128 \text{ bits} > 64 \text{ bits}$, the physical constraint
of the `EXTEND_VECTOR_INREG` operation is violated, causing the
assertion to fail.
### Solution
In `DAGTypeLegalizer::PromoteIntRes_EXTEND_VECTOR_INREG`, when the size
of the promoted input vector (`Promoted`) is found to be greater than
the size of the promoted result vector (`NVT`):
We explicitly truncates the promoted input to the size of the result
type (`NVT`), ensuring the final `*_EXTEND_VECTOR_INREG` node satisfies
the size constraint before it is created.
This behavior aligns with the fact that `*_EXTEND_VECTOR_INREG`
typically only requires the low-order lanes of the input vector.
**Test Added**: `llvm/test/CodeGen/AArch64/issue-171032.ll`
Fixes: #171032
After enabling DFLTCC in zlib-ng for s390x this test starts failing,
because slightly better compression is produced at level 1. Add 1c as a
permissible output.
Many neon right shift intrinsics were not supported by GlobalISel, mainly due to a lack of legalisation logic. This logic has now been implemented.
Some intrinsics involving a narrow lower to two separate GI nodes, which may then be re-combined later into a single assembly instruction.
This PR implement the following papers:
[P1857R3 Modules Dependency Discovery](https://wg21.link/p1857r3).
[P3034R1 Module Declarations Shouldn’t be
Macros](https://wg21.link/P3034R1).
[CWG2947](https://cplusplus.github.io/CWG/issues/2947.html).
At the start of phase 4 an import or module token is treated as starting
a directive and are converted to their respective keywords iff:
- After skipping horizontal whitespace are
- at the start of a logical line, or
- preceded by an export at the start of the logical line.
- Are followed by an identifier pp token (before macro expansion), or
- <, ", or : (but not ::) pp tokens for import, or
- ; for module
Otherwise the token is treated as an identifier.
Additionally:
- The entire import or module directive (including the closing ;) must
be on a single logical line and for module must not come from an
#include.
- The expansion of macros must not result in an import or module
directive introducer that was not there prior to macro expansion.
- A module directive may only appear as the first preprocessing tokens
in a file (excluding the global module fragment.)
- Preprocessor conditionals shall not span a module declaration.
After this patch, we handle C++ module-import and module-declaration as
a real pp-directive in preprocessor. Additionally, we refactor module
name lexing, remove the complex state machine and read full module name
during module/import directive handling. Possibly we can introduce a
tok::annot_module_name token in the future, avoid duplicatly parsing
module name in both preprocessor and parser, but it's makes error
recovery much diffcult(eg. import a; import b; in same line).
This patch also introduce 2 new keyword `__preprocessed_module` and
`__preprocessed_import`. These 2 keyword was generated during `-E` mode.
This is useful to avoid confusion with `module` and `import` keyword in
preprocessed output:
```cpp
export module m;
struct import {};
#define EMPTY
EMPTY import foo;
```
Fixes https://github.com/llvm/llvm-project/issues/54047
---------
Signed-off-by: yronglin <yronglin777@gmail.com>
Signed-off-by: Wang, Yihan <yronglin777@gmail.com>
Add ability to defer parsing and re-enqueueing oneself. This enables
changing CallSiteLoc parsing to not recurse as deeply: previously this
could fail (especially on large inputs in debug mode the recursion could
overflow). Add a default depth cutoff, this could be a parameter later
if needed.
Roll-forward of #170993 with relatively direct change such that if
processing while not resolving/when parsing property it eagerly
resolves.
This patch adds support for consuming a `char` from the front of a
`StringRef`. Most of the time a user wanting to consume a single
character off the front can just wrap the character in a string literal
(i.e., `consume_front("a")`). But this doesn't work if we don't have a
`char` literal, but instead a variable of type `char`. I.e., `char c =
'a'; str.consume_front(c)`. There's at least one helper in LLDB that
does this. Also there's plenty of example of `consume_front` being
passed a single character via string literal. This patch adds the `char`
overload. We already have a `starts_with(char)` overload, so there's at
least some related precedent.
Separate the low-level emission of the appropriate variants of `AUT*`,
`PAC*` and `B(L)RA*` instructions from the high-level logic of pseudo
instruction expansion.
Introduce `getBranchOpcodeForKey` helper function by analogy to
`get(AUT|PAC)OpcodeForKey`.
Previously, while gas syntax had checks for offsets which do not fit
within 32 bits, Intel syntax did not and would silently truncate without
warning.
Apply the same checks in both modes.
The unordered containers re-use the formatters for `std::list` which
were fixed for PDB with #166953.
This should be the last fix for PDB in MSVC STL tests. Unfortunately,
the type names here are very long, because the types of keys/values are
repeated in the template (for hash/eq/allocator).
Refactor the discriminator emission in `AArch64AsmPrinter`:
* factor out ad-hoc "X16 or X17 or not isX16X17Safer" checks into a
dedicated `isPtrauthRegSafe` function
* assert that `Disc` is uint16 once in `emitPtrauthDiscriminator`
instead of in all its callers
* update the comments and assertions for readability
* rename `MayUseAddrAsScratch` argument to `MayClobberAddrDisc`, as it
better reflects the intention
Opcodes 0xA0-0xA3 can access a 64-bit absolute address. Before this
change, LLVM would require this to be written as `movabs`, and writing
it as `mov` would silently truncate the address.
After this change, if `mov moffset` is used with a constant expression
which evaluates to a value that doesn't fit in 32 bits, the instruction
will automatically be changed to `movabs`. This should match the
behavior of more recent versions of gas.
The one existing test which expected a silent truncation + sign-extend
is removed.
This change does not affect `mov` opcodes that reference an external
symbol. Using `mov` will continue to generate a 32-bit address and
reloc_signed_4byte, and `movabs` is required to specify a 64-bit
address.
Fixes#73481
The debug messages are difficult to follow, because it is not printing
which loops it is dealing with. This adds loop names to various debug
messages so it's easier to see which loops it is accepting, rejecting,
etc.
The current baremetal driver implementation does not have a way to
derive the target-triple-level include path within the sysroot.
This feature is especially useful in setups where header paths deviate
from the default bare-metal assumptions. For example, when headers are
shared across target triples, it becomes necessary to organise them
under target-triple-specific directories to ensure correct resolution..
Add `-Wl,-z,defs` in `%cflags` to make linking more consistent across
distros. Aims to catch typos in handwritten assembly tests. If
intentional, individual tests can override this with: `-Wl,-z,undefs`
Tests changed:
- bolt/test/AArch64/bf_min_alignment.s: fixed a typo
- bolt/test/AArch64/tls.c: overriding behaviour in all clang
invocations, making the test more consistent.
- Overrides to allow undefined symbols in:
- bolt/test/AArch64/epilogue-determination.s
- bolt/test/AArch64/exceptions-plt.cpp
- bolt/test/AArch64/ifunc.test
- bolt/test/AArch64/plt-call.test
- bolt/test/AArch64/text-data.c
- bolt/test/AArch64/unsupported-passes.test
- bolt/test/AArch64/unsupported-passes.test
As per the SWOG for [Neoverse
N2](https://developer.arm.com/documentation/109914/latest/), throughput
is 1.5.
- Treat LDPXi/LDNPXi/LDPXpost/LDPXpre as dual loads so they now reserve
two N2Write_4c_1L
resources
- Update relevant tests to reflect new RThroughput
When widening the subvector of INSERT_SUBVECTOR(vec, subvec, 0) to the
same type as its result, we're effectively turning the operation into a
merge that can be implement with a VSELECT whose mask is based on the
original subvector's element count.
The primary goal of this patch is to add a comprehensive set of DTLTO time traces.
I also have implemented support for time traces in llvm-lto2, to allow for adding a test via Lit.
The previous SelectionDAG lowering is still available via
`-aarch64-new-sme-abi=false` (this will stay around until at least LLVM
23).
In tests that contained `CHECK-NEWLOWERING` the checks have been updated
so:
* `CHECK-NEWLOWERING` -> `CHECK` (the new default)
* `CHECK` -> `CHECK-SDAG` (the old SelectionDAG lowering)
But otherwise, the check lines have not changed.
Tests that were not explicitly checking the SME lowering have been
updated to match the new default lowering.
Those tests are:
* llvm/test/CodeGen/AArch64/O0-pipeline.ll
* llvm/test/CodeGen/AArch64/O3-pipeline.ll
* llvm/test/CodeGen/AArch64/sme-disable-gisel-fisel.ll
* llvm/test/CodeGen/AArch64/sme-framelower-use-bp.ll
* llvm/test/CodeGen/AArch64/stack-hazard.ll
Several lit tests are failing on macOS, as they are linux-specific,
but not using the "REQUIRES: system-linux" setting.
This patch adds the missing requirements to tests failing on macOS.
This implements all of [P2404R3](https://wg21.link/p2404r3)'s concept
changes.
---------
Co-authored-by: A. Jiang <de34@live.cn>
Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
Before bb993a89a873ee832d063fb566c889ca3d0c2b72, the stack probes on
aarch64 windows unconditionally called "__chkstk"; after this
refactoring, it only got "__chkstk" for MSVC environments, and no stack
probe at all for other environments.
Simplify RuntimeLibcalls.td to do the same for aarch64 as for arm,
simply adding "__chkstk" for all Windows variants, and add a test to
cover this case.
Adds a number of test cases where we have to be careful when pushing
freeze around. These first two tests are taken from #157678 which failed
to land to due compile-time issues. The last two tests were reduced from
llvm-opt-benchmark workloads on #171435 which was an attempt at
addressing underlying cause of the hangs.
For consistency with `ConstantInt::get()`, add an ImplicitTrunc
parameter to `ConstantInt::getSigned()` as well. It currently defaults
to true and will be flipped to false in the future (by #171456).