Commit Graph

425279 Commits

Author SHA1 Message Date
Martin Storsjö 7e2afe83e8 [Windows] Don't try to wildcard expand paths starting with \\?\
Paths that start with `\\?\` are absolute paths, and aren't expected
to be used with wildcard expressions.

Previously, the `?` at the start of the path triggered the condition
for a potential wildcard, which caused the path to be split and
reassembled. In builds with `LLVM_WINDOWS_PREFER_FORWARD_SLASH=ON`,
this caused a path like e.g. `\\?\D:\tmp\hello.cpp` to be reassembled
into `\\?\D:\tmp/hello.cpp` which isn't a valid path (as such
absolute paths must use backslashes consistently).

This fixes https://github.com/mstorsjo/llvm-mingw/issues/280.

I'm not sure if there's any straightforward way to add a test
for this case, unfortunately.

Differential Revision: https://reviews.llvm.org/D126675
2022-06-01 11:25:49 +03:00
Martin Storsjö 298e9cac92 [MC] [Win64EH] Check that the SEH unwind opcodes match the actual instructions
It's a fairly common issue that the generating code incorrectly marks
instructions as narrow or wide; check that the instruction lengths
add up to the expected value, and error out if it doesn't. This allows
catching code generation bugs.

Also check that prologs and epilogs are properly terminated, to
catch other code generation issues.

Differential Revision: https://reviews.llvm.org/D125647
2022-06-01 11:25:49 +03:00
Martin Storsjö d4022ff331 [MC] [Win64EH] Optimize the ARM unwind info
Use the packed unwind info format if possible; otherwise try to
create a packed epilog.

Differential Revision: https://reviews.llvm.org/D125646
2022-06-01 11:25:49 +03:00
Martin Storsjö 6b75a3523f [ARM] [MC] Add support for writing ARM WinEH unwind info
This includes .seh_* directives for generating it from assembly.
It is designed fairly similarly to the ARM64 handling.

For .seh_handler directives, such as
".seh_handler __C_specific_handler, @except" (which is supported
on x86_64 and aarch64 so far), the "@except" bit doesn't work in
ARM assembly, as '@' is used as a comment character (on all current
platforms).

Allow using '%' instead of '@' for this purpose. This convention
is used by GAS in similar contexts already,
e.g. [1]:

    Note on targets where the @ character is the start of a comment
    (eg ARM) then another character is used instead. For example the
    ARM port uses the % character.

In practice, this unfortunately means that all such .seh_handler
directives will need ifdefs for ARM.

Contrary to ARM64, on ARM, it's quite common that we can't evaluate
e.g. the function length at this point, due to instructions whose
length is finalized later. (Also, inline jump tables end with
a ".p2align 1".)

