Commit Graph

436922 Commits

Author SHA1 Message Date
Sanjay Patel b0bfefb6ec [InstSimplify] fold redundant select of min/max, part 2
This extends e5d15e1162 to handle the inverse predicates
(there's probably a more elegant way to specify the preds).

These patterns correspond to the existing simplify:
max (min X, Y), X --> X
...and extra preds for (non)equality.

The tests cycle through all 10 icmp preds for each min/max
variant with 4 swapped operand patterns each (and the min/max
operands are commuted in every other test within those).

Some Alive2 examples to verify:
https://alive2.llvm.org/ce/z/XMvEKQ
https://alive2.llvm.org/ce/z/QpMChr
2022-09-25 07:06:43 -04:00
Daniel Bertalan d2f3d7bad2
[lld-macho] Force higher alignment for __thread_vars
`__thread_vars` contains pointers to `__tlv_bootstrap`, which are fixed
up by dyld; however the section's alignment is not specified. This means
that the relocations might end up on odd addresses, which is not
representable by the soon to be added chained fixups.

This is arguably a bug in MC, but this behavior has been there since TLV
support was originally added.

This patch forces the `__thread_vars` sections to be aligned to the
target's pointer size. This is done by ld64 as well.

Differential Revision: https://reviews.llvm.org/D134594
2022-09-25 08:02:07 +02:00
Han Zhu 67a04edd4e [X86] Pre-commit unit test for D134477 2022-09-24 21:51:35 -07:00
wangliushuai 910ad36e1a [Clang] Improve diagnostics about the invalid target feature.
Clang with debug builds will crash when run with empty target feature input.
And the warning message is a little bit confusing. This patch adds an empty
check and a new diagnostic to illustrate where goes wrong.

Reviewed By: MaskRay, aaron.ballman

Differential Revision: https://reviews.llvm.org/D133563
2022-09-25 10:27:08 +08:00
Philip Reames 5358968e13 [RISCV] Pattern match scalable strided load/store
Very straight forward extension of the existing pattern matching pass to handle scalable types as well as fixed length types. The only extra bit beyond removing a bailout is recognizing stepvector.

Differential Revision: https://reviews.llvm.org/D134502
2022-09-24 17:41:58 -07:00
Philip Reames 6e7c54ecaf [RISCV] Add lowering for scalable @llvm.riscv.masked.strided.load/store
The code previously assumed fixed length vectors; make the relevant code conditional.

Having the lowering in place is neccessary for an upcoming change to generalize scatter/gather matching to scalable vectors.

Differential Revision: https://reviews.llvm.org/D134489
2022-09-24 17:41:57 -07:00
David Green 2b187effbd [ARM] Fix check lines in memcpy-inline.ll test. NFC
Commit c442698 updated the check lines in this file, but did so in a
way that removed a number of the existing checks, as the
update_llc_test_checks script does not understand all triples. This
fixes it up as needed to keep testing Thumb1 code.
2022-09-24 21:29:41 +01:00
Florian Hahn 473bb59a2f
[LoopVersioning] Add tests where versioning requires LAA invalidation.
Additional test cases for #57825.
2022-09-24 20:33:49 +01:00
Simon Pilgrim 01631a83f1 [BPF] memcmp.ll - add checks for all loads
Noticed while triaging alignment issues for #57872
2022-09-24 18:55:25 +01:00
Simon Pilgrim 9e090dc699 [BPF] ex1.ll - add checks for stores
Noticed while triaging alignment issues for #57872
2022-09-24 18:53:59 +01:00
Nathan James 8c783b8ec7
[clang-tidy] Fix a false positive in readability-simplify-boolean-expr
Reviewed By: LegalizeAdulthood

Differential Revision: https://reviews.llvm.org/D134590
2022-09-24 18:29:19 +01:00
Sanjay Patel e5d15e1162 [InstSimplify] fold redundant select of min/max
This is similar to the existing simplify:
max (max X, Y), X --> max X, Y
...but the select condition can be one of
several predicates as shown in the tests.

The tests cycle through all 10 icmp preds for
each min/max variant with 4 swapped operand
patterns each (and the min/max operands are
commuted in every other test within those).

Some Alive2 examples to verify:
https://alive2.llvm.org/ce/z/lCAQm4
https://alive2.llvm.org/ce/z/kzxVXC
2022-09-24 11:34:05 -04:00
Sanjay Patel eb454433f4 [InstSimplify] add tests for select with min/max op; NFC
These are organized as 10 (predicates) * 4 (swapped operands) * 4 (min/max variants) = 160 tests.
2022-09-24 11:13:17 -04:00
Jun Zhang e07ead85a3
[Clang] Warn when trying to dereference void pointers in C
Previously we only have an extension that warn void pointer deferencing
in C++, but for C we did nothing.

C2x 6.5.3.2p4 says The unary * operator denotes indirection. If it points
to an object, the result is an lvalue designating the object. However, there
is no way to form an lvalue designating an object of an incomplete type as
6.3.2.1p1 says "an lvalue is an expression (with an object type other than
void)", so the behavior is undefined.

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

