Matt Arsenault [Sun, 9 Apr 2023 11:15:45 +0000 (07:15 -0400)]
ValueTracking: Handle exp/exp2 in computeKnownFPClass
Matt Arsenault [Wed, 19 Apr 2023 02:49:37 +0000 (22:49 -0400)]
ValueTracking: Fix computeKnownFPClass for fabs
The fabs utility functions have the opposite purpose and
probably should not be a general utility.
Matt Arsenault [Mon, 10 Apr 2023 13:40:54 +0000 (09:40 -0400)]
ValueTracking: Add computeKnownFPClass baseline tests for exp
Quinn Dawkins [Wed, 5 Apr 2023 04:36:51 +0000 (00:36 -0400)]
[mlir][vector] Add unroll pattern for vector.gather
This pattern is useful for SPIR-V to unroll to a supported vector size
before later lowerings. The unrolling pattern is closer to an
elementwise op than the transfer ops because the index values from which
to extract elements are captured by the index vector and thus there is
no need to update the base offsets when unrolling gather.
Differential Revision: https://reviews.llvm.org/D149066
Jakub Kuderski [Mon, 24 Apr 2023 17:56:21 +0000 (13:56 -0400)]
[mlir][spirv] Fix OOB error in TestModuleCombiner
Also fix a typo in the surrounding code.
Fixes: https://github.com/llvm/llvm-project/issues/62318
Reviewed By: qedawkins
Differential Revision: https://reviews.llvm.org/D149069
Hanhan Wang [Fri, 21 Apr 2023 20:32:54 +0000 (13:32 -0700)]
[mlir][linalg] Add support for lowering pack with outer_dims_perm.
Reviewed By: chelini, qcolombet
Differential Revision: https://reviews.llvm.org/D148845
Valentin Clement [Mon, 24 Apr 2023 17:12:07 +0000 (10:12 -0700)]
[flang][openacc] Support array section with non constant bounds
Add lowering for non constant lower and upper bounds
in array section.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D148840
Fangrui Song [Mon, 24 Apr 2023 17:02:06 +0000 (10:02 -0700)]
[PPCMIPeephole] Fix incorrect compare elimination
D38236 moves a redundant compare instruction from the loop body to the
preheader.
It has a bug: when `MBB1 == &MBB2`, there may be only one compare instruction in the
loop. The code will lift the compare instruction to the preheader, failing to
account for the change of the compare result in a tail call, leading to a miscompile.
Suppress the compare elimination to fix https://github.com/llvm/llvm-project/issues/62294
Reviewed By: #powerpc, nemanjai
Differential Revision: https://reviews.llvm.org/D149030
Florian Hahn [Mon, 24 Apr 2023 16:51:11 +0000 (17:51 +0100)]
[VPlan] Add VPValue::isLiveIn() (NFC).
This helps to clarify checks in multiple places.
Suggested as cleanup in D147892.
Min-Yih Hsu [Mon, 24 Apr 2023 16:32:49 +0000 (09:32 -0700)]
[M68k] Add basic Clang support for M68881/2
- Add the `-m68881` flag
- Add floating point feature detection
- Macro definitions
Differential Revision: https://reviews.llvm.org/D147481
LLVM GN Syncbot [Mon, 24 Apr 2023 16:19:57 +0000 (16:19 +0000)]
[gn build] Port
afa13ba18d9e
max [Mon, 24 Apr 2023 16:17:08 +0000 (11:17 -0500)]
[MLIR][python bindings][fix] implement `replace_all_uses_with` on `PyValue`
Differential Revision: https://reviews.llvm.org/D148816
serge-sans-paille [Mon, 17 Apr 2023 08:13:31 +0000 (10:13 +0200)]
Reapply Move "auto-init" instructions to the dominator of their users
Original patch (
50b2a113db197a97f60ad2aace8b7382dc9b8c31) ignored the
fact that -ftrivial-auto-var-init could affect function parameters with
the sret attribute.
Just do not move instruction that don't affect alloca.
Also add missing test case for volatile instruction.
Differential Revision: https://reviews.llvm.org/D148507
Michael Buch [Mon, 24 Apr 2023 16:04:18 +0000 (12:04 -0400)]
[lldb][test] TestCPP20Standard.py: skip on older compilers
Requires C++20 support (at least for the spaceship operator).
Seems to work back to Clang-11
Aaron Ballman [Mon, 24 Apr 2023 15:58:07 +0000 (11:58 -0400)]
Add missing HTML closing tag
The </li> tag was missing for this entry.
Timm Bäder [Sat, 1 Apr 2023 06:41:20 +0000 (08:41 +0200)]
[clang][Interp][NFC] Take a QualType in visitZeroInitializer()
The given expression is not necessarily usable to obtain a type for,
so we can't use it to get the floating point semantics. Pass a QualType
instead, which we can use--and classify() that here.
Aaron Ballman [Mon, 24 Apr 2023 15:56:25 +0000 (11:56 -0400)]
Remove the "implement better version of existing tools" open project
This project doesn't really relate to improving Clang itself and it
contained stale suggestions like working on code modification
functionality in clang-format.
Aaron Ballman [Mon, 24 Apr 2023 15:55:11 +0000 (11:55 -0400)]
Reword the open project for generating documentation
Work already began on this project, so this updates the wording to
discuss clang-doc specifically.
Aaron Ballman [Mon, 24 Apr 2023 15:43:25 +0000 (11:43 -0400)]
Add some more open project for Clang
This adds open projects for updating the status of our C conformance,
DR conformance for both C and C++, and improving build times.
Maryam Moghadas [Fri, 21 Apr 2023 16:59:58 +0000 (16:59 +0000)]
[PowerPC] Add a new test for vperm with a swapped vector operand and a constant pool
This patch adds a new test that includes a vperm instruction with xxswapd as its
vector operand on little-endian Power8. The test demonstrates the constant pool
for the mask operand, which is intended to indicate the optimization of vperm
and the modification of the constant pool in subsequent patches.
Reviewed By: amyk
Differential Revision: https://reviews.llvm.org/D148942
Ashay Rane [Mon, 24 Apr 2023 13:01:33 +0000 (08:01 -0500)]
[clang] remove dereferencing of invalid pointer
A line in the demangling code for float literals dereferences the
`.end()` iterator, which causes the Windows debug build of llvm-cxxfilt
to crash. The failure can be reproduced by passing the string
`_Z5dummyIXtl8wrapper1IdEtlNS1_Ut_Edi9RightNametlNS2_Ut_ELd405ec00000000000EEEEEEvv`
to `llvm-cxxfilt -n`.
This patch rewrites the code to use the `.size()` member of the
string_view type to avoid dereferencing past the buffer.
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D149061
Simon Pilgrim [Mon, 24 Apr 2023 14:57:01 +0000 (15:57 +0100)]
[VP] Add IR expansion for fneg
Followup to D149052, it wasn't worthwhile to add general support for unary opcodes
Florian Hahn [Mon, 24 Apr 2023 15:10:46 +0000 (16:10 +0100)]
[VPlan] Remove unnecessary includes from VPlan.h (NFC).
Clean up some unnecessary includes from VPlan.h, which is imported in
multiple files.
max [Mon, 24 Apr 2023 15:08:11 +0000 (10:08 -0500)]
[MLIR][python bindings] implement `replace_all_uses_with` on `PyValue`
Differential Revision: https://reviews.llvm.org/D148816
Andrew Gozillon [Mon, 24 Apr 2023 14:46:03 +0000 (09:46 -0500)]
[Flang][OpenMP][Driver][MLIR] Port fopenmp-host-ir-file-path flag and add MLIR module attribute to proliferate to OpenMP IR lowering
This patch ports the fopenmp-host-ir-file-path flag from Clang to Flang-new, this flag
is added by the driver to the device pass when doing two phase compilation (device + host).
This flag is then applied to the module when compiling during the OpenMP device phase.
This file can then be utilised during lowering of the OpenMP dialect to LLVM-IR, which
allows the device and host to maintain 1:1 mapping of OpenMP metadata for variables
during lowering via the OpenMPIRBuilders loadOffloadInfoMetadata facilities
(which is used for declare target and I believe target regions as well).
Reviewer: awarzynski
Differential Revision: https://reviews.llvm.org/D148038
Nikita Popov [Mon, 24 Apr 2023 15:05:06 +0000 (17:05 +0200)]
[LICM] Minor optimization (NFC)
Simplify the match in hoistMinMax and only fetch the preheader
once.
Aaron Ballman [Mon, 24 Apr 2023 14:53:17 +0000 (10:53 -0400)]
Add some open projects for people to consider
These projects are ones that are already known within the community as
areas we would like to see improvements on.
Nikita Popov [Mon, 24 Apr 2023 14:38:48 +0000 (16:38 +0200)]
Revert "[InstSimplify] Support all instructions in simplifyWithOpReplaced()"
This reverts commit
3e3e41b263f4aa76a5a36f02727827bebccdbf07.
This appears to cause a stage2 miscompile of llvm-profgen.
Joseph Huber [Mon, 24 Apr 2023 14:44:54 +0000 (09:44 -0500)]
[libc] Suppress error message from the arch tools if they fail
Summary:
These tools are used to query amdgpu-arch and nvptx-arch. We shouldn't
print their errors to the console if they do fail.
Alexey Bataev [Mon, 24 Apr 2023 13:46:34 +0000 (06:46 -0700)]
[SLP]Fix PR58616: assert for gep nodes with different basic blocks.
Need to relax the assertion check in the FindFirstInst lambda for GEP
nodes with non-GEP instruction to avoid compiler crash.
NAKAMURA Takumi [Mon, 24 Apr 2023 13:54:40 +0000 (22:54 +0900)]
[CMake] Sort deps and reformat
John Brawn [Mon, 24 Apr 2023 14:35:37 +0000 (15:35 +0100)]
[Serialization] Correctly handle special files when deserializing
This was supposed to be part of my previous commit, but I accidentally
pushed an old version of the patch.
Martin Braenne [Mon, 24 Apr 2023 13:11:02 +0000 (13:11 +0000)]
[clang][dataflow] Use existing accessors to check for copy and move assignment ops.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D148612
Simon Pilgrim [Mon, 24 Apr 2023 14:14:06 +0000 (15:14 +0100)]
[VP] IR expansion for fabs/fsqrt/fma/fmadd
Add basic handling for VP ops that can expand to FP intrinsics
Fixes #60464
Differential Revision: https://reviews.llvm.org/D149052
Joseph Huber [Mon, 24 Apr 2023 14:10:31 +0000 (09:10 -0500)]
[Clang] Accept and forward `-fconvergent-functions` in the driver
Currently the `-fconvergent-functions` option is primarily used by GPU
toolchains to enforce convergent operations in line with the semantics.
This option previously was only supported via `-Xclang` and would show
up as unused if passed to the driver. This patch allows the driver to
forward it. This is mostly useful for users wishing to target GPU
toolchains directly via `--target=` without an offloading runtime.
Reviewed By: JonChesterfield, MaskRay
Differential Revision: https://reviews.llvm.org/D149019
Alvin Wong [Sun, 23 Apr 2023 15:58:24 +0000 (23:58 +0800)]
[LLD][COFF] Add /inferasanlibs to lld-link as ignored flag
MSVC link.exe added this flag and MS STL started using this flag in
.drectve [1] when compiling with Clang with asan enabled, as reported
on https://github.com/llvm/llvm-project/issues/56300. This causes issues
with lld-link because it rejects any unknown flags in .drective sections.
As
dc07867dc9991c982bd3441da19d6fcc16ea54d6 noted that, when using Clang
as the driver it explicitly passes the proper asan libraries. Therefore
it should be acceptable to ignore this flag in lld-link to at least
unbreak building with clang-cl and linking with lld-link.
[1]: https://github.com/microsoft/STL/blob/
faaf094ee16bcbfb2c8d612fdb9334bcdef2fd0a/stl/inc/__msvc_sanitizer_annotate_container.hpp#L35
Differential Revision: https://reviews.llvm.org/D149023
Alvin Wong [Sun, 23 Apr 2023 15:52:55 +0000 (23:52 +0800)]
[LLD][COFF] Print object file name for unsupported directives
This is a small QoL improvement suggested by FrancescElies in
https://github.com/llvm/llvm-project/issues/56300#issuecomment-
1172104966.
Differential Revision: https://reviews.llvm.org/D149022
Sam McCall [Fri, 21 Apr 2023 19:22:35 +0000 (21:22 +0200)]
[dataflow] HTMLLogger: fix off-by-one in the BB listing
The indexes of analysis state within a BB element is a bit odd:
BB.0 is the initial state
BB.1 is the state after the first element
etc
This means we have N+1 states and we need N+1 elements in the BB list.
We add a dummy element at the beginning rather than the end, because we want
selecting a CFG element to show the state *afterwards*.
For example, if we click on an expr, we want to be able to see its value model!
Differential Revision: https://reviews.llvm.org/D148951
Stefan Pintilie [Fri, 21 Apr 2023 20:12:07 +0000 (16:12 -0400)]
[NFC][PowerPC] Added a test case to show extra clear instructions.
Added a number of functions that have a clear instruction that is not
actually required. This test is added first and then a patch will be
added later in order to remove the unnecessary instructions.
Simon Pilgrim [Mon, 24 Apr 2023 13:47:05 +0000 (14:47 +0100)]
[DAG] Add ISD::isExtVecInRegOpcode helper.
Match ISD::ANY_EXTEND_VECTOR_INREG\ZERO_EXTEND_VECTOR_INREG\SIGN_EXTEND_VECTOR_INREG opcodes
Simon Pilgrim [Mon, 24 Apr 2023 13:15:14 +0000 (14:15 +0100)]
[X86] Support EVT types in supportedVectorShift* helpers. NFCI.
Move the isSimple() check inside the helpers to avoid a lot of extra checking in a future patch.
Nikita Popov [Mon, 24 Apr 2023 13:22:20 +0000 (15:22 +0200)]
[InstSimplify] Support all instructions in simplifyWithOpReplaced()
Instead of hardcoding a few instruction kinds, use the generic
interface now that we have it.
The primary effect of this is that intrinsics are now supported.
It's worth noting that this is still limited in that it does not
support vectors, so we can't remove e.g. existing fshl special
cases.
Nikita Popov [Mon, 24 Apr 2023 13:08:41 +0000 (15:08 +0200)]
[InstSimplify] Add additional test for select icmp of umin (NFC)
This is a representative test for the simplifyWithOpReplaced()
fold on intrinsics.
John Brawn [Mon, 24 Apr 2023 13:07:41 +0000 (14:07 +0100)]
[Serialization] Place command line defines in the correct file
Fix several problems related to serialization causing command line
defines to be reported as being built-in defines:
* When serializing the <built-in> and <command line> files don't
convert them into absolute paths.
* When deserializing SM_SLOC_BUFFER_ENTRY we need to call
setHasLineDirectives in the same way as we do for
SM_SLOC_FILE_ENTRY.
* When created suggested predefines based on the current command line
options we need to add line markers in the same way that
InitializePreprocessor does.
* Adjust a place in clangd where it was implicitly relying on command
line defines being treated as builtin.
Differential Revision: https://reviews.llvm.org/D144651
Aaron Ballman [Mon, 24 Apr 2023 12:49:48 +0000 (08:49 -0400)]
Remove known-stale projects from the open projects page
This removes or modifies:
Undefined behavior checking -- we've got UBSan and it's well-known
enough that we don't need to call it out specifically as a need.
Improve target support -- this is largely already complete.
Use clang libraries to extend Ragel with a JIT -- this wasn't really
related to improving Clang.
C++1y feature work -- now talks about C++20, C++2b, and C2x instead.
Universal driver -- the bug report linked to by the UniversalDriver
web page has been closed since 2017.
XML representation of the AST -- we removed this functionality in 2013
and replaced it with a JSON representation a few years later. That is a
best-effort project.
Peter Smith [Mon, 17 Apr 2023 17:37:05 +0000 (18:37 +0100)]
[LLD][ELF][AArch64] Add AArch64 short range thunk support
The AArch64 branch immediate instruction has a 128MiB range. This
makes it suitable for use a short range thunk in the same way as
short thunks are implemented in Arm and PPC. This patch adds
support for short range thunks to AArch64.
Adding short range thunk support should mean that OutputSections
can grow to nearly 256 MiB in size without needing long-range
indirect branches.
Differential Revision: https://reviews.llvm.org/D148701
Paul Walker [Thu, 20 Apr 2023 16:45:56 +0000 (16:45 +0000)]
[Clang][Sema] Fix invalid cast when validating SVE types within CheckVariableDeclarationType.
Fixes #62087
Differential Revision: https://reviews.llvm.org/D148919
Jay Foad [Fri, 21 Apr 2023 13:11:31 +0000 (14:11 +0100)]
[Vectorize] Fix vectorization, scalarization and folding of llvm.is.fpclass
llvm.is.fpclass is different from other vectorizable intrinsics in that
it is overloaded on an argument type, not on the return type.
Differential Revision: https://reviews.llvm.org/D148905
Jay Foad [Fri, 21 Apr 2023 14:43:02 +0000 (15:43 +0100)]
[Vectorize] Pre-commit tests for D148905
Differential Revision: https://reviews.llvm.org/D149050
Michael Buch [Mon, 24 Apr 2023 12:40:23 +0000 (08:40 -0400)]
[lldb][tests] TestPreferredName.py: add missing import
Siyuan Zhu [Mon, 24 Apr 2023 12:29:37 +0000 (14:29 +0200)]
[InstSimplify] sdiv a (1 srem b) --> a
Extend the existing fold for division by zero or one to use known
bits, so it catches additional patterns like division by
(1 srem b).
Fixes https://github.com/llvm/llvm-project/issues/62163.
Differential Revision: https://reviews.llvm.org/D149001
Aaron Ballman [Mon, 24 Apr 2023 12:35:43 +0000 (08:35 -0400)]
Fix file info comment; NFC
There is no TargetInfoImpl class any longer.
Michael Buch [Mon, 24 Apr 2023 12:29:48 +0000 (08:29 -0400)]
[lldb][tests] TestPreferredName.py: Fix for older compilers
This only works as of D145803, where we re-point the
`DW_AT_type` based on existence of `[[clang::preferred_name]]`
Siyuan Zhu [Mon, 24 Apr 2023 12:28:12 +0000 (14:28 +0200)]
[InstSimplify] Test case for D149001 (NFC)
Differential Revision: https://reviews.llvm.org/D149012
Aaron Ballman [Mon, 24 Apr 2023 12:25:28 +0000 (08:25 -0400)]
Minor cleanup of the Open Projects page
Sets the charset to UTF-8, fixes the page title, replaces mention of
cfe-dev with Discourse, points out Discord and IRC.
Nikita Popov [Mon, 24 Apr 2023 12:25:45 +0000 (14:25 +0200)]
[InstSimplify] Move more folds into simplifyDivRem() (NFCI)
The threading folds are the same for div/rem and the isDivZero()
fold only differes in the return value.
This should be NFC, but as this slightly shuffles around the
order of the folds it might not be exactly the same.
Jingu Kang [Mon, 24 Apr 2023 12:23:57 +0000 (13:23 +0100)]
[AArch64] Precommit test
This patch precommits tests for:
https://reviews.llvm.org/D148347
Alexandros Lamprineas [Tue, 28 Mar 2023 17:16:19 +0000 (18:16 +0100)]
[FuncSpec] Track the return values of specializations.
To track the return values of specializations, we need to invalidate all
the lattice values across the use-def chain which originates from the
callsites, recompute and propagate.
Differential Revision: https://reviews.llvm.org/D146158
Nikita Popov [Mon, 24 Apr 2023 10:56:09 +0000 (12:56 +0200)]
[InstSimplify] Drop redundant div fold (NFCI)
This is nowadays handled generically via isDivZero() and icmp
simplification, specifically the computeConstantRange() based
logic.
Mikhail Goncharov [Mon, 24 Apr 2023 11:58:09 +0000 (13:58 +0200)]
[bazel] test files for IRDL
8ac8c922fb3f15706f5cb1db2cc655d30b095766
Differential Revision: https://reviews.llvm.org/D149056
Hassnaa Hamdi [Thu, 20 Apr 2023 05:34:05 +0000 (05:34 +0000)]
[AArch64][DAGCombiner]: combine <2xi64> mul add/sub.
64-bit vector mul is not supported in NEON,
so we use the SVE's mul.
To improve the performance, we can go one step further,
and use SVE's add/sub, so that we can use SVE's mla/mls.
That works on these patterns:
add v1, (mul v2, v3)
sub v1, (mul v2, v3)
Reviewed By: david-arm, paulwalker-arm
Differential Revision: https://reviews.llvm.org/D148118
Nikita Popov [Mon, 24 Apr 2023 10:40:46 +0000 (12:40 +0200)]
[InstSimplify] Move fold into isDivZero() (NFCI)
This is a special case where we know the division result is zero.
For the unsigned case this is handled by generic icmp code, for
the signed case we do need to special case it.
Tom Weaver [Mon, 24 Apr 2023 10:14:10 +0000 (11:14 +0100)]
Revert "[Coverity] Fix explicit null dereferences"
This reverts commit
22b23a5213b57ce1834f5b50fbbf8a50297efc8a.
This commit caused the following two build bots to start failing:
https://lab.llvm.org/buildbot/#/builders/216/builds/20322
https://lab.llvm.org/buildbot/#/builders/123/builds/18511
Kito Cheng [Fri, 17 Jun 2022 09:32:51 +0000 (17:32 +0800)]
[RISCV] Add SiFive extension support
Add SiFive extension support
Depends on D147934
Differential Revision: https://reviews.llvm.org/D147935
Nelson Chu [Wed, 18 May 2022 09:26:16 +0000 (02:26 -0700)]
[RISCV] Support LLVM IR intrinsics for xsfvcp extension.
The sf.vc.x and sf.vc.i intrinsics don't have any vector types in the output
and inputs, but the intrinsic spec said that we still need to add vetvli for
them. Therefore, we need to encode the VTYPE to these IR names.
Differential Revision: https://reviews.llvm.org/D147934
David Spickett [Fri, 21 Apr 2023 09:53:50 +0000 (10:53 +0100)]
[llvm][docs] Update "Adding a Builder" docs
* Move step 8 to later, after worker credentials have
been added to the buildmaster.
* Added command for starting the worker, in addition
to creating the worker. The latter only sets up the
directories.
* Noted that in step 6, it is expected that you get a
refused connection.
* Stated that the connection should be tried once,
and the worker then stopped.
We could mention that repeated connections with invalid
credentials will result in an IP ban, but it's probably
detail people don't need here.
If it did happen, then you would not know until you tried
the later steps. At which point you are already in contact
with Galina, who is the person who would help you with that
issue in any case.
Reviewed By: gkistanova
Differential Revision: https://reviews.llvm.org/D148913
Momchil Velikov [Mon, 24 Apr 2023 08:50:28 +0000 (09:50 +0100)]
[CodeGenPrepare] Estimate liveness of loop invariants when checking for address folding profitability
When checking the profitability of folding an address computation
into a memory instruction, the compiler tries to determine the liveness
of the values, comprising the address, at the point of the memory instruction.
This patch improves on the live variable estimates by including
the loop invariants which are references in the loop body.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D143897
Stoorx [Fri, 21 Apr 2023 14:33:15 +0000 (17:33 +0300)]
[clang] Return `std::string_view` from `TargetInfo::getClobbers()`
Change the return type of `getClobbers` function from `const char*`
to `std::string_view`. Update the function usages in CodeGen module.
The reasoning of these changes is to remove unsafe `const char*`
strings and prevent unnecessary allocations for constructing the
`std::string` in usages of `getClobbers()` function.
Differential Revision: https://reviews.llvm.org/D148799
Stoorx [Fri, 21 Apr 2023 21:06:58 +0000 (00:06 +0300)]
[clang] Remove unnecessary virtual inheritance in `TargetInfo`
Since the `TargetInfo` has no diamond-like inheritance diagram,
the `virtual` keyword is not necessary.
Differential Revision: https://reviews.llvm.org/D148961
Stoorx [Tue, 18 Apr 2023 20:49:00 +0000 (23:49 +0300)]
[clang] Make access to submodules via `iterator_range`
In file `clang/lib/Basic/Module.cpp` the `Module` class had `submodule_begin()` and `submodule_end()` functions to retrieve corresponding iterators for private vector of Modules. This commit removes mentioned functions, and replaces all of theirs usages with `submodules()` function and range-based for-loops.
Differential Revision: https://reviews.llvm.org/D148954
Vlad Serebrennikov [Mon, 24 Apr 2023 08:52:31 +0000 (11:52 +0300)]
[clang] Mark CWG2009 as N/A
[[https://wg21.link/p1787 | P1787]]: CWG2331 is resolved by defining lookup from complete-class contexts and out-of-line member definitions. The rest of CWG2009 is resolved by making it ill-formed NDR for forward lookup outside a complete-class context to change the results (before overload resolution, to avoid differences in instantiation).
Wording: The result of the search is the declaration set of S(N, T). If it is an invalid set, the program is ill-formed. If it differs from the result of a search in T for N from immediately after the class-specifier of T, the program is ill-formed, no diagnostic required. ([class.member.lookup]/7)
Reviewed By: #clang-language-wg, shafik
Differential Revision: https://reviews.llvm.org/D148263
Joshua Cao [Mon, 24 Apr 2023 08:39:13 +0000 (01:39 -0700)]
Revert "[SCEV] Precise trip multiples"
This reverts commit
027a4c8b96c7f97df8e98b1dac069b956810ab94.
Sebastian Neubauer [Mon, 24 Apr 2023 08:34:59 +0000 (10:34 +0200)]
[llvm][ADT] Fix Any linker error with multiple compilers
Citing the comment in the source:
Define the type id and initialize with a non-zero value.
Initializing with a zero value means the variab can end up in either the
.data or the .bss section. This can lead to multiple definition linker
errors when some object files are compiled with a compiler that puts the
variable into .data but they are linked to object files from a different
compiler that put the variable into .bss. To prevent this issue from
happening, initialize the variable with a non-zero value, which forces
it to land in .data (because .bss is zero-initialized).
Fixes https://github.com/llvm/llvm-project/issues/62270
A regression of D139974.
Differential Revision: https://reviews.llvm.org/D148953
Alex Zinenko [Mon, 24 Apr 2023 07:33:51 +0000 (07:33 +0000)]
Drop MLIR Bazel dependency on LLVM Analysis
This is no longer necessary after
f5425c128a30 and significatly
decreases the build time and the binary footprint.
Reviewed By: Dinistro
Differential Revision: https://reviews.llvm.org/D149042
Nikita Popov [Fri, 21 Apr 2023 08:17:03 +0000 (10:17 +0200)]
[Pipelines] Don't run ForceFunctionAttrs post-link
This is effectively a debugging pass to adjust function attributes.
I don't think it makes sense to run it in the post-link pipeline.
Differential Revision: https://reviews.llvm.org/D148904
Mikhail Goncharov [Mon, 24 Apr 2023 07:35:06 +0000 (09:35 +0200)]
Joshua Cao [Tue, 11 Apr 2023 06:52:06 +0000 (23:52 -0700)]
[SCEV] Precise trip multiples
We currently have getMinTrailingZeros(), from which we can get a SCEV's
multiple by computing 1 << MinTrailingZeroes. However, this only gets us
multiples that are a power of 2. This patch introduces a way to get max
constant multiples that are not just a power of 2. The logic is similar
to that of getMinTrailingZeros. getMinTrailingZeros is replaced by
computing the max constant multiple, and counting the number of trailing
bits.
This is applied in two places:
1) Computing unsigned constant ranges. For example, if we have i8
{10,+,10}<nuw>, we know the max constant it can be is 250.
2) Computing trip multiples as shown in SCEV output. This is useful if
for example, we are unrolling a loop by a factor of 5, and we know
the trip multiple is 5, then we don't need a loop epilog.
If the code sees that a SCEV does not have <nuw>, it will fall back to
finding the max multiple that is a power of 2. Multiples that are a
power of 2 will still be a multiple even after the SCEV overflows.
Differential Revision: https://reviews.llvm.org/D141823
Joshua Cao [Fri, 14 Apr 2023 07:23:04 +0000 (00:23 -0700)]
[SCEV] Add trip multiple tests
Joshua Cao [Fri, 14 Apr 2023 07:01:44 +0000 (00:01 -0700)]
[SCEV] Add ranges tests
WANG Xuerui [Mon, 24 Apr 2023 07:18:46 +0000 (15:18 +0800)]
[Clang][Driver] Handle LoongArch multiarch tuples
This follows v1.00 of the [[ https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.html | LoongArch Toolchain Conventions ]],
but notably with [[ https://github.com/loongson/LoongArch-Documentation/pull/80 | this patch ]]
applied (a proper version bump to v2.00 was not done, so it is
indistinguishable from the "original" but now incompatible v1.00
otherwise).
Only `loongarch64` is implemented in `Linux::getMultiarchTriple`
because support for LA32 and ILP32* ABIs are incomplete right now.
The Debian sysroot layout is based on Han Gao's recent porting effort,
specifically the ghcr.io/rabenda/beige:loong64-v23-preview-
20230330
container image.
Reviewed By: SixWeining
Differential Revision: https://reviews.llvm.org/D142688
Jean Perier [Mon, 24 Apr 2023 07:04:57 +0000 (09:04 +0200)]
[flang] Turn on use-desc-for-alloc by default
Currently, local allocatables and contiguous/scalar pointers (and some
other conditions) are lowered to a set of independent variables in FIR
(one for the address, one for each bound and one for character length).
The intention was to help LLVM get rids of descriptors. But LLVM knows
how to do that anyway in those cases:
```
subroutine foo(x)
real, target :: x(100)
real, pointer, contiguous :: p(:)
p => x
call bar(p(50))
end subroutine
```
The output fir the option on or off is the same after llvm opt -O1,
there is no descriptor anymore, the indirection is removed.
```
define void @foo_(ptr %0) local_unnamed_addr {
%2 = getelementptr [100 x float], ptr %0, i64 0, i64 49
tail call void @bar_(ptr %2)
ret void
}
```
So the benefit of not using a descriptor in lowering is questionable,
and although it is abstracted as much as possible in the so called
MutableBoxValue class that represent allocatable/pointer in lowering
it is still causing bugs from time to time, and will also be a bit
problematic when emitting debug info for the pointer/allocatable.
In HLFIR lowering, the simplification to always use a descriptor in
lowering was already made. This patch allows decorrelating the impact
from this change from the bigger impact HLFIR will have so that it
is easier to get feedback if this causes performance issues.
The lowering tests relying on the previous behavior are only updated
to set back this option to true. The reason is that I think we should
preserve coverage of the code dealing with the "non descriptor" approach
in lowering until we actually get rid of it. The other reason is that
the test will have to be or are already covered by equivalent HLFIR
tests, which use descriptors.
Differential Revision: https://reviews.llvm.org/D148910
Craig Topper [Mon, 24 Apr 2023 06:28:23 +0000 (23:28 -0700)]
[TableGen] Make getRegisterValueType stricter about HwModes.
I don't think this code would work correctly if the register class
used used HwModes. Add asserts to make sure it's not used with HwModes.
Also fix a long outdated comment on the function.
zhanglimin [Mon, 24 Apr 2023 06:27:37 +0000 (14:27 +0800)]
[lsan][test] Obtaining page size using sysconf(_SC_PAGESIZE)
The effectiveness of the mprotect function depends on whether
the first argument is aligned to a page boundary. If mprotect
doesn't work, the kernel will not generate a SIGSEGV signal for
the process when the calling process tries to access memory in
a manner that violates the protection. If so, this test fails.
The problem for this test is that it uses a fixed 4 kB page size
and is aligned. This fails when the page size is not 4 kB. For
example, this fails on LoongArch which uses a 16 kB pagesize.
Reviewed By: SixWeining, xen0n, MaskRay, vitalybuka
Differential Revision: https://reviews.llvm.org/D148407
Christian Ulmann [Mon, 24 Apr 2023 06:20:46 +0000 (06:20 +0000)]
[LoopInfo] SFINAE mechanism for hoist into check
This commit introduces an SFINAE mechanism to make the LLVM hoist into
check member function not leak into the users of LoopInfo.
Depends on D148235
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D148504
Christian Ulmann [Mon, 24 Apr 2023 06:06:45 +0000 (06:06 +0000)]
[LoopInfo] Move generic LoopInfo into own files
This commit splits the generic part of `LoopInfo` into separate files.
These new `GenericLoopInfo` files are located in `llvm/Support` to be inline
with `GenericDomTree`.
Furthermore, this change ensures that MLIR's Bazel build does not have
to link against `LLVMAnalysis` just to use these template headers.
Depends on D148219
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D148235
Shengchen Kan [Mon, 24 Apr 2023 05:24:25 +0000 (13:24 +0800)]
[X86][tablgen] Fix typo in comments, NFC
Mehdi Amini [Sun, 23 Apr 2023 22:07:51 +0000 (16:07 -0600)]
Remove `-action` suffix from the tag defining an Action: it is redundant here
Differential Revision: https://reviews.llvm.org/D149036
Craig Topper [Mon, 24 Apr 2023 03:32:14 +0000 (20:32 -0700)]
[TableGen] Remove unused ForceMode and CodeGen fields from TypeInfer. NFC
As well as the ForceMode field in PatternToMatch.
Wang, Xin10 [Mon, 24 Apr 2023 00:45:43 +0000 (20:45 -0400)]
Clean come dead code
These codes deleted are dead code, we never go into it.
1. In AggressiveAntiDepBreaker.cpp, have assert AntiDepReg != 0.
2. IfConversion.cpp, Kind can only be one unique value, so isFalse && isRev
can never be true.
3. DAGCombiner.cpp, at line 3675, we have considered the condition like
```
// fold (sub x, c) -> (add x, -c)
if (N1C) {
return DAG.getNode(ISD::ADD, DL, VT, N0,
DAG.getConstant(-N1C->getAPIntValue(), DL, VT));
}
```
4. ScheduleDAGSDNodes.cpp, we have Latency > 1 at line 663
5. MasmParser.cpp, code exists in a switch-case block which decided by
the value FirstTokenKind, at line 1621, FirstTokenKind could only be
one of AsmToken::Dollar, AsmToken::At and AsmToken::Identifier.
Reviewed By: skan
Differential Revision: https://reviews.llvm.org/D148610
Fabian Tschopp [Sun, 23 Apr 2023 15:15:16 +0000 (17:15 +0200)]
[NFC] Fix typos in APFloat.h
represnted -> represented
Reviewed By: lattner
Differential Revision: https://reviews.llvm.org/D149031
Manna, Soumi [Sun, 23 Apr 2023 22:17:28 +0000 (18:17 -0400)]
[NFC][clang] Fix static analyzer concerns
Reported by Coverity:
AUTO_CAUSES_COPY
Unnecessary object copies can affect performance.
1. Inside "SemaDeclCXX.cpp" file, in <unnamed>::DiagnoseUninitializedFields(clang::Sema &, clang::CXXConstructorDecl const *): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.
2. Inside "ClangAttrEmitter.cpp" file, in clang::EmitClangAttrParsedAttrImpl(llvm::RecordKeeper &, llvm::raw_ostream &): Using the auto keyword without an & causes the copy of an object of type pair.
3. Inside "Marshallers.h" file, in clang::ast_matchers::dynamic::internal::MapAnyOfBuilderDescriptor::buildMatcherCtor(clang::ast_matchers::dynamic::SourceRange, llvm::ArrayRef<clang::ast_matchers::dynamic::ParserValue>, clang::ast_matchers::dynamic::Diagnostics *): Using the auto keyword without an & causes the copy of an object of type ParserValue.
4. Inside "CGVTables.cpp" file, in clang::CodeGen::CodeGenModule::GetVCallVisibilityLevel(clang::CXXRecordDecl const *, llvm::DenseSet<clang::CXXRecordDecl const *, llvm::DenseMapInfo<clang::CXXRecordDecl const *, void>> &): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.
5. Inside "ASTContext.cpp" file, in hasTemplateSpecializationInEncodedString(clang::Type const *, bool): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.
6. Inside "ComputeDependence.cpp" file, in clang::computeDependence(clang::DependentScopeDeclRefExpr *): Using the auto keyword without an & causes the copy of an object of type TemplateArgumentLoc.
Reviewed By: tahonermann, erichkeane
Differential Revision: https://reviews.llvm.org/D148812
Teresa Johnson [Sun, 23 Apr 2023 22:00:18 +0000 (15:00 -0700)]
[MemProf] Don't use constexpr via lambda capture due to MSVC issues (NFC)
Modifies
a104e27030587507a711cef0e2b0ddb447fe68fe slightly to switch a
constexpr used via a lambda capture to a const, due to issues with MSVC.
See https://reviews.llvm.org/D140949#inline-1438809 for context.
Fangrui Song [Sun, 23 Apr 2023 21:58:46 +0000 (14:58 -0700)]
[test] Simplify libunwind REQUIRES
Haojian Wu [Sun, 23 Apr 2023 21:54:29 +0000 (23:54 +0200)]
Daniel Kiss [Sun, 23 Apr 2023 21:16:11 +0000 (23:16 +0200)]
[lld][AArch64] Add BTI landing pad to PLT when it is accessed by a range extension thunk.
Adding BTI to those PLT's which accessed with by a range extension thunk due to those preform an indirect call.
Fixes: #62140
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D148704
Simon Pilgrim [Sun, 23 Apr 2023 20:48:25 +0000 (21:48 +0100)]
[CostModel][X86] getMemoryOpCost - increase cost of sub-32-bit vector load/stores
For 8-bit/16-bit vector loads/stores we scalarize and transfer to/from the vector unit, or use the (usually slow) PINSR/PEXTR instructions.
Fixes #59867
Simon Pilgrim [Sun, 23 Apr 2023 20:20:44 +0000 (21:20 +0100)]
[SLP][X86] Add test coverage for Issue #59867
Fangrui Song [Sun, 23 Apr 2023 18:55:12 +0000 (11:55 -0700)]
Remove ExplicitEmulatedTLS and simplify -femulated-tls handling
Currently clangDriver passes -femulated-tls and -fno-emulated-tls to cc1.
cc1 forwards the option to LLVMCodeGen and ExplicitEmulatedTLS is used
to decide the value. Simplify this by moving the Clang decision to
clangDriver and moving the LLVM decision to InitTargetOptionsFromCodeGenFlags.
Hanhan Wang [Thu, 20 Apr 2023 21:46:40 +0000 (14:46 -0700)]
[mlir][Vector] Add 16x16 strategy to vector.transpose lowering.
It adds a `shuffle_16x16` strategy LowerVectorTranspose and renames `shuffle` to `shuffle_1d`. The idea is similar to 8x8 cases in x86Vector::avx2. The general algorithm is:
```
interleave 32-bit lanes using
8x _mm512_unpacklo_epi32
8x _mm512_unpackhi_epi32
interleave 64-bit lanes using
8x _mm512_unpacklo_epi64
8x _mm512_unpackhi_epi64
permute 128-bit lanes using
16x _mm512_shuffle_i32x4
permute 256-bit lanes using again
16x _mm512_shuffle_i32x4
```
After the first stage, they got transposed to
```
0 16 1 17 4 20 5 21 8 24 9 25 12 28 13 29
2 18 3 19 6 22 7 23 10 26 11 27 14 30 15 31
32 48 33 49 ...
34 50 35 51 ...
64 80 65 81 ...
...
```
After the second stage, they got transposed to
```
0 16 32 48 ...
1 17 33 49 ...
2 18 34 49 ...
3 19 35 51 ...
64 80 96 112 ...
65 81 97 114 ...
66 82 98 113 ...
67 83 99 115 ...
...
```
After the thrid stage, they got transposed to
```
0 16 32 48 8 24 40 56 64 80 96 112 ...
1 17 33 49 ...
2 18 34 50 ...
3 19 35 51 ...
4 20 36 52 ...
5 21 37 53 ...
6 22 38 54 ...
7 23 39 55 ...
128 144 160 176 ...
129 145 161 177 ...
...
```
After the last stage, they got transposed to
```
0 16 32 48 64 80 96 112 ... 240
1 17 33 49 66 81 97 113 ... 241
2 18 34 50 67 82 98 114 ... 242
...
15 31 47 63 79 96 111 127 ... 255
```
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D148685
Simon Pilgrim [Sun, 23 Apr 2023 17:39:45 +0000 (18:39 +0100)]
[X86] Add DAG test coverage for Issue #59867 patterns