Amir Ayupov [Fri, 3 Jun 2022 02:08:59 +0000 (19:08 -0700)]
[BOLT][NFC] Make ICP::verifyProfile static
Follow LLVM style guide suggestion to avoid function definitions in anonymous
namespaces: https://llvm.org/docs/CodingStandards.html#anonymous-namespaces
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D124896
Shilei Tian [Fri, 3 Jun 2022 01:50:07 +0000 (21:50 -0400)]
[NFC][Doc] Finish atomic compare
Shilei Tian [Fri, 3 Jun 2022 01:38:12 +0000 (21:38 -0400)]
[Clang][OpenMP] Add the codegen support for `atomic compare capture`
This patch adds the codegen support for `atomic compare capture` in clang.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D120290
Amir Ayupov [Mon, 23 May 2022 04:44:27 +0000 (21:44 -0700)]
[BOLT][DOCS] Add PACKAGE_VERSION to doxygen config
Clang's doxygen documentation specifies LLVM revision. Do the same for BOLT.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D126912
Daniil Suchkov [Fri, 3 Jun 2022 00:52:08 +0000 (00:52 +0000)]
Revert "[LoopInterchange] New cost model for loop interchange"
Reverting the commit due to numerous buildbot failures.
This reverts commit
006334470d8d1b5d8f630890336fcb45795749d1.
Mike Rice [Fri, 3 Jun 2022 00:29:54 +0000 (17:29 -0700)]
[OpenMP][NFC] update status for 'omp_all_memory' directive to 'done'
Akira Hatanaka [Fri, 20 May 2022 19:16:29 +0000 (12:16 -0700)]
[Sema] Reject list-initialization of enumeration types from a
brace-init-list containing a single element of a different scoped
enumeration type
It is rejected because it doesn't satisfy the condition that the element
has to be implicitly convertible to the underlying type of the
enumeration.
http://eel.is/c++draft/dcl.init.list#3.8
Differential Revision: https://reviews.llvm.org/D126084
Aart Bik [Thu, 2 Jun 2022 22:11:02 +0000 (15:11 -0700)]
[mlir][python][f16] add ctype python binding support for f16
Similar to complex128/complex64, float16 has no direct support
in the ctypes implementation. This fixes the issue by using a
custom F16 type to change the view in and out of MLIR code
Reviewed By: wrengr
Differential Revision: https://reviews.llvm.org/D126928
Akira Hatanaka [Fri, 3 Jun 2022 00:02:41 +0000 (17:02 -0700)]
Add a release note for the scope enum initialization bug fix in
https://reviews.llvm.org/D126084
River Riddle [Thu, 2 Jun 2022 23:35:09 +0000 (16:35 -0700)]
[vscode-mlir] Bump to version 0.8
Since version 0.7 we've added:
* Initial language support for TableGen
* Tweaked syntax highlighting for PDLL
* Added a new command to view intermediate PDLL output
River Riddle [Tue, 3 May 2022 18:43:30 +0000 (11:43 -0700)]
[mlir:PDLL] Add better support for providing Constraint/Pattern/Rewrite documentation
This commit enables providing long-form documentation more seamlessly to the LSP
by revamping decl documentation. For ODS imported constructs, we now also import
descriptions and attach them to decls when possible. For PDLL constructs, the LSP will
now try to provide documentation by parsing the comments directly above the decls
location within the source file. This commit also adds a new parser flag
`enableDocumentation` that gates the import and attachment of ODS documentation,
which is unnecessary in the normal build process (i.e. it should only be used/consumed
by tools).
Differential Revision: https://reviews.llvm.org/D124881
Arjun P [Thu, 2 Jun 2022 23:29:17 +0000 (00:29 +0100)]
[MLIR][Presburger] Simplex: remove redundant member vars nRow, nCol
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D126790
Chia-hung Duan [Thu, 2 Jun 2022 23:23:31 +0000 (23:23 +0000)]
[mlir:MultiOpDriver] Quick fix the assertion position
The assertion should come after null check
Nicolas van Kempen [Thu, 2 Jun 2022 21:51:13 +0000 (22:51 +0100)]
[clang-tidy] Add proper emplace checks to modernize-use-emplace
modernize-use-emplace only recommends going from a push_back to an
emplace_back, but does not provide a recommendation when emplace_back is
improperly used. This adds the functionality of warning the user when
an unecessary temporary is created while calling emplace_back or other "emplacy"
functions from the STL containers.
Reviewed By: kuhar, ivanmurashko
Differential Revision: https://reviews.llvm.org/D101471
Congzhe Cao [Thu, 2 Jun 2022 21:53:13 +0000 (17:53 -0400)]
[LoopInterchange] New cost model for loop interchange
This patch proposed to use a new cost model for loop interchange, which
is obtained from loop cache analysis.
Given a loopnest, what loop cache analysis returns is a vector of loops
[loop0, loop1, loop2, ...] where loop0 should be replaced as the outermost
loop, loop1 should be placed one more level inside, and loop2 one more level
inside, etc. What loop cache analysis does is not only more comprehensive than
the current cost model, it is also a "one-shot" query which means that we only
need to query it once during the entire loop interchange pass, which is better
than the current cost model where we query it every time we check whether it is
profitable to interchange two loops. Thus complexity is reduced, especially after
D120386 where we do more interchanges to get the globally optimal loop access pattern.
Updates made to test cases are mostly minor changes and some corrections.
Test coverage for loop interchange is not reduced.
Currently we did not completely remove the legacy cost model, but keep it as
fall-back in case the new cost model did not run successfully. This is because
currently we have some limitations in delinearization, which sometimes makes
loop cache analysis bail out. The longer term goal is to enhance delinearization
and eventually remove the legacy cost model compeletely.
Reviewed By: bmahjour, #loopoptwg
Differential Revision: https://reviews.llvm.org/D124926
Paul Pluzhnikov [Thu, 2 Jun 2022 21:58:56 +0000 (17:58 -0400)]
Clean "./" from __FILE__ expansion.
This is alternative to https://reviews.llvm.org/D121733
and helps with Clang header modules in which FILE
may expand to "./foo.h" or "foo.h" depending on whether the file was
included directly or not.
Only do this when UseTargetPathSeparator is true, as we are already
changing the path in that case.
Reviewed By: ayzhao
Differential Revision: https://reviews.llvm.org/D126396
Shilei Tian [Thu, 2 Jun 2022 21:42:50 +0000 (17:42 -0400)]
[Clang][OpenMP] Avoid using `IgnoreImpCasts` if possible
This patch removes all `IgnoreImpCasts` in Sema, and only uses it if necessary. If the expression is not of the same type as the pointer value, a cast is inserted.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D126602
Paul Robinson [Thu, 2 Jun 2022 21:40:52 +0000 (14:40 -0700)]
[PS5] Ignore 'packed' on one-byte bitfields, matching PS4
Mehdi Amini [Thu, 2 Jun 2022 21:24:06 +0000 (21:24 +0000)]
Revert "[mlir] Add integer range inference analysis"
This reverts commit
1350c9887dca5ba80af8e3c1e61b29d6696eb240.
Shared library build is broken with undefined references.
Matt Arsenault [Thu, 2 Jun 2022 18:59:27 +0000 (14:59 -0400)]
AMDGPU: Move SpilledReg from MFI to SIRegisterInfo
This isn't the most natural place for it, but it avoids a circular
include dependency in an out of tree patch.
Julien Pages [Thu, 2 Jun 2022 20:55:39 +0000 (16:55 -0400)]
[AMDGPU] Improve codegen of extractelement/insertelement in some cases
This patch improves the codegen of extractelement and insertelement for vector
containing 8 elements. Before, a dag combine transformation was generating a
sequence of 8 select/cmp.
This patch changes the upper limit for this transformation and the movrel
instruction will eventually be used instead. Extractlement/insertelement for
vectors containing less than 8 elements are unchanged.
Differential Revision: https://reviews.llvm.org/D126389
Alexander Smarus [Wed, 1 Jun 2022 18:10:06 +0000 (18:10 +0000)]
cmake fill `cmake_args` when cross-compiling external project with non-clang compiler
This makes it possible to crosscompile runtimes with cl.exe on Windows.
An external project is completely misconfigured otherwise because
cmake_args is set only for native builds or builds crosscompiled with
clang.
Differential Revision: https://reviews.llvm.org/D122578
Reviewed By: beanz, compnerd
David Blaikie [Sun, 9 May 2021 03:20:52 +0000 (20:20 -0700)]
Support warn_unused_result on typedefs
While it's not as robust as using the attribute on enums/classes (the
type information may be lost through a function pointer, a declaration
or use of the underlying type without using the typedef, etc) but I
think there's still value in being able to attribute a typedef and have
all return types written with that typedef pick up the
warn_unused_result behavior.
Specifically I'd like to be able to annotate LLVMErrorRef (a wrapper for
llvm::Error used in the C API - the underlying type is a raw pointer, so
it can't be attributed itself) to reduce the chance of unhandled errors.
Differential Revision: https://reviews.llvm.org/D102122
Craig Topper [Thu, 2 Jun 2022 20:28:07 +0000 (13:28 -0700)]
[RISCV] Add custom isel for (add X, imm) used by load/stores.
If the imm is out of range for an ADDI, we will materialize it in
a register using multiple instructions. If the ADD is used by a
load/store, doPeepholeLoadStoreADDI can try to pull an ADDI from
the constant materialization into the load/store offset. This only
works if the ADD has a single use, otherwise the peephole would have
to rebuild multiple nodes.
This patch instead tries to solve the problem when the add is selected.
We check that the add is only used by loads/stores and if it is
we will select it to (ADDI (ADD X, Imm-Lo12), Lo12). This will enable
the simple case in doPeepholeLoadStoreADDI that can bypass an ADDI
used as a pointer. As a result we can remove the more complicated
peephole from doPeepholeLoadStoreADDI.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D126576
Florian Hahn [Thu, 2 Jun 2022 20:43:50 +0000 (21:43 +0100)]
[CaptureTracking] Increase limit and use it for all visited uses.
Currently the MaxUsesToExplore limit only applies to the number of users
per value, not the total number of users to explore.
The current limit of 20 pessimizes IR with opaque pointers in some
cases. Without opaque pointers, we have deeper pointer def-use chains in
general due to extra bitcasts and geps for structs with index 0.
With opaque pointers the def-use chain is not as deep but wider, due to
bitcasts & 0-geps missing.
To improve the situation for opaque pointers, this patch does 2 things:
1. Apply the limit to the total number of uses visited. From the
wording in the description of the option it seems like this may be
the original intention. With the current implementation we could
still end up walking a lot of uses.
2. Increase the limit to 100. This is quite arbitrary, but enables
a good number of additional optimizations.
Those adjustments have a noticeable compile-time impact though. In part
that is likely due to additional transformations (and conversely
the current baseline misses optimizations after switching to opaque
pointers).
This recovers some regressions that showed up after enabling opaque
pointers.
Limit=100:
* NewPM-O3: +0.21%
* NewPM-ReleaseThinLTO: +0.87%
* NewPM-ReleaseLTO-g: +0.46%
https://llvm-compile-time-tracker.com/compare.php?from=
2e50ecb2ef4e1da1aeab05bcf66380068e680991&to=
7e6fbe519d958d09f32f01d5d44a622f551e2031&stat=instructions
Limit=60:
* NewPM-O3: +0.14%
* NewPM-ReleaseThinLTO: +0.41%
* NewPM-ReleaseLTO-g: +0.21%
https://llvm-compile-time-tracker.com/compare.php?from=
aeb19817d66f1a15754163c7f48e01e9ebdd6d45&to=
520563fdc146319aae90d06f88d87f2e9e1247b7&stat=instructions
Limit=40:
* NewPM-O3: +0.11%
* NewPM-ReleaseThinLTO: +0.12%
* NewPM-ReleaseLTO-g: +0.09%
https://llvm-compile-time-tracker.com/compare.php?from=
aeb19817d66f1a15754163c7f48e01e9ebdd6d45&to=
c9182576e9fe3f1c84a71479665aef91a416318c&stat=instructions
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D126236
Fangrui Song [Thu, 2 Jun 2022 20:37:19 +0000 (13:37 -0700)]
[ELF] Remove support for legacy .zdebug sections
.zdebug is unlikely used any longer: gcc -gz switched from legacy
.zdebug to SHF_COMPRESSED with binutils 2.26 (2016), which has been
several years. clang 14 dropped -gz=zlib-gnu support. According to
Debian Code Search (`gz=zlib-gnu`), no project uses -gz=zlib-gnu.
Remove .zdebug support to (a) simplify code and (b) allow removal of llvm-mc's
--compress-debug-sections=zlib-gnu.
In case the old object file `a.o` uses .zdebug, run `objcopy --decompress-debug-sections a.o`
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D126793
Fangrui Song [Thu, 2 Jun 2022 20:28:42 +0000 (13:28 -0700)]
[docs] Mention LLVMContext::setOpaquePointers for C++ API
Krzysztof Drewniak [Thu, 2 Jun 2022 19:04:42 +0000 (19:04 +0000)]
[mlir] Add integer range inference analysis
This commit defines a dataflow analysis for integer ranges, which
uses a newly-added InferIntRangeInterface to compute the lower and
upper bounds on the results of an operation from the bounds on the
arguments. The range inference is a flow-insensitive dataflow analysis
that can be used to simplify code, such as by statically identifying
bounds checks that cannot fail in order to eliminate them.
The InferIntRangeInterface has one method, inferResultRanges(), which
takes a vector of inferred ranges for each argument to an op
implementing the interface and a callback allowing the implementation
to define the ranges for each result. These ranges are stored as
ConstantIntRanges, which hold the lower and upper bounds for a
value. Bounds are tracked separately for the signed and unsigned
interpretations of a value, which ensures that the impact of
arithmetic overflows is correctly tracked during the analysis.
The commit also adds a -test-int-range-inference pass to test the
analysis until it is integrated into SCCP or otherwise exposed.
Finally, this commit fixes some bugs relating to the handling of
region iteration arguments and terminators in the data flow analysis
framework.
Depends on D124020
Depends on D124021
Reviewed By: rriddle, Mogball
Differential Revision: https://reviews.llvm.org/D124023
Mingming Liu [Wed, 1 Jun 2022 15:53:31 +0000 (08:53 -0700)]
[Inline][Remark][NFC] Optionally provide inline context to inline
advisor.
This patch has no functional change, and merely a preparation patch for
main functional change. The motivating use case is to annotate inline
remark pass name with context information (e.g. prelink or postlink,
CGSCC or always-inliner), see D125495 for more details.
Differential Revision: https://reviews.llvm.org/D126824
Adrian Prantl [Thu, 2 Jun 2022 20:05:33 +0000 (13:05 -0700)]
Adapt IRForTarget::RewriteObjCConstStrings() for D126689.
With opaque pointers, the LLVM IR expected by this function changed.
Philip Reames [Thu, 2 Jun 2022 20:04:13 +0000 (13:04 -0700)]
[RISCV] Inline one copy of needVSETVLI into the other [NFC]
Calling the non-MI version directly was unsound (as fixed in
dcdb0bf2), so remove that version to decrease likelyhood of future mistakes.
Xiang Li [Thu, 2 Jun 2022 07:25:12 +0000 (00:25 -0700)]
[HLSL] Add WaveActiveCountBits as Langugage builtin function for HLSL
One clang builtins are introduced
uint WaveActiveCountBits( bool bBit ) as Langugage builtin function for HLSL.
The detail for WaveActiveCountBits is at
https://github.com/microsoft/DirectXShaderCompiler/wiki/Wave-Intrinsics#uint-waveactivecountbits-bool-bbit-
This is only clang part change to make WaveActiveCountBits into AST.
llvm intrinsic for WaveActiveCountBits will be add in separate PR.
Reviewed By: Anastasia
Differential Revision: https://reviews.llvm.org/D126857
Sanjay Patel [Thu, 2 Jun 2022 18:02:11 +0000 (14:02 -0400)]
[InstCombine] add tests for mul with low-bit mask operand; NFC
Sanjay Patel [Thu, 2 Jun 2022 17:03:37 +0000 (13:03 -0400)]
[InstCombine] make pattern matching more consistent; NFC
We could go either way on this and several similar matches.
Just matching as a binop is possibly slightly more efficient;
we don't need to re-confirm the opcode of the instruction.
Maksim Panchenko [Thu, 2 Jun 2022 01:18:54 +0000 (18:18 -0700)]
[BOLT][NFC] Fix braces in BinaryEmitter
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D126844
Craig Topper [Thu, 2 Jun 2022 19:25:40 +0000 (12:25 -0700)]
[DAGCombiner][RISCV] Improve computeKnownBits for (smax X, C) where C is non-negative.
If C is non-negative, the result of the smax must also be
non-negative, so all sign bits of the result are 0.
This allows DAGCombiner to remove a zext_inreg in the modified test.
This zext_inreg started as a sext that became zext before type
legalization then was promoted to a zext_inreg.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D126896
Joe Loser [Thu, 2 Jun 2022 18:11:06 +0000 (12:11 -0600)]
[libc++][test] Fix unused variable warning in string_view tests
In
6423a9f0ec8ba70049ea76e7bcfc9a9d1a54e826, I accidentally thought this was
getting tested, but these variables are unused. Just remove the lines instead of
leaving them commented out.
Differential Revision: https://reviews.llvm.org/D126901
Daniel Douglas [Thu, 2 Jun 2022 19:04:58 +0000 (14:04 -0500)]
[OpenMP][libomp] do not try to dlopen libmemkind on macOS
The memkind library is only available for linux. Calling dlopen here
can also be problematic in a client app that fork'ed.
Differential Revision: https://reviews.llvm.org/D126579
Paul Robinson [Thu, 2 Jun 2022 19:25:48 +0000 (12:25 -0700)]
[PS5] Pack non-POD members in packed structs, matching PS4 ABI
Paul Robinson [Thu, 2 Jun 2022 19:14:54 +0000 (12:14 -0700)]
[PS5] Apply 'packed' attribute to base classes, matching PS4 ABI
Florian Hahn [Thu, 2 Jun 2022 18:47:43 +0000 (19:47 +0100)]
[GVN] Add test for capture tracking use limit.
Test for capture-tracking-max-uses-to-explore, adjusted in D126236.
Aart Bik [Thu, 2 Jun 2022 17:32:04 +0000 (10:32 -0700)]
[mlir][sparse][bufferization] fix doc on new init operation
The example was still using the -now- removed sparse_tensor.init_tensor.
Also, I made the input operands of the matrix multiplication sparse too
(since it looks a bit strange to multiply two dense matrices into a sparse).
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D126897
Adrian Prantl [Thu, 2 Jun 2022 18:41:33 +0000 (11:41 -0700)]
Adapt IRForTarget::RewriteObjCSelector() for D126689.
With opaque pointers, the LLVM IR expected by this function changed.
Joe Nash [Mon, 16 May 2022 19:19:31 +0000 (15:19 -0400)]
[AMDGPU] gfx11 vop3 and inherited vop instructions
This patch includes MC layer support for VOP3 encoded instructions and generic VOP support
classes.
Some VOP1 and VOP2 instructions which share an encoding with gfx10 and are using
the AssemblerPredicate = isGFX10Plus are also enabled. That predicate
will be changed to isGFX10Only in a later patch.
Patch 15/N for upstreaming of AMDGPU gfx11 architecture.
Depends on D126468
Reviewed By: dp
Differential Revision: https://reviews.llvm.org/D126475
Chia-hung Duan [Thu, 2 Jun 2022 18:27:36 +0000 (18:27 +0000)]
[mlir:MultiOpDriver] Don't add ops which are not in the allowed list
In strict mode, only the new inserted operation is allowed to add to the
worklist. Before this change, it would add the users of a replaced op
and it didn't check if the users are allowed to be pushed into the
worklist
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D126899
Alexey Bataev [Thu, 9 Dec 2021 18:34:08 +0000 (10:34 -0800)]
[SLP]Improve shuffles cost estimation where possible.
Improved/fixed cost modeling for shuffles by providing masks, improved
cost model for non-identity insertelements.
Differential Revision: https://reviews.llvm.org/D115462
Anders Waldenborg [Mon, 9 May 2022 06:11:34 +0000 (08:11 +0200)]
scan-build-py: Change scripts to explicitly require python3
The "#!" line in all scan-build-py scripts were using just bare
"/usr/bin/python" which according to PEP-0394 can be either python3,
python2 or not exist at all.
E.g in latest debian and ubuntu releases "/usr/bin/python" does not
exist at all by default and user must install python-is-python2 or
python-is-python3 packages to get the bare version less "python"
command.
Until recently (
70b06fe8a186 "scan-build-py: Force the opening in utf-8"
changed "libscanbuild") these scripts worked in both python2 and
python3, but now they (rightfully) are python3 only, and broke on
systems where the "python" command means python2.
By changing the "#!" to be "python3" it is not only explicit that the
scripts require python3 it also works on systems where "python" command
is python2 or nonexistent.
Differential Revision: https://reviews.llvm.org/D126804
Paul Pluzhnikov [Thu, 2 Jun 2022 17:30:24 +0000 (10:30 -0700)]
Fix a buglet in remove_dots().
The function promises to canonicalize the path, but neglected to do so
for the root component.
For example, calling remove_dots("/tmp/foo.c", Style::windows_backslash)
resulted in "/tmp\foo.c". Now it produces "\tmp\foo.c".
Also fix FIXME in the corresponding test.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D126412
Joe Nash [Thu, 12 May 2022 17:32:19 +0000 (13:32 -0400)]
[AMDGPU] gfx11 ds instructions
MC layer support for ds instructions
Contributors:
Piotr Sobczak <Piotr.Sobczak@amd.com>
Patch 14/N for upstreaming of AMDGPU gfx11 architecture.
Depends on D126463
Reviewed By: arsenm, #amdgpu
Differential Revision: https://reviews.llvm.org/D126468
Paul Robinson [Thu, 2 Jun 2022 18:00:32 +0000 (11:00 -0700)]
[PS5] Make passing unions in registers match PS4 ABI
Paul Robinson [Thu, 2 Jun 2022 17:53:40 +0000 (10:53 -0700)]
[PS5] Classify __m64 as integer, matching PS4 ABI
Balazs Benics [Thu, 2 Jun 2022 17:46:38 +0000 (19:46 +0200)]
[llvm][analyzer][NFC] Introduce SFINAE for specializing FoldingSetTraits
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D126803
Balazs Benics [Thu, 2 Jun 2022 17:46:38 +0000 (19:46 +0200)]
[analyzer][NFC] Uplift checkers after D126801
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D126802
Balazs Benics [Thu, 2 Jun 2022 17:46:38 +0000 (19:46 +0200)]
[analyzer][NFC] Add partial specializations for ProgramStateTraits
I'm also hoisting common code from the existing specializations into a
common trait impl to reduce code duplication.
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D126801
Will Hawkins [Thu, 2 Jun 2022 17:43:11 +0000 (19:43 +0200)]
[libc++] Fix typo in comment at __optional_storage_base
Small typo fix(es) for struct definition of __optional_storage_base for
a reference type.
Reviewed By: #libc, jloser, philnik
Differential Revision: https://reviews.llvm.org/D126621
Ashay Rane [Sun, 29 May 2022 00:33:04 +0000 (17:33 -0700)]
[mlir] translate memref.reshape with static shapes but dynamic dims
Prior to this patch, the lowering of memref.reshape operations to the
LLVM dialect failed if the shape argument had a static shape with
dynamic dimensions. This patch adds the necessary support so that when
the shape argument has dynamic values, the lowering probes the dimension
at runtime to set the size in the `MemRefDescriptor` type. This patch
also computes the stride for dynamic dimensions by deriving it from the
sizes of the inner dimensions.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D126604
Craig Topper [Thu, 2 Jun 2022 16:37:05 +0000 (09:37 -0700)]
[RISCV] Add test case showing unnecessary extend after i32 smax on rv64. NFC
One of the operands of the smax is a positive value so computeKnownBits
determines the result of the smax must always be positive. This allows
DAG combiner to convert the sign extend to zero extend before type
legalization.
After type legalization the smax is promoted to i64 by sign extending
its inputs and the zero extend becomes an AND instruction. We are unable
to remove the AND at this point and it becomes a pair of shifts or a
zext.w.
The result of smax has as many sign bits as the minimum of its inputs.
Had we kept the sign extend instead of turning it into a zero extend
it would be removed by DAG combiner after type legalization.
Luís Ferreira [Thu, 2 Jun 2022 16:01:04 +0000 (16:01 +0000)]
[lldb][NFC] Move non-clang specific method to the generic DWARF Parser
This patch renames DW_ACCESS_to_AccessType function and move it to the abstract
DWARFASTParser, since there is no clang-specific code there. This is useful for
plugins other than Clang.
Reviewed By: shafik, bulbazord
Differential Revision: https://reviews.llvm.org/D114719
David CARLIER [Thu, 2 Jun 2022 16:10:29 +0000 (17:10 +0100)]
[OpenMP] omp_get_proc_id uses sched_getcpu fallback on FreeBSD 13.1 and above.
Reviewers: jlpeyton, jdoerfert
Reviewed-By: jlpeyton
Differential-Revision: https://reviews.llvm.org/D126408
Mikael Simberg [Thu, 2 Jun 2022 15:45:02 +0000 (10:45 -0500)]
[OpenMP][libomp] Make LIBOMP_CONFIGURED_LIBFLAGS a list instead of string
When configuring llvm with the openmp subproject, the build for the omp
target fails if LIBOMP_CONFIGURED_LIBFLAGS contains more than one item.
LIBOMP_CONFIGURED_LIBFLAGS should be a semicolon-separated list instead
of a string with items separated by spaces.
Differential Revision: https://reviews.llvm.org/D125370
Liqiang Tao [Thu, 2 Jun 2022 14:26:33 +0000 (22:26 +0800)]
[llvm][ModuleInliner] Refactor InlineSizePriority and PriorityInlineOrder
This patch introduces the abstract base class InlinePriority to serve as
the comparison function for the priority queue. A derived class, such
as SizePriority, may choose to cache the priorities for different
functions for performance reasons.
This design shields the type used for the priority away from classes
outside InlinePriority and classes derived from it. In turn,
PriorityInlineOrder no longer needs to be a template class.
Reviewed By: kazu
Differential Revision: https://reviews.llvm.org/D126300
Liqiang Tao [Thu, 2 Jun 2022 15:15:42 +0000 (23:15 +0800)]
Revert "[llvm][ModuleInliner] Refactor InlineSizePriority and PriorityInlineOrder"
This reverts commit
50de7f1e7787bf327d1d04c4daab97c1c180b58c.
Mark de Wever [Mon, 16 May 2022 16:48:04 +0000 (18:48 +0200)]
[libc++] Lets to_chars use header implementation.
This removes the duplicated code from the dylib. Instead the dylib will
call the new functions in the header. Since this code is unneeded it's
removed from the unstable ABI.
Depends on D125704
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D125761
Philip Reames [Thu, 2 Jun 2022 14:56:06 +0000 (07:56 -0700)]
[RISCV] Fix an inconsistency with compatible load/store handling
Once we've computed the incoming predecessor state, we should use the same compatibility check with knowledge of MI as we did in phase 2 in order to be consistent across all phases.
Differential Revision: https://reviews.llvm.org/D126574
Joe Loser [Thu, 2 Jun 2022 03:23:40 +0000 (21:23 -0600)]
[libc++][test] Enable some more string_view tests
Some test cases for `ends_with.ptr.pass` and `starts_with.ptr.pass` for
`string_view` are commented out, but work just fine. Uncomment them.
Differential Revision: https://reviews.llvm.org/D126849
Paul Robinson [Thu, 2 Jun 2022 14:50:52 +0000 (07:50 -0700)]
Tidy up `pragma comment lib` handling and testing
A bit of historical research shows that over the years:
Commit
99efc036 added `pragma comment lib` support for PS4.
Commit
fd4db533 added `pragma comment lib` support for all ELF targets.
Commit
1d16515f reworked dependent-library support for all ELF targets.
The upshot is that some PS4-specific code became dead, and the
testing became somewhat fragmented. I've removed the dead code and
combined the previous PS4-specific and linux-specific tests for the
diagnostics into one generic ELF test.
Also added a couple of PS5 runs while I was in there.
LLVM GN Syncbot [Thu, 2 Jun 2022 14:47:37 +0000 (14:47 +0000)]
[gn build] Port
f9b8f422e711
Luís Ferreira [Thu, 2 Jun 2022 14:32:36 +0000 (14:32 +0000)]
[lldb][NFC] Move generic DWARFASTParser code out of Clang-specific code
This patch moves ParseChildArrayInfo out of DWARFASTParserClang in order
to decouple Clang-specific logic from DWARFASTParser.
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D114668
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
Liqiang Tao [Thu, 2 Jun 2022 14:26:33 +0000 (22:26 +0800)]
[llvm][ModuleInliner] Refactor InlineSizePriority and PriorityInlineOrder
This patch introduces the abstract base class InlinePriority to serve as
the comparison function for the priority queue. A derived class, such
as SizePriority, may choose to cache the priorities for different
functions for performance reasons.
This design shields the type used for the priority away from classes
outside InlinePriority and classes derived from it. In turn,
PriorityInlineOrder no longer needs to be a template class.
Reviewed By: kazu
Differential Revision: https://reviews.llvm.org/D126300
serge-sans-paille [Mon, 16 May 2022 14:02:44 +0000 (16:02 +0200)]
[MCParser] Set default alignment value when meeting invalid align
Upon invalid alignment value, still set a default valid alignment value to avoid
hitting later asserts.
Fix #55273
Differential Revision: https://reviews.llvm.org/D125688
Paul Walker [Sun, 22 May 2022 19:32:10 +0000 (20:32 +0100)]
[SVE] Fixed custom lowering of ISD::INSERT_SUBVECTOR.
LowerINSERT_SUBVECTOR emits AArch64ISD::UUNPK## when lowering
scalable vector floating point INSERT_SUBVECTOR. However, these
nodes only make sense for integer types and thus isel patterns do
not exist for floating point, which leads to isel failures.
This patch ensures floating point operands are cast to integer
before the core lowering takes place.
Fixes: #55037
Differential Revision: https://reviews.llvm.org/D126487
Joseph Huber [Thu, 2 Jun 2022 13:32:32 +0000 (09:32 -0400)]
[Binary] Remove OffloadBinary from the Objects enumeration
Summary:
We use the beginning and end of this enumeration to determine what is
and isn't an object format. The enumeration for the OffloadBinary was
put here by mistake which led to it being mistakenly classified as an
Object file.
Aaron Ballman [Thu, 2 Jun 2022 13:31:34 +0000 (09:31 -0400)]
Update more DR status information for C.
This adds new files to track DRs 100-199 and 400-499, but the file
contents are still a work in progress. It also updates the associated
status in the DR tracking page.
Nico Weber [Thu, 2 Jun 2022 13:31:57 +0000 (09:31 -0400)]
Revert "unbreak Modules/cxx20-export-import.cpp with LLVM_APPEND_VC_REV after
8c8a2679a20f"
This reverts commit
4463bd0f89181234e0cef982e21de2e96038f873.
8c8a2679a20f was reverted in
d42fe9aa8420.
Paul Robinson [Thu, 2 Jun 2022 13:25:40 +0000 (06:25 -0700)]
[PS5] Support r and y specifiers of freebsd_kernel_printf format strings
Alex Zinenko [Tue, 31 May 2022 13:49:02 +0000 (15:49 +0200)]
[mlir] add decompose and generalize to structured transform ops
These ops complement the tiling/padding transformations by transforming
higher-level named structured operations such as depthwise convolutions into
lower-level and/or generic equivalents that are better handled by some
downstream transformations.
Differential Revision: https://reviews.llvm.org/D126698
Hans Wennborg [Thu, 2 Jun 2022 13:09:39 +0000 (15:09 +0200)]
Revert "[clang][AIX] add option mdefault-visibility-export-mapping"
This caused assertions, see comment on the code review:
llvm/clang/lib/AST/Decl.cpp:1510:
clang::LinkageInfo clang::LinkageComputer::getLVForDecl(const clang::NamedDecl *, clang::LVComputationKind):
Assertion `D->getCachedLinkage() == LV.getLinkage()' failed.
> The option mdefault-visibility-export-mapping is created to allow
> mapping default visibility to an explicit shared library export
> (e.g. dllexport). Exactly how and if this is manifested is target
> dependent (since it depends on how they map dllexport in the IR).
>
> Three values are provided for the option:
>
> * none: the default and behavior without the option, no additional export linkage information is created.
> * explicit: add the export for entities with explict default visibility from the source, including RTTI
> * all: add the export for all entities with default visibility
>
> This option is useful for targets which do not export symbols as part of
> their usual default linkage behaviour (e.g. AIX), such targets
> traditionally specified such information in external files (e.g. export
> lists), but this mapping allows them to use the visibility information
> typically used for this purpose on other (e.g. ELF) platforms.
>
> Reviewed By: MaskRay
>
> Differential Revision: https://reviews.llvm.org/D126340
This reverts commit
8c8a2679a20f621994fa904bcfc68775e7345edc.
Xing Xue [Thu, 2 Jun 2022 13:03:10 +0000 (09:03 -0400)]
[libunwind][ci][AIX] Add libunwind to buildbot CI
Summary:
This patch changes scripts to add libunwind CI on AIX. Test config file ibm-libunwind-shared.cfg.in is introduced for testing on AIX.
Reviewed by: ldionne, MaskRay, libunwind, ibc++abi
Differential Revision: https://reviews.llvm.org/D126017
PeixinQiao [Thu, 2 Jun 2022 12:58:05 +0000 (20:58 +0800)]
[flang] Add check for conflict of BIND(C) and Parameter attributes
The entity with BIND(C) attribute cannot be a named constant, so the
BIND(C) and parameter attributes are conflicted. Add check for it.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D126654
Nikita Popov [Thu, 2 Jun 2022 12:51:55 +0000 (14:51 +0200)]
Revert "cmake: use llvm dir variables for clang/utils/hmaptool"
As discussed on the review, this change breaks the standalone
clang build. When building against an installed LLVM, the
LLVM_TOOLS_BINARY_DIR cmake variable points to the location of
the installed LLVM tools, not to the cmake build directory. This
means that we would end up trying to move hmaptool into something
like /usr/bin as part of the normal build, while this should only
be happening when running an install target.
This reverts commit
bf1ab1f0eb9578914343f48096229ecccd0ecf52.
Aaron Ballman [Thu, 2 Jun 2022 12:26:38 +0000 (08:26 -0400)]
Revert "Drop qualifiers from return types in C (DR423)"
This reverts commit
d374b65f2da1bdd3d9a7e9ac8ed4ad5467c882f9.
The changes lose AST fidelity (reported in #55778), but also may be
improperly dropping _Atomic qualifiers. I am rolling the changes back
until I've finished discussions in WG14 about the proper resolution to
DR423.
Andrzej Warzynski [Tue, 31 May 2022 18:29:52 +0000 (19:29 +0100)]
[flang][docs] Document CMake support
One out-of-date section is also deleted.
Differential Revision: https://reviews.llvm.org/D126712
Nicolas Vasilache [Thu, 2 Jun 2022 11:52:45 +0000 (11:52 +0000)]
[mlir][SCF] Add scf.foreach_thread.parallel_insert_slice canonicalization.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D126761
Guillaume Chatelet [Thu, 2 Jun 2022 11:25:03 +0000 (13:25 +0200)]
Fix llvm.memset semantics description
The description was referring to a ``src`` parameter probably copied over from ``llvm.memcpy``
Florian Hahn [Thu, 2 Jun 2022 11:07:54 +0000 (12:07 +0100)]
[VPlan] Remove dead VPlan-native special case from BranchOnCount (NFC).
After
05776122b682684ad this special case doesn't exist any longer.
Mikael Holmen [Thu, 2 Jun 2022 10:50:00 +0000 (12:50 +0200)]
[clang-tidy] Remove extra ";" in ModernizeModuleTest.cpp
Without this fix we get
../../clang-tools-extra/unittests/clang-tidy/ModernizeModuleTest.cpp:270:2: error: extra ';' outside of a function is incompatible with C++98 [-Werror,-Wc++98-compat-extra-semi]
};
^
1 error generated.
when compiling with -Werror.
Nikita Popov [Thu, 2 Jun 2022 10:28:12 +0000 (12:28 +0200)]
[Docs] Update default in opaque pointer docs (NFC)
Also mention a relevant C API.
Paul Walker [Mon, 7 Feb 2022 17:55:42 +0000 (17:55 +0000)]
[SVE] Remove custom lowering of scalable vector MGATHER & MSCATTER operations.
Differential Revision: https://reviews.llvm.org/D126255
Nikita Popov [Thu, 2 Jun 2022 10:17:56 +0000 (12:17 +0200)]
[OrcV2Examples] Fix test with opaque pointers
The other two modules now use opaque pointers, so make sure this
one does as well.
Nikita Popov [Thu, 2 Jun 2022 10:07:37 +0000 (12:07 +0200)]
[flang] Update memcpy intrinsic mangling for opaque pointers
Flang is manually mangling names for memset/memcpy/memmove
intrinsics, so we need to update the mangling to use the opaque
pointer format (p0 instead of p0i8).
Nikita Popov [Thu, 2 Jun 2022 09:53:00 +0000 (11:53 +0200)]
[flang] Update tests for opaque pointers
There is still one remaining failure in Lower/forall/character-1.f90.
Martin Storsjö [Thu, 2 Jun 2022 09:57:51 +0000 (12:57 +0300)]
[ARM] Fix a test case typo. NFC.
The test looked for the wrong string, but it happened to match as
it was a substring of the actual output.
This fixes a typo from
d8e67c1cccd8fcb62230166caea744592288da17.
Nikita Popov [Thu, 2 Jun 2022 08:53:32 +0000 (10:53 +0200)]
[llvm-ocaml] Add and use opaque pointer compatible bindings
Add bindings for LLVMConstGEP2, LLVMAddAlias2, LLVMBuildLoad2,
LLVMBuildInvoke2, LLVMBuildGEP2, LLVMBuildInBoundsGEP2,
LLVMBuildStructGEP2, LLVMBuildPtrDiff2 and use these in tests.
Gabor Marton [Tue, 31 May 2022 15:49:52 +0000 (17:49 +0200)]
[analyzer][NFC] Move overconstrained check from reAssume to assumeDualImpl
Depends on D126406. Checking of the overconstrained property is much
better suited here.
Differential Revision: https://reviews.llvm.org/D126707
Martin Storsjö [Thu, 19 May 2022 10:17:24 +0000 (13:17 +0300)]
[clang] [ARM] Add __builtin_sponentry like on aarch64
This is used for calling the SEH aware setjmp on MinGW.
Differential Revision: https://reviews.llvm.org/D126764
Martin Storsjö [Thu, 19 May 2022 10:16:53 +0000 (13:16 +0300)]
[ARM] Implement lowering of the sponentry intrinsic
This is needed for SEH based setjmp on Windows.
Differential Revision: https://reviews.llvm.org/D126763
Martin Storsjö [Fri, 26 Nov 2021 13:17:47 +0000 (15:17 +0200)]
[ARM] Adjust the frame pointer when it's needed for SEH unwinding
For functions that require restoring SP from FP (e.g. that need to
align the stack, or that have variable sized allocations), the prologue
and epilogue previously used to look like this:
push {r4-r5, r11, lr}
add r11, sp, #8
...
sub r4, r11, #8
mov sp, r4
pop {r4-r5, r11, pc}
This is problematic, because this unwinding operation (restoring sp
from r11 - offset) can't be expressed with the SEH unwind opcodes
(probably because this unwind procedure doesn't map exactly to
individual instructions; note the detour via r4 in the epilogue too).
To make unwinding work, the GPR push is split into two; the first one
pushing all other registers, and the second one pushing r11+lr, so that
r11 can be set pointing at this spot on the stack:
push {r4-r5}
push {r11, lr}
mov r11, sp
...
mov sp, r11
pop {r11, lr}
pop {r4-r5}
bx lr
For the same setup, MSVC generates code that uses two registers;
r11 still pointing at the {r11,lr} pair, but a separate register
used for restoring the stack at the end:
push {r4-r5, r7, r11, lr}
add r11, sp, #12
mov r7, sp
...
mov sp, r7
pop {r4-r5, r7, r11, pc}
For cases with clobbered float/vector registers, they are pushed
after the GPRs, before the {r11,lr} pair.
Differential Revision: https://reviews.llvm.org/D125649
Martin Storsjö [Fri, 26 Nov 2021 12:28:16 +0000 (14:28 +0200)]
[ARM] Add SEH opcodes in frame lowering
Skip inserting regular CFI instructions if using WinCFI.
This is based a fair amount on the corresponding ARM64 implementation,
but instead of trying to insert the SEH opcodes one by one where
we generate other prolog/epilog instructions, we try to walk over the
whole prolog/epilog range and insert them. This is done because in
many cases, the exact number of instructions inserted is abstracted
away deeper.
For some cases, we manually insert specific SEH opcodes directly where
instructions are generated, where the automatic mapping of instructions
to SEH opcodes doesn't hold up (e.g. for __chkstk stack probes).
Skip Thumb2SizeReduction for SEH prologs/epilogs, and force
tail calls to wide instructions (just like on MachO), to make sure
that the unwind info actually matches the width of the final
instructions, without heuristics about what later passes will do.
Mark SEH instructions as scheduling boundaries, to make sure that they
aren't reordered away from the instruction they describe by
PostRAScheduler.
Mark the SEH instructions with the NoMerge flag, to avoid doing
tail merging of functions that have multiple epilogs that all end
with the same sequence of "b <other>; .seh_nop_w, .seh_endepilogue".
Differential Revision: https://reviews.llvm.org/D125648
jacquesguan [Thu, 2 Jun 2022 03:00:02 +0000 (03:00 +0000)]
[LegalizeTypes][VP] Add widen and split support for VP FP integer casting op.
This patch adds widen and split support for VP_FPTOSI, VP_FPTOUI, VP_SITOFP and VP_UITOFP.
Differential Revision: https://reviews.llvm.org/D126847
lewuathe [Thu, 2 Jun 2022 08:38:20 +0000 (10:38 +0200)]
[mlir][complex] Lower complex.sin/cos to libm
Lower sin/cos operation in complex dialect to libm as a baseline. This follows up to https://reviews.llvm.org/D125550.
Reviewed By: pifon2a
Differential Revision: https://reviews.llvm.org/D126755