Signed-off-by: Jun Zhang <jun@junz.org>

Differential Revision: https://reviews.llvm.org/D134461
2022-09-24 22:18:04 +08:00
James Y Knight 5351878ba1 [TableGen] Add useDeprecatedPositionallyEncodedOperands option.
Summary:
The existing undefined-bitfield-to-operand matching behavior is very
hard to understand, due to the combination of positional and named
matching. This can make it difficult to track down a bug in a target's
instruction definitions.

Over the last decade, folks have tried to work-around this in various
ways, but it's time to finally ditch the positional matching. With
https://reviews.llvm.org/D131003, there are no longer cases that
_require_ positional matching, and it's time to start removing usage
and support for it.

Therefore: add a (default-false) option, and set it to true only in
those targets that require positional matching today. Subsequent
changes will start cleaning up additional in-tree targets.

NOTE TO OUT OF TREE TARGET MAINTAINERS:

If this change breaks your build, you may restore the previous
behavior simply by adding:
  let useDeprecatedPositionallyEncodedOperands = 1;
to your target's InstrInfo tablegen definition. However, this is
temporary -- the option will be removed in the future.

If your target does not set 'decodePositionallyEncodedOperands', you
may thus start migrating to named operands. However, if you _do_
currently set that option, I recommend waiting until a subsequent
change lands, which adds decoder support for named sub-operands.

Differential Revision: https://reviews.llvm.org/D134073
2022-09-24 09:40:45 -04:00
James Y Knight a538d1f13a [TableGen][CodeEmitterGen] Allow local names for sub-operands in a operand list.
These names can then be matched by name against 'bits' fields in a
record, to populate an instruction's encoding.

This does _not_ yet change DecoderEmitter to allow by-name matching of
sub-operands. Unlike the encoder, the decoder already defaulted to not
supporting positional matching, and backends had workarounds in place
for the missing decoding support.

Additionally, use this new capability to allow the ARM and AArch64
backends not to require any positional operand matching.

Differential Revision: https://reviews.llvm.org/D131003
2022-09-24 09:40:44 -04:00
Valentin Clement e657acd449
[flang] Handle NULL(mold) used in initializer region
NULL intrinsic with a MOLD argument can be used in a type constructor.
This patch handles this use case with a specific lowering that create
an unallocated box with the MOLD type.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D134554
2022-09-24 15:23:08 +02:00
Joseph Huber e2213159fa [Clang] Make Clang driver suggest '-Xclang' for CC1 options passed to the driver
This patch adds an additional check for if an options passed to the
Clang driver could've been intended for the clang compiler. This is
primarily done for the times when a user attempts to pass an option like
`-ast-dump` to the driver instead.

Reviewed By: MaskRay, aaron.ballman

Differential Revision: https://reviews.llvm.org/D134550
2022-09-24 07:58:40 -05:00
eopXD 75279aeecd [RISCV][Clang] Replace all undef value with poison
Address remaining work that dates back to discussion in D126745

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D134513
2022-09-24 04:42:04 -07:00
Valentin Clement de3efd1b4c
[flang] Lower character result of bind(c) function by value
BIND(C) Function returning character must return it by value and
not as hidden argument like done currently. This patch update the
code to return it by value for both use cases.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D134530
2022-09-24 09:00:26 +02:00
Craig Topper 4f86c5cbb7 [RISCV] Rename RISCVScheduleB.td to RISCVScheduleZb.td. NFC 2022-09-23 21:38:42 -07:00
Craig Topper 3967abcc0b [RISCV] Add missing scheduler classes to Zbkb and Zbkx instructions. 2022-09-23 21:38:42 -07:00
Jakub Kuderski 90a1632d0b [mlir][spirv] Switch to kEmitAccessorPrefix_Predixed
Fixes https://github.com/llvm/llvm-project/issues/57887

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D134580
2022-09-24 00:37:06 -04:00
Craig Topper cde3de5381 [RISCV] Remove a few remnants of Zbr I misssed. 2022-09-23 21:21:51 -07:00
Christopher Bate afb0b21f24 [mlir][nvgpu] Use TableGen TypeDef for NVGPU dialect types
Moves definition of DeviceAsyncToken to use the declarative Tablegen
TypeDef since the type is trivial. This also allows for removing the
current code for parsing/printing types by using the auto-generated
functions.

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D134564
2022-09-23 19:46:03 -06:00
Craig Topper 19850cc2d8 Revert "[RISCV] Lower BUILD_VECTOR to RISCVISD::VID_VL if it is floating-point type."
This reverts commit dd53a0bb30.

