Commit Graph

418791 Commits

Author SHA1 Message Date
David Blaikie 4841dab4af llvm-dwarfdump: Including calling convention attribute in pretty printed type names 2022-03-22 19:19:54 +00:00
David Blaikie a3095a25d0 DebugInfo: Simplify const/volatile printing for function types 2022-03-22 19:19:54 +00:00
Corentin Jabot 8f057362a8 [Clang][NFC] Add braces to help readability
In CheckConstexprFunctionStmt, as discussed in
D111400.
2022-03-22 20:12:20 +01:00
Aaron Ballman a6beb18b84 Revert "Add UTF32 to/from UTF8 conversion functions"
This reverts commit c346068928.

It broke at least one of the builders:
https://lab.llvm.org/buildbot#builders/100/builds/13947
2022-03-22 15:00:40 -04:00
Corentin Jabot 683e83c56f [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
2022-03-22 19:51:19 +01:00
Peter Klausler bafbae238a [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
2022-03-22 11:48:14 -07:00
Peter Klausler 54d19ba208 [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
2022-03-22 11:10:30 -07:00
Jacques Pienaar e4fb75a354 [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
2022-03-22 11:08:36 -07:00
Jonas Devlieghere f54931865d
[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.
2022-03-22 11:01:38 -07:00
Cynthia Shen c8b957fd4c [MLIR][Presburger] Fix a comment in the unittests
Reviewed By: arjunp

Differential Revision: https://reviews.llvm.org/D122197
2022-03-22 17:51:21 +00:00
Marcus Johnson c346068928 Add UTF32 to/from UTF8 conversion functions
This is anticipated to be used in new format specifier checking code.
2022-03-22 13:41:43 -04:00
Simon Pilgrim 7f8572b8c3 [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
2022-03-22 17:35:10 +00:00
Craig Topper 51940d69cb [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
2022-03-22 10:29:06 -07:00
Aaron Ballman c3fe8ddd83 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.
2022-03-22 13:15:13 -04:00
Craig Topper 9b0f227d7b [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
2022-03-22 10:14:43 -07:00
Zakk Chen 23d60ce164 [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
2022-03-22 09:58:43 -07:00
Craig Topper 49c2206b3b [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
2022-03-22 09:52:54 -07:00
Nathan Sidwell c354167ae2 [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
2022-03-22 09:42:52 -07:00
Louis Dionne 80e66a05b6 [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
2022-03-22 12:35:47 -04:00
Hendrik Greving 510a2bbda4 [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
2022-03-22 09:34:48 -07:00
Alex Bradbury ef9cf86eb0 [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
2022-03-22 16:24:05 +00:00
Alex Bradbury 9001168cf8 [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
2022-03-22 16:13:35 +00:00
Walter Erquinigo 360dcb759d [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.
2022-03-22 09:10:42 -07:00
Nikita Popov cd6d9ae263 [CGOpenMPRuntime] Remove some uses of deprecated Adddress ctor 2022-03-22 16:29:35 +01:00
Valentin Clement 74f992929e
[flang][NFC] Remove unused variable
Fix for buildbot failure shown after fe252f8ed6
2022-03-22 16:13:03 +01:00
Kiran Chandramohan fea20cb990 [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>
2022-03-22 15:05:21 +00:00
Zakk Chen 10fd2822b7 [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
2022-03-22 07:47:21 -07:00
Sanjay Patel c4d74a93f6 [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.
2022-03-22 10:42:52 -04:00
Valentin Clement fe252f8ed6
[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>
2022-03-22 15:41:11 +01:00
chenglin.bi 01a2ba5dfb [InstCombine] add tests for abs with dominating condition; NFC
Baseline tests for D122013 (issue #54132).
2022-03-22 10:37:12 -04:00
Nikita Popov 4f5640cad3 [CGOpenMPRuntime] Remove some uses of deprecated Address ctor 2022-03-22 15:35:45 +01:00
Krasimir Georgiev eb35e0ecbe [clang-format] don't break up #-style comment sections
Follow-up from 36d13d3f8a; 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
2022-03-22 15:29:02 +01:00
Florian Hahn 50c8588e44
[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.
2022-03-22 14:23:12 +00:00
Pavel Labath 56fb745695 [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.
2022-03-22 15:14:21 +01:00
Kiran Chandramohan db925d08de [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>
2022-03-22 14:04:27 +00:00
Nikita Popov 73c0d05e6a [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.
2022-03-22 15:02:45 +01:00
Aaron Ballman 9cf8f81ca4 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.
2022-03-22 10:00:05 -04:00
Joseph Huber 5856f30b5a [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
2022-03-22 09:28:45 -04:00
Arjun P b68e78cea6 [MLIR][Prebsurger] Add IntegerRelation::intersect supporting locals properly
Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D122149
2022-03-22 13:13:56 +00:00
Arjun P 7f6112496b [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
2022-03-22 13:13:11 +00:00
Arjun P 93ccd7c490 [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
2022-03-22 13:11:56 +00:00
Sanjay Patel 60820e53ec [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
2022-03-22 09:10:55 -04:00
Djordje Todorovic 91ea247039 [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
2022-03-22 14:04:56 +01:00
Nikita Popov afb526b3f4 [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.
2022-03-22 14:00:07 +01:00
Igor Kudrin c344d97a12 [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
2022-03-22 16:46:48 +04:00
Igor Kudrin 568404e897 [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
2022-03-22 16:46:48 +04:00
Igor Kudrin d7681d9f77 [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
2022-03-22 16:46:47 +04:00
Igor Kudrin 2881696b40 [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
2022-03-22 16:46:47 +04:00
Bryan Chan 5269dd7f48 [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.
2022-03-22 08:40:10 -04:00
Vince Bridgers 985888411d [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
2022-03-22 07:35:13 -05:00