Sockke [Fri, 25 Feb 2022 06:44:26 +0000 (14:44 +0800)]
[clang-tidy] Fix `readability-non-const-parameter` for parameter referenced by an lvalue
The checker missed a check for a case when the parameter is referenced by an lvalue and this could cause build breakages.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D117090
Chenbing Zheng [Fri, 25 Feb 2022 06:44:25 +0000 (14:44 +0800)]
[RISCV] DAG Combine vcpop and vfirst with VL=0 to li imm
vcpop and vfirst are still useful when VL=0.
vcpop equivalents to li 0 and vfirst equivalents to li -1,
since no mask elements are active.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D120302
Zakk Chen [Fri, 25 Feb 2022 03:04:24 +0000 (19:04 -0800)]
[RISCV] Update computeTargetABI from llc as well as clang
Clang computes the default ABI if -mabi is empty
and encode it in LLVM IR module flag since D105555.
For correctness, llc need to give the same target-abi
(Options.MCOptions.ABIName) with ABI encoded in IR.
The getSubtargetImpl already has a check for them only if
Options.MCOptions.ABIName is not empty.
In order to get more robustness we could have a check for
explicit ABI, but now we have two different logic to
compute the default ABI.
The front-end ABI is defautl to the ilp32/ilp32e/lp64, and
ilp32d/lp64d when hardware support for extension D.
The backend ABI is default to the ilp32/ilp32e/lp64.
Reviewed by: asb, jrtc27
Differential Revision: https://reviews.llvm.org/D118333
Anton Afanasyev [Fri, 25 Feb 2022 05:04:11 +0000 (08:04 +0300)]
[AggressiveInstCombine] Fix `TruncInstCombine` (fix
f84d732f)
Erase phi-nodes from `InstInfoMap` before erasing themselves
Anton Afanasyev [Wed, 15 Sep 2021 06:19:53 +0000 (09:19 +0300)]
[AggressiveInstCombine] Add `phi` nodes support to `TruncInstCombine`
Expand `TruncInstCombine` to handle loops by adding `phi` nodes
to expression graph.
Reviewed by: RKSimon, lebedev.ri
(recommit of fixed
f84d732f, reverted by 8ad6d5e after sanitizer breakage)
Differential Revision: https://reviews.llvm.org/D109817
Shangwu Yao [Fri, 25 Feb 2022 04:51:43 +0000 (20:51 -0800)]
[CUDA][SPIRV] Assign global address space to CUDA kernel arguments
(resubmit https://reviews.llvm.org/D119207 after fixing the test for
some build settings)
This patch converts CUDA pointer kernel arguments with default address
space to CrossWorkGroup address space (__global in OpenCL). This is
because Generic or Function (OpenCL's private) is not supported as
storage class for kernel pointer types.
Differential revision: https://reviews.llvm.org/D120366
Raúl Peñacoba [Fri, 25 Feb 2022 04:41:02 +0000 (04:41 +0000)]
[Driver] Support GCC detection for GCC compiled with --enable-version-specific-runtime-libs
GCC's compiled with --enable-version-specific-runtime-libs change the paths where includes and libs are found.
This patch adds support for these cases
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D118700
Vitaly Buka [Fri, 25 Feb 2022 04:18:56 +0000 (20:18 -0800)]
[sanitizer] Don't collect unused info
Fangrui Song [Fri, 25 Feb 2022 04:05:59 +0000 (20:05 -0800)]
[ELF] Parallelize initializeLocalSymbols
ObjFile::parse combines symbol initialization and resolution. Many tasks
unrelated to symbol resolution can be postponed and parallelized. This patch
extracts local symbol initialization and parallelizes it.
Technically the new function initializeLocalSymbols can be merged into
ObjFile::postParse, but functions like getSrcMsg may access the
uninitialized (all nullptr) local part of InputFile::symbols.
Linking chrome: 1.02x as fast with glibc malloc, 1.04x as fast with mimalloc
Reviewed By: ikudrin
Differential Revision: https://reviews.llvm.org/D119909
Vasileios Porpodas [Thu, 24 Feb 2022 02:04:36 +0000 (18:04 -0800)]
[SLP] Fix for the min/max intrinsic cost.
The min/max intrinsic cost is currently too low because in the cost calculation
we subtract the cost of the vector compare as we will not emit it.
For the cost of the vector compare we are currently passing BAD_ICMP_PREDICATE
which returns 3, the worst case cost.
I think we should be passing VecPred instead, since we know the predicates of
the compare instr.
I think this is related to commit
b3b993a7ad817 which introduced the predicate
argument to getCmpSelInstrCost().
https://reviews.llvm.org/rGb3b993a7ad817c3c5801341fa78f34332900eb83
Differential Revision: https://reviews.llvm.org/D120439
Vasileios Porpodas [Thu, 24 Feb 2022 02:03:20 +0000 (18:03 -0800)]
[SLP][NFC] Test for a follow-up fix of the the vector min/max instrinsic cost calculation.
The code in this test should not have been vectorized.
It looks worse than the scalar code.
Differential Revision: https://reviews.llvm.org/D120438
lian wang [Wed, 16 Feb 2022 01:59:50 +0000 (01:59 +0000)]
[RISCV] Add schedule class for Zbt extension
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D119808
Xiaodong Liu [Fri, 25 Feb 2022 01:42:19 +0000 (09:42 +0800)]
[sanitizer] Enable trace pc guard coverage test on PPC64/s390x/MIPS
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D120472
Carl Ritson [Fri, 25 Feb 2022 00:42:55 +0000 (09:42 +0900)]
[AMDGPU] Extend pre-emit peephole to redundantly masked VCC
Extend pre-emit peephole for S_CBRANCH_VCC[N]Z to eliminate
redundant S_AND operations against EXEC for V_CMP results in VCC.
These occur after after register allocation when VCC has been
selected as the comparison destination.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D120202
Harald van Dijk [Fri, 25 Feb 2022 00:58:50 +0000 (00:58 +0000)]
[ADT, CSSPGO] Specify set comparer
In _GLIBCXX_DEBUG builds, potentially implicitly enabled by
LLVM_ENABLE_EXPENSIVE_CHECKS, std::set<A, B>::iterator and
std::set<A, C>::iterator are distinct types that are not
interconvertible. This change aligns the iterator types with the set
types.
Reviewed By: hoy
Differential Revision: https://reviews.llvm.org/D119798
Corentin Jabot [Fri, 25 Feb 2022 00:54:00 +0000 (19:54 -0500)]
[libc++] Make sure calls to std::move are always qualified
This fixes instances of the newly added `-Wunqualified-std-cast-call`.
(Commit
7853371146 removed unqualified `move` from the tests,
but these unqualified `move`s remained undetected in the actual headers.)
Differential Revision: https://reviews.llvm.org/D120509
Arthur Eubanks [Fri, 25 Feb 2022 00:54:18 +0000 (16:54 -0800)]
[OpaquePtr][AArch64] Use load/store value type instead of pointer type for ldnt1/stnt1 alignment
Daniel Thornburgh [Tue, 15 Feb 2022 22:21:14 +0000 (22:21 +0000)]
[Debuginfod] Add BUILD_ID syntax to llvm-symbolizer.
This adds a BUILD_ID prefix to the llvm-symbolizer stdin and argument
syntax. The prefix causes the given binary name to be interpreted as a
build ID instead of an object file path. The semantics are analagous to
the behavior of --obj and --build-id.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D119901
Qihan Cai [Thu, 24 Feb 2022 22:13:51 +0000 (09:13 +1100)]
[RISCV] Change rvv version to 1.0 and remove ratify notice
This patch changes the version of V extension from 0.1 to 1.0 in RISCVInstrInfoVPseudos.td, RISCVInstrInfoVSDPatterns.td, RISCVInstrInfoVVLPatterns.td, RISCVInstrInfoV.td
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D120525
Fangrui Song [Fri, 25 Feb 2022 00:34:05 +0000 (00:34 +0000)]
[Driver][test] Make linux-ld.c work with CLANG_DEFAULT_PIE_ON_LINUX=on
Daniel Thornburgh [Tue, 8 Feb 2022 22:07:14 +0000 (22:07 +0000)]
[Symbolize] LRU cache binaries in llvm-symbolizer.
This change adds a simple LRU cache to the Symbolize class to put a cap
on llvm-symbolizer memory usage. Previously, the Symbolizer's virtual
memory footprint would grow without bound as additional binaries were
referenced.
I'm putting this out there early for an informal review, since there may be
a dramatically different/better way to go about this. I still need to
figure out a good default constant for the memory cap and benchmark the
implementation against a large symbolization workload. Right now I've
pegged max memory usage at zero for testing purposes, which evicts the whole
cache every time.
Unfortunately, it looks like StringRefs in the returned DI objects can
directly refer to the contents of binaries. Accordingly, the cache
pruning must be explicitly requested by the caller, as the caller must
guarantee that none of the returned objects will be used afterwards.
For llvm-symbolizer this a light burden; symbolization occurs
line-by-line, and the returned objects are discarded after each.
Implementation wise, there are a number of nested caches that depend
on one another. I've implemented a simple Evictor callback system to
allow derived caches to register eviction actions to occur when the
underlying binaries are evicted.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D119784
Ben Shi [Thu, 24 Feb 2022 11:23:05 +0000 (11:23 +0000)]
[clang][NFC] Move all avr CodeGen tests to avr specific directory
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D120468
Fangrui Song [Fri, 25 Feb 2022 00:22:12 +0000 (00:22 +0000)]
[Driver] Default CLANG_DEFAULT_PIE_ON_LINUX to ON
Default the option introduced in D113372 to ON to match all(?) major Linux
distros. This matches GCC and improves consistency with Android and linux-musl
which always default to PIE.
Note: CLANG_DEFAULT_PIE_ON_LINUX will be removed in the future.
Reviewed By: thesamesam
Differential Revision: https://reviews.llvm.org/D120305
Fangrui Song [Fri, 25 Feb 2022 00:09:18 +0000 (16:09 -0800)]
[asan][test] asan_prelink_test.cpp: use -fno-pie -no-pie
prelink (will be removed by glibc 2.37) does not support PIE.
Fangrui Song [Fri, 25 Feb 2022 00:04:07 +0000 (00:04 +0000)]
[Driver][test] Remove soon irrelevant pie tests
CLANG_DEFAULT_PIE_ON_LINUX=on will soon become the default. The purpose
of these tests has gone.
Fangrui Song [Thu, 24 Feb 2022 23:53:38 +0000 (23:53 +0000)]
[Driver][test] Make hexagon-toolchain-elf.c work with CLANG_DEFAULT_PIE_ON_LINUX=on
Nico Weber [Thu, 24 Feb 2022 23:50:08 +0000 (18:50 -0500)]
.mailmap: remove stray space in comment
Fangrui Song [Thu, 24 Feb 2022 23:25:35 +0000 (15:25 -0800)]
[clang][test] Make mips-vector-return.c work with CLANG_DEFAULT_PIE_ON_LINUX=on
Craig Topper [Thu, 24 Feb 2022 23:09:20 +0000 (15:09 -0800)]
[RISCV] Add 'i64' to some isel so tablegen will remove them for RV32. NFC
Saves a 100 bytes or so from the isel table.
Michael Wyman [Wed, 23 Feb 2022 18:47:16 +0000 (10:47 -0800)]
Clang `unused-but-set-variable` warnings should not apply to `__attribute__((objc_precise_lifetime))` Objective-C pointers
The `objc_precise_lifetime` attribute is applied to Objective-C pointers to ensure the optimizer does not prematurely release an object under Automatic Reference Counting (ARC). It is a common enough pattern to assign values to these variables but not reference them otherwise, and annotating them with `__unused` is not really correct as they are being used to ensure an object's lifetime.
Differential Revision: https://reviews.llvm.org/D120372
Fangrui Song [Thu, 24 Feb 2022 22:09:00 +0000 (14:09 -0800)]
[ELF] Update comment. NFC
Fangrui Song [Thu, 24 Feb 2022 22:08:06 +0000 (14:08 -0800)]
[ELF] Simplify resolveDefined and resolveCommon
This is NFC for valid input (COMMON symbols cannot be weak or versioned).
Rahman Lavaee [Thu, 24 Feb 2022 20:29:08 +0000 (12:29 -0800)]
Revert "Encode address offsets of basic blocks relative to the end of the previous basic blocks."
This reverts commit
029283c1c0d8d06fbf000f5682c56b8595a1101f.
The code in `ELFFile::decodeBBAddrMap` was not changed in the submitted patch.
Differential Revision: https://reviews.llvm.org/D120457
Reid Kleckner [Thu, 24 Feb 2022 21:12:48 +0000 (13:12 -0800)]
[lld/MachO] Fix +asserts build after recent change
Sanjay Patel [Thu, 24 Feb 2022 20:42:30 +0000 (15:42 -0500)]
[AArch64][x86] add tests for bitwise logic + shifts; NFC
Craig Topper [Thu, 24 Feb 2022 20:36:33 +0000 (12:36 -0800)]
[RISCV] Add tests for (neg (abs X)) where the abs has an additional user.
Fangrui Song [Thu, 24 Feb 2022 20:54:16 +0000 (12:54 -0800)]
[ELF][test] Remove invalid weak COMMON tests
GNU as reports `Error: symbol `foo' can not be both weak and common`,
though LLVM integrated assembler does not report an error yet.
Yitzhak Mandelbaum [Thu, 24 Feb 2022 20:02:00 +0000 (20:02 +0000)]
[clang][dataflow] Add limits to size of modeled data structures in environment.
Adds two new parameters to control the size of data structures modeled in the environment: # of values and depth of data structure. The environment already prevents creation of recursive data structures, but that was insufficient in practice. Very large structs still ground the analysis to a halt. These new parameters allow tuning the size more effectively.
In this patch, the parameters are set as internal constants. We leave to a future patch to make these proper model parameters.
Differential Revision: https://reviews.llvm.org/D120510
Jez Ng [Thu, 24 Feb 2022 20:39:59 +0000 (15:39 -0500)]
[lld-macho] Implement -why_live (without perf overhead)
This was based off @thakis' draft in {D103517}. I employed templates to ensure
the support for `-why_live` wouldn't slow down the regular non-why-live code
path.
No stat sig perf difference on my 3.2 GHz 16-Core Intel Xeon W:
base diff difference (95% CI)
sys_time 1.195 ± 0.015 1.199 ± 0.022 [ -0.4% .. +1.0%]
user_time 3.716 ± 0.022 3.701 ± 0.025 [ -0.7% .. -0.1%]
wall_time 4.606 ± 0.034 4.597 ± 0.046 [ -0.6% .. +0.2%]
samples 44 37
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D120377
Aaron Ballman [Thu, 24 Feb 2022 20:41:25 +0000 (15:41 -0500)]
Fix typo in file name; NFC
Aaron Ballman [Thu, 24 Feb 2022 20:30:30 +0000 (15:30 -0500)]
Add -Wno-strict-prototypes to C tests; NFC
This patch adds -Wno-strict-prototypes to all of the test cases that
use functions without prototypes, but not as the primary concern of the
test. e.g., attributes testing whether they can/cannot be applied to a
function without a prototype, etc.
This is done in preparation for enabling -Wstrict-prototypes by
default.
Aaron Ballman [Thu, 24 Feb 2022 20:27:07 +0000 (15:27 -0500)]
Use functions with prototypes when appropriate; NFC
A significant number of our tests in C accidentally use functions
without prototypes. This patch converts the function signatures to have
a prototype for the situations where the test is not specific to K&R C
declarations. e.g.,
void func();
becomes
void func(void);
This is the final batch of tests being updated to add prototypes,
hopefully.
Valentin Clement [Thu, 24 Feb 2022 20:09:40 +0000 (21:09 +0100)]
[flang] Simple array assignment lowering
This patch handles lowering of simple array assignment.
```
a(:) = 10
```
or
```
a(1) = 1
```
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld, schweitz
Differential Revision: https://reviews.llvm.org/D120501
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Jay Foad [Mon, 14 Feb 2022 09:51:56 +0000 (09:51 +0000)]
[AMDGPU] Divergence-driven instruction selection for bitreverse
Differential Revision: https://reviews.llvm.org/D119702
Fangrui Song [Thu, 24 Feb 2022 20:21:40 +0000 (12:21 -0800)]
[ELF] Simplify --fortran-common. NFC
Fangrui Song [Thu, 24 Feb 2022 20:20:05 +0000 (12:20 -0800)]
[ELF] De-template Symbol::resolveLazy. NFC
Damian Rouson [Fri, 12 Nov 2021 00:24:01 +0000 (16:24 -0800)]
[flang] add semantics tests for sync team
Test a range of acceptable forms of SYNC TEAM statements,
including combinations with and without the stat-variable
and errmsg-variable present. Also test that several invalid
forms of SYNC TEAM call generate the correct error messages.
Differential Revision: https://reviews.llvm.org/D120099
Alexey Bataev [Thu, 24 Feb 2022 20:04:39 +0000 (12:04 -0800)]
Revert "[OPENMP]Fix PR50347: Mapping of global scope deep object fails."
This reverts commit
638938117aeae5518d6cacd066ffd9830ef4fc9a. Need to
fix reported fail https://lab.llvm.org/buildbot/#/builders/193/builds/7496
Alexey Bataev [Thu, 1 Jul 2021 11:16:56 +0000 (04:16 -0700)]
[OPENMP]Fix PR50347: Mapping of global scope deep object fails.
Changed the we handle llvm::Constants in sizes arrays. ConstExprs and
GlobalValues cannot be used as initializers, need to put them at the
runtime, otherwise there wight be the compilation errors.
Differential Revision: https://reviews.llvm.org/D105297
Yuanfang Chen [Thu, 24 Feb 2022 19:46:37 +0000 (11:46 -0800)]
[CMake][WinMsvc] Replace MSVC_BASE/WINSDK_BASE with LLVM_WINSYSROOT
- Using LLVM_WINSYSROOT would pick up DIA SDK path automatically,
otherwise llvm-pdbutil has no DIA support.
- Add MSVC_VER to specify VC tools version.
- Make MSVC_VER/WINSDK_VER optional. If not specified, use the highest
version number like the driver does.
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D117852
Simon Pilgrim [Thu, 24 Feb 2022 19:18:37 +0000 (19:18 +0000)]
[DAG] Attempt to fold bswap(shl(x,c)) -> zext(bswap(trunc(shl(x,c-bw/2))))
If the shl is at least half the bitwidth (i.e. the lower half of the bswap source is zero), then we can reduce the shift and perform the bswap at half the bitwidth and just zero extend.
Based off PR51391 + PR53867
Differential Revision: https://reviews.llvm.org/D120192
David Green [Thu, 24 Feb 2022 19:33:45 +0000 (19:33 +0000)]
[AArch64] Regenerate dp1.ll test, NFC
The old check lines were not showing enough congtext to show issues.
Regenerate the test with theua auto-check lines to be clearer.
Fangrui Song [Thu, 24 Feb 2022 19:31:58 +0000 (11:31 -0800)]
[ELF] Set config->exportDynamic to true if config->shared. NFC
Stanislav Mekhanoshin [Tue, 22 Feb 2022 20:26:41 +0000 (12:26 -0800)]
[AMDGPU] Extend SILoadStoreOptimizer to handle global stores
TODO: merge flat load/stores.
TODO: merge flat with global promoting to flat.
Differential Revision: https://reviews.llvm.org/D120346
Damian Rouson [Fri, 12 Nov 2021 00:22:38 +0000 (16:22 -0800)]
[flang] add semantics test for sync memory
Test a range of acceptable forms of SYNC MEMORY statements,
including combinations with and without the stat-variable
and errmsg-variable present. Also test that several invalid
forms of SYNC MEMORY call generate the correct error messages.
Differential Revision: https://reviews.llvm.org/D120097
Momchil Velikov [Thu, 24 Feb 2022 18:36:37 +0000 (18:36 +0000)]
[AArch64] Async unwind - Always place the first LDP at the end when ReverseCSRRestoreSeq is true
This patch is in preparation for the async unwind CFI.
Put the first `LDP` the end, so that the load-store optimizer can run
and merge the `LDP` and the `ADD` into a post-index `LDP`.
Do this always and as early as at the time of the initial creation of
the CSR restore instructions, even if that `LDP` is not guaranteed to
be mergeable with a subsequent `SP` increment.
This greatly simplifies the CFI generation for prologue, as otherwise
we have to take extra steps to ensure reordering does not cross CFI
instructions.
Reviewed By: danielkiss
Differential Revision: https://reviews.llvm.org/D112328
Stanislav Mekhanoshin [Wed, 23 Feb 2022 00:33:06 +0000 (16:33 -0800)]
[AMDGPU] Fix combined MMO in load-store merge
Loads and stores can be out of order in the SILoadStoreOptimizer.
When combining MachineMemOperands of two instructions operands are
sent in the IR order into the combineKnownAdjacentMMOs. At the
moment it picks the first operand and just replaces its offset and
size. This essentially loses alignment information and may generally
result in an incorrect base pointer to be used.
Use a base pointer in memory addresses order instead and only adjust
size.
Differential Revision: https://reviews.llvm.org/D120370
Amir Ayupov [Wed, 16 Feb 2022 01:27:31 +0000 (17:27 -0800)]
[X86] Introduce x86-cmov-converter-force-all
Introduce an option to expand all CMOV groups into hammocks, matching GCC's
`-fno-if-conversion2` flag. The motivation is to leave CMOV conversion
opportunities to a binary optimizer that can make the decision based on branch
misprediction rate (available e.g. in Intel's LBR).
Reviewed By: MaskRay, skan
Differential Revision: https://reviews.llvm.org/D119777
Benjamin Kramer [Thu, 24 Feb 2022 18:30:50 +0000 (19:30 +0100)]
[tblgen] Compress CompositeSequences to 1/8th of its size. NFCI.
Craig Topper [Thu, 24 Feb 2022 18:15:07 +0000 (10:15 -0800)]
[RISCV] Add Zbb RUN lines to neg-abs.ll.
Momchil Velikov [Thu, 24 Feb 2022 17:36:19 +0000 (17:36 +0000)]
[AArch64] Async unwind - helper functions to decide on CFI emission
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D112327
Fangrui Song [Thu, 24 Feb 2022 18:06:11 +0000 (10:06 -0800)]
[analyzer] Just use default capture after
7fd60ee6e0a87957a718297a4a42d9881fc561e3
Thomas Raoux [Wed, 16 Feb 2022 07:49:32 +0000 (23:49 -0800)]
[mlir][memref] Add transformation to do loop multi-buffering
This transformation is useful to break dependency between consecutive loop
iterations by increasing the size of a temporary buffer. This is usually
combined with heavy software pipelining.
Differential Revision: https://reviews.llvm.org/D119406
Craig Topper [Thu, 24 Feb 2022 17:23:14 +0000 (09:23 -0800)]
[RISCV] Update some tests to use floating point ABI where it makes sense.
Trying to reduce the diffs from D118333 for cases where it makes
more sense to use an FP ABI.
Reviewed By: asb, kito-cheng
Differential Revision: https://reviews.llvm.org/D120447
Momchil Velikov [Thu, 24 Feb 2022 16:08:14 +0000 (16:08 +0000)]
[AArch64] Async unwind - do not schedule frame setup/destroy
The PostRA scheduler can reorder non-CFI instructions in a way that
makes the unwind info not instruction precise.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D112326
Craig Topper [Thu, 24 Feb 2022 17:18:48 +0000 (09:18 -0800)]
[RISCV] Fold (sext_inreg (fmv_x_anyexth X), i16) -> (fmv_x_signexth X).
Add a new ISD opcode to represent the sign extending behavior of
vmv.x.h. Keep the previous anyext opcode to allow the existing
(fmv_x_anyexth (fmv_h_x X)) combine to keep working without needing
to generate a sign extend.
For fmv.x.w we are able to match the sext_inreg in an isel pattern,
but a 16-bit sext_inreg is lowered to a shift pair before isel. This
seemed like a larger match than we should do in isel.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D118974
Valentin Clement [Thu, 24 Feb 2022 17:11:41 +0000 (18:11 +0100)]
[flang] Lower allocatable assignment for scalar
Add lowering for simple assignement on allocatable
scalars.
This patch is part of the upstreaming effort from fir-dev branch.
Depends on D120483
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D120488
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Stanislav Gatev [Wed, 23 Feb 2022 15:39:26 +0000 (15:39 +0000)]
[clang][dataflow] Update StructValue child when assigning a value
When assigning a value to a storage location of a struct member we
need to also update the value in the corresponding `StructValue`.
This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.
Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D120414
Sven van Haastregt [Thu, 24 Feb 2022 16:28:52 +0000 (16:28 +0000)]
[clang-tidy] Remove opencl-c.h inclusion from tests
After D120254 some clang-tidy tests started failing on release builds.
clang-tidy has been using the `-fdeclare-opencl-builtins` functionality
since this became the default in clang, so there is no need to include
`opencl-c.h`.
Differential Revision: https://reviews.llvm.org/D120470
Sanjay Patel [Thu, 24 Feb 2022 16:09:57 +0000 (11:09 -0500)]
[SDAG] remove shift that is redundant with part of funnel shift
This is the SDAG translation of D120253 :
https://alive2.llvm.org/ce/z/qHpmNn
The SDAG nodes can have different operand types than the result value.
We can see an example of that with AArch64 - the funnel shift amount
is an i64 rather than i32.
We may need to make that match even more flexible to handle
post-legalization nodes, but I have not stepped into that yet.
Differential Revision: https://reviews.llvm.org/D120264
Valentin Clement [Thu, 24 Feb 2022 16:16:02 +0000 (17:16 +0100)]
[flang] Handle allocatable dummy arguments
This patch handles allocatable dummy argument lowering
in function and subroutines.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: schweitz
Differential Revision: https://reviews.llvm.org/D120483
Co-authored-by: Jean Perier <jperier@nvidia.com>
Anton Korobeynikov [Thu, 24 Feb 2022 16:03:21 +0000 (19:03 +0300)]
Disable Mailgun click tracking
Aaron Ballman [Thu, 24 Feb 2022 16:00:40 +0000 (11:00 -0500)]
Remove useless RUN lines in the middle of the file and pipe to FileCheck; NFC
Joseph Huber [Thu, 24 Feb 2022 15:24:39 +0000 (10:24 -0500)]
[OpenMP] Make section variable external to prevent collisions
Summary:
We use a section to embed offloading code into the host for later
linking. This is normally unique to the translation unit as it is thrown
away during linking. However, if the user performs a relocatable link
the sections will be merged and we won't be able to access the files
stored inside. This patch changes the section variables to have external
linkage and a name defined by the section name, so if two sections are
combined during linking we get an error.
Sanjay Patel [Thu, 24 Feb 2022 15:20:18 +0000 (10:20 -0500)]
[InstCombine] try harder to preserve 'nsz' in fneg-of-select transform
The corner case where 'nsz' needs to be removed is very narrow
as discussed here:
https://reviews.llvm.org/rG3cdd05e519dd
If the select condition is not undef, there's no problem with
propagating 'nsz':
https://alive2.llvm.org/ce/z/4GWJdq
Sanjay Patel [Thu, 24 Feb 2022 15:19:23 +0000 (10:19 -0500)]
[InstCombine] add test for fneg of select with FMF; NFC
Jay Foad [Wed, 23 Feb 2022 11:35:55 +0000 (11:35 +0000)]
[MIRParser] Diagnose too large align values in MachineMemOperands
When parsing MachineMemOperands, MIRParser treated the "align" keyword
the same as "basealign". Really "basealign" should specify the
alignment of the MachinePointerInfo base value, and "align" should
specify the alignment of that base value plus the offset.
This worked OK when the specified alignment was no larger than the
alignment of the offset, but in cases like this it just caused
confusion:
STW killed %18, 4, %stack.1.ap2.i.i :: (store (s32) into %stack.1.ap2.i.i + 4, align 8)
MIRPrinter would never have printed this, with an offset of 4 but an
align of 8, so it must have been written by hand. MIRParser would
interpret "align 8" as "basealign 8", but I think it is better to give
an error and force the user to write "basealign 8" if that is what they
really meant.
Differential Revision: https://reviews.llvm.org/D120400
Change-Id: I7eeeefc55c2df3554ba8d89f8809a2f45ada32d8
Marius Brehler [Thu, 17 Feb 2022 09:57:09 +0000 (09:57 +0000)]
[mlir][emitc] Add a variable op
This adds a variable op, emitted as C/C++ locale variable, which can be
used if the `emitc.constant` op is not sufficient.
As an example, the canonicalization pass would transform
```mlir
%0 = "emitc.constant"() {value = 0 : i32} : () -> i32
%1 = "emitc.constant"() {value = 0 : i32} : () -> i32
%2 = emitc.apply "&"(%0) : (i32) -> !emitc.ptr<i32>
%3 = emitc.apply "&"(%1) : (i32) -> !emitc.ptr<i32>
emitc.call "write"(%2, %3) : (!emitc.ptr<i32>, !emitc.ptr<i32>) -> ()
```
into
```mlir
%0 = "emitc.constant"() {value = 0 : i32} : () -> i32
%1 = emitc.apply "&"(%0) : (i32) -> !emitc.ptr<i32>
%2 = emitc.apply "&"(%0) : (i32) -> !emitc.ptr<i32>
emitc.call "write"(%1, %2) : (!emitc.ptr<i32>, !emitc.ptr<i32>) -> ()
```
resulting in pointer aliasing, as %1 and %2 point to the same address.
In such a case, the `emitc.variable` operation can be used instead.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D120098
Corentin Jabot [Thu, 24 Feb 2022 15:00:44 +0000 (07:00 -0800)]
[clang] Warn on unqualified calls to std::move and std::forward
This adds a diagnostic when an unqualified call is resolved
to std::move or std::forward.
This follows some C++ committee discussions where some
people where concerns that this might be an usual anti pattern
particularly britle worth warning about - both because move
is a common name and because these functions accept any values.
This warns inconditionnally of whether the current context is in
std:: or not, as implementations probably want to always qualify
these calls too, to avoid triggering adl accidentally.
Differential Revision: https://reviews.llvm.org/D119670
Sven van Haastregt [Thu, 24 Feb 2022 15:17:24 +0000 (15:17 +0000)]
[OpenCL] Handle TypeExtensions in OpenCLBuiltinFileEmitter
Until now, any types that had TypeExtensions attached to them were not
guarded with those extensions. Extend the OpenCLBuiltinFileEmitter
such that all required extensions are emitted for the types of a
builtin function.
The `clang-tblgen -gen-clang-opencl-builtin-tests` emitter will now
produce e.g.:
#if defined(cl_khr_fp16) && defined(cl_khr_fp64)
half8 test11802_convert_half8_rtp(double8 arg1) {
return convert_half8_rtp(arg1);
}
#endif // TypeExtension
Differential Revision: https://reviews.llvm.org/D120262
Florian Hahn [Thu, 24 Feb 2022 14:51:43 +0000 (14:51 +0000)]
[AArch64] Simplify and extend tests added in
0c5ea01b20623e40.
Simon Pilgrim [Thu, 24 Feb 2022 14:14:08 +0000 (14:14 +0000)]
[X86] LowerRotate - enable v8i16 ROTL/ROTR on all pre-SSE41 targets
We're still better off expanding this once we have PMOVZX
Simon Pilgrim [Thu, 24 Feb 2022 13:51:51 +0000 (13:51 +0000)]
[X86] SimplifyDemandedVectorEltsForTargetNode - add X86ISD::ANDNP handling
Shraiysh Vaishay [Thu, 24 Feb 2022 13:30:40 +0000 (19:00 +0530)]
[mlir][OpenMP][NFC] Remove unused binary operator enum
This patch removes binary operator enum which was introduced with `omp.atomic.update`. Now the update operation handles update in a region so this is no longer required.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D120458
Benjamin Kramer [Thu, 24 Feb 2022 13:19:19 +0000 (14:19 +0100)]
[Symbolizer] Move ctor/dtor into .cpp file
On some standard library configurations these have a dependency on the
complete type of SymbolizableModule. They also do a lot of
copying/freeing so no point in inlining them.
Alex Zinenko [Tue, 11 Jan 2022 10:56:21 +0000 (11:56 +0100)]
[mlir] Document creation of Python bindings for a dialect
Documentation exists about the details of the API but is missing a
description of the overall structure per dialect.
Reviewed By: shabalin
Differential Revision: https://reviews.llvm.org/D117002
Benjamin Kramer [Thu, 24 Feb 2022 12:34:04 +0000 (13:34 +0100)]
[mlir][linalg] Cast back to the original type after making linalg.generic outputs more static
This codepath was entirely untested.
Differential Revision: https://reviews.llvm.org/D120473
Roman Lebedev [Thu, 24 Feb 2022 05:47:14 +0000 (08:47 +0300)]
[NFC][SROA] Update tests for D113520
serge-sans-paille [Wed, 23 Feb 2022 21:18:20 +0000 (22:18 +0100)]
Cleanup includes: ProfileData
Estimation of the impact on preprocessor output:
before:
1067349756
after:
1065940348
Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D120434
serge-sans-paille [Wed, 23 Feb 2022 21:16:39 +0000 (22:16 +0100)]
Cleanup include: DebugInfo/Symbolize
Estimation of the impact on preprocessor output
after:
1067349756
before:
1067487786
Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D120433
Jay Foad [Thu, 24 Feb 2022 12:17:34 +0000 (12:17 +0000)]
[AMDGPU] Fix permissions on test files
Florian Hahn [Thu, 24 Feb 2022 12:12:21 +0000 (12:12 +0000)]
[AArch64] Add vector select test showing redundant operations.
The tests show sub-optimal lowering of extend/cmp/select chains starting
with v16i8 vectors.
Shao-Ce SUN [Thu, 24 Feb 2022 03:14:43 +0000 (11:14 +0800)]
[NFC][RISCV] Reuse ISD::NodeType in float extension
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D120412
Sven van Haastregt [Thu, 24 Feb 2022 11:52:32 +0000 (11:52 +0000)]
[OpenCL] opencl-c.h: remove arg names for image builtins
This simplifies completeness comparisons against OpenCLBuiltins.td and
also makes the header no longer "claim" the identifiers "image",
"image_array", "coord", "sampler", "sample", "gradientX", "gradientY",
"lod", and "color".
Continues the direction set out in D119560.
Pavel Labath [Thu, 24 Feb 2022 11:47:17 +0000 (12:47 +0100)]
[lldb] Fix macos build for D120425
Javier Setoain [Thu, 27 Jan 2022 13:36:16 +0000 (13:36 +0000)]
[mlir][LLVM] Allow scalable vectors in ShuffleVectorOp
The current implementation of ShuffleVectorOp assumes all vectors are
scalable. LLVM IR allows shufflevector operations on scalable vectors,
and the current translation between LLVM Dialect and LLVM IR does the
rigth thing when the shuffle mask is all zeroes. This is required to
do a splat operation on a scalable vector, but it doesn't make sense
for scalable vectors outside of that operation, i.e.: with non-all zero
masks.
Differential Revision: https://reviews.llvm.org/D118371
Simon Pilgrim [Thu, 24 Feb 2022 11:12:52 +0000 (11:12 +0000)]
[X86] LowerShiftByScalarVariable - use getSplatSourceVector for vXi8 shift expansion
Using getSplatValue causes poor codegen due to not always being able to remove the EXTRACT_VECTOR_ELT created inside getSplatValue.
The vXi16 shifts/rotates are still showing occasional regressions but vXi8 is a definite improvement.
Nikita Popov [Thu, 24 Feb 2022 11:12:05 +0000 (12:12 +0100)]
Revert "[RISCV] add the MC layer support of Zfinx extension"
This reverts commit
7798ecca9c3db42241169d31fea4fb820ed01830.
As reported in https://reviews.llvm.org/D93298#3331641 and
following, this causes assertion failures with inline assembly.
Shao-Ce SUN [Thu, 20 Jan 2022 02:58:26 +0000 (10:58 +0800)]
[NFC][clang] Simplify `isOneOf` function
Reviewed By: tmatheson
Differential Revision: https://reviews.llvm.org/D117740
Pavel Labath [Thu, 24 Feb 2022 11:05:42 +0000 (12:05 +0100)]
[lldb] One more fix for the MonitorChildProcess patch (D120425)