If unable to to evaluate the function length immediately, emit
it as an MCExpr instead. If we'd implement splitting the unwind
info for a function (which isn't implemented for ARM64 yet either),
we wouldn't know whether we need to split it though.

Avoid calling getFrameIndexOffset() on an unset
FuncInfo.UnwindHelpFrameIdx, to avoid triggering asserts in the
preexisting testcase CodeGen/ARM/Windows/wineh-basic.ll. (Once
MSVC exception handling is fully implemented, those changes
can be reverted.)

[1] https://sourceware.org/binutils/docs/as/Section.html#Section

Differential Revision: https://reviews.llvm.org/D125645
2022-06-01 11:25:48 +03:00
Martin Storsjö e71b07e468 [MC] [Win64EH] Wrap the epilog instructions in a struct. NFC.
For ARM SEH, the epilogs will need a little more associated data than
just the plain list of opcodes.

This is a preparatory refactoring for D125645.

Differential Revision: https://reviews.llvm.org/D125879
2022-06-01 11:25:48 +03:00
Diana Picus a159128811 [flang] Upstream lowering of real control loops
Upstream the code for handling loops with real control variables from
the fir-dev branch at
https://github.com/flang-compiler/f18-llvm-project/tree/fir-dev/

Also add a test.

Loops with real-valued control variables are always lowered to
unstructured loops. The real-valued control variables are handled the
same as integer ones, the only difference is that they need to use
floating point instructions instead of the integer equivalents.

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2022-06-01 08:00:45 +00:00
Balázs Kéri d597a461e0 [clang][ASTImporter] Add support for import of UsingPackDecl.
Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D125986
2022-06-01 09:58:08 +02:00
Ping Deng ae8ae45e2a [DAGCombine][NFC] Add braces to 'else' to match braced 'if'
Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D126624
2022-06-01 07:54:05 +00:00
Benjamin Kramer 7d431e9ec5 [mlir][complex] Remove unused variables. NFC. 2022-06-01 09:33:02 +02:00
Dossay Oryspayev e72f573848 [flang][OpenMP] Added parser support for defaultmap (OpenMP 5.0)
This patch adds parser support for defaultmap clause [OpenMP 5.0].

Reviewed By: kiranchandramohan, peixin, shraiysh

Differential Revision: https://reviews.llvm.org/D124190
2022-06-01 12:52:20 +05:30
lewuathe 6d75c89783 [mlir][complex] Add tan op for complex dialect
Add tangent operation for complex dialect. This is the follow-up change of https://reviews.llvm.org/D126521

Differential Revision: https://reviews.llvm.org/D126685
2022-06-01 09:20:42 +02:00
Fangrui Song 94573a49c9 [ELF][test] Change some tests to use SHF_COMPRESSED instead of legacy .zdebug 2022-06-01 00:18:54 -07:00
Gabor Marton 160798ab9b [analyzer] Handle SymbolCast in SValBuilder
Make the SimpleSValBuilder to be able to look up and use a constraint
for an operand of a SymbolCast, when the operand is constrained to a
const value.
This part of the SValBuilder is responsible for constant folding. We
need this constant folding, so the engine can work with less symbols,
this way it can be more efficient. Whenever a symbol is constrained with
a constant then we substitute the symbol with the corresponding integer.
If a symbol is constrained with a range, then the symbol is kept and we
fall-back to use the range based constraint manager, which is not that
efficient. This patch is the natural extension of the existing constant
folding machinery with the support of SymbolCast symbols.

Differential Revision: https://reviews.llvm.org/D126481
2022-06-01 08:42:04 +02:00
Peixin-Qiao 5491fdf559 [flang] Add semantic check for named constant as function result
Similar to procedure argument, the function result cannot be one
named constant.

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D126693
2022-06-01 14:38:46 +08:00
owenca 3d56131bf6 [Docs] Clarify the guideline on omitting braces
While working on a clang-format option RemoveBracesLLVM that removes
braces following the guideline, we were unsure about what to do with
the braces of do-while loops. The ratio of using to omitting the
braces is about 4:1 in the llvm-project source, so it will help to
add an example to the guideline.

Also cleans up the original examples including making the nested if
example more targeted on avoiding potential dangling else situations.

Differential Revision: https://reviews.llvm.org/D126512
2022-05-31 23:35:30 -07:00
Endre Fülöp e290fcef11 [clang-tidy] Extend cert-oop57-cpp to check non-zero memset values
Clang Tidy check cert-oop57-cpp now checks for arbitrary-valued
arguments in memset expressions containing non-trivially
default-constructible instances. Previously it only checked literal 0 values.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D126186
2022-06-01 08:23:23 +02:00
Endre Fülöp 1c459a20ea Revert "[clang-tidy] Extend cert-oop57-cpp to check non-zero memset values"
Revert to fix a ReleaseNote issue.

This reverts commit d33f199910.
2022-06-01 08:21:16 +02:00
Endre Fülöp d33f199910 [clang-tidy] Extend cert-oop57-cpp to check non-zero memset values
Clang Tidy check cert-oop57-cpp now checks for arbitrary-valued
arguments in memset expressions containing non-trivially
default-constructible instances. Previously it only checked literal 0 values.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D126186
2022-06-01 08:15:03 +02:00
wangpc 57203af167 [RISCV] Set target-abi explicitly to reduce codegen results
As mentioned in D125947, we can reduce codegen results by
adding an explicit hard single-float ABI.

Reviewed By: luismarques

Differential Revision: https://reviews.llvm.org/D126640
2022-06-01 13:49:23 +08:00
Fangrui Song 873d2aff42 [AArch64][test] Replace -march with -mtriple for llc RUN lines
-march is error-prone: -march inherits the OS and environment from the default
target triple. Use -mtriple which is more common.
2022-05-31 22:39:43 -07:00
Fangrui Song 726e2c5be5 [X86][test] Remove unneeded -mtriple from llc RUN lines 2022-05-31 22:35:07 -07:00
Tue Ly 800051487f [libc] Implement FLAGS option for generating all combinations for targets.
Add FLAGS option for add_header_library, add_object_library,
add_entrypoint_object, and add_libc_unittest.

In general, a flag is a string provided for supported functions under the
multi-valued option `FLAGS`.  It should be one of the following forms:
  FLAG_NAME
  FLAG_NAME__NO
  FLAG_NAME__ONLY
A target will inherit all the flags of its upstream dependency.

When we create a target `TARGET_NAME` with a flag using (add_header_library,
add_object_library, ...), its behavior will depend on the flag form as follow:
- FLAG_NAME: The following 2 targets will be generated:
    `TARGET_NAME` that has `FLAG_NAME` in its `FLAGS` property.
    `TARGET_NAME.__NO_FLAG_NAME` that depends on `DEP.__NO_FLAG_NAME` if
       `TARGET_NAME` depends on `DEP` and `DEP` has `FLAG_NAME` in its `FLAGS`
       property.
- FLAG_NAME__ONLY: Only generate 1 target `TARGET_NAME` that has `FLAG_NAME`
    in its `FLAGS` property.
- FLAG_NAME__NO: Only generate 1 target `TARGET_NAME.__NO_FLAG_NAME` that
    depends on `DEP.__NO_FLAG_NAME` if `DEP` is in its DEPENDS list and `DEP`
    has `FLAG_NAME` in its `FLAGS` property.

To show all the targets generated, pass SHOW_INTERMEDIATE_OBJECTS=ON to cmake.
To show all the targets' dependency and flags, pass
`SHOW_INTERMEDIATE_OBJECTS=DEPS` to cmake.

To completely disable a flag FLAG_NAME expansion, set the variable
`SKIP_FLAG_EXPANSION_FLAG_NAME=TRUE`.

Reviewed By: michaelrj, sivachandra

Differential Revision: https://reviews.llvm.org/D125174
2022-06-01 00:54:07 -04:00
Reid Kleckner 17296607a7 Revert "[Bazel][GN] Reuse the GN LLVM config file generation code"
This reverts commit e2ee8bf981.

This change is beyond my ability to integrate into Google's internal
build configuration tonight.
2022-05-31 21:15:46 -07:00
Zi Xuan Wu (Zeson) 80fd9f3e0a [CSKY] Fix error of underestimated function size by save/restore R15(LR) when we use BSR far jump.
In CSKYConstantIslands, when fix up an unconditional branch(CSKY::BR32) whose destination is
too far away to fit in its displacement field, and if the R15(LR) register has been
spilled in the prologue, then we can use BSR to implement a far jump. So we need estimate function
size, and spill R15(LR) when the function size >= unconditional branch(CSKY::BR32) can reach.

EstimateFunctionSizeInBytes function adds up all instructions and constant pool entries(each entry is 4 bytes).
2022-06-01 11:05:19 +08:00
Fangrui Song 944110353b [Hexagon][test] Fix some tests on linux-musl
-march=hexagon uses the default target triple and changes the arch part of
hexagon. On linux-musl, this essentially becomes hexagon-unknown-linux-musl
which has different code generation. Use -mtriple instead.

Link: https://github.com/llvm/llvm-project/issues/48936
2022-05-31 19:55:50 -07:00
Nemanja Ivanovic 1013967436 [PowerPC] Remove const from paired vector store builtins
For some reason, we implemented the xx_stxvp intrinsics
to require a const pointer. This absolutely doesn't make
sense for a store. Remove the const from the definition.
2022-05-31 21:51:15 -05:00
Reid Kleckner e2ee8bf981 [Bazel][GN] Reuse the GN LLVM config file generation code
Currently, the Bazel build uses static, checked in [llvm-]config.h files
in combination with global macro definitions to mimic CMake's generated
headers. This change reuses the write_cmake_config.py script from the GN
build to generate the headers from source in the same way. The purpose
is to ensure that the Bazel build stays up to date with any changes to
the CMake config files. The write_cmake_config.py script has good error
checking to ensure that unneeded, stale variables are not passed, and
that any missing variables are reported as errors.

I tried to closely follow the logic in the GN build here:
  llvm/utils/gn/secondary/llvm/include/Config/BUILD.gn
The duplication between this file and config.bzl is significant, and we
could consider going further, but I'd like to hold off on it for now.

The GN build changes are to move the write_cmake_config.py script up to
//llvm/utils/write_cmake_config.py, and update the paths accordingly.

The next logical change is to generate Clang's config.h header.

Differential Revision: https://reviews.llvm.org/D126581
2022-05-31 19:40:05 -07:00
Reid Kleckner 3c31c68c90 [Bazel] Add missing dep after mlgo test change f46dd19b48 2022-05-31 19:39:42 -07:00
Yaxun (Sam) Liu 92a606f6de [HIP] Pass -Xoffload-linker option to device linker
Reuse -Xoffload-linker option for HIP toolchain.

Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D126704
2022-05-31 22:17:40 -04:00
Yaxun (Sam) Liu 377806a65e [HIP] Fix static lib name on windows
clang by default assumes static library name to be xxx.lib
when -lxxx is specified on Windows with MSVC environment,
instead of libxxx.a.

This patch fixes static device library unbundling for that.
It falls back to libxxx.a if xxx.lib is not found.

Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D126681
2022-05-31 22:13:50 -04:00
Phoebe Wang a2ea5b496b [X86] Add support for `-mharden-sls=[none|all|return|indirect-jmp]`
The patch addresses the feature request from https://github.com/ClangBuiltLinux/linux/issues/1633. The implementation borrows a lot from aarch64.

Reviewed By: nickdesaulniers, MaskRay

Differential Revision: https://reviews.llvm.org/D126137
2022-06-01 09:45:04 +08:00
Chenbing Zheng e183665874 [InstCombine] [NFC] remove useless TODO 2022-06-01 09:29:05 +08:00
Alexander Yermolovich ec2711b354 [BOLT][DWARF] Fix dwarf5-debug-line test
After D126484, order in .debug-line-str and .debug-line is different. Changed
test accordingly.

Differential Revision: https://reviews.llvm.org/D126733
2022-05-31 18:17:16 -07:00
Mariusz Borsa e2adffc39c [Sanitizers][Darwin] Deprecate SANITIZER_MAC - fail compilation if encountered
Previous couple commits replaced SANITIZER_MAC with SANITIZER_APPLE in bulk.
This change will prompt anyone still trying to use SANITIZER_MAC to rename.

Differential Revision: https://reviews.llvm.org/D126577
2022-05-31 18:08:59 -07:00
Xiang Li d3e4727907 [HLSL] add -D option for dxc mode.
Create dxc_D as alias to option D which Define <macro> to <value> (or 1 if <value> omitted).

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D125338
2022-05-31 17:50:36 -07:00
Maksim Panchenko e290133c76 [BOLT] Add new class for symbolizing X86 instructions
Summary:
While disassembling instructions, we need to replace certain immediate
operands with symbols. This symbolizing process relies on reading
relocations against instructions. However, some X86 instructions can
have multiple immediate operands and up to two relocations against
them. Thus, correctly matching a relocation to an operand is not
always possible without knowing the operand offset within the
instruction.

Luckily, LLVM provides an interface for passing the required info from
the disassembler via a virtual MCSymbolizer class. Creating a
target-specific version allows a precise matching of relocations to
operands.

This diff adds X86MCSymbolizer class that performs X86-specific
symbolizing (currently limited to non-branch instructions).

Reviewers: yota9, Amir, ayermolo, rafauler, zr33

Differential Revision: https://reviews.llvm.org/D120928
2022-05-31 17:48:19 -07:00
Zakk Chen 79e3d57f52 [RISCV][NFC] Rename variables in rvv intrinsics related files.
This patch does the same thing as D125886 did.

- Use `Overloaded` rather than `Mangled`.
- Use `Prototype` or `Desc` rather than `Seq`, it's not just a string
sequence.

Reviewed By: fakepaper56

Differential Revision: https://reviews.llvm.org/D126634
2022-05-31 17:43:01 -07:00
wren romano 98e142cd4f [mlir][sparse] Using x-macros in the function-suffix functions
By defining the `{primary,overhead}TypeFunctionSuffix` functions via the same x-macros used to generate the runtime library's functions themselves, this helps avoid bugs from typos or things getting out of sync.

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D126720
2022-05-31 17:36:43 -07:00
Mircea Trofin f46dd19b48 [mlgo] Incrementally update FunctionPropertiesInfo during inlining
Re-computing FunctionPropertiesInfo after each inlining may be very time
consuming: in certain cases, e.g. large caller with lots of callsites,
and when the overall IR doesn't increase (thus not tripping a size bloat
threshold).