We have seen crashes from this internally. Probably due to the use
of RoundingMode::Dynamic.
2022-09-23 18:41:41 -07:00
Jakub Kuderski 250f9e09e4 [mlir][spirv] Switch to kEmitAccessorPrefix_Both
Prepare for switching to prefixed accessors.

Issue: https://github.com/llvm/llvm-project/issues/57887

Reviewed By: antiagainst, rriddle

Differential Revision: https://reviews.llvm.org/D134560
2022-09-23 21:31:43 -04:00
Peter Klausler 3bc334b31a [flang] Fix crash in semantics in error recovery
When a FUNCTION statement has both an explicit type in its prefix
and a RESULT clause in its suffix, semantics crashes due to the
redundant type; emit a nice error message instead.

Differential Revision: https://reviews.llvm.org/D134504
2022-09-23 17:45:35 -07:00
Raman Tenneti 8f1e362ee9 Implement nanosleep per https://pubs.opengroup.org/onlinepubs/009695399/basedefs/time.h.html
Tested:
Limited unit test: This makes a call and checks that no error was
returned, but we currently don't have the ability to ensure that
time has elapsed as expected.

Co-authored-by: Jeff Bailey <jeffbailey@google.com>

Reviewed By: sivachandra, jeffbailey

Differential Revision: https://reviews.llvm.org/D134095
2022-09-24 00:13:58 +00:00
Peter Klausler 3bbb2c2d99 [flang] Preserve component array lower bounds in folding
When a component array of a named constant is extracted as
a constant value, ensure that the lower bounds of the array
are properly acquired from the declaration of the component.

Differential Revision: https://reviews.llvm.org/D134499
2022-09-23 17:13:05 -07:00
Craig Topper 0d58a8cd49 [RISCV] Merge half-intrinsics-strict.ll into zvh-half-intrinsics-strict.ll. NFC
I had forgotten how we had the files partitioned.
2022-09-23 16:37:47 -07:00
Daniel Rodríguez Troitiño 74150a0afa [objdump] Fix typo in error message.
Change "inconsistant" for "inconsistent" in the message, the file name
and the test output.

Reviewed By: pete, MaskRay

Differential Revision: https://reviews.llvm.org/D134562
2022-09-23 16:27:24 -07:00
Slava Zakharin a707675dbb [flang][runtime] Enabled HAS_FLOAT128 for builds with clang.
I am building with clang, and I noticed for quite a while that
REAL(16) runtimes functions are not available. I did not know why
until I saw this typo.

Differential Revision: https://reviews.llvm.org/D134503
2022-09-23 16:20:09 -07:00
Peter Klausler 166563fdc7 [flang] Fix spurious error with COMMON and EQUIVALENCE
f18 emits an error message when two objects related by EQUIVALENCE
to a third are specified as members of a COMMON block.  This is not
always a sign of an error, however; it is possible for multiple objects
in a COMMON block to all be equivalenced to distinct offsets in another
object in a way that is consistent.  So refine the check.

Differential Revision: https://reviews.llvm.org/D134485
2022-09-23 15:32:39 -07:00
Peter Klausler 19d11b4d9d [flang] Allow "non-expandable" scalars in single-element contexts
When a scalar expression is not expandable -- i.e., it would have to be
evaluated once and saved in a temporary to avoid changing the semantics
of the program if it were to be evaluated more than once -- it affects
some aspects of folding and expression semantics.  In cases where
scalar expansion would not cause multiple evaluations due to the shape
of the result having but a single element, however, these "non-expandable"
scalar expressions can be safely allowed.

Differential Revision: https://reviews.llvm.org/D134476
2022-09-23 15:26:33 -07:00
Yi Kong 32994b7357 Make MLIR model URLs cache variables
This allows us to directly use the models published on Github.

Differential Revision: https://reviews.llvm.org/D134566
2022-09-23 15:21:53 -07:00
jeff 33ab74ac46 [AMDGPU] Precommit switching test to generated checks for D134463
Change-Id: I0d90f86ab759347a2f20448d28cc09ddaea3a4d4
2022-09-23 15:12:53 -07:00
Peter Klausler dd41453f1b [flang] Allow a generic-spec on a PUBLIC/PRIVATE statement to declare a generic
A generic-spec can appear on a module accessibility control statement
even if it has not been declared as a generic interface, because there's
nothing else that it could be.

