Adrian Prantl [Fri, 19 May 2023 17:51:43 +0000 (10:51 -0700)]
Relax test
Petr Hosek [Wed, 17 May 2023 05:41:42 +0000 (05:41 +0000)]
[BOLT][CMake] Use correct output paths and passthrough necessary options
This addresses https://github.com/llvm/llvm-project/issues/62748.
Differential Revision: https://reviews.llvm.org/D150752
Peiming Liu [Tue, 16 May 2023 22:16:21 +0000 (22:16 +0000)]
[mlir][sparse] Support packing external data into arbitrary sparse tensor encoding.
We previously only support packing two array (values and coordinates) into COO tensors.
This patch allows packing inputs into arbitrary sparse tensor format.
It also deletes the "implicit" data canonicalization performed inside sparse compiler,
but instead requires users to canonicalize the data before passing it to the sparse compiler.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D150916
Zequan Wu [Fri, 19 May 2023 17:34:29 +0000 (13:34 -0400)]
Fix tests failure on
75993812d5c1f269b781c34987748f2a792a579d
It follows the rules:
1. Use native path if it's already absolute
2. Use Windows back-slash if it's windows formatting.
3. Use Posix style otherwise.
Vasileios Porpodas [Fri, 5 May 2023 22:33:39 +0000 (15:33 -0700)]
[SLP][NFC] Cleanup: Remove KeyNodes set.
I don't see a good reason form having the `KeyNodes` set.
This patch removes the set.
Differential Revision: https://reviews.llvm.org/D150918
Adrian Prantl [Fri, 19 May 2023 17:22:27 +0000 (10:22 -0700)]
Work around a modularization issue in the Python headers.
Manna, Soumi [Fri, 19 May 2023 17:05:45 +0000 (10:05 -0700)]
[NFC][CLANG] Fix dereference issue before null check found by Coverity static analyzer tool
Reported by Coverity static analyzer tool:
Inside "ParsePragma.cpp" file, in <unnamed>::PragmaRISCVHandler::HandlePragma(clang::Preprocessor &, clang::PragmaIntroducer, clang::Token &): All paths that lead to this null pointer comparison already dereference the pointer earlier
PP.Lex(Tok);
II = Tok.getIdentifierInfo();
//deref_ptr_in_call: Dereferencing pointer II.
StringRef IntrinsicClass = II->getName();
//Dereference before null check (REVERSE_INULL)
//check_after_deref: Null-checking II suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
if (!II || !(II->isStr("vector") || II->isStr("sifive_vector"))) {
PP.Diag(Tok.getLocation(), diag::warn_pragma_invalid_argument)
<< PP.getSpelling(Tok) << "riscv" << /*Expected=*/true
<< "'vector' or 'sifive_vector'";
return;
}
This patch removes redundant StringRef type 'IntrinsicClass' and checks
II->isStr("vector") || II->isStr("sifive_vector") instead to set Actions.DeclareRISCVVBuiltins or
Actions.DeclareRISCVVectorBuiltins.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D150895
Florian Hahn [Fri, 19 May 2023 17:15:20 +0000 (18:15 +0100)]
[VPlan] Use isUniformAfterVec in VPReplicateRecipe::execute.
I was unable to find a case where this actually changes generated code,
but it enables the bug fix in D144434. It also brings codegen in line
with the handling of stores to uniform addresses in the cost model
(D134460).
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D144491
eopXD [Thu, 23 Mar 2023 08:51:39 +0000 (01:51 -0700)]
[1/11][IR] Permit load/store/alloca for struct of the same scalable vector type
This patch-set aims to simplify the existing RVV segment load/store
intrinsics to use a type that represents a tuple of vectors instead.
To achieve this, first we need to relax the current limitation for an
aggregate type to be a target of load/store/alloca when the aggregate
type contains homogeneous scalable vector types. Then to adjust the
prolog of an LLVM function during lowering to clang. Finally we
re-define the RVV segment load/store intrinsics to use the tuple types.
The pull request under the RVV intrinsic specification is
riscv-non-isa/rvv-intrinsic-doc#198
---
This is the 1st patch of the patch-set. This patch is originated from
D98169.
This patch allows aggregate type (StructType) that contains homogeneous
scalable vector types to be a target of load/store/alloca. The RFC of
this patch was posted in LLVM Discourse.
https://discourse.llvm.org/t/rfc-ir-permit-load-store-alloca-for-struct-of-the-same-scalable-vector-type/69527
The main changes in this patch are:
Extend `StructLayout::StructSize` from `uint64_t` to `TypeSize` to
accommodate an expression of scalable size.
Allow `StructType:isSized` to also return true for homogeneous
scalable vector types.
Let `Type::isScalableTy` return true when `Type` is `StructType`
and contains scalable vectors
Extra description is added in the LLVM Language Reference Manual on the
relaxation of this patch.
Authored-by: Hsiangkai Wang <kai.wang@sifive.com>
Co-Authored-by: eop Chen <eop.chen@sifive.com>
Reviewed By: craig.topper, nikic
Differential Revision: https://reviews.llvm.org/D146872
Aaron Ballman [Fri, 19 May 2023 16:37:44 +0000 (12:37 -0400)]
Reword diagnostic for style; NFC
Clang diagnostics do not start with a capital letter.
Tulio Magno Quites Machado Filho [Fri, 19 May 2023 15:15:00 +0000 (12:15 -0300)]
[PowerPC][lit] Recognize triple ppc64le.*-linux
Some Linux distributions, e.g. Red Hat, use the triple
ppc64le-redhat-linux. Add a pattern that treats ppc64le.*-linux as
powerpc64le-linux during test execution.
Reviewed By: qiucf
Differential Revision: https://reviews.llvm.org/D149746
Nikolas Klauser [Wed, 17 May 2023 01:24:16 +0000 (18:24 -0700)]
[libc++] Install GCC 13 in the docker containers
Reviewed By: ldionne, #libc, Mordante
Spies: Mordante, libcxx-commits, arichardson
Differential Revision: https://reviews.llvm.org/D150695
Jakub Mazurkiewicz [Fri, 19 May 2023 15:57:49 +0000 (11:57 -0400)]
[Clang][clang-cl] Implement `__builtin_FUNCSIG`
This patch implements __builtin_FUNCSIG intrinsic which returns the same string as __FUNCSIG__.
Fixes https://github.com/llvm/llvm-project/issues/58951
Differential Revision: https://reviews.llvm.org/D150183
Slava Zakharin [Fri, 19 May 2023 15:21:35 +0000 (08:21 -0700)]
[flang][hlfir] Use complete form of DesignateOp for im/re array designators.
With this change, the lowering provides full slice triples for
designators like ...%array_comp%im/re, so that the codegen
does not have to figure it out for the array_comp.
Basically, ...%array_comp%im/re is lowered the same way
as ...%array_comp(:,:,...)%im/re.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D150842
Ivan Kosarev [Fri, 19 May 2023 15:28:34 +0000 (16:28 +0100)]
[AMDGPU][AsmParser] Refine parsing of some 32-bit instruction operands.
Eliminates the need for the custom code in parseCustomOperand().
The remaining uses of NamedOperandU32 are to be addressed separately.
Part of <https://github.com/llvm/llvm-project/issues/62629>.
Reviewed By: dp
Differential Revision: https://reviews.llvm.org/D150204
Jay Foad [Fri, 19 May 2023 14:51:04 +0000 (15:51 +0100)]
[GVN] Precommit tests for convergent calls in GVN/NewGVN
Vladislav Dzhidzhoev [Wed, 22 Mar 2023 13:14:16 +0000 (14:14 +0100)]
[AArch64][GlobalISel] Selection support for v8s8, v4s16, v16s8 G_INSERT_VECTOR_ELT with GPR scalar
This is to support some NEON intrinsics on GlobalISel.
Differential Revision: https://reviews.llvm.org/D146780
Caroline Concatto [Fri, 19 May 2023 14:40:23 +0000 (14:40 +0000)]
[CLANG][AArch64][SVE2.1] Add UCLAMP/SCLAMP/FCLAMP function prototypes
Submitting this patch in the name of: David Sherwood <david.sherwood@arm.com>
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D150863
Slava Zakharin [Fri, 19 May 2023 15:11:22 +0000 (08:11 -0700)]
[flang][hlfir] Added a TODO note for parameterized array component shapes.
Without the TODO, MLIR verifier fails because of invalid hlfir.declare
or fir.alloca that lowering produces.
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D150911
Mark de Wever [Thu, 9 Feb 2023 20:38:42 +0000 (21:38 +0100)]
[libc++][format] Improves fill character.
The main change is to allow a UCS scalar value as fill character.
Especially for char based formatting this increase the number of valid
characters. Originally this was to be expected ABI breaking, however the
current change does not seem to break the ABI.
Implements
- P2572 std::format() fill character allowances
Depends on D144499
Reviewed By: ldionne, tahonermann, #libc
Differential Revision: https://reviews.llvm.org/D144742
Alex Brachet [Fri, 19 May 2023 15:17:59 +0000 (15:17 +0000)]
[asan] Don't use libstdc++ in test
It shouldn't be assumed that libstdc++ is always available even on Linux.
Just let the compiler pick the default
Differential Revision: https://reviews.llvm.org/D150809
Jay Foad [Fri, 19 May 2023 15:11:41 +0000 (16:11 +0100)]
[GVN] Fix test case for convergent calls
Without "willreturn" this did not get as far as testing the convergent
handling in GVN.
Fangrui Song [Fri, 19 May 2023 14:59:37 +0000 (07:59 -0700)]
Allow -fsanitize=function on all targets
Functions instrumented with -fsanitize=function have two words before
the function label: a signature and a RTTI proxy.
Instrumented call sites check the signature first to skip checks
for uninstrumented callees.
The code is generic and works for all targets supporting C++ RTTI.
Change clangDriver to allow all targets. Add tests for Armv8.5
Branch Target Identification and `-fpatchable-function-entry=`.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D148573
Fangrui Song [Fri, 19 May 2023 14:50:29 +0000 (07:50 -0700)]
Change -fsanitize=function to place two words before the function entry
The current implementation of -fsanitize=function places two words (the prolog
signature and the RTTI proxy) at the function entry, which makes the feature
incompatible with Intel Indirect Branch Tracking (IBT) that needs an ENDBR instruction
at the function entry. To allow the combination, move the two words before the
function entry, similar to -fsanitize=kcfi.
Armv8.5 Branch Target Identification (BTI) has a similar requirement.
Note: for IBT and BTI, whether a function gets a marker instruction at the entry
generally cannot be assumed (it can be disabled by a function attribute or
stronger LTO optimizations).
It is extremely unlikely for two words preceding a function entry to be
inaccessible. One way to achieve this is by ensuring that a function is
aligned at a page boundary and making the preceding page unmapped or
unreadable. This is not reasonable for application or library code.
(Think: the first text section has crt* code not instrumented by
-fsanitize=function.)
We use 0xc105cafe for all targets. .long 0xc105cafe disassembles to invalid
instructions on all architectures I have tested, except Power where it is
`lfs 8, -13570(5)` (Load Floating-Point with a weird offset, unlikely to be used in real code).
---
For the removed function in AsmPrinter.cpp, remove an assert: `mdconst::extract`
already asserts non-nullness.
For compiler-rt/test/ubsan/TestCases/TypeCheck/Function/function.cpp,
when the function doesn't have prolog/epilog (-O1 and above), after moving the two words,
the address of the function equals the address of ret instruction,
so symbolizing the function will additionally get a non-zero column number.
Adjust the test to allow an optional column number.
```
.long
3238382334
.long .L__llvm_rtti_proxy-_Z1fv
_Z1fv: // symbolizing here retrieves the line table entry from the second .loc
.file 0 ...
.loc 0 1 0
.cfi_startproc
.loc 0 2 1 prologue_end
retq
```
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D148665
Jay Foad [Fri, 19 May 2023 14:46:11 +0000 (15:46 +0100)]
[GVN] Simplify presplit coroutine handling. NFC.
Alex Bradbury [Fri, 19 May 2023 14:28:42 +0000 (15:28 +0100)]
[RISCV][MC] Add support for experimental Zvfbfwma extension
Provides MC layer support for Zvfbfwma: vector BF16 widening mul-add.
As currently specified, Zvfbfwma does not appear to have a dependency on
Zvfbfmin or Zfbfmin.
Differential Revision: https://reviews.llvm.org/D147612
Jacob Crawley [Thu, 18 May 2023 15:35:36 +0000 (15:35 +0000)]
[flang] Change return type of reduction intrinsics
Comments in the recent patch https://reviews.llvm.org/D149964,
mentioned that using hlfir_ExprType in cases where intrinsics
return simple scalars adds unnecessary abstraction that isn't
needed unless an array type is being used.
This patch modifies the HLFIR operations for product, sum and any
so that they only return a hlfir_ExprType when the result is an array,
otherwise they will return just the simple scalar type.
Differential Revision: https://reviews.llvm.org/D150877
Roy Jacobson [Fri, 5 May 2023 14:50:50 +0000 (17:50 +0300)]
[Sema] Mark ineligibility of special member functions correctly
I checked if the member function declaration was a copy constructor, but it's not sufficient; We need to check
the arguments against the instantiated class.
Fixed https://github.com/llvm/llvm-project/issues/62555
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D149961
Alex Bradbury [Fri, 19 May 2023 14:26:25 +0000 (15:26 +0100)]
[RISCV][MC] Add support for experimental Zvfbfmin extension
Provides MC layer support for Zfbfmin: vector BF16 conversions.
Zvfbfmin does not appear to have a dependency on Zfbfmin as currently
specified.
Differential Revision: https://reviews.llvm.org/D147611
Shengchen Kan [Fri, 19 May 2023 14:21:56 +0000 (22:21 +0800)]
Revert "Revert "[X86] Remove patterns for ADC/SBB with immediate 8 and optimize during MC lowering, NFCI""
This reverts commit
cb16b33a03aff70b2499c3452f2f817f3f92d20d.
In fact, the test https://bugs.chromium.org/p/chromium/issues/detail?id=1446973#c2
already passed after
5586bc539acb26cb94e461438de01a5080513401
Alex Bradbury [Fri, 19 May 2023 14:16:38 +0000 (15:16 +0100)]
[RISCV][MC] Add support for experimental Zfbfmin extension
Provides MC layer support for Zfbfmin: scalar BF16 conversions.
As documented, this extension includes FLH, FSH, FMV.H.X, and FMH.X.H as
defined in Zfh/Zfhmin, but doesn't require either extension.
No Zfbfinxmin has been defined (though you would expect one in the
future, for symmetry with Zfhinxmin). See issue
https://github.com/riscv/riscv-bfloat16/issues/27.
Differential Revision: https://reviews.llvm.org/D147610
Jay Foad [Fri, 19 May 2023 14:07:31 +0000 (15:07 +0100)]
[GVN] No else after return. NFC.
Jean Perier [Fri, 19 May 2023 08:24:25 +0000 (10:24 +0200)]
[flang][hlfir] Implement hlfir.forall codegen when no temp is required
The patch applies the schedule built with the utility added in the
previous D150455 patch to generate the code for an ordered assignment
tree. For now, it only supports forall that do not contain user defined
assignments or assignments to vector subscripted entities, and for
which the scheduling analysis does not require temporary storages.
Support for temporary, WHERE, and user-defined/vector subscript
assignment will be added in later patches.
This enables end-to-end support with HLFIR for forall where the schedule
analysis can prove there is no need to create temporary storage.
Differential Revision: https://reviews.llvm.org/D150564
Luke Lau [Tue, 2 May 2023 13:08:17 +0000 (14:08 +0100)]
[RISCV] Add test for unprofitable SLP vectorization
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D149653
Luke Lau [Wed, 17 May 2023 12:01:08 +0000 (13:01 +0100)]
[RISCV] Add tests for store merging with unaligned scalar access
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D150770
Nico Weber [Fri, 19 May 2023 13:40:06 +0000 (09:40 -0400)]
Revert "[RFC][MC][MachO]Only emits compact-unwind format for "canonical" personality symbols. For the rest, use DWARFs."
This reverts commit
09aaf53a05e3786eea374f3ce57574225036412d.
Causes toolchain asserts building libc++ for x86_64,
see https://reviews.llvm.org/D144999#4356215
LLVM GN Syncbot [Fri, 19 May 2023 13:23:07 +0000 (13:23 +0000)]
[gn build] Port
094ab4781262
Thomas Preud'homme [Thu, 18 May 2023 09:10:21 +0000 (09:10 +0000)]
Add control of hex casing in APInt::toString
This will be used in implementing arbitrary precision support to
FileCheck's numeric variables and expressions.
Reviewed By: foad, RKSimon
Differential Revision: https://reviews.llvm.org/D150879
Jun Zhang [Fri, 19 May 2023 12:56:21 +0000 (20:56 +0800)]
Revert "Reland [clang-repl] Introduce Value to capture expression results"
This reverts commit
d71a4e02277a64a9dece591cdf2b34f15c3b19a0.
See http://45.33.8.238/macm1/61024/step_7.txt
Zequan Wu [Wed, 17 May 2023 21:06:42 +0000 (17:06 -0400)]
Use windows baskslash on anonymous tag locations if using MSVCFormatting and it's not absolute path.
This fixes a nondeterminism on debug info when building on windows natively vs
cross building to windows.
[1] https://github.com/llvm/llvm-project/blob/llvmorg-17-init/clang/lib/Lex/HeaderSearch.cpp#L465
Differential Revision: https://reviews.llvm.org/D150817
Hans Wennborg [Fri, 19 May 2023 12:29:06 +0000 (14:29 +0200)]
Revert "[X86] Remove patterns for ADC/SBB with immediate 8 and optimize during MC lowering, NFCI"
This caused compiler assertions, see comment on
https://reviews.llvm.org/D150107.
This also reverts the dependent follow-up change:
> [X86] Remove patterns for ADD/AND/OR/SUB/XOR/CMP with immediate 8 and optimize during MC lowering, NFCI
>
> This is follow-up of D150107.
>
> In addition, the function `X86::optimizeToFixedRegisterOrShortImmediateForm` can be
> shared with project bolt and eliminates the code in X86InstrRelaxTables.cpp.
>
> Differential Revision: https://reviews.llvm.org/D150949
This reverts commit
2ef8ae134828876ab3ebda4a81bb2df7b095d030 and
5586bc539acb26cb94e461438de01a5080513401.
Kiran Chandramohan [Fri, 19 May 2023 11:51:58 +0000 (11:51 +0000)]
[Flang][OpenMP] Add Todo for doconcurrent with worksharing loop
This is a valid usage. We do not handle it as of now. Gfortran/Ifx produces an error, possibly because `do concurrent` was not allowed in previous versions of the OpenMP standard.
Fixes #62649
Reviewed By: Leporacanthicus
Differential Revision: https://reviews.llvm.org/D150869
Goran Flegar [Fri, 19 May 2023 12:00:38 +0000 (14:00 +0200)]
[mlir][linalg] Fix unused variable on opt build
Dominik Adamski [Fri, 19 May 2023 11:42:16 +0000 (06:42 -0500)]
[MLIR][OpenMP][OMPIRBuilder] Lower OpenMP version attributes to LLVM IR
MLIR version attribute should be lowered to LLVM IR module metadata.
The lowering is done by OpenMPIRBuilder.
Differential Revision: https://reviews.llvm.org/D150574
Reviewed By: kiranchandramohan
Kiran Chandramohan [Fri, 19 May 2023 10:30:15 +0000 (10:30 +0000)]
Revert "[mlir] Fix memory explosion when converting global variable bodies in ModuleTranslation"
Reverting due to failure in spec cam4 benchmark. See github issue
https://github.com/llvm/llvm-project/issues/62802 for details.
This reverts commit
095e6ac9fd92d03dcb1e19b60cb06a8140aae69d.
Dominik Adamski [Fri, 19 May 2023 11:14:52 +0000 (06:14 -0500)]
[OpenMP][MLIR][Flang][bbc][Driver] Add fopenmp-version and generate corresponding MLIR attribute
This patch adds flag -fopenmp-version to the Flang frontend and bbc tool.
This flag is lowered to MLIR OpenMP flag attribute.
Differential Revision: https://reviews.llvm.org/D150354
Reviewed By: kiranchandramohan
Benjamin Kramer [Fri, 19 May 2023 11:19:18 +0000 (13:19 +0200)]
Enna1 [Fri, 19 May 2023 11:18:28 +0000 (19:18 +0800)]
[IR] Adds Instruction::setNoSanitizeMetadata()
This patch adds a new method setNoSanitizeMetadata() for Instruction, and use it in SanitizerMetadata and SanitizerCoverage.
Reviewed By: nickdesaulniers, MaskRay
Differential Revision: https://reviews.llvm.org/D150632
Dominik Adamski [Tue, 9 May 2023 12:26:09 +0000 (07:26 -0500)]
[OpenMP][MLIR] Add OpenMP version attribute to OMP OffloadModuleInterface
The intent of OpenMP version attribute is to be applied to a module
and then hold information on OpenMP version flag.
Information about OpenMP version can be specified in Clang
by flag -fopenmp-version and it is stored in LLVM-IR module metadata:
!llvm.module.flags = !{!0, !1}
!0 = !{i32 7, !"openmp", i32 51}
!1 = !{i32 7, !"openmp-device", i32 51}
OpenMP MLIR version attributes will allow to lower Flang frontend flag
to OpenMP MLIR code and then to LLVM IR.
There are two OpenMP MLIR version attributes. The first one "omp.version"
MLIR attribute corresponds to host OpenMP version. The second one
corresponds to "openmp-device" LLVM-IR metadata. "openmp-device" LLVM-IR
metadata is attached only for offloaded code.
Differential Revision: https://reviews.llvm.org/D150351
Reviewed By: kiranchandramohan
Stephen Tozer [Thu, 18 May 2023 16:13:15 +0000 (17:13 +0100)]
[DebugInfo][InstrRef] Handle non-directly reachable DBG_PHIs in LiveDebugValues
Fixes: https://github.com/llvm/llvm-project/issues/62725
This patch fixes an error in which a DBG_INSTR_REF referring to a DBG_PHI in a
block that is not directly reachable from the entry block results in a crash
during LiveDebugValues. Note that this fix prevents a crash from occurring, but
will give undef locations to users of these PHIs even if a valid location exists.
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D150707
Shengchen Kan [Fri, 19 May 2023 05:26:45 +0000 (13:26 +0800)]
[X86] Remove patterns for ADD/AND/OR/SUB/XOR/CMP with immediate 8 and optimize during MC lowering, NFCI
This is follow-up of D150107.
In addition, the function `X86::optimizeToFixedRegisterOrShortImmediateForm` can be
shared with project bolt and eliminates the code in X86InstrRelaxTables.cpp.
Differential Revision: https://reviews.llvm.org/D150949
Thomas Symalla [Mon, 8 May 2023 18:50:20 +0000 (20:50 +0200)]
[AMDGPU] Improve abs modifier usage
If a call to the llvm.fabs intrinsic has users in another reachable
BB, SelectionDAG will not apply the abs modifier to these users and
instead generate a v_and ..., 0x7fffffff instruction.
For fneg instructions, the issue is similar.
This patch implements `AMDGPUIselLowering::shouldSinkOperands`,
which allows CodegenPrepare to call `tryToSinkFreeOperands`.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D150347
Simon Pilgrim [Fri, 19 May 2023 09:40:14 +0000 (10:40 +0100)]
Fix MSVC "not all control paths return a value" warning. NFC.
Simon Pilgrim [Fri, 19 May 2023 09:39:31 +0000 (10:39 +0100)]
Add missing llvm/Support/Compiler.h include for MSVC builds without __has_attribute
Thomas Symalla [Fri, 19 May 2023 09:27:28 +0000 (11:27 +0200)]
[NFC] Fix typo in CodeGenPrepare.cpp
Jay Foad [Mon, 15 May 2023 16:06:07 +0000 (17:06 +0100)]
[M68k] Do not require register scavenging during PEI
Nothing in this target appears to use the scavenger.
Differential Revision: https://reviews.llvm.org/D150584
Hristo Hristov [Thu, 18 May 2023 18:23:01 +0000 (21:23 +0300)]
[libc++][ranges][NFC] Added P2711R1 to release notes
This adds release notes for P2711R.
`join_with_view` is missing an implementation yet.
Implemented in: https://reviews.llvm.org/D144822
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D150845
Thurston Dang [Fri, 19 May 2023 06:54:29 +0000 (06:54 +0000)]
sanitizer_common: fix buildbot by restoring wcslen semantics
Windows buildbot (https://lab.llvm.org/buildbot/#/builders/127/builds/48479)
was broken by my patch https://reviews.llvm.org/D150909 because it
gated wcslen interception to SI_POSIX, instead of always intercepting wcslen.
This changes it back to always intercepting wcslen.
luxufan [Fri, 19 May 2023 05:35:55 +0000 (13:35 +0800)]
[ValueTracking][InstCombine] Add a new API to allow to ignore poison generating flags or metadatas when implying poison
This patch add a new API `impliesPoisonIgnoreFlagsOrMetadatas` which is
the same as `impliesPoison` but ignoring poison generating flags or
metadatas in the process of implying poison and recording these ignored
instructions.
In InstCombineSelect, replacing `impliesPoison` with
`impliesPoisonIgnoreFlagsOrMetadatas` to allow more patterns like
`select i1 %a, i1 %b, i1 false` to be optimized to and/or instructions
by droping the poison generating flags or metadatas.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149404
Yeting Kuo [Mon, 24 Apr 2023 15:56:40 +0000 (23:56 +0800)]
[ASAN] Support memory checks on experimental.vp.strided.load/store.
The patch adds new member MaybeStride into InterestingMemoryOperand to represent
the stride value of experimental.vp.strided.load/store.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D149073
Thurston Dang [Thu, 18 May 2023 21:30:28 +0000 (21:30 +0000)]
sanitizer_common: guard the wcslen interceptor code with SANITIZER_INTERCEPT_WCSLEN
This patch adds the #if SANITIZER_INTERCEPT_ guard for wcslen, similarly to how all the other
functions are guarded. It was the only missing SANITIZER_INTERCEPT_ guard [1].
This missing guard was discovered while investigating the stage2/hwasan check failure of https://reviews.llvm.org/D150708 ("hwasan: lay groundwork for importing subset of sanitizer_common interceptors [NFC]"), that was seen in https://lab.llvm.org/buildbot/#/builders/236/builds/4069. llvm_build_hwasan/unittests/ADT/./ADTTests had crashed with a backtrace of:
...
A disassembly of the binary showed that wcslen interception was present (since it was not guarded by SANITIZER_INTERCEPT_WCSLEN); howver, since INIT_WCSLEN was not called, REAL(wcslen) was null, resulting in the null pointer dereference.
[1] I checked this using "egrep '^#[ ]*define[ ]+(INIT_.*)' sanitizer_common_interceptors.inc | tr -s ' ' | sed -r 's/^# /#/' | cut -d ' ' -f 2 | sort | uniq -c | grep -v '^[ ]*2[ ]'"
The other matches are {INIT_PTHREAD_SETNAME_NP, INIT_QSORT, INIT_SHA2_INTECEPTORS(LEN), INIT_TLS_GET_ADDR, INIT_WAIT4}, which all have good reasons for not having exactly two cases.
Differential Revision: https://reviews.llvm.org/D150909
Alina Sbirlea [Fri, 19 May 2023 04:48:01 +0000 (21:48 -0700)]
Revert "ValueTracking: Delete body of isKnownNeverInfinity"
This reverts commit
73925ef8b0eacc6792f0e3ea21a3e6d51f5ee8b0.
Introduces test failures, mismatch inf/nan
Alina Sbirlea [Fri, 19 May 2023 04:47:29 +0000 (21:47 -0700)]
Revert "SimplifyLibCalls: Pass AssumptionCache to isKnownNeverInfinity"
This reverts commit
faa32734bf9a55fa3f91d91f6fdf0f8a951a9c0e.
Revert due to test failures introduced by
73925ef8b0eacc6792f0e3ea21a3e6d51f5ee8b0
Alina Sbirlea [Fri, 19 May 2023 04:42:39 +0000 (21:42 -0700)]
Revert "InstSimplify: Pass AssumptionCache to isKnownNeverInfinity"
This reverts commit
0012b94a4e8e0c757ef0adcd68fb61bb0318b26c.
Reverting due to test failures introduced by
73925ef8b0eacc6792f0e3ea21a3e6d51f5ee8b0
Updated floating-point-compare.ll to keep the assume declaration.
Siva Chandra Reddy [Thu, 18 May 2023 06:26:18 +0000 (06:26 +0000)]
[libc] Add a str() method to FPBits which returns a string representation.
Unit tests for the str() method have also been added.
Previously, a separate test only helper function was being used by the
test matchers which has regressed over many cleanups. Moreover, being a
test only utility, it was not tested separately (and hence the
regression).
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D150906
Sameer Sahasrabuddhe [Fri, 19 May 2023 06:19:09 +0000 (11:49 +0530)]
[AMDGPU][Uniformity] SI_IF and SI_ELSE pseudos are always divergent
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D150861
Jianjian GUAN [Thu, 18 May 2023 09:32:21 +0000 (17:32 +0800)]
[RISCV] Refactor predicates for rvv VL patterns.
This patch is similar to https://reviews.llvm.org/D150550 and https://reviews.llvm.org/D150754, it adds accurate predicates for VL patterns depending on vector type.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D150850
Job Noorman [Fri, 19 May 2023 05:41:17 +0000 (07:41 +0200)]
[JITLink][AArch64] Implement R_AARCH64_TSTBR14
This relocation is used for the 14-bit immediate in test and branch
instructions.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D150778
Jianjian GUAN [Thu, 18 May 2023 07:12:17 +0000 (15:12 +0800)]
[RISV] Fix the foreach scope.
Move all independent definations out of the foreach scope.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D150847
LLVM GN Syncbot [Fri, 19 May 2023 05:41:29 +0000 (05:41 +0000)]
[gn build] Port
d71a4e02277a
Jun Zhang [Thu, 18 May 2023 12:45:56 +0000 (20:45 +0800)]
Reland [clang-repl] Introduce Value to capture expression results
This reverts commit
7158fd381a0bc0222195d6a07ebb42ea57957bda.
* Fixes endianness issue on big endian machines like PowerPC-bl
* Disable tests on platforms that having trouble to support JIT
Signed-off-by: Jun Zhang <jun@junz.org>
khei4 [Fri, 19 May 2023 05:10:02 +0000 (14:10 +0900)]
[SimplifyCFG] add nuw/nsw on BuildLookuptable BitMap shiftwidth calculation
Differential Revision: https://reviews.llvm.org/D150838
Shengchen Kan [Fri, 19 May 2023 02:30:44 +0000 (10:30 +0800)]
[X86] Remove patterns for ADC/SBB with immediate 8 and optimize during MC lowering, NFCI
This is follow-up of D150107.
Vadim Paretsky [Fri, 19 May 2023 01:56:25 +0000 (18:56 -0700)]
[OpenMP] remove usage of std::abs in the new loop collapse support code
On some platforms, std::abs may inadvertently pull in a math library.
This patch replaces its use in the new loop collapse code with
a no thrills in-situ implementation.
Differential Revision: https://reviews.llvm.org/D150882
wanglei [Thu, 18 May 2023 12:41:58 +0000 (20:41 +0800)]
[LoongArch] Handle out-fo-range uimm8 operands in LoongArchAsmParser
With this fix, when encountering an out-of-range uimm8 operand, the code
now triggers an appropriate error message, clearly indicating that the
immediate value must be an integer within the range of 0 to 255.
Manna, Soumi [Fri, 19 May 2023 01:13:58 +0000 (18:13 -0700)]
[NFC][Clang][Coverity] Fix Static Code Analysis Concerns with copy without assign
This patch adds copy/move assignment operator to the class which has user-defined copy/move constructor.
Reviewed By: tahonermann, NoQ, aaronpuchert
Differential Revision: https://reviews.llvm.org/D150411
Mitch Phillips [Thu, 18 May 2023 23:32:55 +0000 (16:32 -0700)]
[HWASan] Ignore shortgranules for global tag selection
Tag selection for global variables is sequential, starting at a
pseduo-ish seed that's based on the hash of the file name.
Previously, it was possible for a global to be assigned a tag in the
range [1,15]. If the global's size was not a multiple of granules (i.e.
`size % 16 != 0`), then the last granule of the global would be assigned
a short granule tag as well.
If the real memory tag of the global (e.g. '04') happened to collide
with the short granule tag (e.g. '04'), then __hwasan_check would
see that the memory tag matched the short granule tag, and dutifully
assume (in this fast check) that everthing is okay.
Unfortunately, if you tried to access the [5,15]th byte, you never get
to the short granule check. This means you miss intra-granule overflows
on the last granule of a global, if said global was assigned a real
memory tag in the range [1,15].
This causes flakiness in certain global tests, if the SHA of the
filename changes between runs.
This problem also exists for heap and stack allocations as well, but
there's a concern that if we exclude the [1,15] range for heap and stack
that it's an unhappy tradeoff. On Android, this would mean that a 1/255
chance of false positive becomes 1/240. On other platforms though (that
have a less-than-8-bit tag space), this may be unacceptable. We can
think about potential fixes for that in other places, but globals are
fine to reduce the space, as really the only thing that matters is
catching sequential overflow. The false-negative scenario is much, much
more common in use-after-free and use-after-scope, which globals don't
have.
Differential Revision: https://reviews.llvm.org/D150742
Vitaly Buka [Thu, 18 May 2023 23:32:36 +0000 (16:32 -0700)]
[test][HWASAN] Test for globals with short granules
Artem Dergachev [Thu, 18 May 2023 23:00:25 +0000 (16:00 -0700)]
[-Wunsafe-buffer-usage] Hide fixits/suggestions behind an extra flag.
This patch implements a new clang driver flag -fsafe-buffer-usage-suggestions
which allows turning the smart suggestion machine on and off (defaults to off).
This is valuable for stability reasons, as the machine is being rapidly improved\
and we don't want accidental breakages to ruin the build for innocent users.
It is also arguably useful in general because it enables separation of concerns
between project contributors: some users will actively update the code to
conform to the programming model, while others simply want to make sure that
they aren't regressing it. Finally, there could be other valid reasons to
opt out of suggestions entirely on some codebases (while continuing to enforce
-Wunsafe-buffer-usage warnings), such as lack of access to hardened libc++
(or even to the C++ standard library in general) on the target platform.
When the flag is disabled, the unsafe buffer usage analysis is reduced to
an extremely minimal mode of operation that contains virtually no smarts:
not only it doesn't offer automatic fixits, but also textual suggestions
such as "change the type of this variable to std::span to preserve bounds
information" are not displayed, and in fact the machine doesn't even try
to blame specific variables in the first place, it simply warns on
the operations and leaves everything else to the user. So this flag turns off
a lot more of our complex machinery than what we already turn off in presence
of say -fno-diagnostic-fixit-info.
The flag is discoverable: when it's off, the warnings are accompanied by a note:
telling the user that there's a flag they can use.
Differential Revision: https://reviews.llvm.org/D146669
Craig Topper [Fri, 19 May 2023 00:10:18 +0000 (17:10 -0700)]
[RISCV] Fix incorrect check-prefixes in attr-riscv-rvv-vector-bits-types.c. NFC
wren romano [Thu, 18 May 2023 23:17:04 +0000 (16:17 -0700)]
[mlir][sparse] Adding SparseTensorEncodingAttr::getDimSlice
This helps catch segfaults and OOB.
Reviewed By: aartbik, Peiming
Differential Revision: https://reviews.llvm.org/D150917
Kai Sasaki [Thu, 18 May 2023 23:23:46 +0000 (08:23 +0900)]
[mlir][bufferization] Prevent crash in one shot bufferization with unranked tensor cast
One shot bufferization does not support bufferizing the cast between unranked tensors. To prevent the crash, we can check the compatibility of the result type in advance. Reported in https://github.com/llvm/llvm-project/issues/62369.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D149239
Matt Arsenault [Wed, 12 Apr 2023 01:23:16 +0000 (21:23 -0400)]
InstSimplify: Pass AssumptionCache through fcmp ord/uno simplification
Matt Arsenault [Tue, 11 Apr 2023 23:54:22 +0000 (19:54 -0400)]
InstSimplify: Pass AssumptionCache to isKnownNeverNaN queries
Matt Arsenault [Tue, 11 Apr 2023 23:25:37 +0000 (19:25 -0400)]
InstSimplify: Pass AssumptionCache through more isKnownNeverNaN queries
Matt Arsenault [Tue, 11 Apr 2023 20:53:02 +0000 (16:53 -0400)]
InstSimplify: Pass AssumptionCache to isKnownNeverInfinity
Makes these cases work with assumes.
Spenser Bauman [Thu, 18 May 2023 23:16:10 +0000 (16:16 -0700)]
[mlir][tosa] Fix constant folding of tosa.mul
The constant folder for tosa.mul produces a tensor attribute whose type
may not match the result type of the operation when broadcasting is
needed. This results in a tosa.const op whose attribute's type does not
match the type of the const op.
This change explicitly expands the attribute to the expected result
type.
Reviewed By: eric-k256, jpienaar
Differential Revision: https://reviews.llvm.org/D150439
Yi Kong [Thu, 18 May 2023 23:26:27 +0000 (16:26 -0700)]
Revert "Reland "[BOLT] Parallelize legacy profile merging""
This reverts commit
611fb179b19857ffb87df81c926902fc7e3412ab.
Broken tests
Alex Langford [Thu, 18 May 2023 22:31:25 +0000 (15:31 -0700)]
[lldb][NFCI] Pre-allocate storage in ObjCLanguage::MethodName::GetFullNameWithoutCategory
The size of a full ObjC MethodName can vary somewhat, but it is
computable ahead of time.
Using a reasonably sized ObjC application, this actually improves the
time it takes to initialize symbol indexes for ObjC names ever so
slightly. Additionally, I found that the variability in time also was
improved considerably.
Differential Revision: https://reviews.llvm.org/D150914
Valentin Clement [Thu, 18 May 2023 23:20:57 +0000 (16:20 -0700)]
[mlir][openacc] Add reduction representation
Similarly to D150622 for private clause, the reduction is currently not
modeled in a good way. This patch is inspired by the reduction representation
in the omp dialect (D105358) and make a new representation for the reduction in
the OpenACC dialect.
A new operation is introduced to model the sequences of operation needed to
initialize a local reduction value and how to combine two values during the
reduction. The operation requires two mandatory regions.
1. The init region specifies how to initialize the local reduction
value. The region has an argument that contains the value of the
reduction accumulator at the start of the reduction. It is expected to
`acc.yield` the new value.
2. The reduction region contains a sequences of operations to combine two
values of the reduction type into one. It has two arguments and it is
expected to `acc.yield` the combined value.
Example:
```mlir
acc.reduction.recipe @reduction_add_i64 : i64 init reduction_operator<add> {
^bb0(%0: i64):
// init region contains a sequence of operations to initialize the local
// reduction value as specified in 2.5.15
%c0 = arith.constant 0 : i64
acc.yield %c0 : i64
} reduction {
^bb0(%0: i64, %1: i64)
// reduction region contains a sequence of operations to combine
// two values into one.
%2 = arith.addi %0, %1 : i64
acc.yield %2 : i64
}
// The reduction symbol is then used in the corresponding operation.
acc.parallel reduction(@reduction_add_i64 -> %a : i64) {
}
Reviewed By: razvanlupusoru, vzakhari
Differential Revision: https://reviews.llvm.org/D150818
Yi Kong [Fri, 28 Apr 2023 12:26:16 +0000 (21:26 +0900)]
Reland "[BOLT] Parallelize legacy profile merging"
This reverts commit
78d8d016490909ac759c6f76c5f8679bc7a58b2e.
Heejin Ahn [Mon, 15 May 2023 20:12:43 +0000 (13:12 -0700)]
[RegisterCoalescer] Remove DbgMergedVRegNums (NFC)
Not sure what this was originally intended for, but this seems to be
unused. It didn't seem to be used when it was first added in D64630
either.
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D150606
Heejin Ahn [Tue, 25 Apr 2023 08:44:25 +0000 (01:44 -0700)]
[DebugInfo][InstrRef] Prettyprint metadata
Some metadata prettyprinting, including variable prettyprinting and
debug line info comments, is currently only supported for `DBG_VALUE`.
This allows `DBG_INSTR_REF` can be printed in the same way.
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D150620
Slava Zakharin [Thu, 18 May 2023 21:51:45 +0000 (14:51 -0700)]
[flang] Fixed initialization of c_ptr/c_funptr arrays.
When lowering ends up outlining the initialization of an entity
containing an array of c_ptr/c_funptr it is treating the array
initializer as scalar due to the missing check for the rank.
When initializing non-0 rank c_ptr/c_funptr entity it has to
recurse via genConstantValue().
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D150903
Craig Topper [Thu, 18 May 2023 22:47:29 +0000 (15:47 -0700)]
[RISCV] Remove unused CHECK-ILP lines from attr-riscv-rvv-vector-bits-types.c. NFC
I must have copied these from SVE by accident. They aren't relevant
for RISC-V.
Nikolas Klauser [Wed, 17 May 2023 17:34:51 +0000 (10:34 -0700)]
[libc++][NFC] Rename iterator category checks to make it obvious that they check //only// the iterator category
We plan to add concepts for checking that iterators actually provide what they claim to. This is to avoid people thinking that these type traits actually check the iterator requirements in more detail.
Reviewed By: ldionne, #libc
Spies: Mordante, libcxx-commits, wenlei
Differential Revision: https://reviews.llvm.org/D150801
Hanhan Wang [Tue, 16 May 2023 21:08:44 +0000 (14:08 -0700)]
[mlir][linalg] Fix tensor.pad sizes computation in lowerPack.
The padded sizes should be derived from destination tensor, not source
tensor. There could be more than one incomplete tile in padding domain.
Reviewed By: qedawkins
Differential Revision: https://reviews.llvm.org/D150726
Dave Lee [Thu, 18 May 2023 22:30:07 +0000 (15:30 -0700)]
[lldb] Remove decl for non-existent ResolveSymbolContextForAddress overload (NFC)
Matt Arsenault [Tue, 11 Apr 2023 20:41:02 +0000 (16:41 -0400)]
InstSimplify: Use isKnownNeverInfOrNaN
Matt Arsenault [Tue, 11 Apr 2023 20:32:50 +0000 (16:32 -0400)]
InstSimplify: Combine computeKnownFPClass calls and pass AssumptionCache