Ben Shi [Sun, 13 Mar 2022 06:35:49 +0000 (06:35 +0000)]
[AVR] Generate 'rcall' instead of 'call' on avr2 and avr25
The 'call' (long call) instruction is available on avr3 and above,
and devices in avr2 and avr25 should use the 'rcall' (short call)
instruction for function calls.
Reviewed By: aykevl, dylanmckay
Differential Revision: https://reviews.llvm.org/D121539
Ben Shi [Thu, 10 Mar 2022 09:01:07 +0000 (09:01 +0000)]
[AVR] Add more devices
Synchronize AVR device lists with gcc-avr-5.4.0 and avr-libc-2.0.0.
Reviewed By: dylanmckay, aykevl
Differential Revision: https://reviews.llvm.org/D121359
Ben Shi [Fri, 4 Mar 2022 14:42:41 +0000 (14:42 +0000)]
[AVR] Fix incorrect calling convention for varargs functions
An i8 argument should only cost 1 byte on the stack. This is
compatible with avr-gcc.
There are also more test cases (of calling convention) are added.
Reviewed By: aykevl, dylanmckay
Differential Revision: https://reviews.llvm.org/D121767
hsmahesha [Wed, 23 Mar 2022 01:45:52 +0000 (07:15 +0530)]
[AMDGPU] [NFC]: Organize the code around reserving registers.
First, add code to reserve all required special purpose registers,
followed by code to reserve SGPRs, followed by code to reserve
VGPRs/AGPRs.
This patch is prepared as a pre-requisite to fix an issue related to
GFX90A hardware.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D122219
Akira Hatanaka [Wed, 23 Mar 2022 01:39:16 +0000 (18:39 -0700)]
[NFC][Clang][OpaquePtr] Remove calls to Address::deprecated in
TargetInfo.cpp
Differential Revision: https://reviews.llvm.org/D122199
Nathan Chancellor [Wed, 23 Mar 2022 00:32:33 +0000 (17:32 -0700)]
Revert "[InstCombine] try to narrow shifted bswap-of-zext"
This reverts commit
9e9bda2e8f5b88715bad767a4b7740df32b040d2.
This causes a backend error when building the Linux kernel for arm64.
See https://reviews.llvm.org/D122166 for a simplified reproducer.
Vasileios Porpodas [Tue, 22 Mar 2022 22:21:20 +0000 (15:21 -0700)]
Recommit "[SLP] Fix lookahead operand reordering for splat loads." attempt 2, fixed assertion crash.
Original review: https://reviews.llvm.org/D121354
This reverts commit
f7d7d2a08d16356c57f6d2d36bc2fc0589a55df9.
Fabian Wolff [Tue, 22 Mar 2022 23:28:18 +0000 (00:28 +0100)]
[clang-tidy] Fix false positives in `misc-redundant-expression` check
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D122111
Arthur Eubanks [Tue, 22 Mar 2022 23:26:44 +0000 (16:26 -0700)]
[gn build] Manually port 89f6b26
Jez Ng [Fri, 10 Sep 2021 21:00:43 +0000 (17:00 -0400)]
[lld-macho][nfc] Don't mix file sizes with addresses
Update DataInCode's calculation of `endAddr` to use `getSize()` instead
of `getFileSize()` -- while in practice they're the same for
non-zerofill sections (which code sections are), we still should treat
address sizes / offsets as distinct from file sizes / offsets.
Snehasish Kumar [Tue, 22 Mar 2022 21:40:02 +0000 (14:40 -0700)]
Reland "[memprof] Store callsite metadata with memprof records."
This reverts commit
f4b794427e8037a4e952cacdfe7201e961f31a6f.
Reland with underlying msan issue fixed in D122260.
Snehasish Kumar [Tue, 22 Mar 2022 20:56:30 +0000 (13:56 -0700)]
[memprof] Initialize MemInfoBlock data.
This patch updates the existing default no-arg constructor for
MemInfoBlock to explicitly initialize all members. Also add missing
DataTypeId initialization to the other constructor. These issues were
exposed by msan on patch D121179. With this patch D121179 builds cleanly
on msan.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D122260
Craig Topper [Tue, 22 Mar 2022 21:19:50 +0000 (14:19 -0700)]
[X86] Fold MMX_MOVD64from64rr + store to MMX_MOVQ64mr instead of MMX_MOVD64from64mr.
MMX_MOVD64from64rr moves an MMX register to a 64-bit GPR.
MMX_MOVD64from64mr is the memory version of moving a MMX register to a
64-bit GPR. It requires the REX.W bit to be set. There are no isel
patterns that use this instruction.
MMX_MOVQ64mr is the MMX register store instruction. It doesn't
require a REX.W prefix. This makes it one byte shorter to encode
than MMX_MOVD64from64mr in many cases.
Both store instructions output the same mnemonic string. The assembler
would choose MMX_MOVQ64mr if it was to parse the output. Which is
another reason using it is the correct thing to do.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D122241
Zixu Wang [Tue, 22 Mar 2022 21:11:45 +0000 (14:11 -0700)]
[NFC][clang][extract-api] Use proper name string for Objective-C language
Change the Symbol Graph serializer for ExtractAPI to use `objective-c`
for the language name string for Objective-C, to align with clang
frontend standards.
Craig Topper [Tue, 22 Mar 2022 20:51:22 +0000 (13:51 -0700)]
[SelectionDAG] Add printing support for the Align value of AssertAlign nodes.
Differential Revision: https://reviews.llvm.org/D122262
wren romano [Sat, 19 Mar 2022 02:31:03 +0000 (19:31 -0700)]
[mlir][sparse] Distinguishing "shape" from "sizes" in variable names
I'm using "shape" to mean the compile-time object, where zeros indicate sizes which are compile-time dynamic; and using "sizes" to mean the run-time object, where zeros indicate a dimension with no coordinates (hence resulting in trivial storage). Because their semantics differ on zeros, it's important to keep them distinguished. Although we do not define separate C++ types to capture the distinction, we can at least use variable names to do so.
This is (tangential) work towards fixing: https://github.com/llvm/llvm-project/issues/51652
Depends On D122057
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D122058
Mike Rice [Tue, 22 Mar 2022 17:55:21 +0000 (10:55 -0700)]
[OpenMP] Initial parsing/sema for the 'omp parallel loop' construct
Adds basic parsing/sema/serialization support for the
#pragma omp parallel loop directive.
Differential Revision: https://reviews.llvm.org/D122247
Stanislav Mekhanoshin [Tue, 22 Mar 2022 19:08:29 +0000 (12:08 -0700)]
[AMDGPU] Allow v_accvgpr_write to use SGPR on gfx90a
This is undocumented, but it should work.
Differential Revision: https://reviews.llvm.org/D122252
Philip Reames [Tue, 22 Mar 2022 20:30:59 +0000 (13:30 -0700)]
[instcombine] Fold away memset/memmove from otherwise unused alloca
The motivation for this is that while both memcpyopt and dse will catch this case, both are limited by MSSA's walk back threshold when finding clobbers. As such, if you have a memcpy of an otherwise dead alloca placed towards the end of a long basic block with lots of other memory instructions, it would be missed. This is a bit undesirable for such an "obviously" useless bit of code.
As noted in comments, we should probably generalize instcombine's escape analysis peephole (see visitAllocInst) to allow read xor write. Doing that would subsume this code in a more general way, but is also a more involved change. For the moment, I went with the easiest fix.
Louis Dionne [Tue, 22 Mar 2022 20:48:30 +0000 (16:48 -0400)]
[libc++][NFC] Slight improvement to __availability documentation
wren romano [Sat, 19 Mar 2022 02:20:33 +0000 (19:20 -0700)]
[mlir][sparse] Adding Action::kSparseToSparse for @newSparseTensor
This is work towards: https://github.com/llvm/llvm-project/issues/51652
This differential doesn't yet make use of the new kSparseToSparse, just introduces it. The differential that finally makes use of them is D122061, which is the final differential in the chain that fixes bug 51652.
Depends On D122054
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D122055
Valentin Clement [Tue, 22 Mar 2022 20:32:57 +0000 (21:32 +0100)]
[flang][NFC] Add forall lowering tests
This patch adds some lowering tests for the `forall` construct.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D122253
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Arthur Eubanks [Tue, 22 Mar 2022 20:27:04 +0000 (13:27 -0700)]
Revert "Recommit "[SLP] Fix lookahead operand reordering for splat loads.""
This reverts commit
79613185d305013de743cdbd6690e4d77c8af27e.
Causes crashes, see comments in https://reviews.llvm.org/D121973.
Sanjay Patel [Tue, 22 Mar 2022 20:02:09 +0000 (16:02 -0400)]
[InstCombine] reorder code, fix formatting; NFC
The affected code can be updated to solve #54364,
so make some cosmetic diffs before real changes.
Zixu Wang [Mon, 21 Mar 2022 07:53:28 +0000 (00:53 -0700)]
[clang][extract-api] Refactor ExtractAPI and improve docs
- The name SymbolGraph is inappropriate and confusing for the new library
for clang-extract-api. Refactor and rename things to make it clear that
ExtractAPI is the core functionality and SymbolGraph is one serializer
for the API information.
- Add documentation comments to ExtractAPI classes and methods to improve
readability and clearness of the ExtractAPI work.
Differential Revision: https://reviews.llvm.org/D122160
Philip Reames [Tue, 22 Mar 2022 20:16:17 +0000 (13:16 -0700)]
[test,instcombine] Precommit test for upcoming transform
wren romano [Sat, 19 Mar 2022 02:10:40 +0000 (19:10 -0700)]
[mlir][sparse] Introducing options for the SparseTensorConversion pass
This is work towards: https://github.com/llvm/llvm-project/issues/51652
This differential sets up the options and threads them through everywhere, but doesn't actually use them yet. The differential that finally makes use of them is D122061, which is the final differential in the chain that fixes bug 51652.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D122054
wren romano [Tue, 22 Mar 2022 00:39:15 +0000 (17:39 -0700)]
[mlir][sparse] Moving lexOrder from SparseTensorCOO to Element
This is the more logical place for the function to live. If/when we factor out a separate class for just the `Coordinates` themselves, then the definition should be moved to `Coordinates::lexOrder` (and `Element::lexOrder` would become a thin wrapper delegating to that function).
This is (tangentially) work towards fixing: https://github.com/llvm/llvm-project/issues/51652
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D122057
Valentin Clement [Tue, 22 Mar 2022 19:56:25 +0000 (20:56 +0100)]
[flang][NFC] Add pointer dummy arguments tests
This patch adds test for calls with POINTER dummy arguments on the caller side.
It also fixes some formatting error that was introduced when upstreaming
the other pointer tests.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D122238
Co-authored-by: Jean Perier <jperier@nvidia.com>
Stanislav Mekhanoshin [Tue, 22 Mar 2022 19:42:31 +0000 (12:42 -0700)]
[AMDGPU] Update mfma test to run gfx940 checks. NFC.
spupyrev [Thu, 17 Mar 2022 16:51:07 +0000 (09:51 -0700)]
[BOLT] Avoid pointless loop rotation
It seems the earlier implementation does not follow the description
in LoopRotationPass.h: It rotates loops even if they are already laid out
correctly. The diff adjusts the behaviour.
Given that the impact of LoopInversionPass is minor, this change won't
yield significant perf differences. Tested on clang-10: there seems to be a
0.1%-0.3% cpu win and a small reduction of branch misses.
**Before:**
BOLT-INFO: 120 Functions were reordered by LoopInversionPass
**After:**
BOLT-INFO: 79 Functions were reordered by LoopInversionPass
Reviewed By: yota9
Differential Revision: https://reviews.llvm.org/D121921
Philip Reames [Tue, 22 Mar 2022 19:38:20 +0000 (12:38 -0700)]
[test] Autogen a test for ease of update
Louis Dionne [Tue, 22 Mar 2022 19:35:30 +0000 (15:35 -0400)]
[cmake] Demote fatal error to a warning when we don't know the Apple SDK in use
Sometimes, we could be building for a platform where we don't link
compiler-rt, so being able to figure out the right compiler-rt suffix
isn't necessary, but we shouldn't fail the build.
Louis Dionne [Tue, 22 Mar 2022 19:34:48 +0000 (15:34 -0400)]
[libc++][NFC] Use struct instead of class for ranges::end
This is consistent with what we do elsewhere.
David Blaikie [Mon, 21 Mar 2022 19:37:39 +0000 (19:37 +0000)]
llvm-dwarfdump: Including calling convention attribute in pretty printed type names
David Blaikie [Thu, 17 Mar 2022 22:59:18 +0000 (22:59 +0000)]
DebugInfo: Simplify const/volatile printing for function types
Corentin Jabot [Tue, 22 Mar 2022 19:05:17 +0000 (20:05 +0100)]
[Clang][NFC] Add braces to help readability
In CheckConstexprFunctionStmt, as discussed in
D111400.
Aaron Ballman [Tue, 22 Mar 2022 18:59:57 +0000 (14:59 -0400)]
Revert "Add UTF32 to/from UTF8 conversion functions"
This reverts commit
c3460689288abc98c91d8d6bffa74be9eb16c74d.
It broke at least one of the builders:
https://lab.llvm.org/buildbot#builders/100/builds/13947
Corentin Jabot [Tue, 5 Oct 2021 21:33:31 +0000 (23:33 +0200)]
[Clang][C++2b] P2242R3: Non-literal variables [...] in constexpr
Allow goto, labelled statements as well as `static`, `thread_local`, and
non-literal variables in `constexpr` functions.
As specified. for all of the above (except labelled statements) constant
evaluation of the construct still fails.
For `constexpr` bodies, the proposal is implemented with diagnostics as
a language extension in older language modes. For determination of
whether a lambda body satisfies the requirements for a constexpr
function, the proposal is implemented only in C++2b mode to retain the
semantics of older modes for programs conforming to them.
Reviewed By: aaron.ballman, hubert.reinterpretcast, erichkeane
Differential Revision: https://reviews.llvm.org/D111400
Peter Klausler [Wed, 16 Mar 2022 19:32:03 +0000 (12:32 -0700)]
[flang] Initial UTF-8 support in runtime I/O
Implements UTF-8 encoding and decoding for external units
with OPEN(ENCODING='UTF-8'). This encoding applies to default
CHARACTER values that are not 7-bit ASCII as well as to
the wide CHARACTER kinds 2 and 4. Basic testing is in place
via direct calls to the runtime I/O APIs, but serious checkout
awaits lowering support of the wide CHARACTER kinds.
Differential Revision: https://reviews.llvm.org/D122038
Peter Klausler [Wed, 16 Mar 2022 17:16:45 +0000 (10:16 -0700)]
[flang] Fix crash: ENTRY with generic interface of the same name
Name resolution was crashing while processing the ENTRY statement
due to a lack of special-case code necessary to handle the indirection
needed when the generic has the same name as the ENTRY.
Differential Revision: https://reviews.llvm.org/D122050
Jacques Pienaar [Tue, 22 Mar 2022 18:08:36 +0000 (11:08 -0700)]
[mlir][ods] Add Deprecate helper
Add method to tag classes/defs as deprecated. Previously deprecations
were only verbally communicated and folks didn't have an active warning
while building about impending removal. Add mechanism to tag defs as
deprecated to allow warning users.
This doesn't change any policy, it just moves deprecation warnings from
comments to something more user visible.
Differential Revision: https://reviews.llvm.org/D122164
Jonas Devlieghere [Tue, 22 Mar 2022 02:18:29 +0000 (19:18 -0700)]
[lldb] Set the TERM environment variable for the API tests
Avoid "TERM environment variable not set" by either propagating the TERM
environment variable or defaulting to vt100. All of our CI is already
doing this explicitly through the --env dotest arg, but it's easy to
forget when setting up a new job. I don't see any downside in making it
the default.
Cynthia Shen [Tue, 22 Mar 2022 15:54:25 +0000 (15:54 +0000)]
[MLIR][Presburger] Fix a comment in the unittests
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D122197
Marcus Johnson [Tue, 22 Mar 2022 17:41:43 +0000 (13:41 -0400)]
Add UTF32 to/from UTF8 conversion functions
This is anticipated to be used in new format specifier checking code.
Simon Pilgrim [Tue, 22 Mar 2022 17:34:48 +0000 (17:34 +0000)]
[ARM] select_xform.ll - re-add and fix missing CHECK prefixes
We were still checking test results with the CHECK prefix but they had bit-rotted since whenever it'd been removed from the --check-prefixes list
Craig Topper [Tue, 22 Mar 2022 17:16:53 +0000 (10:16 -0700)]
[RISCV] Special case sign extended scalars when type legalizing nxvXi64 .vx instrinsics on RV32.
On RV32, we need to type legalize i64 scalar arguments to intrinsics.
We usually do this by splatting the value into a vector separately.
If the scalar happens to be sign extended, we can continue using a .vx
intrinsic.
We already special cased sign extended constants, this extends it
to any sign extended value.
I've only added tests for one case of vadd. Most intrinsics go
through the same check.
Reviewed By: khchen
Differential Revision: https://reviews.llvm.org/D122186
Aaron Ballman [Tue, 22 Mar 2022 17:14:16 +0000 (13:14 -0400)]
Allow -Wno-gnu to silence GNU extensions related to pointer arithmetic
These diagnostics were added to a diagnostic group, but that diagnostic
group was not under -Wgnu. I've now split them into their own
diagnostic group that is added both to the original group (so user's
currently opting in or out of these should not see a change) and under
the -Wgnu group so that -Wno-gnu can be used to disable all GNU
extension diagnostics. This fixes Issue 54444.
Craig Topper [Tue, 22 Mar 2022 16:53:39 +0000 (09:53 -0700)]
[TableGen][RISCV] Add InstAliases with zero_reg to cover unmasked vnot.v, vncvt.x.x.w, vneg.v, etc.
The mask being NoRegister prevented the existing aliases from matching
since NoRegister isn't in the VMV0 register class.
To workaround this I've added new aliases that look for zero_reg.
I had to motify tablegen to generate matching code for zero_reg.
And as a consequence, I had to change the EmitPriority for an ARM
alias that used zero_reg that started printing.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D121496
Zakk Chen [Mon, 28 Feb 2022 09:07:13 +0000 (01:07 -0800)]
[RISCV][NFC] Refine and refactor RISCVVEmitter and riscv_vector.td.
1. Rename nomask as unmasked to keep with the terminology in the spec.
2. Merge UnMaskpolicy and Maskedpolicy arguments into one in RVVBuiltin class.
3. Rename HasAutoDef as HasBuiltinAlias.
4. Move header definition code into one class.
Reviewed By: rogfer01
Differential Revision: https://reviews.llvm.org/D120870
Craig Topper [Tue, 22 Mar 2022 16:41:40 +0000 (09:41 -0700)]
[VP] Preserve address space of pointer for strided load/store intrinsics.
This adds LLVMAnyPointerToElt to use instead of LLVMPointerToElt.
This allows us to preserve the address space as part of the type
overload for the intrinsic, but still require the vector element
type to match the pointer type.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D122042
Nathan Sidwell [Wed, 26 Jan 2022 15:22:04 +0000 (07:22 -0800)]
[demangler] Add support for C++20 modules
Add support for module name demangling. We have two new demangler
nodes -- ModuleName and ModuleEntity. The former represents a module
name in a hierarchical fashion. The latter is the combination of a
(name) node and a module name. Because module names and entity
identities use the same substitution encoding, we have to adjust the
flow of how substitutions are handled, and examine the substituted
node to know how to deal with it.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D119933
Louis Dionne [Tue, 22 Mar 2022 14:58:24 +0000 (10:58 -0400)]
[clang][NFC] Refactor logic for picking standard library on Apple
Flip the logic around: always default to libc++ except on older platforms,
instead of defaulting to libstdc++ except on newer platforms. Since roughly
all supported platforms use libc++ now, it makes more sense to make that
the default, and allows the removal of some downstream diff.
Differential Revision: https://reviews.llvm.org/D122232
Hendrik Greving [Tue, 22 Mar 2022 02:20:53 +0000 (19:20 -0700)]
[IR] Allow matching pointer to vector with opaque pointers.
Allows for skipping the pointer to vector type if opaque pointers
are enabled and the matching pointer is a vector pointer when
matching an intrinsic signature in the verifier.
No test added since lacking a target using intrinsic with pointer
to vector arguments.
Differential Revision: https://reviews.llvm.org/D122203
Alex Bradbury [Tue, 22 Mar 2022 16:24:05 +0000 (16:24 +0000)]
[WebAssembly][NFC] Delete type checking logic for removed ref.null instruction
D114979 changed the textual formal of ref.null - dropping ref.null in
favour of ref.null_extern and ref.null_func. Therefore, the type checker
no longer needs logic to handle "ref.null".
Differential Revision: https://reviews.llvm.org/D122123
Alex Bradbury [Tue, 22 Mar 2022 15:50:56 +0000 (15:50 +0000)]
[WebAssembly] Add tests for the Asm type checker
While looking at bugs like PR54022, I noted that there is no real test
coverage for the asm type checker. This patch starts to address that,
adding a series of tests for the errors messages produced, as well as
some FIXMEs as an XFAIL test for some current issues.
It's not intended to be an exhaustive test, but does have test cases for
each of the instructions that the type checker has specific handling
for.
Differential Revision: https://reviews.llvm.org/D122020
Walter Erquinigo [Tue, 22 Mar 2022 16:08:47 +0000 (09:08 -0700)]
[simple] fix some the documentation
Some links were not rendered correctly in the intel pt documentation and
some spacing was fixed in some command objects.
Nikita Popov [Tue, 22 Mar 2022 15:19:00 +0000 (16:19 +0100)]
[CGOpenMPRuntime] Remove some uses of deprecated Adddress ctor
Valentin Clement [Tue, 22 Mar 2022 15:11:42 +0000 (16:11 +0100)]
[flang][NFC] Remove unused variable
Fix for buildbot failure shown after
fe252f8ed6369acdb13d4e290d3b9dfe2ec4eb8e
Kiran Chandramohan [Tue, 22 Mar 2022 14:13:52 +0000 (14:13 +0000)]
[Flang] Lower the sqrt intrinsics
The intrinsic computes the square root for real and complex numbers. By
default they are lowered to runtime calls to libpgmath. With the llvm
option, it can be lowered to llvm intrinsics (not all types .eg. complex
are supported for llvm lowering).
This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project
Reviewed By: schweitz
Differential Revision: https://reviews.llvm.org/D122018
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Zakk Chen [Thu, 17 Mar 2022 03:17:06 +0000 (20:17 -0700)]
[RISCV] Add policy operand for masked compare and vmsbf/vmsif/vmsof IR
intrinsics.
Those operations are updated under a tail agnostic policy, but they
could have mask agnostic or undisturbed.
Reviewed By: rogfer01
Differential Revision: https://reviews.llvm.org/D120228
Sanjay Patel [Tue, 22 Mar 2022 14:40:05 +0000 (10:40 -0400)]
[InstCombine] add test for abs with dominating condition; NFC
There's a potential miscompile or missed optimization with
propagating 'nsw' in the transform proposed in D122013, so
we need at least one more test for coverage.
Valentin Clement [Tue, 22 Mar 2022 14:40:32 +0000 (15:40 +0100)]
[flang] Lower boxed procedure
In FIR, we want to wrap function pointers in a special box known as a
boxproc value. Fortran has a limited form of dynamic scoping
[https://tinyurl.com/2p8v2hw7] between "host procedures" and "internal
procedures". There are a number of implementations possible.
Boxproc typed values abstract away the implementation details of when a
function pointer can be passed directly (as a raw address) and when a
function pointer has to account for the presence of a dynamic scope.
When lowering Fortran syntax to FIR, all function pointers are emboxed
as boxproc values.
When creating LLVM IR, we must strip away the abstraction and produce
low-level LLVM "assembly" code. This patch implements that
transformation as converting the boxproc values to either raw function
pointers or executable trampolines on the stack as needed. The
trampoline then captures the dynamic scope context within an executable
thunk that can be passed instead of the function's raw address.
Some extra handling is required for Fortran functions that return a
character value to deal with LEN values here.
Some of the code in Bridge.cpp and ConvertExpr.cpp and be re-arranged to
faciliate the upstreaming effort.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: jeanPerier, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D122223
Co-authored-by: mleair <leairmark@gmail.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
chenglin.bi [Tue, 22 Mar 2022 14:34:21 +0000 (10:34 -0400)]
[InstCombine] add tests for abs with dominating condition; NFC
Baseline tests for D122013 (issue #54132).
Nikita Popov [Tue, 22 Mar 2022 14:10:33 +0000 (15:10 +0100)]
[CGOpenMPRuntime] Remove some uses of deprecated Address ctor
Krasimir Georgiev [Tue, 22 Mar 2022 14:28:34 +0000 (15:28 +0100)]
[clang-format] don't break up #-style comment sections
Follow-up from https://github.com/llvm/llvm-project/commit/
36d13d3f8adb3d1a6bae71370afa23d11a94dc78; https://reviews.llvm.org/D121451.
Restore the old behavior in situations where we use # as comments and long strings of #'s for comment sections.
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D122230
Florian Hahn [Tue, 22 Mar 2022 14:23:11 +0000 (14:23 +0000)]
[LV] Remove Loop argument from createInductionResumeValues (NFCI).
createInductionResumeValues only uses its loop argument only to get the
pre-header, but the pre-header is already known (we created/cached it
earlier). Remove the unneeded loop argument.
Pavel Labath [Tue, 22 Mar 2022 13:52:02 +0000 (14:52 +0100)]
[lldb/test] Increase pexpect termination timeouts
By default these timeouts are extremely small (0.1s). This means that
100ms after sending an EOF, pexpect will start sending the process
increasingly aggressive signals, but the small timeouts mean that (on a
loaded machine) the kernel may not have enough time to process the
signal even if the overall effect of the signal is to kill the
application.
It turns out we were already relying on this signals (instead of regular
EOF quits) in our tests. In my experiments it was sufficient to block
SIGINT and SIGHUP to cause some test to become flaky. This was most
likely the reason of a couple of flakes on the lldb-x86_64-debian bot,
and is probably the reason why the pexpect tests are flaky on several
other (e.g. asan) bots.
This patch increses the timeout to 6 seconds (60-fold increase), which
is hopefully sufficient to avoid flakes even in the most extreme
situations.
Kiran Chandramohan [Tue, 22 Mar 2022 14:04:02 +0000 (14:04 +0000)]
[Flang] Lower the exp, log, log10 intrinsics
The intrinsic computes the exponent, log real and complex numbers and
log10 for real numbers. By default they are lowered to runtime calls to
libpgmath. kind=10 and 16 are not supported. With the llvm option, it
can be lowered to llvm intrinsics (not all types .eg. complex are
supported for llvm lowering).
This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D122132
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: William S Moses <gh@wsmoses.com>
Nikita Popov [Tue, 22 Mar 2022 13:38:27 +0000 (14:38 +0100)]
[CGOpenMPRuntimeGPU] Remove uses of deprecated address constructor
Worth noting that the code marked with FIXME is dead and would
produce invalid IR if hit. Someone familiar with this code should
probably look into that.
Aaron Ballman [Tue, 22 Mar 2022 14:00:05 +0000 (10:00 -0400)]
Fix _BitInt suffix width calculation
@mgehre-amd pointed out the following post-commit review feedback on
the changes in
8cba72177dcd8de5d37177dbaf2347e5c1f0f1e8:
As an example, the paper says 3wb /* Yields an _BitInt(3); two value
bits, one sign bit */.
So I would expect that 0xFwb gives _BitInt(5); four value bits, one
sign bit, but with this implementation I get _BitInt(2).
This is because ResultVal as 4 bits, and getMinSignedBits() inteprets
it as negative and thus says that 1 bit is enough to represent -1.
This corrects the behavior for calculating the bit-width and adds some
test coverage.
Joseph Huber [Tue, 22 Mar 2022 13:28:12 +0000 (09:28 -0400)]
[LTO] Add configuartion option to use default optimization pipeline
This patch adds a configuration option to simply use the default pass
pipeline in favor of the LTO-specific one. We observed some severe
performance penalties when uding device-side LTO for OpenMP offloading
applications caused by the LTO-pass pipeline. This is primarily because
OpenMP uses an LLVM bitcode library to implement a GPU runtime library.
In a standard compilation we link this bitcode library into each source
file and optimize it with the default pipeline. When performing LTO we
link it late with all the files, but the bitcode library never has the
regular optimization pipeline applied to it so we miss a few
optimizations just using the LTO pipeline to optimize it.
I'm not committed to this solution, but it's the easiest method to solve
this performance regression when using LTO without changing the
optimizatin pipeline for other users.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D122133
Arjun P [Thu, 17 Mar 2022 22:25:40 +0000 (22:25 +0000)]
[MLIR][Prebsurger] Add IntegerRelation::intersect supporting locals properly
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D122149
Arjun P [Mon, 21 Mar 2022 17:13:19 +0000 (17:13 +0000)]
[MLIR][Presburger] MultiAffineFunction::removeIdRange: fix bug where kind wasn't passed on to IntegerPolyhedron::removeIdRange
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D122158
Arjun P [Fri, 18 Mar 2022 12:29:29 +0000 (12:29 +0000)]
[MLIR][Presburger] fix bug where Simplex::addZeroRow was not undoable
Previously, an UndoLogEntry was added by addRow but not by addZeroRow. So
calling directly into addZeroRow, as LexSimplex::addCut does, was not an
undoable operation. In the current usage of addCut this could never
lead to an incorrect result, and addZeroRow is protected, so it is not
currently possible to add a regression test for this. This bug needs to be
fixed for the symbolic integer lexmin algorithm.
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D122162
Sanjay Patel [Tue, 22 Mar 2022 13:02:28 +0000 (09:02 -0400)]
[InstCombine] try to canonicalize logical shift after bswap
When shifting by a byte-multiple:
bswap (shl X, C) --> lshr (bswap X), C
bswap (lshr X, C) --> shl (bswap X), C
This is an IR implementation of a transform suggested in D120648.
The "swaps cancel" test models the motivating optimization from
that proposal.
Alive2 checks (as noted in the other review, we could use
knownbits to handle shift-by-variable-amount, but that can be an
enhancement patch):
https://alive2.llvm.org/ce/z/pXUaRf
https://alive2.llvm.org/ce/z/ZnaMLf
Differential Revision: https://reviews.llvm.org/D122010
Djordje Todorovic [Tue, 22 Mar 2022 11:16:30 +0000 (12:16 +0100)]
[Debugify] Use DebugifyLevel in Debugify original mode
Before this patch the DebugifyLevel option was used for
the synthetic mode, so after this, it will be used in
the original mode as well.
Differential Revision: https://reviews.llvm.org/D115623
Nikita Popov [Tue, 22 Mar 2022 12:57:54 +0000 (13:57 +0100)]
[LICM] Handle store of pointer to itself (PR54495)
Rather than iterating over users and comparing operands, iterate
over uses and check operand number. Otherwise, we'll end up
promoting a store twice if it has two equal operands.
This can only happen with opaque pointers, as otherwise both
operands differ by a level of indirection, so a bitcast would have
to be involved.
Fixes https://github.com/llvm/llvm-project/issues/54495.
Igor Kudrin [Tue, 22 Mar 2022 10:14:56 +0000 (14:14 +0400)]
[NVPTX][tests] Do not run tests that require direct object generation
NVPTX does not support generating binary files, which is required for
these tests.
The majority of tests in 'DebugInfo/Generic' also require emitting
object files, so they all are disabled for NVPTX.
Differential Revision: https://reviews.llvm.org/D121996
Igor Kudrin [Tue, 22 Mar 2022 10:14:25 +0000 (14:14 +0400)]
[tests] Make 'object-emission' imply 'default_triple'
If 'config.target_triple' is empty, there is no sense to define the
'object-emission' tag.
Differential Revision: https://reviews.llvm.org/D121994
Igor Kudrin [Tue, 22 Mar 2022 10:13:48 +0000 (14:13 +0400)]
[NVPTX] Avoid a crash when 'llc' is called with '-filetype=null'
For '-filetype=null', 'NVPTXTargetStreamer' is not created, so the
return value of 'OutStreamer->getTargetStreamer()' should be checked
before calling the methods.
Differential Revision: https://reviews.llvm.org/D122001
Igor Kudrin [Tue, 22 Mar 2022 10:13:37 +0000 (14:13 +0400)]
[tests] Force (some) X86-specific tests to use an explicit triple
These tests are located in 'X86' subfolders which means that they should
be compiled for that target. As they did not have the target specified
explicitly, they in fact were compiled for a default target triple. Not
all targets support all required features for these tests; for example,
if NVPTX is used as a default triple, the tests fail. The patch makes the
tests run for 'x86_64', thus they pass regardless of the default target.
Differential Revision: https://reviews.llvm.org/D121998
Bryan Chan [Tue, 22 Mar 2022 12:36:42 +0000 (08:36 -0400)]
[ThinLTO] Work around buggy FileCheck pattern; NFC
Update the FileCheck patterns in a test case to prevent a path name
containing the `@` character from causing it to fail unnecessarily,
e.g. during a Jenkins CI job.
Vince Bridgers [Wed, 9 Feb 2022 00:22:32 +0000 (18:22 -0600)]
[analyzer] Refactor makeNull to makeNullWithWidth (NFC)
Usages of makeNull need to be deprecated in favor of makeNullWithWidth
for architectures where the pointer size should not be assumed. This can
occur when pointer sizes can be of different sizes, depending on address
space for example. See https://reviews.llvm.org/D118050 as an example.
This was uncovered initially in a downstream compiler project, and
tested through those systems tests.
steakhal performed systems testing across a large set of open source
projects.
Co-authored-by: steakhal
Resolves: https://github.com/llvm/llvm-project/issues/53664
Reviewed By: NoQ, steakhal
Differential Revision: https://reviews.llvm.org/D119601
Sanjay Patel [Tue, 22 Mar 2022 11:52:39 +0000 (07:52 -0400)]
[InstCombine] try to narrow shifted bswap-of-zext
This is the IR counterpart to
370ebc9d9a573d6
which provided a bswap narrowing fix for issue #53867.
Here we can be more general (although I'm not sure yet
what would happen for illegal types in codegen - too
rare to worry about?):
https://alive2.llvm.org/ce/z/3-CPfo
This will be more effective if we have moved the shift
after the bswap as proposed in D122010, but it is
independent of that patch.
Differential Revision: https://reviews.llvm.org/D122166
Sanjay Patel [Fri, 18 Mar 2022 20:08:37 +0000 (16:08 -0400)]
[InstCombine] add tests for shift-of-bswap; NFC
David Green [Tue, 22 Mar 2022 12:20:19 +0000 (12:20 +0000)]
[AArch64] Add extra insert subvector cost model tests. NFC
alex-t [Tue, 22 Mar 2022 12:13:15 +0000 (13:13 +0100)]
[AMDGPU] use scalar shift for SALU users in frame index elimination
In the frame index lowering we have to insert shift and add
instructions to adjust stack object access. We need to take care of the stack
object user kind and use scalar shift/add for scalar users.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D121524
Djordje Todorovic [Tue, 22 Mar 2022 09:14:36 +0000 (10:14 +0100)]
[Debugify] Optimize debugify original mode
Before we start addressing the issue with having
a lot of false positives when using debugify in
the original mode, we have made a few patches that
should speed up the execution of the testing
utility Passes.
For example, when testing a large project
(let's say LLVM project itself), we can face
a lot of potential DI issues. Usually, we use
-verify-each-debuginfo-preserve (that is very
similar to -debugify-each) -- it collects
DI metadata before each Pass, and after the Pass
it checks if the Pass preserved the DI metadata.
However, we can speed up this process, since we
don't need to collect DI metadata before each
Pass -- we could use the DI metadata that are
collected after the previous Pass from
the pipeline as an input for the next Pass.
This patch speeds up the utility for ~2x.
Differential Revision: https://reviews.llvm.org/D115622
Shraiysh Vaishay [Tue, 22 Mar 2022 09:47:52 +0000 (15:17 +0530)]
[flang][OpenMP] Lowering critical construct
This patch adds translation from PFT to FIR for critical construct.
This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project
Co-authored-by: kiranchandramohan <kiranchandramohan@gmail.com>
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D122218
Simon Pilgrim [Tue, 22 Mar 2022 10:48:19 +0000 (10:48 +0000)]
[X86][SandyBridge] Remove superfluous mmx store from vector load schedule model group
Noticed by D122216
alex-t [Sat, 12 Mar 2022 14:38:11 +0000 (17:38 +0300)]
[AMDGPU] use scalar shift for SALU users in frame index elimination
In the frame index lowering we have to insert shift and add
instructions to adjust stack object access. We need to take care of the stack
object user kind and use scalar shift/add for scalar users.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D121524
Simon Moll [Tue, 22 Mar 2022 10:41:14 +0000 (11:41 +0100)]
[VP] Fix VPintrinsic::getStaticVectorLength for vp.merge|select
VPIntrinsic::getStaticVectorLength infers the operational vector length
of a VPIntrinsic instance from a type that is used with the intrinsic.
The function used the mask operand before. Yet, vp.merge|select do not
have a mask operand (in the predicating sense that the other VP
intrinsics are using them - it is a selection mask for them). Fallback
to the return type to fix this.
Reviewed By: kaz7
Differential Revision: https://reviews.llvm.org/D121913
Nikita Popov [Tue, 22 Mar 2022 09:25:35 +0000 (10:25 +0100)]
[CGStmtOpenMP] Remove uses of deprecated Address constructor
Shengchen Kan [Tue, 22 Mar 2022 08:49:45 +0000 (16:49 +0800)]
[X86] Rename MMX_MOVD64from64rm to MMX_MOVD64from64mr b/c it stores sth, NFC
Reviewed By: pengfei, RKSimon
Differential Revision: https://reviews.llvm.org/D122216
serge-sans-paille [Tue, 22 Mar 2022 09:37:17 +0000 (10:37 +0100)]
Fix missing include under -DEXPENSIVE_CHECK
Regression introduced by
f1985a3f855d3676c5aad0e5c258d2ea38598f44
Zakk Chen [Mon, 21 Feb 2022 08:54:46 +0000 (00:54 -0800)]
[RISCV] Add policy operand for masked vid and viota IR intrinsics.
Reviewed By: rogfer01
Differential Revision: https://reviews.llvm.org/D120227
Haojian Wu [Mon, 21 Mar 2022 14:55:46 +0000 (15:55 +0100)]
Reland "[pseudo] Split greatergreater token."
It was reverted, because the test had a lift-time issue.
Reland
f66d3758bda99e9f57bfdad168212feda18792ae with a fix.
Alex Bradbury [Tue, 22 Mar 2022 09:11:46 +0000 (09:11 +0000)]
[WebAssembly] Always emit functype directives for defined functions
This fixes bug <https://github.com/llvm/llvm-project/issues/54022>. For
now this means that defined functions will have two .functype directives
emitted. Given discussion in that bug has suggested interest in moving
towards using something other than .functype to mark the beginning of a
function (which would, as a side-effect, solve this issue), this patch
doesn't attempt to avoid that duplication.
Some test cases that used CHECK-LABEL: foo rather than CHECK-LABEL: foo:
are broken by this change. This patch updates those test cases to always
have a colon at the end of the CHECK-LABEL string.
Differential Revision: https://reviews.llvm.org/D122134
Nikita Popov [Tue, 22 Mar 2022 09:08:04 +0000 (10:08 +0100)]
[CodeGen][RISCV] Avoid deprecated address constructor