Commit Graph

417721 Commits

Author SHA1 Message Date
serge-sans-paille fbbc41f8dd Cleanup include: TableGen
This also includes a few cleanup from Support.

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D121331
2022-03-11 11:41:32 +01:00
Nikita Popov 36be8fabb0 [Bitcode] Delete phi node on error
These error conditions are checked after the phi node has been
created, so we also need to delete it.
2022-03-11 11:37:29 +01:00
Nikita Popov ba3380026a [Bitcode] Improve some error messages
It's not particularly helpful if 95% of our errors just say
"Invalid record". This at least adds the record type to a subset
of errors.
2022-03-11 11:37:29 +01:00
Florian Hahn aa590e5823
[AArch64] Improve costs for some conversions to fp16.
Currently the cost model under-estimates the cost of certain
FP16 conversions.

This patch updates getCastInstrCost to return more accurate costs for
the cases improved in c2ed9fd054.

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D113700
2022-03-11 10:27:39 +00:00
Pavel Labath 161bddf3af [ADT] Make BitmaskEnum operations constant expressions
This avoids runtime initialization (a global constructor) whenever they appear
in the initializer.

The patch just adds the constexpr keyword to a couple of functions.

Differential Revision: https://reviews.llvm.org/D121281
2022-03-11 11:11:55 +01:00
David Sherwood aeeb1199b4 [AArch64][SVE] Change the asserts in LowerToPredicatedOp to check for legal types
When building the LLVM test suite with SVE I discovered a crash
when compiling some Halide tests, which occurs because we try to
use SVE to lower 64-bit vector multiplies and there is no
vscale_range attribute on the function. In this case the min SVE
vector bits was 0, which caused an assert in LowerToPredicatedOp
to fire. I have amended the asserts in this function to check that the
fixed-width type is legal. If the fixed-width type is larger than NEON
and is legal then it must be because we've set the min SVE vector
bits to something > 128. Or if the min SVE bits is 0, then the only
legal types allowed are 128 bit types - for any other types the assert
will fire.

Tests added here:

  CodeGen/AArch64/sve-fixed-length-no-vscale-range.ll

Differential Revision: https://reviews.llvm.org/D121297
2022-03-11 09:57:58 +00:00
Nikita Popov 02c2106002 [InstSimplify] Handle vector GEP when simplifying zero indices
If the base is a scalar and the index is a vector, we can't
simplify, as this is effectively a splat operation.
2022-03-11 10:56:44 +01:00
Nikita Popov d7645f4ef8 [Bitcode] Delete instruction on error
As these errors are detected after the instruction has already been
created (but before it has been inserted into the function), we
also need to delete it.
2022-03-11 10:56:43 +01:00
Yun Long 5c3861b277 [MLIR][python binding] Add OpaqueAttribute to python binding.
Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D120847
2022-03-11 10:56:21 +01:00
Vassil Vassilev 788e0f7f3e [clang-repl] Add an accessor to our underlying execution engine
This patch will allow better incremental adoption of these changes in downstream
cling and other users which want to experiment by customizing the execution
engine.
2022-03-11 09:24:47 +00:00
Nikita Popov e732f69ea1 [Bitcode] Report error for missing element type for attr upgrade
Otherwise this is going to crash either the TypeFinder or the
Verifier.
2022-03-11 10:18:42 +01:00
Dmitry Vassiliev dfeb978155 Fixed a roll-over on size_t in getNewUninitMemBuffer()
Reviewed By: serge-sans-paille

Differential Revision: https://reviews.llvm.org/D121399
2022-03-11 13:16:58 +04:00
Nikita Popov 374bb6dd80 [docs] Update opaque pointers transition state (NFC)
Bitcode is now supported.
2022-03-11 09:35:38 +01:00
Nikita Popov dcc4b94d94 [llvm-c] Document that LLVMGetElementType on pointers is deprecated (NFC)
We can't actually deprecate the function, because it is also used
for arrays and vectors, so we can only document this.
2022-03-11 09:28:18 +01:00
Jean Perier a7802a806d [flang] Do not return true for pointer sub-object in IsPointerObject
evaluate::IsPointerObject used to return true for pointer suboject like
`pointer(10)` while these object are not pointers. This prevented some
checks like 15.5.2.7 to be correctly enforced (e.g., it was possible to
pass `pointer(10)` to a non intent(in) dummy pointer).

