- Aug 25, 2022
-
-
Ilia Diachkov authored
The patch adds support for OpenCL and SPIR-V built-in functions. Their detection and properties are implemented using TableGen. Five tests are added to demonstrate the improvement. Differential Revision: https://reviews.llvm.org/D132024 Co-authored-by:
Aleksandr Bezzubikov <zuban32s@gmail.com> Co-authored-by:
Michal Paszkowski <michal.paszkowski@outlook.com> Co-authored-by:
Andrey Tretyakov <andrey1.tretyakov@intel.com> Co-authored-by:
Konrad Trifunovic <konrad.trifunovic@intel.com>
-
-
Saleem Abdulrasool authored
We may be requested to emit an unaligned nop sequence (e.g. 7-bytes or 3-bytes). These should be 0-filled even though that is not a valid instruction. This matches the behaviour on other architectures like ARM, X86, and MIPS. When a custom section is emitted, it may be classified as text even though it may be a data section or we may be emitting data into a text segment (e.g. a literal pool). In such cases, we should be resilient to the emission request. This was originally identified by the Linux kernel build and reported on D131270 by Nathan Chancellor. Differential Revision: https://reviews.llvm.org/D132482 Reviewed By: luismarques Tested By: Nathan Chancellor
-
Cameron McInally authored
The SROA algorithm won't work for Scalable Vectors, since we don't know how many bytes are loaded/stored. Bail out if a Scalable Vector is seen. Differential Revision: https://reviews.llvm.org/D132417
-
Sanjay Patel authored
~(A * C1) + A --> (A * (1 - C1)) - 1 This is a non-obvious mix of bitwise logic and math: https://alive2.llvm.org/ce/z/U7ACVT The pattern may be produced by Negator from the more typical code seen in issue #57255.
-
Sanjay Patel authored
Negator can create non-obvious math while trying hard to avoid subtraction. issue #57255
-
Eli Friedman authored
The unittests are already included in check-polly, so check-all was running them twice. Running them twice causes a race on the output files, which led to intermittent failures on the reverse-iteration buildbot.
-
Chris Bieneman authored
HLSL entry function parameters must have parameter annotations. This allows appropriate intrinsic values to be populated into parameters during code generation. This does not handle entry function return values, which will be handled in a subsequent commit because we don't currently support any annotations that are valid for function returns. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D131625
-
Ye Luo authored
if(TARGET amdgpu-arch) doesn't work when ENABLE_LLVM_PROJECTS=openmp because openmp subdirectory is processed before clang subdirectory. Adopt the same logic of enabling tests like the CUDA plugin. Differential Revision: https://reviews.llvm.org/D132579
-
Sami Tolvanen authored
This reverts commit 67504c95 as using PointerEmbeddedInt to store 32 bits breaks 32-bit arm builds.
-
Michael Liao authored
- isCheapToSpeculateCttz/isCheapToSpeculateCtlz have one type operand after https://reviews.llvm.org/D132520
-
Prabhdeep Singh Soni authored
This supports lowering from parse-tree to MLIR for OpenMP safelen clause in SIMD construct. Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D132574
-
Sami Tolvanen authored
The KCFI sanitizer, enabled with `-fsanitize=kcfi`, implements a forward-edge control flow integrity scheme for indirect calls. It uses a !kcfi_type metadata node to attach a type identifier for each function and injects verification code before indirect calls. Unlike the current CFI schemes implemented in LLVM, KCFI does not require LTO, does not alter function references to point to a jump table, and never breaks function address equality. KCFI is intended to be used in low-level code, such as operating system kernels, where the existing schemes can cause undue complications because of the aforementioned properties. However, unlike the existing schemes, KCFI is limited to validating only function pointers and is not compatible with executable-only memory. KCFI does not provide runtime support, but always traps when a type mismatch is encountered. Users of the scheme are expected to handle the trap. With `-fsanitize=kcfi`, Clang emits a `kcfi` operand bundle to indirect calls, and LLVM lowers this to a known architecture-specific sequence of instructions for each callsite to make runtime patching easier for users who require this functionality. A KCFI type identifier is a 32-bit constant produced by taking the lower half of xxHash64 from a C++ mangled typename. If a program contains indirect calls to assembly functions, they must be manually annotated with the expected type identifiers to prevent errors. To make this easier, Clang generates a weak SHN_ABS `__kcfi_typeid_<function>` symbol for each address-taken function declaration, which can be used to annotate functions in assembly as long as at least one C translation unit linked into the program takes the function address. For example on AArch64, we might have the following code: ``` .c: int f(void); int (*p)(void) = f; p(); .s: .4byte __kcfi_typeid_f .global f f: ... ``` Note that X86 uses a different preamble format for compatibility with Linux kernel tooling. See the comments in `X86AsmPrinter::emitKCFITypeId` for details. As users of KCFI may need to locate trap locations for binary validation and error handling, LLVM can additionally emit the locations of traps to a `.kcfi_traps` section. Similarly to other sanitizers, KCFI checking can be disabled for a function with a `no_sanitize("kcfi")` function attribute. Reviewed By: nickdesaulniers, kees, joaomoreira, MaskRay Differential Revision: https://reviews.llvm.org/D119296 -
Siva Chandra Reddy authored
Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D132533
-
Philip Reames authored
-
Philip Reames authored
-
Valery N Dmitriev authored
Differential Revision: https://reviews.llvm.org/D132506
-
Jan Svoboda authored
When compiling a module, its semantics and Clang's behavior are affected by other modules. These modules are typically the **imported** ones. However, during implicit build, some modules end up being compiled and read without being actually imported. This patch starts tracking such modules and serializing them into `.pcm` files. This enables the dependency scanner to construct explicit compilations that mimic implicit build. Reviewed By: benlangmuir Differential Revision: https://reviews.llvm.org/D132430
-
Philip Reames authored
-
Fabian Parzefall authored
This reverts commit 587d2653.
-
Fabian Parzefall authored
This reverts commit 101344af.
-
Fabian Parzefall authored
This reverts commit 7e254818.
-
Philip Reames authored
When rebasing the review which became f79214d1, I forgot to adjust for the changed semantics introduced by 531dd363. Functionally, this had no impact, but semantically it resulted in an incorrect result for isPredicatedInst. I noticed this while doing a follow up change.
-
Petr Hosek authored
We're seeing the following warnings with --rtlib=compiler-rt: lld-link: warning: ignoring unknown argument '--as-needed' lld-link: warning: ignoring unknown argument '-lunwind' lld-link: warning: ignoring unknown argument '--no-as-needed' MSVC doesn't use the unwind library, so just omit it. Differential Revision: https://reviews.llvm.org/D132440
-
Daniel Bertalan authored
This commit adds definitions for the `dyld_chained_import*` structs. The imports array is now printed with `llvm-otool -chained_fixups`. This completes this option's implementation. A slight difference from cctools otool is that we don't yet dump the raw bytes of the imports entries. When Apple's effort to upstream their chained fixups code continues, we'll replace this code with the then-upstreamed code. But we need something in the meantime for testing ld64.lld's chained fixups code. Differential Revision: https://reviews.llvm.org/D131982
-
Michael Jones authored
The FormatSection and the writer functions both previously took a char* and a length to represent a string. Now they use the StringView class to represent that more succinctly. This change also required fixing everywhere these were used, so it touches a lot of files. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D131994
-
Mark de Wever authored
D132284 has an approach to reduce the number of transitive includes based on the language version used. This requires to be able to validate changes in transitive includes in all language versions. Due to issues in the experimental library c++03 will be done separately. Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D132534
-
Fabian Parzefall authored
To generate all symbols correctly, it is necessary to record the address of each fragment. This patch moves the address info for the main and cold fragments from BinaryFunction to FunctionFragment, where this data is recorded for all fragments. Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D132051
-
Fabian Parzefall authored
This changes `FunctionFragment` from being used as a temporary proxy object to access basic block ranges to a heap-allocated object that can store fragment-specific information. Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D132050
-
Fabian Parzefall authored
A const-qualified reference to function layout allows accessing non-const qualified basic blocks on a const-qualified function. This patch adds or removes const-qualifiers where necessary to indicate where basic blocks are used in a non-const manner. Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D132049
-
Slava Zakharin authored
The attribute is translated into LLVM's function attribute 'readnone'. There is no explicit verification regarding conflicting 'readnone' and function attributes from 'passthrough', though, LLVM would assert if they are incompatible during LLVM IR creation. Differential Revision: https://reviews.llvm.org/D131457
-
Philip Reames authored
This patch adds support for vectorizing conditionally executed div/rem operations via a variant of widening. The existing support for predicated divrem in the vectorizer requires scalarization which we can't do for scalable vectors. The basic idea is that we can always divide (take remainder) by 1 without executing UB. As such, we can use the active lane mask to conditional select either the actual divisor for active lanes, or a constant one for inactive lanes. We already account for the cost of the active lane mask, so the only additional cost is a splat of one and the vector select. This is one of several possible approaches to this problem; see the review thread for discussion on some of the others. This one was chosen mostly because it was straight forward, and none of the others seemed oviously better. I enabled the new code only for scalable vectors. We could also legally enable it for fixed vectors as well, but I haven't thought through the cost tradeoffs between widening and scalarization enough to know if that's profitable. This will be explored in future patches. Differential Revision: https://reviews.llvm.org/D130164
-
Florian Hahn authored
-
spupyrev authored
The diff modifies ext-tsp code layout algorithm in the following ways: (i) fixes merging of cold block chains (this is a port of D129397); (ii) adjusts the cost model utilized for optimization; (iii) adjusts some APIs so that the implementation can be used in BOLT; this is a prerequisite for D129895. The only non-trivial change is (ii). Here we introduce different weights for conditional and unconditional branches in the cost model. Based on the new model it is slightly more important to increase the number of "fall-through unconditional" jumps, which makes sense, as placing two blocks with an unconditional jump next to each other reduces the number of jump instructions in the generated code. Experimentally, this makes a mild impact on the performance; I've seen up to 0.2%-0.3% perf win on some benchmarks. Reviewed By: hoy Differential Revision: https://reviews.llvm.org/D129893
-
Fangrui Song authored
We currently process one OutputSection at a time and for each OutputSection write contained input sections in parallel. This strategy does not leverage multi-threading well. Instead, parallelize writes of different OutputSections. The default TaskSize for parallelFor often leads to inferior sharding. We prepare the task in the caller instead. * Move llvm::parallel::detail::TaskGroup to llvm::parallel::TaskGroup * Add llvm::parallel::TaskGroup::execute. * Change writeSections to declare TaskGroup and pass it to writeTo. Speed-up with --threads=8: * clang -DCMAKE_BUILD_TYPE=Release: 1.11x as fast * clang -DCMAKE_BUILD_TYPE=Debug: 1.10x as fast * chrome -DCMAKE_BUILD_TYPE=Release: 1.04x as fast * scylladb build/release: 1.09x as fast On M1, many benchmarks are a small fraction of a percentage faster. Mozilla showed the largest difference with the patch being about 1.03x as fast. Differential Revision: https://reviews.llvm.org/D131247
-
Jonas Devlieghere authored
Teach LLVM about filesets. Filesets were added in macOS 11 (Big Sur) to combine multiple Mach-O files. They introduce a new load command (LC_FILESET_ENTRY) consisting of a fileset_entry_command. struct fileset_entry_command { uint32_t cmd; /* LC_FILESET_ENTRY */ uint32_t cmdsize; /* includes entry_id string */ uint64_t vmaddr; /* memory address of the entry */ uint64_t fileoff; /* file offset of the entry */ union lc_str entry_id; /* contained entry id */ uint32_t reserved; /* reserved */ }; This patch teaches LLVM about the new load command and the corresponding data. Differential revision: https://reviews.llvm.org/D132432 -
Tyker authored
Note: when operating on a Type hierarchy with LeafType inheriting from MiddleType which inherits from mlir::Type. calling LeafType::classof(MiddleType) will always return false. because classof call the static getTypeID from its parent instead of the dynamic Type::getTypeID so classof in this context will check if the TypeID of LeafType is the same as the TypeID of MiddleType which is always false. It is bypassed in this commit inside CastInfo<To, From>::isPossible by calling classof with an mlir::Type. but other unsuspecting users of LeafType::classof(MiddleType) would still get an incorrect result.
-
Prabhdeep Singh Soni authored
This supports translation from MLIR to LLVM IR using OMPIRBuilder for OpenMP safelen clause in SIMD construct. Reviewed By: ftynse Differential Revision: https://reviews.llvm.org/D132245
-
Prabhdeep Singh Soni authored
This reverts commit 172fe170.
-
Simon Pilgrim authored
This patch adds a Type operand to the TLI isCheapToSpeculateCttz/isCheapToSpeculateCtlz callbacks, allowing targets to decide whether branches should occur on a type-by-type/legality basis. For X86, this patch proposes to allow CTTZ speculation for i8/i16 types that will lower to promoted i32 BSF instructions by masking the operand above the msb (we already do something similar for i8/i16 TZCNT). This required a minor tweak to CTTZ lowering - if the src operand is known never zero (i.e. due to the promotion masking) we can remove the CMOV zero src handling. Although BSF isn't very fast, most CPUs from the last 20 years don't do that bad a job with it, although there are some annoying passthrough EFLAGS dependencies. Additionally, now that we emit 'REP BSF' in most cases, we are tending towards assuming this will most likely be executed as a TZCNT instruction on any semi-modern CPU. Differential Revision: https://reviews.llvm.org/D132520
-