This patch addresses this by incrementally updating
FunctionPropertiesInfo.

Differential Revision: https://reviews.llvm.org/D125841
2022-05-31 17:27:32 -07:00
Eli Friedman abdf0da800 [LoopIdiom] Fix bailout for aliasing in memcpy transform.
Commit dd5991cc modified the aliasing checks here to allow transforming
a memcpy where the source and destination point into the same object.
However, the change accidentally made the code skip the alias check for
other operations in the loop.

Instead of completely skipping the alias check, just skip the check for
whether the memcpy aliases itself.

Differential Revision: https://reviews.llvm.org/D126486
2022-05-31 17:24:23 -07:00
Jim Ingham d92f7f790c Fix a copy-paste error in "br com add -s py -o 'some_python' BKPT_NAME"
The function that was supposed to iterate over all the breakpoints sharing
BKPT_NAME stopped after the first one because of a reversed "if success"
condition.

Differential Revision: https://reviews.llvm.org/D126730
2022-05-31 17:24:14 -07:00
Adrian Prantl ca73de4374 Adapt LLDB for D120540.
In https://reviews.llvm.org/D120540 the -fcxx-modules flag changed
semantics and specifying it explicitly seems to no longer be what we
want here.
2022-05-31 16:56:37 -07:00
Yuki Okushi 36c1183c78
[test] Remove an outdated FIXME
rG6a9c719ee1be4562a9e16f2c71ac3e51ef9c4292 removed the backticks and this FIXME comment is no longer necessary.

