Commit Graph

479101 Commits

Author SHA1 Message Date
Craig Topper
77e88db6b7 [RISCV][GISel] Add missing curly brace to test. NFC 2023-10-30 10:12:56 -07:00
Michael Buch
c3f7ca7810 [lldb][Test] TestDataFormatterLibcxxChrono.py: skip test on older clang versions (#70544)
These tests were failing on the LLDB public matrix build-bots for older
clang versions:
```
clang-7: warning: argument unused during compilation: '-nostdlib++' [-Wunused-command-line-argument]
error: invalid value 'c++20' in '-std=c++20'
note: use 'c++98' or 'c++03' for 'ISO C++ 1998 with amendments' standard
note: use 'gnu++98' or 'gnu++03' for 'ISO C++ 1998 with amendments and GNU extensions' standard
note: use 'c++11' for 'ISO C++ 2011 with amendments' standard
note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard
note: use 'c++14' for 'ISO C++ 2014 with amendments' standard
note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard
note: use 'c++17' for 'ISO C++ 2017 with amendments' standard
note: use 'gnu++17' for 'ISO C++ 2017 with amendments and GNU extensions' standard
note: use 'c++2a' for 'Working draft for ISO C++ 2020' standard
note: use 'gnu++2a' for 'Working draft for ISO C++ 2020 with GNU extensions' standard
make: *** [main.o] Error 1
```

The test fails because we try to compile it with `-std=c++20` (which is
required for std::chrono::{days,weeks,months,years}) on clang versions
that don't support the `-std=c++20` flag.

We could change the test to conditionally compile the C++20 parts of the
test based on the `-std=` flag and have two versions of the python
tests, one for the C++11 chrono features and one for the C++20 features.

This patch instead just disables the test on older clang versions
(because it's simpler and we don't really lose important coverage).
2023-10-30 17:08:25 +00:00
Nick Desaulniers
693941132e [docs] mention that DenseMap has a SmallDenseMap variant (#70677)
via https://github.com/llvm/llvm-project/pull/67699/files#r1375105711
2023-10-30 10:07:58 -07:00
Jake Egan
a1b4005bae [clang][Module] Mark test unsupported since objc doesn't have xcoff/g… (#70661)
…off support

Same as D135848. The newly added test fails with `fatal error: error in
backend: Objective-C support is unimplemented for object file format`.
2023-10-30 13:06:49 -04:00
Adrian Prantl
c42b640208 Fix the DEVELOPER_DIR computation (#70528)
The code was incorrectly going into the wrong direction by removing one
component instead of appendeing /Developer to it. Due to fallback
mechanisms in xcrun this never seemed to have caused any issues.
2023-10-30 10:00:40 -07:00
Craig Topper
284d136c4a [RISCV] Teach copyPhysReg to allow copies between GPR<->FPR32/FPR64 (#70525)
This is needed because GISel emits copies instead of bitcasts like
SelectionDAG.
2023-10-30 09:58:51 -07:00
Valentin Clement (バレンタイン クレメン)
f706837e2b [flang][mlir][openacc] Switch device_type representation to an enum (#70250)
Switch the representation from scalar integer to a enumeration. The
parser transform the string in the input to the correct enumeration.
2023-10-30 09:51:42 -07:00
Jay Foad
101008be83 [AMDGPU] CodeGen for 64-bit buffer atomic cmpswap intrinsics (#70475)
Implement codegen for:
llvm.amdgcn.raw.buffer.atomic.cmpswap.i64
llvm.amdgcn.raw.ptr.buffer.atomic.cmpswap.i64
llvm.amdgcn.struct.buffer.atomic.cmpswap.i64
llvm.amdgcn.struct.ptr.buffer.atomic.cmpswap.i64
2023-10-30 16:44:22 +00:00
Louis Dionne
3c5885535a [libc++][tests] Fix a few remaining instances of outdated static assertion regexes in our test suite (#70454)
This is a re-application of 166b3a8617, which was reverted in
fde1ecdec8 because it broke some tests.
2023-10-30 17:28:51 +01:00
Arthur Eubanks
f75370310c [X86] Print 'l' section flag for SHF_X86_64_LARGE (#70380)
When directly compiling to an object file we properly set the section
flag, but not when emitting assembly.
2023-10-30 09:24:18 -07:00
Timm Bäder
8a1719d3ed [clang][Interp][NFC] Use delegate() in VisitCXXBindTemporaryExpr 2023-10-30 17:20:27 +01:00
Z572
7de70e0f72 [Flang][OpenMP] Fix comments that should not be Sentinels on fixed format. (#68911)
Fixes #68653
2023-10-31 00:20:00 +08:00
Alan Phipps
f95b2f1acf Reland "[InstrProf][compiler-rt] Enable MC/DC Support in LLVM Source-based Code Coverage (1/3)"
Part 1 of 3. This includes the LLVM back-end processing and profile
reading/writing components. compiler-rt changes are included.

Differential Revision: https://reviews.llvm.org/D138846
2023-10-30 11:15:02 -05:00
Valentin Clement (バレンタイン クレメン)
dc8c2a7794 [flang][openacc][NFC] Add test for atomic with array ref (#70261)
After #69944 lowering of array ref in atomic operation works properly.
Add some lowering test to catch up regression in the future.
2023-10-30 09:08:57 -07:00
LLVM GN Syncbot
3746f20b56 [gn build] Port 72e6c1c70d 2023-10-30 15:58:08 +00:00
Nick Desaulniers
d9b15b068d [CGExprConstant] stop calling into ConstExprEmitter for Reference type destinations (#70366)
Fixes a bug introduced by
commit b54294e2c9 ("[clang][ConstantEmitter] have
tryEmitPrivate[ForVarInit] try ConstExprEmitter fast-path first")

In the added test case, the QualType is a LValueReferenceType.

    LValueReferenceType 0x558412998d90 'const char (&)[41]'
    `-ParenType 0x558412998d30 'const char[41]' sugar
      `-ConstantArrayType 0x558412998cf0 'const char[41]' 41
        `-QualType 0x55841294c271 'const char' const
          `-BuiltinType 0x55841294c270 'char'

Fixes: #69979
2023-10-30 08:48:31 -07:00
Luke Lau
fecd11ba87 [RISCV] Remove old peephole declaration in RISCVISelDAGToDAG.h. NFC
It was removed in 72e6c1c70d
2023-10-30 15:45:54 +00:00
David Spickett
bb9dced2d3 [lldb][AArch64][Linux] Rename Is<ext>Enabled to Is<ext>Present (#70303)
For most register sets, if it was enabled this meant you could use it,
it was present in the process. There was no present but turned off
state. So "enabled" made sense.

Then ZA came along (and soon to be ZT0) where ZA can be present in the
hardware when you have SME, but ZA itself can be made inactive. This
means that "IsZAEnabled()" doesn't mean is it active, it means do you
have SME. Which is very confusing when we actually want to know if ZA is
active.

So instead say "IsZAPresent", to make these checks more specific. For
things that can't be made inactive, present will imply "active" as
they're never inactive.
2023-10-30 15:45:40 +00:00
tsitdikov
8bc4462bc1 Remove unused variable. (#70670)
All usages of the variable have been removed in
https://github.com/llvm/llvm-project/pull/68689, we now need to clean it
up.
2023-10-30 16:37:30 +01:00
Natalie Chouinard
f89b85996a [HLSL][SPIR-V] Fix clang driver lang target test (#70330)
This test has been failing since the SPIR-V backend started failing
explicitly on unsupported shader types. Switched this test to a compute
shader since it is currently the only type supported.
2023-10-30 11:36:38 -04:00
Timm Baeder
56dab2cb07 [clang][Interp] Fix truncateCast() (#69911)
The added test case used to fail because we converted the LHS to `-1`.
2023-10-30 16:27:47 +01:00
Jessica Del
849297c97d [AMDGPU][wmma] - Add tied wmma intrinsic (#69903)
These new intrinsics, `amdgcn_wmma_tied_f16_16x16x16_f16` and
`amdgcn_wmma_tied_f16_16x16x16_f16`,
explicitly tie the destination accumulator matrix to the input
accumulator matrix.

The `wmma_f16` and `wmma_bf16` intrinsics only write to 16-bit of the
32-bit destination VGPRs.
Which half is determined via the `op_sel` argument. The other half of
the destination registers remains unchanged.

In some cases however, we expect the destination to copy the other
halves from the input accumulator.
For instance, when packing two separate accumulator matrices into one.
In that case, the two matrices
are tied into the same registers, but separate halves. Then it is
important to copy the other matrix values
to the new destination.
2023-10-30 16:23:49 +01:00
Luke Lau
72e6c1c70d [RISCV] Begin moving post-isel vector peepholes to a MF pass (#70342)
We currently have three postprocess peephole optimisations for vector
pseudos:

1) Masked pseudo with all ones mask -> unmasked pseudo
2) Merge vmerge pseudo into operand pseudo's mask
3) vmerge pseudo with all ones mask -> vmv.v.v pseudo

This patch aims to move these peepholes out of SelectionDAG and into a
separate RISCVFoldMasks MachineFunction pass.

There are a few motivations for doing this:

* The current SelectionDAG implementation operates on MachineSDNodes,
which are essentially MachineInstrs but require a bunch of logic to
reason about chain and glue operands. The RISCVII::has*Op helper
functions also don't exactly line up with the SDNode operands. Mutating
these pseudos and their operands in place becomes a good bit easier at
the MachineInstr level. For example, we would no longer need to check
for cycles in the DAG during performCombineVMergeAndVOps.

* Although it's further down the line, moving this code out of
SelectionDAG allows it to be reused by GlobalISel later on.

* In performCombineVMergeAndVOps, it may be possible to commute the
operands to enable folding in more cases (see
test/CodeGen/RISCV/rvv/vmadd-vp.ll). There is existing machinery to
commute operands in TII::commuteInstruction, but it's implemented on
MachineInstrs.

The pass runs straight after ISel, before any of the other machine SSA
optimization passes run. This is so that dead-mi-elimination can mop up
any vmsets that are no longer used (but if preferred we could try and
erase them from inside RISCVFoldMasks itself). This also means that
these peepholes are no longer run at codegen -O0, so this patch isn't
strictly NFC.

Only the performVMergeToVMv peephole is refactored in this patch, the
remaining two would be implemented later. And as noted by @preames, it
should be possible to move doPeepholeSExtW out of SelectionDAG as well.
2023-10-30 15:17:00 +00:00
Stanislav Mekhanoshin
fe8335babb [AMDGPU] Select 64-bit imm moves if can be encoded as 32 bit operand (#70395)
This allows folding of 64-bit operands if fit into 32-bit. Fixes
https://github.com/llvm/llvm-project/issues/67781
2023-10-30 08:12:28 -07:00
Stanislav Mekhanoshin
ee6d62db99 [AMDGPU] Prevent folding of the negative i32 literals as i64 (#70274)
We can use sign extended 64-bit literals, but only for signed operands.
At the moment we do not know if an operand is signed. Such operand will
be encoded as its low 32 bits and then either correctly sign extended or
incorrectly zero extended by HW.
2023-10-30 08:07:43 -07:00
cor3ntin
273ceb1337 [Clang] Diagnose defaulted assignment operator with incompatible object parameter (#70176)
Per https://eel.is/c++draft/dcl.fct.def.default#2.2, the explicit object
parameter of a defaulted special member function must be of the same
type as the one of an equivalent implicitly defaulted function, ignoring
references.

Fixes #69233
2023-10-30 16:05:53 +01:00
agozillon
6a62707c04 [Flang][OpenMP][MLIR] Initial array section mapping MLIR -> LLVM-IR lowering utilising omp.bounds (#68689)
This patch seeks to add initial lowering of OpenMP array sections within
target region map clauses from MLIR to LLVM IR.

This patch seeks to support fixed sized contiguous (don't think OpenMP
supports anything other than contiguous sections from my reading but i
could be wrong) arrays initially, before looking toward assumed size and
shaped arrays. The patch also currently does not include stride, it's
left for future work.

Although, assumed size works in some fashion (dummy arguments) with some
minor alterations to the OMPEarlyOutliner, so it is possible changes
made in the IsolatedFromAbove series may allow this to work with no
further required patches.

It utilises the generated omp.bounds to calculate the size of the mapped
OpenMP array (both for sectioned and un-sectioned arrays) as well as the
offset to be passed to the kernel argument structure.

Alongside these changes some refactoring of how map data is handled is
attempted, using a new MapData structure to keep track of information
utilised in the lowering of mapped values.

The initial addition of a more complex createDeviceArgumentAccessor that
utilises capture kinds similarly to (and loosely based on) Clang to
generate different kernel argument accesses is also added.

A similar function for altering how the kernel argument is passed to the
kernel argument structure on the host is also utilised
(createAlteredByCaptureMap), which allows modification of the
pointer/basePointer based on their capture (and bounds information).
It's of note ByRef, is the default for explicit mappings and ByCopy will
be the default for implicit captures, so the former is currently tested
in this patch and the latter is not for the moment.
2023-10-30 16:00:23 +01:00
LLVM GN Syncbot
4bbb2bc051 [gn build] Port bb352b6ead 2023-10-30 14:41:09 +00:00
Egor Zhdan
bb352b6ead [APINotes] Upstream APINotesReader
This upstreams more of the Clang API Notes functionality that is
currently implemented in the Apple fork:
https://github.com/apple/llvm-project/tree/next/clang/lib/APINotes
2023-10-30 14:36:44 +00:00
Alexey Bataev
af15c46777 [SLP]Do not crash if number of vector registers does not feet the vector
type.

Need to check, if the number of vector registers, returned by TTI, is
not greater than total number of mask element and not zero, before
trying to perform any operations. TTI still may return non-valid number
of registers.
2023-10-30 07:30:52 -07:00
Nikita Popov
fb08c694a4 [JumpThreading] Add test for #70651 (NFC) 2023-10-30 15:26:25 +01:00
Discookie
564e0165ab [clang][analyzer] Do not analyze opaque types in CXXDeleteChecker (#70638)
While inheritance can only be expressed if the class has a definition,
in this case one of the types might be opaque to the analyzer.

Fixes a crash encountered while analyzing LLVM.
2023-10-30 14:03:33 +00:00
Nikita Popov
292f34b0d3 [AArch64][GlobalISel] Fix incorrect ABI when tail call not supported (#70215)
The check for whether a tail call is supported calls
determineAssignments(), which may modify argument flags. As such, even
though the check fails and a non-tail call will be emitted, it will not
have a different (incorrect) ABI.

Fix this by operating on a separate copy of the arguments.

Fixes https://github.com/llvm/llvm-project/issues/70207.
2023-10-30 15:01:01 +01:00
Cullen Rhodes
43a94cbafa [mlir][ArmSME] NFC: Rename tild_id -> tile_id 2023-10-30 14:00:21 +00:00
Yueh-Ting (eop) Chen
e9ff4e4291 [Clang][RISCV] Add vundefine intrinsics for tuple types (#70354)
riscv-non-isa/rvv-intrinsic-doc#288
2023-10-30 21:59:02 +08:00
Ivan Kosarev
89f8d35094 [AMDGPU] Fix subtarget predicates for some V_MFMA instructions. (#70450)
Resolves AsmParser ambiguity, e.g., V_MFMA_I32_32X32X8I8_vi currently
has isGFX908orGFX90A as its subtarget predicate, which makes it
identical to V_MFMA_I32_32X32X8I8_gfx90a_acd on GFX90A.

Part of <https://github.com/llvm/llvm-project/issues/69256>.
2023-10-30 13:47:25 +00:00
Pete Steinfeld
ddd2747b7e [flang] Put ISO_Fortran_binding.h where it can be easily used (#70129)
The update stems from the discussion in

https://discourse.llvm.org/t/adding-flang-specific-header-files-to-clang/72442

This is my third attempt at this. My second attempt was in pull request
#69121.

This is my second attempt at this. My first attempt was in pull request
#68756.

This pull request has three changes from the second one:
- I put the test into the Driver directory rather than Examples so that
it would get run without require the define LLVM_BUILD_EXAMPLES.
- When installing ISO_Fortran_binding.h, I changed the location where it
was installed from.
- I changed the test so that it would work when flang was built with
shared libraries.

Here's the information from my previous attempts:

I decided to put ISO_Fortran_binding.h in a place where it would be
accessible with the include: "#include<ISO_Fortran_binding.h>" rather
than "#include<fortran/ISO_Fortran_binding.h>" because this is what
gfortran implements.

Note that the file is also installed into ".../include/flang", so if a
user wanted to access the file from a compiler other than clang, it
would be available.

I added a test in ".../flang/test/Driver". To make the test work, I also
needed to put ISO_Fortran_binding.h into the build area.

Although the flang project depends on clang, clang may not always be
available in a flang build. For example, when building just the
"check-flang" target, the "clang" executable may not be available at the
time the new test gets run. To account for this, I made the test's
script check for the existence of the "clang" executable. If "clang" is
not available, it simply prints "PASS". If it is available, it fully
builds and executes the test. On success, this will also print "PASS"
2023-10-30 06:44:09 -07:00
Igor Kirillov
70904226e1 [LoopVectorize] Enhance Vectorization decisions for predicate tail-folded loops with low trip counts (#69588)
* Avoid using `CM_ScalarEpilogueNotAllowedLowTripLoop` for loops known
to be predicate tail-folded, delegating to `areRuntimeChecksProfitable`
to decide on the profitability of vectorizing loops with runtime checks.
* Update the `areRuntimeChecksProfitable` function to consider the
`ScalarEpilogueLowering` setting when assessing vectorization of a loop.

With this patch, we can make more informed decisions for loops with low
trip counts, especially when leveraging Profile-Guided Optimization
(PGO) data.
2023-10-30 13:43:26 +00:00
Simon Pilgrim
432649700d [X86] vec_insert-5.ll - ensure we build with +mmx as we reference x86_mmx types
Enabling SSE doesn't guarantee MMX is enabled on all targets

Avoids a crash in D152928 (although we still currently see a regression with that patch applied resulting in MMX codegen)
2023-10-30 12:43:18 +00:00
martinboehme
526c9b7e37 [clang][nullability] Use proves() and assume() instead of deprecated synonyms. (#70297) 2023-10-30 13:18:57 +01:00
Henrik G. Olsson
da28c33094 [UTC] Recognise CHECK lines with globals matched literally (#70050)
Previously when using `-p` a.k.a. `--preserve-names` existing lines for
checking globals were not recognised as such, leading to the line being
kept while also being emitted again, resulting in duplicated CHECK
lines.

This resolves #70048.
2023-10-30 13:17:26 +01:00
Cullen Rhodes
a1b2ace137 [mlir][ArmSME] Add optional padding and mask operands to tile_load (#69195)
Padding and mask are optional, but if one is specified both must be
specified. This is consistent with vector.transfer_read.
2023-10-30 12:12:52 +00:00
Benjamin Kramer
f664326363 Remove the opaque pointers flag from tools
This has been the default for a while and the flags are slowly going
away. NFCI.
2023-10-30 12:58:24 +01:00
Tulio Magno Quites Machado Filho
b2929bebb6 [lldb] Adapt code to Python 3.13 (#70445)
1. Remove usage of PyEval_ThreadsInitialized and PyEval_InitThreads

Both of these functions were removed in Python 3.13 [1] after being
deprecated since Python 3.9.

According to "What's new in Python 3.13" document [1]:

    Since Python 3.7, Py_Initialize() always creates the GIL: calling
    PyEval_InitThreads() did nothing and PyEval_ThreadsInitialized()
    always returned non-zero.

2. Replace _Py_IsFinalizing() with Py_IsFinalizing().

[1] https://docs.python.org/3.13/whatsnew/3.13.html
2023-10-30 08:55:34 -03:00
Nicolas Vasilache
8483d18be5 [mlir][Transform] Relax the applicability of transform.foreach_match to also take into account the op itself 2023-10-30 11:53:04 +00:00
Christian Ulmann
46edbce454 [MLIR][LLVM] Change CAPI pointer factory to create opaque pointers (#70572)
This commit changes the LLVM dialect's CAPI pointer getters to drop
support for typed pointers. Typed pointers are deprecated and should no
longer be generated.
2023-10-30 12:50:37 +01:00
Christian Ulmann
3e96070b2d [MLIR][LLVM] Avoid exporting broken debug intrinsics without a location (#70643)
LLVM IR does not allow debug intrinsics without a debug attachment. The
location export can fail the export of a location due to multiple
reasons. To deal with this, this commit adds a check to the debug
intrinsic's LLVM builders, that skips them, if the location is
`nullptr`.

Fixes #60222
2023-10-30 12:49:16 +01:00
Nathan Sidwell
7b2e0095bc [clang] Robustify openmp test (#69739)
If the source path contains 'alias' this would spuriously fail. Be more
specific about not wanting global aliases
2023-10-30 07:39:45 -04:00
tsitdikov
97f05956c6 Update mlir-spirv-cpu-runner.cpp (#70649)
https://github.com/llvm/llvm-project/pull/70568 removed the support for
lowering SPIRV to LLVM dialect. We now need to stop using
enableOpaquePointers with ConvertSPIRVToLLVMPassOptions.
2023-10-30 12:39:03 +01:00
Nathan Sidwell
8f11f98481 [clang][NFC] Assert not llvm_unreachable (#70149)
An assert is better here.
2023-10-30 07:37:42 -04:00