Commit Graph

417588 Commits

Author SHA1 Message Date
serge-sans-paille efec6b800f Conditional include of Twine.h under Z3 2022-03-11 15:48:06 +01:00
Benjamin Kramer 3b15a7c042 [BFI] Use SmallPtrSets. NFCI. 2022-03-11 15:20:57 +01:00
Louis Dionne a805a15b28 [libc++] Remove workaround for missing declarations on Windows store apps
We don't need preprocessor logic to exclude those declarations when compiling for
the Windows App Store, because that is handled by using_if_exists now.

Differential Revision: https://reviews.llvm.org/D108632
2022-03-11 09:08:30 -05:00
Louis Dionne 21f73d5826 [libc++] Remove workaround for C11 features on compilers that don't support using_if_exists
Instead of carrying around #ifdefs to determine whether those functions
are available on the platform, unconditionally use the using_if_exists
attribute to import it into namespace std only when available. That was
the purpose of this attribute from the start.

This change means that trying to use libc++ with an old SDK (or on an
old platform for platforms that ship system headers in /usr/include)
will require a recent Clang that supports the using_if_exists attribute.
When using an older Clang or GCC, the underlying platform has to support
a C11 standard library.

Differential Revision: https://reviews.llvm.org/D108203
2022-03-11 09:06:43 -05:00
Louis Dionne 611469c5c5 [libc++] Remove raw call to debug handler from __char_traits_length_checked
As a fly-by fix, also move it closer to where it is needed, and add a
comment explaining the existence of this weird function.

Differential Revision: https://reviews.llvm.org/D121231
2022-03-11 09:05:29 -05:00
Nikita Popov 237df15c08 [Verifier] Check type of swifterror alloca
Per LangRef, swifterror alloca must be a pointer.

Not checking this may result in a verifier error after transforms
instead, so make sure it's discarded early.
2022-03-11 14:52:56 +01:00
Florian Hahn ecea477df3
[VPlan] Helper to check if a recipe uses scalar values of op.
This patch adds a helper to check if a recipe only uses scalars of a
given operand. This is similar to onlyFirstLaneUsed, which was
introduced earlier.

By default, usesScalars falls back on onlyFirstLaneUsed.

Will be used by D120828.

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D120827
2022-03-11 13:41:08 +00:00
Nikita Popov 7781f61efa [ConstantFold] Fix scalable shufflevector fold with all-undef mask
If the input is scalable, we should not be returning a fixed-width
vector as a result.
2022-03-11 14:30:02 +01:00
Nikita Popov 853beb55e1 [FuzzMutate] Support scalable shufflevector 2022-03-11 14:20:40 +01:00
Nikita Popov a3aac5693d [IRMutator] Handle module with only declarations
There was a mismatch here, with one check checking whether there
are any functions, and the other collecting only non-declaration
functions.
2022-03-11 14:20:39 +01:00
Nikita Popov 806450805d [ConstFold] Don't fold calls with mismatching function type
With opaque pointers, this is no longer ensured through pointer
type identity.
2022-03-11 14:09:23 +01:00
Tue Ly 38cadd90b7 [libc] Implement expf function that is correctly rounded for all rounding modes.
Implement expf function that is correctly rounded for all rounding modes.

Reviewed By: sivachandra, zimmermann6

Differential Revision: https://reviews.llvm.org/D121440
2022-03-11 07:16:47 -05:00
Marek Kurdej b44eb207e9 [clang-format] Refactor condition in AnnotatingParser::modifyContext(). NFC. 2022-03-11 13:12:43 +01:00
Florian Hahn e07b899192
[FunctionAttrs] Rename addReadAttrs -> addMemoryAttrs.
The addReadAttrs name is out of date, as the function also adds
the writeonly attribute. addMemoryAttrs is more accurate.
2022-03-11 11:49:22 +00:00
Andrzej Warzynski 125a4d915e [flang] Remove deprecated fields from FIROps.td
This patch removes deprecated parser/printer/verifier fields from
FIROps.td. This is a follow-up of https://reviews.llvm.org/D119776 - it
takes care of operations deriving from `fir_IntegralSwitchTerminatorOp`
and `region_Op`.

No new functionality is added, hence no tests. This patch addresses:
https://github.com/llvm/llvm-project/issues/54314.

Differential Revision: https://reviews.llvm.org/D121406

Some changes were extracted from D121090 (by River Riddle).

co-authored-by: River Riddle <riddleriver@gmail.com>
2022-03-11 11:29:20 +00:00
Matt Devereau 6c5da880e0 [AArch64][SVE][Clang] Fix crash for incorrect svptrue and svcnt parameters
Giving an int parameter to SVE intrinsics svptrue and svcnt caused Clang
to crash on compilation. Changing their parameter types to void instead of
omitting args results in a diagnostic error message instead.

Differential Revision: https://reviews.llvm.org/D121294
2022-03-11 11:19:53 +00:00
Nikita Popov cda82d39f3 [Bitcode] Check for type mismatch when assigning value
If the value is forward-declared, then the type must match,
otherwise we can't RAUW.
2022-03-11 12:12:54 +01:00
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