After updating IsPointerObject behavior and adding a test for 15.5.2.7 in
call07.f90, a test in call03.f90 for 15.5.2.4(14) was failing.
It appeared the related semantics check was relying on IsPointerObject
to return true for `pointer(10)`. Adapt the code to detect pointer element
in another way.
While looking at the code, I also noticed that semantics was
rejecting `character(1)` pointer/assumed shape suboject when these are
allowed (the standard has a special case for character(1) in
15.5.2.4(14), and I verified that other compilers that enforce 15.5.2.4(14)
do accept this).

Differential Revision: https://reviews.llvm.org/D121377
2022-03-11 09:26:21 +01:00
Nikita Popov 3ed643ea76 [AMDGPUPromoteAlloca] Make compatible with opaque pointers
This mainly changes the handling of bitcasts to not check the types
being casted from/to -- we should only care about the actual
load/store types. The GEP handling is also changed to not care about
types, and just make sure that we get an offset corresponding to
a vector element.

This was a bit of a struggle for me, because this code seems to be
pretty sensitive to small changes. The end result seems to produce
strictly better results for the existing test coverage though,
because we can now deal with more situations involving bitcasts.

Differential Revision: https://reviews.llvm.org/D121371
2022-03-11 09:20:51 +01:00
Yevgeny Rouban c5f34d1692 [CommandLine] Keep option default value unset if no cl::init() is used
Current declaration of cl::opt is incoherent between class and non-class
specializations of the opt_storage template. There is an inconsistency
in the initialization of the Default field: for inClass instances
the default constructor is used - it sets the Optional Default field to
None; though for non-inClass instances the Default field is set to
the type's default value. For non-inClass instances it is impossible
to know if the option is defined with cl::init() initializer or not:

cl::opt<int> i1("option-i1");
cl::opt<int> i2("option-i2", cl::init(0));
cl::opt<std::string> s1("option-s1");
cl::opt<std::string> s2("option-s2", cl::init(""));

assert(s1.Default.hasValue() != s2.Default.hasValue()); // Ok
assert(i1.Default.hasValue() != i2.Default.hasValue()); // Fails

This patch changes constructor of the non-class specializations to keep
the Default field unset (that is None) rather than initialize it with
DataType().

Reviewed By: lattner
Differential Revision: https://reviews.llvm.org/D114645
2022-03-11 14:24:25 +07:00
Peixin-Qiao f2ac513812 [flang] Fix processing ModuleLikeUnit evaluationList
Push the ModuleLikeUnit evalutionList when entering module unit. Pop it
when exiting module unit if there is no module procedure. Otherwise, pop
it when entering the first module procedure.

Reviewed By: V Donaldson

Differential Revision: https://reviews.llvm.org/D120460
2022-03-11 15:20:23 +08:00
Craig Topper e9d4922543 [RISCV] Add tablegen helper classes to create PatFrag to check for one use. NFC
Reduces code and the class can be instantiated in isel patterns to
avoid creating more *_oneuse classes.
2022-03-10 23:14:21 -08:00
Peixin-Qiao b905864845 [flang] Support for dump OpenMP/OpenACC declarative directives PFT in module
OpenMP/OpenACC declarative directives can also be used in module unit.
Add support for dump them in module.

Reviewed By: kiranchandramohan, V Donaldson

Differential Revision: https://reviews.llvm.org/D120459
2022-03-11 14:33:17 +08:00
Craig Topper 337d49da84 [RISCV] Fix typo in comment. NFC 2022-03-10 22:00:18 -08:00
Eric Tang 336c92d5e8 [RISCV] Add alias for HFENCE.VVMA
Signed-off-by: Eric Tang <eric.tang@starfivetech.com>

Differential Revision: https://reviews.llvm.org/D120878
2022-03-11 13:32:52 +08:00
Johannes Doerfert e8fadafe77 [Attributor][NFCI] Make AAPointerInfo deterministic
The order in which we kept accesses was non-deterministic and a debug
output was a pointer value. Fixed both.
2022-03-10 23:27:47 -06:00
Johannes Doerfert 7211dbd01d [Attributor][NFCI] Remove non-deterministic behavior and debug output 2022-03-10 23:27:47 -06:00
Craig Topper 1f3a8d58a6 [RISCV] Use ZERO_EXTEND instead of ANY_EXTEND when promoting i32 RISCVISD::SHFL. NFC
We know the shift amount is a constant with bit 31 clear. anyext
of constant will be either zext or sext which will produce the
same result here. But we really shouldn't rely on that. It would
be valid to put a random number in the upper bits. Our isel patterns
expect the upper bits to be 0 so we should ask for it explicitly.
2022-03-10 20:57:04 -08:00
Weining Lu 097035f308 [LoongArch] Use getLoc() directly to construct error message 2022-03-11 11:55:35 +08:00
Fangrui Song 4a8de2832a [ELF] Add -z pack-relative-relocs
GNU ld 2.38 added -z pack-relative-relocs which is similar to
--pack-dyn-relocs=relr but synthesizes the `GLIBC_ABI_DT_RELR` version
dependency if a shared object named `libc.so.*` has a `GLIBC_2.*` version
dependency.

