Matt Arsenault [Sun, 10 Apr 2022 16:08:10 +0000 (12:08 -0400)]
Mips/GlobalISel: Add stub post-legalizer combiner
This enables no combines, just adds the boilerplate for the new pass.
Xiaodong Liu [Fri, 15 Apr 2022 01:34:16 +0000 (01:34 +0000)]
[utils] Use git to checkout code instead of svn in building docker image
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D123795
Mehdi Amini [Fri, 15 Apr 2022 01:28:10 +0000 (01:28 +0000)]
Fix MLIR website generation
Matt Arsenault [Wed, 13 Apr 2022 23:01:20 +0000 (19:01 -0400)]
llvm-reduce: Handle cloning MachineFrameInfo and stack objects
This didn't work at all before, and would assert on any frame
index. Also copy the other fields, which I believe should cover
everything. There are a few that are untested since MIR serialization
is apparently still missing them (isStatepointSpillSlot,
ObjectSSPLayout, and ObjectSExt/ObjectZExt).
Peter Klausler [Wed, 6 Apr 2022 21:00:40 +0000 (14:00 -0700)]
[flang] Accept TYPE(intrinsic type) in declarations only for non-extension type
To avoid clashing with names of user derived types, the redundant
syntax TYPE(intrinsic type spec) must be interpreted as a monomorphic
derived type when "intrinsic type spec" is a single word. This
affects TYPE(BYTE) and TYPE(DOUBLECOMPLEX), but not TYPE(DOUBLE COMPLEX)
in free form source.
Differential Revision: https://reviews.llvm.org/D123724
Dhruva Chakrabarti [Thu, 14 Apr 2022 23:38:49 +0000 (23:38 +0000)]
[libomptarget] [amdgpu] Hostcall offset check should consider implicit args
Fixed hostcall offset check to compare against kernarg segment size
and implicit arguments. Improved the corresponding debug print.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D123827
Matt Arsenault [Wed, 13 Apr 2022 22:40:52 +0000 (18:40 -0400)]
llvm-reduce: Inform MRI of used phys reg masks
I'm not sure how to directly observe this invisible cache for a test.
Matt Arsenault [Wed, 13 Apr 2022 21:39:04 +0000 (17:39 -0400)]
llvm-reduce: Copy register allocation hints to clone
Matt Arsenault [Tue, 12 Apr 2022 22:10:02 +0000 (18:10 -0400)]
AMDGPU: Select i8/i16 global and flat atomic load/store
As far as I know these should be atomic anyway, as long as the address
is aligned. Unaligned atomics hit an ugly error in AtomicExpand.
Peter Klausler [Wed, 6 Apr 2022 19:51:57 +0000 (12:51 -0700)]
[flang] Defer NAMELIST group item name resolution
Items in NAMELIST groups might be host-associated implicitly-typed
variables, but name resolution can't know that when the NAMELIST
appears in a specification part and the host's execution part has
not yet been analyzed. So defer NAMELIST group item name resolution
to the end of the execution part. This is safe because nothing
else in name resolution depends on whether a variable is in a
NAMELIST group or not.
Differential Revision: https://reviews.llvm.org/D123723
Matt Arsenault [Fri, 8 Apr 2022 14:16:56 +0000 (10:16 -0400)]
AMDGPU: Fix assert if v_mov_b32_dpp is last instruction in the block
This can happen if the use instruction is a phi.
Fixes issue 49961
Matt Arsenault [Wed, 13 Apr 2022 21:07:44 +0000 (17:07 -0400)]
llvm-reduce: Fix asserting on undef virtual registers
This was only populating the virtual register map for def operands
that appeared in the function, but that may not exist if there are
only undef uses.
Matt Arsenault [Wed, 13 Apr 2022 17:18:41 +0000 (13:18 -0400)]
llvm-reduce: Fix handling of generic virtual registers
Try to preserve register banks, types and names. Fixes the lowest
hanging fruit in issue 54894.
Matt Arsenault [Wed, 13 Apr 2022 14:45:27 +0000 (10:45 -0400)]
MachineCSE: Report this requires SSA
Matt Arsenault [Wed, 13 Apr 2022 01:51:30 +0000 (21:51 -0400)]
llvm-reduce: Fix some copy-pasted comment errors
Matt Arsenault [Fri, 15 Apr 2022 00:16:15 +0000 (20:16 -0400)]
MachineFunction: Remove unused field
Jonas Devlieghere [Thu, 14 Apr 2022 23:59:56 +0000 (16:59 -0700)]
Remove folder introduced by incorrect patch level
Peter Klausler [Tue, 5 Apr 2022 20:42:12 +0000 (13:42 -0700)]
[flang] Allow modification of construct entities
Construct entities from ASSOCIATE, SELECT TYPE, and SELECT RANK
are modifiable if the are associated with modifiable variables
without vector subscripts. Update WhyNotModifiable() to accept
construct entities that are appropriate.
A need for more general error reporting from one overload of
WhyNotModifiable() caused its result type to change to
std::optional<parser::Message> instead of ::MessageFixedText,
and this change had some consequences that rippled through
call sites.
Some test results that didn't allow for modifiable construct
entities needed to be updated.
Differential Revision: https://reviews.llvm.org/D123722
Jonas Devlieghere [Thu, 14 Apr 2022 23:52:38 +0000 (16:52 -0700)]
[lldb] Show the DBGError if dsymForUUID can't find a dSYM
Show the user the DBGError (if available) when dsymForUUID fails.
rdar://
90949180
Differential revision: https://reviews.llvm.org/D123743
Thomas Raoux [Thu, 14 Apr 2022 22:10:51 +0000 (22:10 +0000)]
[mlir][nvgpu] Move mma.sync and ldmatrix in nvgpu dialect
Move gpu operation mma.sync and ldmatrix in nvgpu as they are specific
to nvidia target.
Differential Revision: https://reviews.llvm.org/D123824
Bill Wendling [Thu, 14 Apr 2022 23:35:41 +0000 (16:35 -0700)]
[randstruct] Add test for "-frandomize-layout-seed-file" flag
This test makes sure that the "-frandomize-layout-seed" and
"-frandomize-layout-seed-file" flags generate the same layout for the
record.
Reviewed By: aaron.ballman, MaskRay
Differential Revision: https://reviews.llvm.org/D123636
Jonas Devlieghere [Thu, 14 Apr 2022 22:05:07 +0000 (15:05 -0700)]
Revert "[lldb] Pin the shared cache when iterating over its images"
This reverts commit
af969141fa285157044e34fb6b27963c3278241b because it
didn't have the intended performance benefit to offset the increase in
our (virtual) memory usage.
Peter Klausler [Mon, 4 Apr 2022 23:43:44 +0000 (16:43 -0700)]
[flang] Fix TYPE/CLASS IS (T(...)) in SELECT TYPE
TYPE IS and CLASS IS guards in SELECT TYPE constructs are
allowed to specify the same type as the type of the selector
but f18's implementation of that predicate required strict
equality of the derived type representations. We need to
allow for assumed values of LEN type parameters to match
explicit and deferred type parameter values in the selector
and require equality for KIND type parameters. Implement
DerivedTypeSpec::Match() to perform this more relaxed type
comparison, and use it in check-select-type.cpp.
Differential Revision: https://reviews.llvm.org/D123721
Bill Wendling [Thu, 14 Apr 2022 23:07:00 +0000 (16:07 -0700)]
Revert "[randstruct] Add test for "-frandomize-layout-seed-file" flag"
There's a test failure.
This reverts commit
31ea4798ad0990838ccd27f80ca112f177ce91d9.
Mehdi Amini [Sun, 3 Apr 2022 23:59:34 +0000 (23:59 +0000)]
Apply clang-tidy fixes for modernize-use-default-member-init in PDLLServer.cpp (NFC)
Mehdi Amini [Sun, 3 Apr 2022 23:40:43 +0000 (23:40 +0000)]
Apply clang-tidy fixes for modernize-use-default-member-init in SparseTensorUtils.cpp (NFC)
Peter Klausler [Wed, 13 Apr 2022 17:27:36 +0000 (10:27 -0700)]
[flang] Local generics must not shadow host-associated generics
It is possible for generic interfaces of equivalent (but not necessarily
identical -- operator(.eq.) is equivalent to operator(==)) names to
be declared in a host scope and a nested scope, and the nested declaration
should function as an extension of the host's.
Differential Revision: https://reviews.llvm.org/D123719
Peter Klausler [Thu, 14 Apr 2022 21:55:47 +0000 (14:55 -0700)]
[flang] Inner INTRINSIC must not shadow host generic
A generic interface (however spelled) can have the same name as
an intrinsic procedure in the same scope. When an explicit INTRINSIC
attribute statement appears in a nested scope, semantics was
unconditionally declaring a new symbol that hid the generic entirely.
Catch this case and create instead a host association symbol for
the generic that can then be decorated with the INTRINSIC attribute.
Differential Revision: https://reviews.llvm.org/D123718
Bill Wendling [Thu, 14 Apr 2022 22:40:48 +0000 (15:40 -0700)]
[randstruct] Add test for "-frandomize-layout-seed-file" flag
This test makes sure that the "-frandomize-layout-seed" and
"-frandomize-layout-seed-file" flags generate the same layout for the
record.
Reviewed By: aaron.ballman, MaskRay
Differential Revision: https://reviews.llvm.org/D123636
Peter Klausler [Mon, 4 Apr 2022 21:30:38 +0000 (14:30 -0700)]
[flang][runtime] Preserve effect of positioning in record in non-advancing output
When formatted non-advancing output ends in a control edit descriptor
like nX or Tn or TRn that effectively extends the record, fill any
gap with explicit blanks at the completion of the WRITE.
Differential Revision: https://reviews.llvm.org/D123716
Peter Klausler [Mon, 4 Apr 2022 19:09:05 +0000 (12:09 -0700)]
[flang] Make F0.1 output editing of zero edge case consistent
The statement
PRINT '(2F0.1)', 0.0, 0.5
should emit consistent ".0 .5" output, not "0.0 .5".
Differential Revision: https://reviews.llvm.org/D123715
Fangrui Song [Thu, 14 Apr 2022 22:20:58 +0000 (15:20 -0700)]
[Driver] Remove unneeded -f[no-]pascal-strings translation. NFC
They used to translate to -m[no-]pascal-strings.
This is unneeded after
28c96319c8ab397c2e7d1a47b852bf2afae4f04b or some point in
2009 when -m[no-]pascal-strings became aliases for -f[no-]pascal-strings.
Bixia Zheng [Thu, 14 Apr 2022 16:41:27 +0000 (09:41 -0700)]
[mlir][sparse][taco] Use the SparseCompiler from python/tools.
Copy the implementation of SparseCompiler from python/tools to taco/tools until we have a common place to install it. Modify TACO to use this SparseCompiler for compilation and jitting.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D123696
Peter Klausler [Mon, 4 Apr 2022 18:39:51 +0000 (11:39 -0700)]
[flang] Raise FP exceptions from runtime conversion to binary
Formatted READs of REAL should convert the exception flags from
the decimal-to-binary conversion library into real runtime FP
exceptions so that they at least show up in the termination message
of a STOP statement.
Differential Revision: https://reviews.llvm.org/D123714
Igor Chebykin [Thu, 14 Apr 2022 21:22:12 +0000 (14:22 -0700)]
[NVPTX][tests] Do not run the test CodeGen/Generic/2010-11-04-BigByval.ll
NVPTX does not support the testcase llvm/test/CodeGen/Generic/2010-11-04-BigByval.ll
There are NVPTX specific testcases for byval args in the llvm/test/CodeGen/NVPTX
The test is marked as UNSUPPORTED for NVPTX due to unacceptable run time when using XFAIL
Differential Revision: https://reviews.llvm.org/D122939
Andrew Browne [Wed, 13 Apr 2022 18:49:49 +0000 (11:49 -0700)]
[DFSan] Avoid replacing uses of functions in comparisions.
This can cause crashes by accidentally optimizing out checks for
extern_weak_func != nullptr, when replaced with a known-not-null wrapper.
This solution isn't perfect (only avoids replacement on specific patterns)
but should address common cases.
Internal reference: b/
185245029
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D123701
Eli Friedman [Thu, 14 Apr 2022 20:50:03 +0000 (13:50 -0700)]
Comment out assertions about initializer size added in D123649.
They're causing failures in LLVM test-suite. Added some regression
tests that explain the issue.
Peter Klausler [Mon, 4 Apr 2022 13:44:05 +0000 (06:44 -0700)]
[flang] Correct interaction between generics and intrinsics
Fortran allows a generic interface to have he same name as an
intrinsic procedure. If the intrinsic is explicitly marked with
the INTRINSIC attribute, restrictions apply (C848) - the generic
must contain only functions or subroutines, depending on the
intrinsic. Explicit or not, the generic overrides the intrinsic,
but the intrinsic behavior must still be available for calls
whose actual arguments do not match any of the specific procedures.
Semantics was not checking constraint C848, and it didn't allow
an explicit INTRINSIC attribute on a name of a generic interface.
Differential Revision: https://reviews.llvm.org/D123713
Jameson Nash [Wed, 13 Apr 2022 21:49:36 +0000 (17:49 -0400)]
[X86] Fix test case for SoftPromoteHalf of STRICT_FP_EXTEND/STRICT_FP_ROUND.
Tests that should have been with
33b9f3abd78ffe31e2f468f64d36dbdf75b25d6e
when writing the tests that should have been with
0daf9b8e41327b1511b2bbc272184ff4fdb8de79.
Differential Revision: https://reviews.llvm.org/D123739
Louis Dionne [Thu, 14 Apr 2022 20:08:43 +0000 (16:08 -0400)]
[libc++][NFC] Add missing 'return 0' to test
Michael Jones [Tue, 12 Apr 2022 23:20:55 +0000 (16:20 -0700)]
[libc][docs] Add doc for libc string functions
This patch adds a document describing the status of the string functions
in LLVM-libc.
Reviewed By: sivachandra, jeffbailey
Differential Revision: https://reviews.llvm.org/D123645
V Donaldson [Tue, 12 Apr 2022 17:26:14 +0000 (10:26 -0700)]
[flang] Use full result range for clock_gettime implementation of SYSTEM_CLOCK
Update the primary clock_gettime implementation of SYSTEM_CLOCK to use
the full range of values, dependent on the type kind of the requested
result. Counts/sec and count max for supported kinds become:
kind counts/sec count max
1 10 127
2 1000 32767
4 1000
2147483647
8
1000000000 9223372036854775807
16
1000000000 9223372036854775807
The secondary "fallback" implementation is not changed.
Real valued COUNT_RATE arguments are not changed.
The test program below has calls for kinds 1, 2, 4, 8, 16. Support for
these types varies by compiler. The code as given can be restricted to
accommodate these variations, with results shown below.
subroutine c
integer(1) c1, r1, m1
integer(2) c2, r2, m2
integer(4) c4, r4, m4
integer(8) c8, r8, m8
integer(16) c16, r16, m16
print*
print '(a5,3a22)', 'kind', 'counts/sec', 'count max', 'count'
print*
call system_clock(c1, r1, m1)
print '(i5,3i22)', 1, r1, m1, c1
call system_clock(c2, r2, m2)
print '(i5,3i22)', 2, r2, m2, c2
call system_clock(c4, r4, m4)
print '(i5,3i22)', 4, r4, m4, c4
call system_clock(c8, r8, m8)
print '(i5,3i22)', 8, r8, m8, c8
call system_clock(c16, r16, m16)
print '(i5,3i22)', 16, r16, m16, c16
end
subroutine k(j)
j = 0
do i=1,
1000000000
j = j + i
enddo
end
program p
do i=1,1 ! increase loop count to check for (kind=1) wraparound
call k(j)
call c
enddo
end
=== flang output without change (last column counts vary per run) ===
kind counts/sec count max count
1 -24 127 83
2 1000 290 211
4 1000 290 211
8
1000000000 290448383 211631452
16
1000000000 290448383 211633853
=== flang output with change (last column counts vary per run) ===
1 10 127 21
2 1000 32767 2100
4 1000
2147483647 2100
8
1000000000 9223372036854775807 2100183374
16
1000000000 9223372036854775807 2100185353
Other compilers; kind support varies (last column counts vary per run).
Test and ouput modified to avoid crashes and normalize results.
Some negative values indicate unsupported kinds; others are bugs.
kind counts/sec count max count
1 0 0 -127
2 0 0 -32767
4 1000
2147483647 69271692
8
1000000000 9223372036854775807 69271692353290
16
1000000000 9223372036854775807 69271692354794
=======
1 10 127 0
2 1000 32767 0
4 1000000
2147483647 0
8
10000000 9223372036854775807 9
=======
1 0 0 -127
2 1000 32767 3263
4 10000
2147483647 1788192630
8 1000000
9223372036854775807 1649443459263095
=======
1 -24 -1 36
2 1000 -1 -10716
4 1000
2147483647 176018980
8 1000
9223372036854775807 1649443460644
=======
2 100 28799 23080
4 100 8639999 4285480
8 100 8639999 4285480
16 100 8639999 4285480
=======
1 -24 -1 4
2 1000 23551 -26108
4 1000
86399999 67541508
8 1000000
9223372036854775807 1649443541508087
Brad Smith [Thu, 14 Apr 2022 19:45:37 +0000 (15:45 -0400)]
[VE][compiler-rt] Correct location of VE support in clear_cache function, NFC
Looks like when the VE support was added it was added a few lines below where it should have been.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D123439
Paul Robinson [Wed, 13 Apr 2022 18:32:14 +0000 (11:32 -0700)]
[PS5] Add basic PS5 driver behavior
This adds a PS5-specific ToolChain subclass, which defines some basic
PS5 driver behavior. Future patches will add more target-specific
driver behavior.
Jonas Devlieghere [Thu, 14 Apr 2022 19:08:27 +0000 (12:08 -0700)]
[lldb] Remove TestShell.test
Remove TestShell.test because it's failing on the bot with "this is a
non-interactive debug session, cannot get permission to debug
processes." The only thing that's special about this test is the shell
we're launching with. I need to do a bit of digging to understand why
that's causing this error.
rdar://
91766931
Peter Klausler [Fri, 1 Apr 2022 23:01:04 +0000 (16:01 -0700)]
[flang] Fix shape analysis of RESHAPE result
Shape analysis of RESHAPE(..., SHAPE=s) should of course return
the SHAPE= actual argument when it is constant; but when it is
not, its length is still known, and thus so is the rank of the
result of RESHAPE(), and shape analysis should at least return
a shape vector of the right length rather than a result that
makes the result appear to be a scalar, which can lead to some
bogus error messages.
Also, while here: rename a private GetShapeHelper::AsShape()
routine so that it can't be confused with the ones in the API
of shape.h.
Differential Revision: https://reviews.llvm.org/D123712
Eli Friedman [Thu, 14 Apr 2022 18:56:40 +0000 (11:56 -0700)]
Allow flexible array initialization in C++.
Flexible array initialization is a C/C++ extension implemented in many
compilers to allow initializing the flexible array tail of a struct type
that contains a flexible array. In clang, this is currently restricted
to C. But this construct is used in the Microsoft SDK headers, so I'd
like to extend it to C++.
For now, this doesn't handle dynamic initialization; probably not hard
to implement, but it's extra code, and I don't think it's necessary for
the expected uses. And we explicitly fail out of constant evaluation.
I've added some additional code to assert that initializers have the
correct size, with or without flexible array init. This might catch
issues unrelated to flexible array init.
Differential Revision: https://reviews.llvm.org/D123649
LLVM GN Syncbot [Thu, 14 Apr 2022 18:36:20 +0000 (18:36 +0000)]
[gn build] Port
b9ca972b1ff0
Yonghong Song [Thu, 14 Apr 2022 15:42:52 +0000 (08:42 -0700)]
[BPF] handle opaque-pointer for __builtin_preserve_enum_value
Opaque pointer [1] is enabled as the default with commit [2].
Andrii found that current __builtin_preserve_enum_value() can only handle
non opaque pointer code pattern and will segfault with latest
llvm main branch where opaque-pointer is enabled by default.
This patch added the opaque pointer support.
Besides llvm selftests, also verified with bpf-next bpf selftests.
[1] https://llvm.org/docs/OpaquePointers.html
[2] https://reviews.llvm.org/D123122
Differential Revision: https://reviews.llvm.org/D123800
Chris Bieneman [Thu, 14 Apr 2022 01:47:28 +0000 (20:47 -0500)]
[HLSL] Pointers are unsupported in HLSL
HLSL does not support pointers or references. This change generates
errors in sema for generating pointer, and reference types as well as
common operators (address-of, dereference, arrow), which are used with
pointers and are unsupported in HLSL.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D123167
Fangrui Song [Thu, 14 Apr 2022 18:32:29 +0000 (11:32 -0700)]
[ELF][AArch64] Fix unneeded thunk for branches to hidden undefined weak
Similar to D119787 for PPC64.
A hidden undefined weak may change its binding to local before some
`isUndefinedWeak` code, so some `isUndefinedWeak` code needs to be changed to
`isUndefined`. The undefined non-weak case has been errored, so just using
`isUndefined` is fine.
The Linux kernel recently has a usage that a branch from 0xffff800008491ee0
references a hidden undefined weak symbol `vfio_group_set_kvm`.
It relies on the behavior that a branch to undefined weak resolving to the next
instruction, otherwise it'd see spurious relocation out of range errors.
Fixes https://github.com/ClangBuiltLinux/linux/issues/1624
Differential Revision: https://reviews.llvm.org/D123750
Sanjay Patel [Thu, 14 Apr 2022 18:02:56 +0000 (14:02 -0400)]
[InstCombine] canonicalize select with signbit test
This is part of solving issue #54750 - in that example
we have both forms of the compare and do not recognize
the equivalence.
Andrew Savonichev [Thu, 14 Apr 2022 18:25:31 +0000 (21:25 +0300)]
Revert "[NVPTX] Disable parens for identifiers starting with '$'"
This reverts commit
78d70a1c976934587e6d4c5698c348b8f09d9d96.
Failed on Mips32:
https://lab.llvm.org/buildbot#builders/109/builds/36628
# CHECK: # fixup A - offset: 0, value: ($tmp0), kind: fixup_Mips_26
<stdin>:580:2: note: possible intended match here
# fixup A - offset: 0, value: $tmp0, kind: fixup_Mips_26
Peter Klausler [Fri, 1 Apr 2022 21:18:02 +0000 (14:18 -0700)]
[flang] Always encode multi-byte output in UTF-8
A recent change to implement UTF-8 encoding should have
made the encoding conditional only for CHARACTER(KIND=1)
to enable UTF-8 output vs. Latin-1 or whatever. UTF-8 output
of wider CHARACTER kinds should not be conditional (until we choose
to support UCS-16, maybe). So wider CHARACTER kinds are being
emitted with extra zero bytes; this patch fixes them.
Differential Revision: https://reviews.llvm.org/D123711
Fangrui Song [Thu, 14 Apr 2022 18:13:41 +0000 (11:13 -0700)]
[clang-tidy] Add portability-std-allocator-const check
Report use of `std::vector<const T>` (and similar containers of const
elements). These are now allowed in standard C++ due to undefined
`std::allocator<const T>`. They do not compile with libstdc++ or MSVC.
Future libc++ will remove the extension (D120996).
See docs/clang-tidy/checks/portability-std-allocator-const.rst for detail.
I have attempted clean-up in a large code base. Here are some statistics:
* 98% are related to the container `std::vector`, among `deque/forward_list/list/multiset/queue/set/stack/vector`.
* 24% are related to `std::vector<const std::string>`.
* Both `std::vector<const absl::string_view>` and `std::vector<const int>` contribute 2%. The other contributors spread over various class types.
The check can be useful to other large code bases and may serve as an example
for future libc++ strictness improvement.
Note: on MSVC where -fdelayed-template-parsing is the default, the check cannot
catch cases in uninstantiated templates.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D123655
Andrew Savonichev [Mon, 11 Apr 2022 18:33:04 +0000 (21:33 +0300)]
[NVPTX] Disable parens for identifiers starting with '$'
ptxas fails to parse such syntax:
mov.u64 %rd1, ($str);
fatal : Parsing error near '$str': syntax error
A new MCAsmInfo option was added because InParens parameter of
MCExpr::print is not sufficient to disable parens
completely. MCExpr::print resets it to false for a recursive call in
case of unary or binary expressions.
Differential Revision: https://reviews.llvm.org/D123702
Zequan Wu [Fri, 1 Apr 2022 22:40:56 +0000 (15:40 -0700)]
[LLDB][NativePDB] Fix a crash when S_DEFRANGE_SUBFIELD_REGISTER descirbes a simple type
When a variable is simple type and has 64 bits, the debug info may look like the following when targeting 32bit windows. The variable's content is split into two 32bits registers.
```
480 | S_LOCAL [size = 12] `x`
type=0x0013 (__int64), flags = param
492 | S_DEFRANGE_SUBFIELD_REGISTER [size = 20]
register = EAX, may have no name = true, offset in parent = 0
range = [0001:0073,+7), gaps = []
512 | S_DEFRANGE_SUBFIELD_REGISTER [size = 20]
register = ECX, may have no name = true, offset in parent = 4
range = [0001:0073,+7), gaps = []
```
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D122943
Zequan Wu [Thu, 14 Apr 2022 17:58:17 +0000 (10:58 -0700)]
[LLDB][NativePDB] Fix inline line info in line table
It fixes the following case:
```
0602 line 1 (+1)
0315 code 0x15 (+0x15)
0B2B code 0x20 (+0xB) line 2 (+1)
0602 line 3 (+1)
0311 code 0x31 (+0x11)
...
```
Inline ranges should have following mapping:
`[0x15, 0x20) -> line 1`
`[0x20, 0x31) -> line 2`
Inline line entries:
`0x15, line 1`, `0x20, line 2`, `0x31, line 3`.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D123092
Jonas Devlieghere [Thu, 14 Apr 2022 17:46:57 +0000 (10:46 -0700)]
[lldb] Port Process::PrintWarning* to use the new diagnostic events
Port the two Process::PrintWarning functions to use the new diagnostic
events through Debugger::ReportWarning. I kept the wrapper function in
the process, but delegated the work to the Module. Consistent with the
current code, the Module ensures the warning is only printed once per
module.
Differential revision: https://reviews.llvm.org/D123698
Jonas Devlieghere [Thu, 14 Apr 2022 17:45:11 +0000 (10:45 -0700)]
[lldb] Prevent crash when adding a stop hook with --shlib
Currently, lldb crashes when adding a stop hook with --shlib because we
unconditionally use the target in SymbolContextSpecifier::AddSpecification.
This patch prevents the crash and add a test.
rdar://
68524781
Differential revision: https://reviews.llvm.org/D123746
Martin Sebor [Thu, 14 Apr 2022 17:59:04 +0000 (11:59 -0600)]
Use descriptive register names for readability (NFC).
Maksim Panchenko [Thu, 14 Apr 2022 02:39:39 +0000 (19:39 -0700)]
[BOLT][perf2bolt] Fix base address calculation for shared objects
When processing profile data for shared object or PIE, perf2bolt needs
to calculate base address of the binary based on the map info reported
by the perf tool. When the mapping data provided is for the second
(or any other than the first) segment and the segment's file offset
does not match its memory offset, perf2bolt uses wrong assumption
about the binary base address.
Add a function to calculate binary base address using the reported
memory mapping and use the returned base for further address
adjustments.
Reviewed By: yota9
Differential Revision: https://reviews.llvm.org/D123755
Mark de Wever [Thu, 14 Apr 2022 17:27:04 +0000 (19:27 +0200)]
[libc++] Adds a missing include.
This fixes the modular build.
Peter Klausler [Thu, 31 Mar 2022 15:50:18 +0000 (08:50 -0700)]
[flang] Defer all function result type processing
When a type specification appears in the prefix of a FUNCTION statement,
defer its processing as late as possible so that any symbols in the
tpe specification can be resolved in the function's scope to local
declarations, including use-associated symbols. f18 was already doing
this deferral in a limited form for derived types, and this patch
makes it work for intrinsic type parameter values as well.
In short, "real(kind(x)) function foo(x)" now works as it should.
"As late as possible" means the end of the specification part, or
the first appearance of the function result name in the specification
part.
Differential Revision: https://reviews.llvm.org/D123705
Andrew Litteken [Thu, 14 Apr 2022 17:23:33 +0000 (12:23 -0500)]
Revert "[IROutliner] Ensure that phi values that are passed in as arguments are remapped as arguments"
Failing test due to typo
This reverts commit
d6eb480afbc038871570fa053d772c913cd77a61.
Andrew Litteken [Mon, 21 Mar 2022 20:56:50 +0000 (15:56 -0500)]
[IROutliner] Ensure that phi values that are passed in as arguments are remapped as arguments
Issue: https://github.com/llvm/llvm-project/issues/54430
For incoming values of phi nodes added to an outlined function to accommodate different exit paths in the function, when a value is a constant that is passed into the outlined function as an argument, we find the corresponding value in the first extracted function used to fill the overall outlined function. When this value is an argument, the corresponding value used will be the old value, prior to outlining. This patch maintains a mapping from these values to arguments, and uses this mapping to update the added phi node accordingly.
Reviewers: paquette
Differential Revision: https://reviews.llvm.org/D122206
Paul Robinson [Thu, 14 Apr 2022 17:14:01 +0000 (10:14 -0700)]
[PS4] Fix a couple of typos
Andrew Litteken [Mon, 21 Mar 2022 20:56:22 +0000 (15:56 -0500)]
[IROutliner] Ensure that incoming blocks of PHINodes are included in the unique numbering gneration for phi nodes for each exit path
Issue: https://github.com/llvm/llvm-project/issues/54431
PHINodes that need to be generated to accommodate a PHINode outside the region due to different output paths need to have their own numbering to determine the number of output schemes required to properly handle all the outlined regions. This numbering was previously only determined by the order and values of the incoming values, as well as the parent block of the PHINode. This adds the incoming blocks to the calculation of a hash value for these PHINodes as well, and the supporting infrastructure to give each block in a region a corresponding canonical numbering.
Reviewer: paquette
Differential Revision: https://reviews.llvm.org/D122207
Thomas Raoux [Thu, 7 Apr 2022 07:14:39 +0000 (07:14 +0000)]
[mlir][nvgpu] Add NVGPU dialect (architectural specific gpu dialect)
This introduce a new dialect for vendro specific ptx operations. This
also adds the first operation ldmatrix as an example. More operations
will be added in follow up patches.
This new dialect is meant to be a bridge between GPU and Vector
dialectis and NVVM dialect.
This is based on the RFC proposed here:
https://discourse.llvm.org/t/rfc-add-nv-gpu-dialect-hw-specific-extension-of-gpu-dialect-for-nvidia-gpus/61466/8
Differential Revision: https://reviews.llvm.org/D123266
Arthur Eubanks [Wed, 13 Apr 2022 21:36:30 +0000 (14:36 -0700)]
[clang-format] Skip preprocessor lines when finding the record lbrace
With D117142, we would now format
```
struct A {
#define A
void f() { a(); }
#endif
};
```
into
```
struct A {
#ifdef A
void f() {
a();
}
#endif
};
```
because we were looking for the record lbrace without skipping preprocess lines.
Fixes https://github.com/llvm/llvm-project/issues/54901.
Reviewed By: curdeius, owenpan
Differential Revision: https://reviews.llvm.org/D123737
Paul Walker [Tue, 12 Apr 2022 17:28:51 +0000 (18:28 +0100)]
[SVE] Refactor MGATHER lowering for unsupported passthru values.
Handle unsupported passthru values before lowering the gather to
target specific nodes. This is a simplification that's on the road
to moving more of MGATHER lowering into td based isel.
Differential Revision: https://reviews.llvm.org/D123683
chenglin.bi [Thu, 14 Apr 2022 16:10:00 +0000 (00:10 +0800)]
[SimplifyCFG] Try to fold switch with single result value and power-of-2 cases to mask+select
When switch with 2^n cases go to one result, check if the 2^n cases can be covered by n bit masks.
If yes we can use "and condition, ~mask" to simplify the switch
case 0 2 4 6 -> and condition, -7
https://alive2.llvm.org/ce/z/jjH_0N
case 0 2 8 10 -> and condition, -11
https://alive2.llvm.org/ce/z/K7E-2V
case 2 4 8 12 -> and (sub condition, 2), -11
https://alive2.llvm.org/ce/z/CrxbYg
Fix one case of https://github.com/llvm/llvm-project/issues/39957
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D122485
Peter Klausler [Wed, 30 Mar 2022 18:51:50 +0000 (11:51 -0700)]
[flang] Fix combining cases of USE association & generic interfaces
Fortran admits a few ways to have multiple symbols with the
same name in the same scope. Two of them involve generic
interfaces (from INTERFACE or GENERIC, the syntax doesn't matter);
these are allowed to inhabit a scope with either a derived type or
a subprogram that is also a specific procedure of the generic.
(But not both a derived type and a subprogram; they could not
cohabit a scope anyway, generic or not.)
In cases of USE association, f18 needs to be capable of combining
use-associated generic interfaces with other use-associated entities.
Two generics get merged (this case was nearly correct); a generic
and a derived type can merge into a GenericDetails with a shadowed
derivedType(); and a generic can replace or ignore a use-associated
procedure of the same name so long as that procedure is already
one of its specifics.
Further, these modifications to the use-associated generic
interface must be made to a local copy of the symbol. The previous
code was messing directly with the symbol in the module's scope.
The fix is basically a reimplementation of the member function
DoAddUse() in name resolution.
Differential Revision: https://reviews.llvm.org/D123704
John Brawn [Thu, 4 Nov 2021 12:19:12 +0000 (12:19 +0000)]
[AArch64] Add mayRaiseFPException to appropriate instructions
This is mostly handled by adding "let mayRaiseFPException = 1" before
the definition of the relevant instruction classes, but there are a
couple of complications:
* When we have a multiclass where currently some instantiations are
of instructions that can raise an exception and others aren't we
need to split that into two multiclasses, one inheriting from the
other using a multiclass parameter to enable exceptions.
* In a couple of places in the globalisel instruction selector we
need to manually set the NoFPExcept flag. There's also another
place that looks like it should need it, but that code is never hit
for those opcodes due to them being handled by the generic
instruction selector, so I've instead just removed them from the
switch.
Differential Revision: https://reviews.llvm.org/D115352
John Brawn [Tue, 25 Jan 2022 17:09:44 +0000 (17:09 +0000)]
[AArch64] Adjust aarch64 constrained intrinsics tests and un-XFAIL
Remove the checking of the generated asm, as that's already tested
elsewhere, and adjust some tests that were expecting the wrong
intrinsic to be generated.
Differential Revision: https://reviews.llvm.org/D118259
John Brawn [Thu, 9 Dec 2021 12:39:29 +0000 (12:39 +0000)]
[AArch64] Lowering and legalization of strict FP16
For strict FP16 to work correctly needs some changes in lowering and
legalization:
* SelectionDAGLegalize::PromoteNode was missing handling for some
strict fp opcodes.
* Some of the custom lowering of strict fp operations needed to be
adjusted to work with FP16.
* Custom lowering needed to be added for round-to-int operations.
With this, and the previous patches for the rest of the strict fp
isel, we can set IsStrictFPEnabled = true.
Differential Revision: https://reviews.llvm.org/D115620
Kevin P. Neal [Fri, 8 Apr 2022 15:47:54 +0000 (11:47 -0400)]
[FPEnv][InstSimplify] Fold fsub -0.0, -X ==> X
Currently the fsub optimizations in InstSimplify don't know how to fold
-0.0 - (-X) to X when the constrained intrinsics are used. This adds partial
support. The rest of the support will come later with work on the IR
matchers.
This review is split out from D107285.
Differential Revision: https://reviews.llvm.org/D123396
LLVM GN Syncbot [Thu, 14 Apr 2022 15:22:09 +0000 (15:22 +0000)]
[gn build] Port
1fdf952deeb9
Chris Bieneman [Wed, 30 Mar 2022 19:20:15 +0000 (14:20 -0500)]
[HLSL] Add Semantic syntax, and SV_GroupIndex
HLSL has a language feature called Semantics which get attached to
declarations like attributes and are used in a variety of ways.
One example of semantic use is here with the `SV_GroupIndex` semantic
which, when applied to an input for a compute shader is pre-populated
by the driver with a flattened thread index.
Differential Revision: https://reviews.llvm.org/D122699
# Conflicts:
# clang/include/clang/Basic/Attr.td
# clang/include/clang/Basic/AttrDocs.td
LLVM GN Syncbot [Thu, 14 Apr 2022 14:51:17 +0000 (14:51 +0000)]
[gn build] Port
e471ba3d0122
Joseph Huber [Fri, 25 Mar 2022 15:02:29 +0000 (11:02 -0400)]
[Object] Add binary format for bundling offloading metadata
We need to embed certain metadata along with a binary image when we wish
to perform a device-linking job on it. Currently this metadata was
embedded in the section name of the data itself. This worked, but made
adding new metadata very difficult and didn't work if the user did any
sort of section linking.
This patch introduces a custom binary format for bundling offloading
metadata with a device object file. This binary format is fundamentally
a simple string map table with some additional data and an embedded
image. I decided to use a custom format rather than using an existing
format (ELF, JSON, etc) because of the specialty use-case of this. We
need a simple binary format that can be concatenated without requiring
other external dependencies.
This extension will make it easier to extend the linker wrapper's
capabilties with whatever data is necessary. Eventually this will allow
us to remove all the external arguments passed to the linker wrapper and
embed it directly in the host's linker so device linking behaves exactly
like host linking.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D122069
Joseph Huber [Sat, 2 Apr 2022 21:55:00 +0000 (17:55 -0400)]
[OpenMP] Make offloading sections have the SHF_EXCLUDE flag
Offloading sections can be embedded in the host during codegen via a
section. This section was originally marked as metadata to prevent it
from being loaded, but these sections are completely unused at runtime
so the linker should automatically drop them from the final executable
or shard library. This flag adds support for the SHF_EXCLUDE flag in
target lowering and uses it.
Reviewed By: JonChesterfield, MaskRay
Differential Revision: https://reviews.llvm.org/D122987
Peter Klausler [Fri, 1 Apr 2022 19:46:04 +0000 (12:46 -0700)]
[flang] Improve appearance of message attachments
Error messages can have a list of attachments; these are used to point
to related source locations, supply additional information, and to
encapsulate error messages that were *not* emitted in a given context
to explain why a warning was justified.
This patch adds a message severity ("Because") for that last case,
and extends to AttachTo() API to provide a means for overriding
the severity of an attached message.
Some existing message attachments had their severities adjusted,
now that we're printing them. And operator==() for Message was
cleaned up while debugging after I noticed that it was recursively
O(N**2) and subject to returning a false positive.
Differential Revision: https://reviews.llvm.org/D123710
Fabian Wolff [Thu, 14 Apr 2022 14:17:24 +0000 (16:17 +0200)]
[libc++] Fix undefined behavior in `std::filebuf`
Fixes https://github.com/llvm/llvm-project/issues/49267.
Fixes https://github.com/llvm/llvm-project/issues/49282.
Fixes https://github.com/llvm/llvm-project/issues/49789.
Reviewed By: ldionne
Differential Revision: https://reviews.llvm.org/D122257
David Green [Thu, 14 Apr 2022 14:19:33 +0000 (15:19 +0100)]
[AArch64] Move v4i8 concat load lowering to a combine.
The existing code was not updating the uses of loads that it recreated,
leading to incorrect chains which could break the ordering between
nodes. This moves the code to a combine instead, and makes sure we
update the chain references. This does mean it happens earlier -
potentially before the concats are simplified. This can lead to
inefficiencies in the codegen, which will be fixed in followups.
Andrew Savonichev [Sun, 10 Apr 2022 19:33:48 +0000 (22:33 +0300)]
[NVPTX] Fix barrier.ll LIT test
The second parameter should be a multiple of the warp size (32).
PTX ISA spec, s9.7.12.1. Parallel Synchronization and Communication
Instructions: bar, barrier
barrier.sync{.aligned} a{, b};
Operand b specifies the number of threads participating in the
barrier. If no thread count is specified, all threads in the CTA
participate in the barrier. When specifying a thread count, the value
must be a multiple of the warp size.
Differential Revision: https://reviews.llvm.org/D123470
Andrew Savonichev [Thu, 31 Mar 2022 17:03:30 +0000 (20:03 +0300)]
[NVPTX] Avoid dots in global names
It seems that ptxas cannot parse them:
ptxas fatal: Parsing error near '.2': syntax error
Differential Revision: https://reviews.llvm.org/D123041
Andrew Savonichev [Thu, 31 Mar 2022 20:50:34 +0000 (23:50 +0300)]
[NVPTX] .attribute(.managed) is only supported for sm_30 and PTX 4.0
PTX ISA spec, s5.4.8. Variable Attribute Directive: .attribute
PTX ISA Notes
Introduced in PTX ISA version 4.0.
Target ISA Notes
.managed attribute requires sm_30 or higher.
Differential Revision: https://reviews.llvm.org/D123040
Andrew Savonichev [Thu, 31 Mar 2022 18:16:30 +0000 (21:16 +0300)]
[NVPTX] shfl.sync is introduced in PTX 6.0
PTX ISA spec, s9.7.8.6. Data Movement and Conversion Instructions:
shfl.sync
PTX ISA Notes
Introduced in PTX ISA version 6.0.
Target ISA Notes
Requires sm_30 or higher.
Differential Revision: https://reviews.llvm.org/D123039
Andrew Savonichev [Thu, 31 Mar 2022 16:30:41 +0000 (19:30 +0300)]
[NVPTX] 64-bit atom.{and,or,xor,min,max} require sm_32 or higher
PTX ISA spec, s9.7.12.4. Parallel Synchronization and Communication
Instructions: atom
Target ISA Notes
64-bit atom.{and,or,xor,min,max} require sm_32 or higher.
Differential Revision: https://reviews.llvm.org/D123038
LLVM GN Syncbot [Thu, 14 Apr 2022 13:37:28 +0000 (13:37 +0000)]
[gn build] Port
58d9ab70aef3
Nikolas Klauser [Wed, 13 Apr 2022 20:59:09 +0000 (22:59 +0200)]
[libc++][ranges] Implement ranges::minmax and ranges::minmax_element
Reviewed By: var-const, #libc, ldionne
Spies: sstefan1, ldionne, BRevzin, libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D120637
PeixinQiao [Thu, 14 Apr 2022 13:34:00 +0000 (21:34 +0800)]
[flang] Fix intrinsic interface for DIMAG/DCONJG
The intrinsics DREAL, DIMAG, and DCONJG are from Fortran 77 extensions.
For DREAL, the type of argument is extended to any complex. For DIMAG
and DCONJG, the type of argument for them should be complex(8). For DIMAG,
the result type should be real(8). For DCONJG, the result type should be
complex(8). Fix the intrinsic interface for them and add test cases for
the semantic checks and the lowering.
Reviewed By: Jean Perier
Differential Revision: https://reviews.llvm.org/D123459
PeixinQiao [Thu, 14 Apr 2022 13:28:30 +0000 (21:28 +0800)]
[flang] Fix float-number representation bug
The float number is represented as (-1)^s * 1.f * 2^(-127) for 32-bit,
where s is the signed flag, f is the mantissa. When the exponent bits
are all zeros, the float number is represented as (-1)^s * 0.f *2^(-126)
for 32-bit, in which case, the intPart is '0'.
Reviewed By: Jean Perier
https://reviews.llvm.org/D123673
Alex Zinenko [Thu, 14 Apr 2022 13:25:42 +0000 (15:25 +0200)]
[mlir] fix compiler warnings
-Wsign-compare and -Wunsued-value in the recently introduced code.
LLVM GN Syncbot [Thu, 14 Apr 2022 13:21:19 +0000 (13:21 +0000)]
[gn build] Port
dd47ab750b58
Nico Weber [Thu, 14 Apr 2022 13:20:51 +0000 (09:20 -0400)]
Revert "[clang-tidy] Add portability-std-allocator-const check"
This reverts commit
73da7eed8fac84c9005518740f12d58389998d95.
Breaks check-clang-tools on Windows, see comment on
https://reviews.llvm.org/D123655
LLVM GN Syncbot [Thu, 14 Apr 2022 13:06:13 +0000 (13:06 +0000)]
[gn build] Port
73da7eed8fac
Nico Weber [Thu, 14 Apr 2022 13:05:11 +0000 (09:05 -0400)]
Revert "[gn build] Port
73da7eed8fac"
This reverts commit
bd4463bebfe8545c8e626fc7828beac3509b656f.
Breaks check-clang-tools on Windows, see comment on
https://reviews.llvm.org/D123655
Lei Zhang [Thu, 14 Apr 2022 12:56:47 +0000 (08:56 -0400)]
[mlir][vector] Cast away leading one dims for insert ops
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D123621