483439 Commits

Author SHA1 Message Date
Peter Klausler
a6e77fdd74
[flang][runtime] Make defined formatted I/O process format elementally (#74150)
The present implementation of defined formatted I/O is incorrect for
arrays in the data item list; it assumes that a DT defined format
descriptor (or list-directed/namelist instance) applies to all of the
elements in the array. The loop over the elements in the array is within
the DefinedFormattedIo() template function that handles defined
formatted I/O, not around its calls. This causes only one format list
edit descriptor to be used for the whole array, which is of course
wrong.

Invert this arrangment by performing the per-element looping in at the
top level in FormattedDerivedTypeIo() instead.

Defined unformatted I/O remains as it was.
2023-12-11 11:55:44 -08:00
Stefan Gränitz
54397f9ac1
[llvm-c] Expose debug support for LLJIT in Orc C-API bindings (#73257)
Allow C-API users to debug their JITed code via the GDB JIT Interface.

This is currently supported on ELF and MachO based platforms. On
other systems `LLVMOrcLLJITEnableDebugSupport()` returns an error.

This patch adds a new C-API header `LLJITUtils.h`, which can host
further advanced JIT features in the future. Using the header requires
linking against LLVMOrcDebugging.
2023-12-11 20:47:20 +01:00
Walter Erquinigo
07ed3258d0
[lldb-dap] Include [opt] in the frame name only if a custom frame format is not specified. (#74861)
Currently there's an include in which `[opt]` might be emitted twice if
the frame format also asks for it. As a trivial fix, we should manually
emit `[opt]` only if a custom frame format is not specified.
2023-12-11 14:46:25 -05:00
Peter Klausler
10f15e2ec4
[flang][runtime] Crash more informatively in defined I/O error case (#74134)
Defined unformatted I/O is not allowed except from/to an external unit.
This restriction prohibits an INQUIRE(IOLENGTH=n) statement from using
derived types with defined unformatted output in its I/O list. The
runtime currently detects this case and crashes with an internal error;
this patch defines a new I/O error enum and causes the program to crash
with a more useful message.
2023-12-11 11:28:38 -08:00
Natalie Chouinard
f2afd10776
[github] Enable assertions on test workflow (#74849) 2023-12-11 13:58:18 -05:00
Jonathan Thackray
f576cbe44e
[AArch64] Correctly mark Neoverse N2 as an Armv9.0a core (#75055)
Neoverse N2 was incorrectly marked as an Armv8.5a core. This has been
changed to an Armv9.0a core. However, crypto options are not enabled
by default for Armv9 cores, so -mcpu=neoverse-n2+crypto is required
to enable crypto for this core.

Neoverse N2 Technical Reference Manual:
   https://developer.arm.com/documentation/102099/0003/
2023-12-11 18:52:25 +00:00
michaelrj-google
b1a91b7ee0
[libc][NFC] fix uint128 init in float properties (#75084)
An unsigned integer was being initialized with -1 to set all its bits to
1, but this doesn't work for the BigInt class which may be used as an
integer type on systems that don't support uint128 natively. This patch
moves the initialization to use ~T(0) instead.
2023-12-11 10:46:10 -08:00
Johannes Doerfert
12cbccc312
[OpenMP] Add extra flags to libomptarget and plugin builds (#74520) 2023-12-11 10:41:50 -08:00
Amy Huang
3745f47587
Fix to msvc::no_unique_address causing assert when used with __declspec(empty_bases) (#74776)
no_unique_address makes it possible for a class to be empty and have
non-zero virtual size, so just remove this assert.

Bug: https://github.com/llvm/llvm-project/issues/74442
2023-12-11 10:38:46 -08:00
Aart Bik
d96f46dd20
[mlir][sparse] fix bug in custom reduction scalarization code (#74898)
Bug found with BSR of "spy" SDDMM method
2023-12-11 10:22:17 -08:00
Finn Plummer
40e2bb5330
[mlir][spirv] Add folding for Bitwise[Or|And|Xor] (#74193)
Add missing constant propogation folder for Bitwise[Or|And|Xor].

Move previous Bitwise[Or|And] fold implementations to
SPIRVCanonicalization for consistency.

Implement additional folding when lhs == rhs and rhs = 0 for Xor. As
well as, update an Xor testcase to account for this introduced folding.

This helps for readability of lowered code into SPIR-V.

Part of work for #70704
2023-12-11 13:09:40 -05:00
Lang Hames
ef314d39b9 [ORC][MachO] Enable customization of MachO-headers produced by MachOPlatform.
MachOPlatform users can now override the default MachO header graph produced
for JITDylibs when setupJITDylib is called.
2023-12-11 09:59:21 -08:00
Youngsuk Kim
f92d970c8c [llvm][SanitizerCoverage] Remove no-op 'ptr addrspace(0)' to 'ptr addrspace(0)' pointercast (NFC)
Opaque ptr cleanup effort.
2023-12-11 11:56:49 -06:00
kkwli
a4e67de96f
[flang] update ppc-vec-store-elem-order.f90 after #74709 (NFC) (#75064) 2023-12-11 12:32:13 -05:00
Fangrui Song
54b4a0d688
[llvm-readobj] --needed-libs: support --elf-output-style=JSON (#75028)
Close #74529
2023-12-11 08:59:19 -08:00
Dinar Temirbulatov
05b68d5960
[AArch64][SME2] Add PEXT, PSEL builtins for SME2 (#72827)
This change enables PEXT, PSEL builtins for SME2 target.
2023-12-11 16:58:22 +00:00
Philip Reames
99c0a3ea98
[RISCV] Enable target attribute when invoked through clang driver (#74889)
d80e46d added support for the target function attribute. However, it
turns out that commit has a nasty bug/oversight. As the tests in that
revision show, everything works if clang -cc1 is directly invoked. I was
suprised to learn this morning that compiling with clang (i.e. the
typical user workflow) did not work.

The bug is that if a set of explicit negative extensions is passed to
cc1 at the command line (as the clang driver always does), we were
copying these negative extensions to the end of the rewritten extension
list. When this was later parsed, this had the effect of turning back
off any extension that the target attribute had enabled.

This patch updates the logic to only propagate the features from the
input which don't appear in the rewritten form in either positive or
negative form.

Note that this code structure is still highly suspect. In particular I'm
fairly sure that mixing extension versions with this code will result in
odd results. However, I figure its better to have something which mostly
works than something which doesn't work at all.
2023-12-11 08:55:21 -08:00
Guillaume Chatelet
e4f3ec2579
[libc][NFC] Simplify FloatProperties implementation (#74821)
This is a follow up on #74481 that migrates code from all
specializations into `FPCommonProperties` (except for
`EXPLICIT_BIT_MASK` in the `X86_Binary80` specialization)
2023-12-11 17:40:47 +01:00
Philip Reames
898db1136e
[flang] Support -mvscale-min and mvscale-max on all targets (#74633)
We have other targets with scalable vectors (e.g.RISC-V), and there
doesn't seem to be any particular reason these options can't be used on
those targets.
2023-12-11 08:34:02 -08:00
Jonas Paulsson
07056c2274
[SystemZ] Use LCGR/AGHI for i64 XOR with -1 (#74882)
LCGR/AGHI is a more compact way of implementing a 64-bit NOT.
2023-12-11 17:28:12 +01:00
Timm Baeder
607f19cb94
[clang][Interp] Fix float->int casts overflowing (#72658)
If S.noteUndefinedBehavior() returns true, we will continue evaluation
and need a value on the stack.
2023-12-11 17:25:03 +01:00
Simon Pilgrim
33819f3bfb [X86] X86FixupVectorConstants - create f32/f64 broadcast constants if the source constant data was ANY floating point type
We don't need an exact match, this is mainly cleanup for cases where v2f32 style types have been cast to f64 etc.
2023-12-11 16:23:04 +00:00
Simon Pilgrim
a7d8d11a14 [X86] combineConcatVectorOps - constant fold vector load concatenation directly into a new load.
Create a new constant pool entry directly instead of going via a BUILD_VECTOR node, which makes constant pool reuse more difficult.

Helps with some regressions in #73509
2023-12-11 16:23:04 +00:00
Guillaume Chatelet
7e761ba854
[libc][NFC] Simplify FloatProperties implementation (#74481)
Factor in common properties of `FloatProperties`.

This is a first patch of a series to simplify `FloatProperties` and
`FPBits` implementations.
2023-12-11 17:14:20 +01:00
Guillaume Chatelet
c703e65765
[libc][NFC] Remove custom leading_zeroes, factor in frequent typenames (#74825) 2023-12-11 17:10:42 +01:00
Guillaume Chatelet
7b387d2758
[libc][NFC] Fix mixed up biased/unbiased exponent (#75037)
According to [wikipedia](https://en.wikipedia.org/wiki/Exponent_bias)
the "biased exponent" is the encoded form that is always positive
whereas the unbiased form is the actual "real" exponent that can be
positive or negative.
`FPBits` seems to be using `unbiased_exponent` to describe the encoded
form (unsigned). This patch simply use `biased` instead of `unbiased`.
2023-12-11 17:06:48 +01:00
Tom Eccles
a9adcef450
[flang] fix ppc test broken after #74709 (#74826) 2023-12-11 15:56:40 +00:00
Timm Bäder
32ec462519 [clang][Interp][NFC] Handle body-less functions like implicit ones
They don't have any source to look up locations in.
2023-12-11 16:48:21 +01:00
Yaxun (Sam) Liu
45f3eea12a
Fix test rocm-detect.hip (#74872)
Replace %T with %t since %T is deprecated.
2023-12-11 10:39:48 -05:00
Simon Pilgrim
7ff2ce9c7b [X86] combineConcatVectorOps - pull out repeated DAG.getContext calls. NFC. 2023-12-11 15:32:07 +00:00
Stephen Tozer
e1c0e7e515
[Dexter] Set ShouldBuild=false for Visual Studio solutions (#75045)
Since Dexter no longer intends to build any code, the ShouldBuild
property in any Visual Studio project being run by Dexter should be
false to ensure that a build step is never invoked by Dexter, whether
the project has already been built or not.

Reviewed by: OCHyams
2023-12-11 15:19:40 +00:00
Lorenzo Chelini
fcdb848596 [MLIR][Linalg] (NFC) Drop verify-diagnostics from transpose-conv2d.mlir
We are not checking diagnostics in this test.
2023-12-11 16:13:19 +01:00
Zequan Wu
ace26b380f
[Profile] Disable continuous mode when reset to default.profraw due to malformed LLVM_PROFILE_FILE. (#74879)
When LLVM_PROFILE_FILE is set incorrectly (e.g. multiple %c) and it
falls back to use `default.profraw` name, but continuous mode is still
set. This might cause signal bus in the following scenario.

LLVM_PROFILE_FILE is set incorrectly (with "%c%c") for process A and B.
Suppose A starts first and falls back to use `default.profraw` and
mmaped its file content to memory. Later B starts and also falls back to
use `default.profraw`, but it will truncate the file because online
merging is disable when reseting to `default.profraw`. When A tries to
update counter via mmaped memory, signal bus will occur.

This fixes it by disabling continuous mode when reset to
default.profraw.
2023-12-11 10:13:08 -05:00
Zahira Ammarguellat
b40c534656
[clang] Add support for -fcx-limited-range, #pragma CX_LIMITED_RANGE and -fcx-fortran-rules. (#70244)
This patch adds the #pragma CX_LIMITED_RANGE defined in the C
specification.
It also adds the options -f[no]cx-limited-range and
-f[no]cx-fortran-rules.
-fcx-limited-range enables algebraic formulas for complex multiplication
and division. This option is enabled with -ffast-math.
-fcx-fortran-rules enables algebraic formulas for complex multiplication
and enables Smith’s algorithm for complex division (SMITH, R. L.
Algorithm 116: Complex division. Commun. ACM 5, 8 (1962)).

---------

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Co-authored-by: Joseph Huber <jhuber6@vols.utk.edu>
Co-authored-by: Guray Ozen <guray.ozen@gmail.com>
Co-authored-by: Nishant Patel <nishant.b.patel@intel.com>
Co-authored-by: Jessica Clarke <jrtc27@jrtc27.com>
Co-authored-by: Petr Hosek <phosek@google.com>
Co-authored-by: Joseph Huber <35342157+jhuber6@users.noreply.github.com>
Co-authored-by: Craig Topper <craig.topper@sifive.com>
Co-authored-by: Alexander Yermolovich <43973793+ayermolo@users.noreply.github.com>
Co-authored-by: Usama Hameed <u_hameed@apple.com>
Co-authored-by: Philip Reames <preames@rivosinc.com>
Co-authored-by: Evgenii Kudriashov <evgenii.kudriashov@intel.com>
Co-authored-by: Fangrui Song <i@maskray.me>
Co-authored-by: Aart Bik <39774503+aartbik@users.noreply.github.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: Youngsuk Kim <youngsuk.kim@hpe.com>
Co-authored-by: Arthur Eubanks <aeubanks@google.com>
Co-authored-by: Jan Svoboda <jan_svoboda@apple.com>
Co-authored-by: Walter Erquinigo <a20012251@gmail.com>
Co-authored-by: Eric <eric@efcs.ca>
Co-authored-by: Fazlay Rabbi <106703039+mdfazlay@users.noreply.github.com>
Co-authored-by: Pete Lawrence <plawrence@apple.com>
Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
Co-authored-by: Adrian Prantl <aprantl@apple.com>
Co-authored-by: Owen Pan <owenpiano@gmail.com>
Co-authored-by: LLVM GN Syncbot <llvmgnsyncbot@gmail.com>
Co-authored-by: Med Ismail Bennani <ismail@bennani.ma>
Co-authored-by: Congcong Cai <congcongcai0907@163.com>
Co-authored-by: Rik Huijzer <github@huijzer.xyz>
Co-authored-by: Wang Pengcheng <wangpengcheng.pp@bytedance.com>
Co-authored-by: Yuanfang Chen <tabloid.adroit@gmail.com>
Co-authored-by: Kazu Hirata <kazu@google.com>
Co-authored-by: Mehdi Amini <joker.eph@gmail.com>
Co-authored-by: Aiden Grossman <agrossman154@yahoo.com>
Co-authored-by: Rana Pratap Reddy <109514914+ranapratap55@users.noreply.github.com>
Co-authored-by: Yingwei Zheng <dtcxzyw2333@gmail.com>
Co-authored-by: Piotr Zegar <me@piotrzegar.pl>
Co-authored-by: KAWASHIMA Takahiro <t-kawashima@fujitsu.com>
Co-authored-by: Tobias Hieta <tobias@hieta.se>
Co-authored-by: Luke Lau <luke@igalia.com>
Co-authored-by: Shivam Gupta <shivam98.tkg@gmail.com>
Co-authored-by: cor3ntin <corentinjabot@gmail.com>
Co-authored-by: Yeting Kuo <46629943+yetingk@users.noreply.github.com>
Co-authored-by: Stanislav Mekhanoshin <rampitec@users.noreply.github.com>
Co-authored-by: David Spickett <david.spickett@linaro.org>
Co-authored-by: Matthew Devereau <matthew.devereau@arm.com>
Co-authored-by: Martin Storsjö <martin@martin.st>
Co-authored-by: Qiu Chaofan <qiucofan@cn.ibm.com>
Co-authored-by: Pierre van Houtryve <pierre.vanhoutryve@amd.com>
Co-authored-by: Mikael Holmen <mikael.holmen@ericsson.com>
Co-authored-by: Uday Bondhugula <uday@polymagelabs.com>
Co-authored-by: Nikita Popov <npopov@redhat.com>
Co-authored-by: Johannes Reifferscheid <jreiffers@google.com>
Co-authored-by: Benjamin Kramer <benny.kra@googlemail.com>
Co-authored-by: Oliver Stannard <oliver.stannard@arm.com>
Co-authored-by: Dmitry Vyukov <dvyukov@google.com>
Co-authored-by: Benjamin Maxwell <benjamin.maxwell@arm.com>
Co-authored-by: Piotr Sobczak <piotr.sobczak@amd.com>
Co-authored-by: Simon Pilgrim <llvm-dev@redking.me.uk>
Co-authored-by: Timm Bäder <tbaeder@redhat.com>
Co-authored-by: Sunil Kuravinakop <koops@hpe.com>
Co-authored-by: zhongyunde 00443407 <zhongyunde@huawei.com>
Co-authored-by: Christudasan Devadasan <Christudasan.Devadasan@amd.com>
Co-authored-by: bjacob <jacob.benoit.1@gmail.com>
Co-authored-by: Weining Lu <luweining@loongson.cn>
Co-authored-by: Andrzej Warzyński <andrzej.warzynski@arm.com>
Co-authored-by: Jay Foad <jay.foad@amd.com>
Co-authored-by: Markus Mützel <markus.muetzel@gmx.de>
Co-authored-by: Erik Jonsson <erik.j.jonsson@ericsson.com>
Co-authored-by: Pete Steinfeld <47540744+psteinfeld@users.noreply.github.com>
Co-authored-by: Alexey Bataev <a.bataev@outlook.com>
Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
Co-authored-by: Qizhi Hu <836744285@qq.com>
2023-12-11 10:03:27 -05:00
Brad Smith
8b5af3139c
[OpenMP] Change check for OS to check for defined for a macro (#75012)
Check for the existence of the macro instead of checking for Solaris.
illumos has this macro in sys/time.h.

/export/home/brad/llvm-brad/openmp/runtime/src/z_Linux_util.cpp:77:9: warning: 'TIMEVAL_TO_TIMESPEC' macro redefined [-Wmacro-redefined]
   77 | #define TIMEVAL_TO_TIMESPEC(tv, ts)                                            \
      |         ^
/usr/include/sys/time.h:424:9: note: previous definition is here
  424 | #define TIMEVAL_TO_TIMESPEC(tv, ts) { \
      |         ^
2023-12-11 09:54:24 -05:00
Krystian Stasiowski
29bd78b2f6
[Clang][Sema] Diagnose friend function specialization definitions (#72863)
Per [[class.friend]p6](http://eel.is/c++draft/class.friend#6) a friend
function shall not be defined if its name isn't unqualified. A
_template-id_ is not a name, meaning that a friend function
specialization does not meet this criteria and cannot be defined.

GCC, MSVC, and EDG all consider friend function specialization
definitions to be invalid de facto explicit specializations and diagnose
them as such.

Instantiating a dependent friend function specialization definition
[currently sets off an assert](https://godbolt.org/z/Krqdq95hY) in
`FunctionDecl::setFunctionTemplateSpecialization`. This happens because
we do not set the `TemplateSpecializationKind` of the `FunctionDecl`
created by template argument deduction to `TSK_ExplicitSpecialization`
for friend functions
[here](https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaTemplate.cpp#L9600).
I changed the assert condition because I believe this is the correct
behavior.
2023-12-11 06:35:57 -08:00
Youngsuk Kim
9071a15d4b
[llvm][Attributor] Strip AddressSpaceCast from 'constructPointer' (#74742)
* Remove pointer AddressSpaceCast in function `constructPointer`
* Remove 1st parameter (`ResTy`) of function `constructPointer`

1st input argument to function `constructPointer` in all 4 call-sites is
`ptr addrspace(0)`. Function `constructPointer` performs a pointer
AddressSpaceCast to `ResTy`, making the returned pointer have type `ptr
addrspace(0)` in all 4 call-sites.

Unless there's a clear reason to discard the addrspace info of input
parameter `Ptr`, I think we should keep and forward that info to the
returned pointer of `constructPointer`.

Opaque ptr cleanup effort.
2023-12-11 09:29:01 -05:00
Felipe de Azevedo Piovezan
06d6af72fb
[lldb][NFC] Simplify DWARRFDeclContext::GetQualifiedName (#74788)
This commit factors out the logic building each component of a qualified
name into its own function so that it may be reused by a future commit,
while also simplifying the logic of assembling these pieces together by
using llvm::interleave.
2023-12-11 11:16:36 -03:00
Joseph Huber
ef23bba6e5 [Linkerwrapper] Make -Xoffload-linker pass directly to clang
Summary:
We provide `-Xoffload-linker` to pass arguments directly to the link
step. Currently this uses `-Wl,` implicitly which prevents us from using
clang options that we otherwise could make use of. This patch removes
that implicit behavior as users can just as easiliy pass
`-Xoffload-linker -Wl,-foo` if needed.
2023-12-11 07:56:19 -06:00
Nikita Popov
97efd8aa43 [InstCombine] Preserve inalloca tag when transforming alloca
This is not meaningful in any practical sense, and just makes sure
we don't cause verifier failures.
2023-12-11 14:27:00 +01:00
martinboehme
0474a92c9e
[clang][dataflow] Convert SpecialBoolAnalysis to synthetic fields. (#74706)
We're working towards eliminating `RecordValue`; this eliminates one
more
blocker on that path.
2023-12-11 14:14:16 +01:00
Benjamin Kramer
2a988a38a0 [bazel] Port 2460bf2facd1c0208ecda68c427a256710246dbb 2023-12-11 13:57:05 +01:00
LLVM GN Syncbot
d1c9b37d36 [gn build] Port 2460bf2facd1 2023-12-11 12:43:54 +00:00
Michael Klemm
50a5f5c183
[flang][driver] Add -fno-fortran-main (link time) option to remove Fortran_main from link line (#74139)
This PR adds the `-fno-fortran-main` command line option to remove
`Fortran_main.a` from the link and to allow for linking Fortran code w/o
program unit with C/C++ translation units that provide the `main()`
entrypoint.

When linking Fortran code with C/C++ code (Fortran calling into C/C++),
PR #73124 introduced a proper error message that would prevent
successful linkage, if there was a program unit from Fortran *and*
`main()` function coming from C/C++. Alas, this caused some breakage of
code that would call Fortran code from C/C++ and rightfully provided the
`main()` entrypoint. Classic Flang had the command-line option
`-fno-fortran-main` to then remove the entrypoints for the Fortran
program unit from the linker stage.

This PR is related to PR #74120 and (merged) PR #73124.

---------

Co-authored-by: Andrzej Warzyński <andrzej.warzynski@gmail.com>
2023-12-11 13:35:27 +01:00
Florian Hahn
19918ac34d
[VPlan] Mark Select VPInstructions as not having sideeffects.
Select VPInstructions don't have sideeffects, mark them accordingly.
2023-12-11 12:26:32 +00:00
Orlando Cazalet-Hyams
5d55839791
[AssignmentTracking] Skip large types in redundant debug info pruning (#74329)
Fix https://github.com/llvm/llvm-project/issues/74189 (crash report).

The pruning code uses a BitVector to track which parts of a variable have been
defined in order to find redundant debug records. BitVector uses a u32 to track
size; variable of types with a bit-size greater than max(u32) ish* can't be
represented using a BitVector.

Fix the assertion by introducing a limit on type size. Improve performance by
bringing the limit down to a sensible number and tracking byte-sizes instead
of bit-sizes.

Skipping variables in this pruning code doesn't cause debug info correctness
issues; it just means there may be some extra redundant debug records.

(*) `max(u32) - 63` due to BitVector::NumBitWords implementation.
2023-12-11 12:23:26 +00:00
Nikita Popov
ae7bffd71c [InstCombine] Don't create unnecessary zero-index GEP (NFCI)
Note needed with opaque pointers.
2023-12-11 13:09:09 +01:00
Yingchi Long
2460bf2fac
[BPF][GlobalISel] add initial gisel support for BPF (#74999)
This adds initial codegen support for BPF backend.

Only implemented ir-translator for "RET" (but not support isel).

Depends on: #74998
2023-12-11 19:58:34 +08:00
Nikita Popov
b68afd7b51 [Bitcode] Check validity of fcmp/icmp predicate
The predicate should match the operand types.
2023-12-11 12:54:59 +01:00
Simon Pilgrim
d1deeae094
[X86] Rename VBROADCASTF128/VBROADCASTI128 to VBROADCASTF128rm/VBROADCASTI128rm (#75040)
Add missing rm postfix to show these are load instructions
2023-12-11 11:52:53 +00:00