This is used to implement the (as some glibc folks call) version lockout
mechanism. Add this option, because glibc does not want to support
--pack-dyn-relocs=relr which does not add `GLIBC_ABI_DT_RELR`.
See https://maskray.me/blog/2021-10-31-relative-relocations-and-relr for
detail.

Close https://github.com/llvm/llvm-project/issues/53775

Reviewed By: peter.smith

Differential Revision: https://reviews.llvm.org/D120701
2022-03-10 19:54:21 -08:00
Alex Brachet e970d2823c [llvm-mt] Add support /notify_update
`/notify_update` is an undocumented feature used by CMake. From their usage, it looks like this feature just changes `mt`'s exit code if the output file was changed. See https://gitlab.kitware.com/cmake/cmake/-/blob/master/Source/cmcmd.cxx#L2300 this is also consistent with some testing I have done of the mt.exeshipped with Visual Studio. See also the comment at https://gitlab.kitware.com/cmake/cmake/-/blob/master/Source/cmcmd.cxx#L2440.

There might be a more performant way to implement this by first checking calling `llvm::sys::fs::file_size()` and if it is the same as the new output's size use `llvm::WritableMemoryBuffer` and fallback to `llvm::FileOutputBuffer` otherwise,  but these don't inherit from a common ancestor so any implementation doing this would be really ugly.

Fixes https://github.com/llvm/llvm-project/issues/54329

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D121438
2022-03-11 03:46:46 +00:00
Khem Raj a11d1cc41c [builtins] Use mcr for dmb instruction on armv6
At present compiler-rt cross compiles for armv6 ( -march=armv6 ) but includes
dmb instructions which are only available in armv7+ this causes SIGILL on
clang+compiler-rt compiled components on rpi0w platforms.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D99282
2022-03-10 19:30:00 -08:00
4vtomat 25df633c24 Split up large test files(over 10k lines) under clang/test/CodeGen/RISCV including:
The llvm pre-merge test got timeout due to large test files, this commit
split up the files that have over 10k lines under clang/test/CodeGen/RISCV
into even smaller ones.

Differential Revision: https://reviews.llvm.org/D121431
2022-03-10 19:13:39 -08:00
Chia-hung Duan ed645f6336 [mlir] Support verification order (3/3)
In this CL, update the function name of verifier according to the
behavior. If a verifier needs to access the region then it'll be updated
to `verifyRegions`.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D120373
2022-03-11 01:16:28 +00:00
Jez Ng fc968bcba4
[lld-macho][nfc] Fix formatting in ld64-vs-lld.rst 2022-03-10 18:33:18 -05:00
Sanjay Patel ca808e8924 [x86] add tests for and+setcc; NFC 2022-03-10 18:32:00 -05:00
Zhiyao Ma adc26b4eae [ARM] Fix 8-bit immediate overflow in the instruction of segmented stack prologue.
It fixes the overflow of 8-bit immediate field in the emitted
instruction that allocates large stacklet.

For thumb2 targets, load large immediate by a pair of movw and movt
instruction. For thumb1 and ARM targets, load large immediate by reading
from literal pool.

Differential Revision: https://reviews.llvm.org/D118545
2022-03-10 15:15:24 -08:00
Philippe Valembois 26cd258420 [AArch64] Use correct calling convention for each vararg
While checking is tail call optimization is possible, the calling
convention applied to fixed arguments is not the correct one.
This implies for DarwinPCS that all arguments of a vararg function will
go to the stack although fixed ones can go in registers.

This prevents non-virtual thunks to be tail optimized although they are
marked as musttail.

Differential Revision: https://reviews.llvm.org/D120622
2022-03-10 15:07:25 -08:00
Zequan Wu d54c4df314 [clang-format] Fix namespace format when the name is followed by a macro
Example:
```
$ cat a.cpp
namespace my_namespace::yeah API_AVAILABLE(macos(10.15)) {
void test() {}
}

$ clang-format a.cpp
namespace my_namespace::yeah API_AVAILABLE(macos(10.15)) {
void test() {}
}// namespace my_namespace::yeahAPI_AVAILABLE(macos(10.15))
```
After:
```
$ clang-format a.cpp
namespace my_namespace::yeah API_AVAILABLE(macos(10.15)) {
void test() {}
}// namespace my_namespace::yeah
```