Differential Revision: https://reviews.llvm.org/D126528
2022-06-01 08:17:46 +09:00
Yuki Okushi 5c14940394
[clangd] Remove a test with a duplicate of FileCacheTests
FIXME says it should be removed so followed it.

Differential Revision: https://reviews.llvm.org/D126608
2022-06-01 08:15:54 +09:00
Alexander Shaposhnikov a72cc958a3 [CodeGen][AArch64] Add support for LDAPR
This diff adds support for LDAPR (RCPC extension)
(https://github.com/llvm/llvm-project/issues/55561).

Differential revision: https://reviews.llvm.org/D126250

Test plan: ninja check-all
2022-05-31 21:40:50 +00:00
wren romano c63d4fac4f [mlir][sparse] Improving the FATAL macro
The previous macro definition using `{...}` would fail to compile when the callsite uses a semicolon followed by an else-statement (i.e., `if (...) FATAL(...); else ...;`).  Replacing the simple braces with `do{...}while(0)` (n.b., semicolon not included in the macro definition) enables callsites to use the semicolon plus else-statement syntax without problems.  The new definition now requires the semicolon at all callsites, but since it was already being called that way nothing changes.

For more explanation, see <https://gcc.gnu.org/onlinedocs/cpp/Swallowing-the-Semicolon.html>

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D126514
2022-05-31 14:31:38 -07:00
Fangrui Song da9d41cb87 [Bazel] Fix typo: startlark=>starlark 2022-05-31 14:12:41 -07:00
Stanislav Mekhanoshin dec1283279 [AMDGPU] Fix image opcodes GlobalISel on gfx90a.
- Correct flavor of an instruction was not selected.
- GFX90A does not support TFE.

Differential Revision: https://reviews.llvm.org/D126312
2022-05-31 14:07:46 -07:00
LLVM GN Syncbot d0d985c196 [gn build] Port 13e1a65327 2022-05-31 21:00:23 +00:00
Andrzej Warzynski 11837af03d [flang][nfc] Fix Windows build
* Breaking change: https://reviews.llvm.org/D125832
* Buildbot failure: https://lab.llvm.org/buildbot/#/builders/172/builds/13123

Sending this without a review - this is a rather straightforward fix.
2022-05-31 20:59:44 +00:00