While here, simplify the parse tree and parser for AccessId, since
one of its alternatives is ambiguous with the other.

Differential Revision: https://reviews.llvm.org/D134471
2022-09-23 14:17:42 -07:00
Peter Klausler 9489699438 [flang] Fold IS_CONTIGUOUS() to .FALSE. when it is known to be
At present, IS_CONTIGUOUS() can only either fold to .TRUE. or
remain unknown.  The underlying analysis, however, is capable
of returning a tri-state result (true, false, or unknown).
Extend and expose it to folding so that IS_CONTIGUOUS() can
fold to .FALSE. as well as to .TRUE. when contiguity is
known.

Differential Revision: https://reviews.llvm.org/D134466
2022-09-23 14:16:26 -07:00
Craig Topper 90a5d8499a [RISCV] Promote f16 STRICT_FCEIL/FLOOR/TRUNC/NEARBYINT/RINT/ROUND,ROUNDEVEN to f32. 2022-09-23 14:01:51 -07:00
Peter Klausler c7285cd09f [flang] Don't emit portability warnings for things in module files
Any symbol in a module file will have been already shamed with
portability warnings when the module was compiled, so don't pile
on when compiling other program units that use the module.
This also silences warnings about some symbols whose names were
created or extended by the compiler to avoid clashes.

Differential Revision: https://reviews.llvm.org/D134455
2022-09-23 13:45:09 -07:00
Craig Topper f466838511 [RISCV] Simplify check-prefixes in half-intrinsics.ll. NFC 2022-09-23 13:26:07 -07:00
Peter Klausler bfc3907369 [flang] Fix spurious errors from MODULE subprograms
When an explicit MODULE procedure is defined in the same (sub)module
as its interface, and the interface was defined in a generic
interface of the same name, bogus errors about symbols already
having been defined will ensue.  Cleaning up this aspect of name
resolution and symbol table management requires marking the
place-holding SubprogramNameDetails symbols of explicit MODULE
subprograms as such, ensuring that that attribute is not inherited
if the SubprogramNameDetails symbol is recycled as a SubprogramDetails,
and gathering some code that should have been common between
BeginSubprogram() and BeginMpSubprogram() together in one
new routine.

Differential Revision: https://reviews.llvm.org/D134446
2022-09-23 13:12:23 -07:00
Petar Avramovic a3becb333d [clang][AMDGPU] Temporarily disable clang atomic fadd test for gfx90a
Test is broken by D130579. Temporarily disable to silence builbot failures.
2022-09-23 21:49:16 +02:00
Mikhail Korolev 74f0b058f0 Fix Z3 version detection regexp
regexp for try_run path expects '0 or more' digits which is incorrect because it should be 'one or more', regexp for header parsing expects 'exactly one' digit which is incorrect with current Z3 version (4.11.2)

Reviewed By: mikhail.ramalho

Differential Revision: https://reviews.llvm.org/D134261
2022-09-23 16:24:51 -03:00
Douglas Yung 91e0423595 Revert "[SROA] Create additional vector type candidates based on store and load slices"
This reverts commit de3445e0ef.

This is causing GHI #57796 and #57821.
2022-09-23 12:24:07 -07:00
Douglas Yung 0a7f4e03a9 Revert "[SROA] Check typeSizeEqualsStoreSize in isVectorPromotionViable"
This reverts commit 3f08d248c4.

The commit this change is fixing is being reverted due to GHI #57796 and #37821, so revert this commit as well.
2022-09-23 12:24:07 -07:00
Peter Klausler 0ba2a3c44f [flang] Replace negative known CHARACTER length with zero in type analysis
When a DynamicType for CHARACTER has a known length, correct a negative
length value to its effective length of zero so that all such types
compare equal in interface compatibility checking.

Differential Revision: https://reviews.llvm.org/D134405
2022-09-23 12:22:19 -07:00
Erich Keane 0d18815baf Fix GH57943: Friend constraint checker didn't handle null decls.
Apparently TransformDecl in TreeTransform can be called with a nullptr
for a Decl, so my casts were illegal.  The fix here is to add an early
exit to my TransformDecl.
2022-09-23 12:21:56 -07:00
Jay Foad ddfa0f62d8 [AMDGPU] Add GFX11 feature for subtargets with more VGPRs
The full complement of physical VGPRs for GFX11 is 50% more than GFX10.
Some subtargets have this, others stay the same as GFX10. This affects
occupancy calculations.

Differential Revision: https://reviews.llvm.org/D134522
2022-09-23 20:18:23 +01:00