Reviewed By: MyDeveloperDay, owenpan, curdeius

Differential Revision: https://reviews.llvm.org/D121269
2022-03-10 15:00:32 -08:00
Sam McCall 7f0df31ee3 [clang-tools-extra] Don't consider python below LLVM_MINIMUM_PYTHON_VERSION. NFC 2022-03-10 23:57:27 +01:00
Dave Lee 14e4d2e564 [lldb] Remove unused include in ScriptedProcessInterface.h 2022-03-10 14:56:21 -08:00
Eli Friedman 27a5749625 [Sema][Windows] Don't special-case void* in __unaligned conversions.
As far as I can tell, MSVC allows the relevant conversions for all
pointer types. Found compiling a Windows SDK header.

I've verified that the updated errors in MicrosoftExtensions.cpp match
the ones that MSVC actually emits, except for the one with a FIXME. (Not
sure why this wasn't done for the patch that added the tests.)

To make up for the missing error, add a warning that triggers on
conversions that drop the __unaligned qualfier.

Differential Revision: https://reviews.llvm.org/D120936
2022-03-10 14:49:16 -08:00
Diego Caballero f71f9958b9 [mlir][Vector] Modernize default lowering of vector transpose
This patch removes an old recursive implementation to lower vector.transpose to extract/insert operations
and replaces it with a iterative approach that leverages newer linearization/delinearization utilities.
The patch should be NFC except by the order in which the extract/insert ops are generated.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D121321
2022-03-10 22:33:14 +00:00
Florian Hahn 3c9e849943
[FunctionAttrs] Add tests for argmemonly inference. 2022-03-10 22:32:29 +00:00
owenca 0be56c8701 [clang-format][NFC] Group all C++ passes under isCpp()
Also removes a not very helpful comment.
2022-03-10 14:30:30 -08:00
Sam McCall 2d58ba200a [clang-tools-extra] Remove unused lit features/substitutions. NFCI 2022-03-10 23:28:43 +01:00
Sam McCall 6ed2f8902b Fix reference to execute_external leftover in 69924ccf7a 2022-03-10 23:20:03 +01:00
Sam McCall 69924ccf7a Remove redundant lit config already handled in llvm_config. NFCI
This logic duplicates lit.llvm.initialize, which we're already calling
(in lit.site.cfg.py.in).
The equivalent logic was removed from clang in d4401d354a but
never cleaned up here.
2022-03-10 23:11:01 +01:00
Dave Lee 47f652d695 [lldb] Call ThreadPlan::DiscardPlan from Thread::DiscardPlan
Correct `Thread::DiscardPlan` to call `DiscardPlan` instead of `PopPlan`.

Differential Revision: https://reviews.llvm.org/D96655
2022-03-10 13:58:08 -08:00
Sylvestre Ledru 54d7fde46e llvm-ifs doc: Replace a utf-8 char by a more classic one
Fails on old python (like on ubuntu bionic) otherwise with:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 2130: ordinal not in range(128)
2022-03-10 22:45:05 +01:00
Kirill Stoimenov 120e0434bc [ASan] Added back @PLT to __asan_report_* calls to avoid compile errors.
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D121409
2022-03-10 21:43:00 +00:00
Saleem Abdulrasool c604207608 lldb/ObjectFile,Disassembler: read some state from the executable
Add support to inspect the ELF headers for RISCV targets to determine if
RVC or RVE are enabled and the floating point support to enable.  As per
the RISCV specification, d implies f, q implies d implies f, which gives
us the cascading effect that is used to enable the features when setting
up the disassembler.  With this change, it is now possible to attach the
debugger to a remote process and be able to disassemble the instruction
stream.

~~~
$ bin/lldb tmp/reduced
(lldb) target create "reduced"
Current executable set to '/tmp/reduced' (riscv64).
(lldb) gdb-remote localhost:1234
(lldb) Process 5737 stopped
* thread #1, name = 'reduced', stop reason = signal SIGTRAP
    frame #0: 0x0000003ff7fe1b20
->  0x3ff7fe1b20: mv     a0, sp
    0x3ff7fe1b22: jal    1936
    0x3ff7fe1b26: mv     s0, a0
    0x3ff7fe1b28: auipc  a0, 27
~~~
2022-03-10 21:42:06 +00:00
Siva Chandra Reddy 1f45a1071d [libc][Obvious] Destroy the block store var in block store test. 2022-03-10 21:36:46 +00:00