Jim Ingham [Thu, 1 Jun 2023 17:21:23 +0000 (10:21 -0700)]
Prevent some spurious error messages in the debugserver logs.
DNBGetDeploymentInfo was calling GetPlatformString w/o checking that
the load command it was processing actually provided a platform string.
That caused a bunch of worrisome looking error messages in the debugserver
log output.
Differential Revision: https://reviews.llvm.org/D151861
Jim Ingham [Wed, 31 May 2023 21:43:00 +0000 (14:43 -0700)]
Add EXC_SYSCALL to the set of ignorable mach exceptions.
Add some more tests of what exceptions we accept and don't accept.
Differential Revision: https://reviews.llvm.org/D151843
Haowei Wu [Thu, 1 Jun 2023 17:20:17 +0000 (10:20 -0700)]
Revert "[Fuchsia] Add llvm-debuginfod to toolchain"
This reverts commit
731f9ac6e53611dabb51c52bfc8011c2aab7790b.
Kun Wu [Fri, 26 May 2023 21:46:22 +0000 (21:46 +0000)]
[mlir][sparse][gpu] add result type to spmv and spmm gpu libgen path
Differential Revision: https://reviews.llvm.org/D151592
Nick Desaulniers [Thu, 1 Jun 2023 17:09:43 +0000 (10:09 -0700)]
remove Demangle/StringView.h
Now that we've converted libcxxabi and llvm Demangle to use
std::string_view, this code no longer has any users. Bye bye!
Reviewed By: #libc_abi, phosek, MaskRay
Differential Revision: https://reviews.llvm.org/D148387
Jan Svoboda [Wed, 31 May 2023 05:58:49 +0000 (22:58 -0700)]
[clang] NFCI: Split `HeaderSearch::findAllModulesForHeader()`
This mimics the `ModuleMap` API and enables D151854, where the `AllowCreation = true` function needs `FileEntryRef` but `AllowCreation = false` functions is happy with plain `FileEntry`. No functional change intended.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D151853
Jan Svoboda [Wed, 31 May 2023 17:35:59 +0000 (10:35 -0700)]
[clang] NFCI: Use `FileEntryRef` in `ModuleMapCallbacks`
This patch removes path hackery from `ModuleMapCallbacks` by adopting `FileEntryRef`. No functional change intended.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D151852
Alex Langford [Thu, 25 May 2023 23:22:13 +0000 (16:22 -0700)]
[lldb][NFCI] Remove use of ConstString from UnixSignals::SignalCode
On llvm.org and all downstream forks that I'm aware of, SignalCodes are
always created from C string literals. They are never compared to
anything so they take up space in the ConstString StringPool for no
tangible benefit.
I've changed the type here to `const llvm::StringLiteral` instead of
using a `StringRef` or a `const char *` to express intent -- These
strings come from constant data whose lifetime is directly tied to that
of the running process (and are thus safe to store).
Differential Revision: https://reviews.llvm.org/D151516
David Green [Thu, 1 Jun 2023 16:49:25 +0000 (17:49 +0100)]
Revert "[ARM] Allow D-reg copies to use VMOVD with fpregs64"
This reverts commit
0a762ec1b09d96734a3462f8792a5574d089b24d.
Some CPUs enable fp64 by default (such as cortex-m7). When specifying a
single-precision fpu with them like -mfpu=fpv5-sp-d16, the fp64 feature will
be disabled, but fpreg64 will not. We need to disable them both correctly under
clang in order for the backend to be able to use the reliably. In the meantime
this reverts
0a762ec1b09d96734 until that issue is fixed.
John Brawn [Thu, 1 Jun 2023 10:09:40 +0000 (11:09 +0100)]
[Lex] Only warn on defining or undefining language-defined builtins
D144654 made it so that we warn on any defining or undefining of
builtin macros. However the C and C++ standards only forbid the
defining or undefining of macros defined in the language standard
itself, but clang defines more macros than those and warning on those
may not be helpful.
Resolve this by only warning if the builtin macro name is the name of
a macro defined by the language. This is done in a way that removes
some of the existing checks, as those were made redundant by
restricting the warning in this way.
Differential Revision: https://reviews.llvm.org/D151741
Hussain Kadhem [Thu, 1 Jun 2023 16:31:51 +0000 (12:31 -0400)]
Flang implementation for COMPILER_VERSION and COMPILER_OPTIONS intrinsics
This revision implements the Fortran intrinsic procedures COMPILER_VERSION and COMPILER_OPTIONS from the iso_fortran_env module.
To be able to set the COMPILER_OPTIONS string according to the original compiler driver invocation, a string is passed to the frontend driver using the environment variable FLANG_COMPILER_OPTIONS_STRING, for lack of a better mechanism.
Fixes #59233
Reviewed By: awarzynski
Differential Revision: https://reviews.llvm.org/D140524
Keith Smiley [Thu, 1 Jun 2023 01:55:17 +0000 (18:55 -0700)]
[clang][Darwin] Error out when missing requested libarclite library
Starting with the SDKs provided with Xcode 14.3, this library no longer
exists. Before this change this results in an opaque linker error in the
case that your deployment target is low enough that this library is
added. This produces a more useful error message in that case.
Differential Revision: https://reviews.llvm.org/D150988
Jay Foad [Wed, 24 May 2023 13:19:33 +0000 (14:19 +0100)]
[MachineInstr] Implement new operand accessors all_defs and all_uses
Differential Revision: https://reviews.llvm.org/D151423
Teresa Johnson [Thu, 1 Jun 2023 15:57:35 +0000 (08:57 -0700)]
[ThinLTO] Restructure promotion / internalization decisions (NFC)
Restructures the combined index based promotion and internalization
decision code so that it is a bit easier to follow. This is in
preparation for a bugfix to this code that will modify one part of the
logic.
Piotr Fusik [Thu, 1 Jun 2023 15:58:36 +0000 (08:58 -0700)]
[NFC][libc++][tests] Move directories under stringstream
Reviewed By: #libc, philnik
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D151884
LLVM GN Syncbot [Thu, 1 Jun 2023 15:52:25 +0000 (15:52 +0000)]
[gn build] Port
ee6ec2c5f1a5
Nikolas Klauser [Thu, 1 Jun 2023 15:51:35 +0000 (08:51 -0700)]
[libc++][PSTL] Implement std::reduce and std::transform_reduce
Reviewed By: ldionne, #libc
Spies: libcxx-commits, miyuki
Differential Revision: https://reviews.llvm.org/D150736
Alexandros Lamprineas [Thu, 1 Jun 2023 14:09:08 +0000 (15:09 +0100)]
[IPSCCP] Decouple queries for function analysis results.
The SCCPSolver is using a structure (AnalysisResultsForFn) where it keeps
pointers to various analyses needed by the IPSCCP pass. These analyses are
requested all at the same time, which can become problematic in some cases.
For example one could be retrieved via getCachedAnalysis() prior to the
actual execution of the analysis. In more detail:
The IPSCCP pass uses a DomTreeUpdater to preserve the PostDominatorTree
in case the PostDominatorTreeAnalysis had run before IPSCCP. Starting with
commit
1b1232047e83b the IPSCCP pass may use BlockFrequencyAnalysis for
some functions in the module. As a result, the PostDominatorTreeAnalysis
may not run until the BlockFrequencyAnalysis has run, since the latter
analysis depends on the former. Currently, we setup the DomTreeUpdater
using getCachedAnalysis to retrieve a PostDominatorTree. This happens
before BlockFrequencyAnalysis has run, therefore the cached analysis can
become invalid by the time we use it.
Differential Revision: https://reviews.llvm.org/D151666
Jay Foad [Thu, 1 Jun 2023 14:21:09 +0000 (15:21 +0100)]
[DAGCombiner] Do not fold fadd (fmul x, y), (fmul x, y) -> fma x, y, (fmul x, y)
Differential Revision: https://reviews.llvm.org/D151890
Sven van Haastregt [Thu, 1 Jun 2023 15:21:54 +0000 (16:21 +0100)]
[OpenCL] Add CLK_UNORM_INT_101010_2 channel type
This new channel data type was added in OpenCL C 3.0.
Louis Dionne [Wed, 31 May 2023 18:40:01 +0000 (11:40 -0700)]
[libc++][NFC] Use TEST_HAS_NO_FILESYSTEM_LIBRARY in the test suite
This replaces some uses of internal libc++ macros with the equivalent
macro from "test_macros.h".
Differential Revision: https://reviews.llvm.org/D151825
Louis Dionne [Wed, 31 May 2023 17:07:54 +0000 (10:07 -0700)]
[libc++] Use .gen.py tests to generate _LIBCPP_VERSION tests
This removes the need for contributors to do some manual steps
when adding a new public header.
Differential Revision: https://reviews.llvm.org/D151831
Florian Hahn [Thu, 1 Jun 2023 15:14:02 +0000 (16:14 +0100)]
[LV] Bail out on loop-variant steps when rewriting SCEV exprs.
If the step is not loop-invariant, we cannot create a modified AddRec,
as the start needs to be loop-invariant. Mark those cases as
CannotAnalyze and bail out, to fix a crash.
Juan Manuel MARTINEZ CAAMAÑO [Thu, 1 Jun 2023 14:54:49 +0000 (16:54 +0200)]
[NFC][TargetTransformInfo] Make getInliningThreholdMultiplier and getInlinerVectorBonusPercent const
Reviewed By: jlebar
Differential Revision: https://reviews.llvm.org/D149739
Louis Dionne [Thu, 1 Jun 2023 15:06:44 +0000 (08:06 -0700)]
[libc++][NFC] Fix header guard for <typeinfo>
Nikita Popov [Thu, 1 Jun 2023 14:31:46 +0000 (16:31 +0200)]
[Clang] Convert some tests to opaque pointers (NFC)
Petr Hosek [Fri, 26 May 2023 22:11:24 +0000 (22:11 +0000)]
[BOLT][CMake] Redo the build and install targets
The existing BOLT install targets are broken on Windows becase they
don't properly handle the output extension. We cannot use the existing
LLVM macros since those make assumptions that don't hold for BOLT. This
change instead implements custom macros following the approach used by
Clang and LLD.
Differential Revision: https://reviews.llvm.org/D151595
Jay Foad [Thu, 1 Jun 2023 14:10:16 +0000 (15:10 +0100)]
[AMDGPU] New test case where we should not form FMA
Nikita Popov [Thu, 1 Jun 2023 13:57:42 +0000 (15:57 +0200)]
[InstCombine] Use DL-aware constant folding for phi compare
Serves the dual purpose of avoiding an extra InstCombine iteration
for the DL-aware folding and removing one icmp constexpr use.
Zibi Sarbinowski [Thu, 1 Jun 2023 13:42:52 +0000 (08:42 -0500)]
[z/OS] Disable pr59765-modules-global-ctor-dtor.cppm on z/OS to make it unsupported.
[z/OS] Disable pr59765-modules-global-ctor-dtor.cppm
Reviewed By: SeanP
Differential Revision: https://reviews.llvm.org/D151828
Haojian Wu [Thu, 1 Jun 2023 13:31:43 +0000 (15:31 +0200)]
[clangd] NFC, use const HeaderSearch when possible.
Paulo Matos [Thu, 1 Jun 2023 13:27:33 +0000 (15:27 +0200)]
[InstCombine] Disable generation of fshl/fshr for rotates
Disable conversion of funnel shifts (fshl/fshr) into rotates
unless one of the operands is known to be a constant value.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D150670
Nikita Popov [Thu, 1 Jun 2023 13:30:46 +0000 (15:30 +0200)]
Revert "[SCCP] Constant propagation through freeze instruction"
This reverts commit
559d47a1790e1a9f9b1f8838a443eb7624ef1ac7.
Caused failure on sanitizer-aarch64-linux-bootstrap-ubsan:
clang++: /b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/lib/Transforms/Utils/SCCPSolver.cpp:442: llvm::ValueLatticeElement &llvm::SCCPInstVisitor::getValueState(llvm::Value *): Assertion `!V->getType()->isStructTy() && "Should use getStructValueState"' failed.
Nikita Popov [Thu, 1 Jun 2023 13:29:27 +0000 (15:29 +0200)]
[InstCombine] Remove old add in foldLShrOverflowBit()
Explicitly remove the old add instruction, so we don't need a
separate InstCombine iteration to DCE it.
Haojian Wu [Thu, 1 Jun 2023 13:21:08 +0000 (15:21 +0200)]
[include-cleaner] NFC, use const HeaderSearch when possible.
Nikita Popov [Thu, 1 Jun 2023 12:18:19 +0000 (14:18 +0200)]
[SDAG] Fix incorrect use of undef for boolean contents (PR63055)
FoldSetCC() returns UNDEF in a number of cases. However, the SetCC
result must follow BooleanContents. Unless the type is a
pre-legalization i1 or we have UndefinedBooleanContents, the use of
UNDEF will not uphold the requirement that the top bits are either
zero or match the low bit. In such cases, return zero instead.
Fixes https://github.com/llvm/llvm-project/issues/63055.
Differential Revision: https://reviews.llvm.org/D151883
Haojian Wu [Thu, 1 Jun 2023 13:12:58 +0000 (15:12 +0200)]
[Tooling] NFC, use const HeaderSearch for isSelfContainedHeader.
Valentin Clement [Thu, 1 Jun 2023 13:16:03 +0000 (22:16 +0900)]
[flang][openacc] Add lowering for multiply operator
Add support for the * operation in OpenACC lowering. Support is added
for the types currently supported.
Depends on D151564
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D151565
Valentin Clement [Thu, 1 Jun 2023 13:14:42 +0000 (22:14 +0900)]
[flang][openacc] Initial reduction clause lowering
Add initial support to lower reduction clause to its representation in MLIR.
This patch adds support for addition of integer and real scalar types. Other
operators and types will be added with follow up patches.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D151564
Haojian Wu [Thu, 1 Jun 2023 13:01:21 +0000 (15:01 +0200)]
[clang] NFC, make more HeaderSearch methods const.
Mikhail Gudim [Thu, 1 Jun 2023 13:04:27 +0000 (15:04 +0200)]
[SCCP] Constant propagation through freeze instruction
The freeze instruction has not been handled by SCCPInstVisitor.
This patch adds SCCPInstVisitor::visitFreezeInst(FreezeInst &I)
method to handle freeze instructions.
Differential Revision: https://reviews.llvm.org/D151659
Haojian Wu [Thu, 1 Jun 2023 12:52:46 +0000 (14:52 +0200)]
[clangd] NFC, remove an unused member in
IncludeStructure::RecordHeaders.
Jay Foad [Thu, 1 Jun 2023 12:32:17 +0000 (13:32 +0100)]
[AMDGPU] New test case where it is better not to form FMA
Guillaume Chatelet [Thu, 1 Jun 2023 10:28:04 +0000 (10:28 +0000)]
[libc] Reduce math tests runtime further
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D151875
Haojian Wu [Thu, 1 Jun 2023 11:57:02 +0000 (13:57 +0200)]
[clang][NFC] Make HeaderSearch::suggestPathToFileForDiagnostics method const.
Nikita Popov [Thu, 1 Jun 2023 12:31:28 +0000 (14:31 +0200)]
[X86] Add test for PR63055 (NFC)
Igor Kirillov [Thu, 25 May 2023 12:53:17 +0000 (12:53 +0000)]
[LoopLoadElimination] Add support for stride equal to -1
This patch allows us to gain all the benefits provided by
LoopLoadElimination pass to descending loops.
Differential Revision: https://reviews.llvm.org/D151448
Joseph Huber [Wed, 31 May 2023 20:47:43 +0000 (15:47 -0500)]
[LinkerWrapper] Fix static library symbol resolution
The linker wrapper performs its own very basic symbol resolution for the
purpose of supporting standard static library semantics. We do this here
because the Nvidia `nvlink` wrapper does not support static linking and
we have some offloading specific extensions.
Currently, we always place symbols in the "table" even if they aren't
extracted. This caused the logic to fail when many files were used that
referenced the same undefined variable. This patch changes the pass to
only add the symbols to the global "table" if the file is actually
extracted.
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/D151839
Simon Pilgrim [Wed, 31 May 2023 15:51:07 +0000 (16:51 +0100)]
[X86] Fix masked store scheduler ports for skylake models
Only uses port2+3 for agen, and was missing port4 for the actual store
Noticed while investigating the skylake vs icelake diffs for Issue #62602
Nimish Mishra [Thu, 1 Jun 2023 10:31:34 +0000 (16:01 +0530)]
[flang][OpenMP] Verify support for private/firstprivate on unstructured sections
Verification of support for lowering private/firstprivate clauses
on unstructured sections.
Differential Revision: https://reviews.llvm.org/D145352
Reviewed By: TIFitis
Ritanya B Bharadwaj [Thu, 1 Jun 2023 09:21:32 +0000 (04:21 -0500)]
[OpenMP] Add support for declare target initializer expressions
Initial support for OpenMP 5.0 declare target "as if" behavior for "initializer expressions".
OpenMP 5.0, 2.12.7 declare target.
Reviewed By: Alexey
Differential Revision: https://reviews.llvm.org/D146418
David Green [Thu, 1 Jun 2023 09:54:53 +0000 (10:54 +0100)]
[AArch64] Increase the cost of i1 inserts / extracts
i1 inserts will need an extra cset, and i1 extracts need a cmp (or tst) in
order to be used. This increase the cost of them a little to account for those
extra instructions.
https://godbolt.org/z/3c5z4G7Mh
Differential Revision: https://reviews.llvm.org/D151189
Nikita Popov [Thu, 1 Jun 2023 08:58:58 +0000 (10:58 +0200)]
[InstCombine] Fix worklist management in rewriteGEPAsOffset() more thoroughly
We need to add the replaced instruction itself to the worklist as
well. We want to remove the old instructions, but can't easily do
so directly, as the icmp is also one of the users and we need to
retain it until the fold has finished.
Antonio Abbatangelo [Thu, 1 Jun 2023 08:18:12 +0000 (16:18 +0800)]
[X86] Align stack to 16-bytes on 32-bit with X86_INTR call convention
Adds a dynamic stack alignment to functions under the interrupt call
convention on x86-32. This fixes the issue where the stack can be
misaligned on entry, since x86-32 makes no guarantees about the stack
pointer position when the interrupt service routine is called.
The alignment is done by overriding X86RegisterInfo::shouldRealignStack,
and by setting the correct alignment in X86FrameLowering::calculateMaxStackAlign.
This forces the interrupt handler to be dynamically aligned, generating
the appropriate `and` instruction in the prologue and `lea` in the
epilogue. The `no-realign-stack` attribute can be used as an opt-out.
Fixes #26851
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D151400
Timm Bäder [Thu, 1 Jun 2023 07:48:04 +0000 (09:48 +0200)]
[clang][Interp] Optionally cast comparison result to non-bool
Our comparison opcodes always produce a Boolean value and push it on the
stack. However, the result of such a comparison in C is int, so the
later code expects an integer value on the stack.
Work around this problem by casting the boolean value to int in those
cases. This is not ideal for C however. The comparison is usually
wrapped in a IntegerToBool cast anyway.
Differential Revision: https://reviews.llvm.org/D149645
Nikita Popov [Thu, 1 Jun 2023 08:31:13 +0000 (10:31 +0200)]
[InstCombine] Fix worklist management in transformToIndexedCompare()
Use replaceInstUsesWith() rather than plain RAUW to make sure the
old instructions are added back to the worklist for DCE.
zhuna [Thu, 1 Jun 2023 07:53:50 +0000 (15:53 +0800)]
[DWP] add overflow check for llvm-dwp tools if offset overflow
Now, if the offset overflow happens, we just silently ignore it.
We will generate a bad dwp file, which will crash the gdb or make
it undefined behavior, and hard to address the root cause. So, we
need to produce some messages if overflow happens.
Reviewed By: ayermolo, dblaikie, steven.zhang
Differential Revision: https://reviews.llvm.org/D144565
David Green [Thu, 1 Jun 2023 08:28:48 +0000 (09:28 +0100)]
[AArch64] Adjust costs of i1 and/or/xor reductions
This expands the reduction cost of i1 and/or/xor, so that larger type sizes get
handled by the existing code. For i1 reductions - and will use maxv, or will use
minv and xor will use addv, plus the cost of legalizing the type for larger
vectors using and/or/xor. The i1 vectors will be legalized to higher width
integers (say v16i8), which this overrides the cost of. As with all i1 vectors
there is a chance that the types the i1 vector is created with and how it is
used will not match, introducing extra extends that are not necessarily
costmodelled.
https://godbolt.org/z/6Gc9K6b7T
Differential Revision: https://reviews.llvm.org/D151184
Andrzej Warzynski [Tue, 16 May 2023 15:26:46 +0000 (16:26 +0100)]
[mlir][transform] Add support for expressing scalable tile sizes
This patch enables specifying scalable tile sizes when using the
Transform dialect to drive tiling, e.g.:
```
%1, %loop = transform.structured.tile %0 [[4]]
```
This is implemented by extending the TileOp with a dedicated attribute
for "scalability" and by updating various parsing hooks. At the moment,
only the trailing tile size can be scalable. The following is not yet
supported:
```
%1, %loop = transform.structured.tile %0 [[4], [4]]
```
This change is a part of larger effort to enable scalable vectorisation
in Linalg. See this RFC for more context:
* https://discourse.llvm.org/t/rfc-scalable-vectorisation-in-linalg/
Differential Revision: https://reviews.llvm.org/D150944
Nikita Popov [Thu, 1 Jun 2023 08:18:30 +0000 (10:18 +0200)]
[InstCombine] Fix worklist management in foldPHIArgIntToPtrToPHI()
Make sure the old operand is added back to the worklist for DCE.
Petr Hosek [Thu, 1 Jun 2023 08:03:16 +0000 (08:03 +0000)]
Revert "[BOLT][CMake] Redo the build and install targets"
This reverts commit
f99a7d3e38095cfdaf7e729289a8894dd31c7efa since it
broke the bolt-aarch64-ubuntu-clang-shared bot.
Balázs Kéri [Thu, 1 Jun 2023 07:20:36 +0000 (09:20 +0200)]
[clang][analyzer] Merge apiModeling.StdCLibraryFunctions and StdCLibraryFunctionArgs checkers into one.
Main reason for this change is that these checkers were implemented in the same class
but had different dependency ordering. (NonNullParamChecker should run before StdCLibraryFunctionArgs
to get more special warning about null arguments, but the apiModeling.StdCLibraryFunctions was a modeling
checker that should run before other non-modeling checkers. The modeling checker changes state in a way
that makes it impossible to detect a null argument by NonNullParamChecker.)
To make it more simple, the modeling part is removed as separate checker and can be only used if
checker StdCLibraryFunctions is turned on, that produces the warnings too. Modeling the functions
without bug detection (for invalid argument) is not possible. The modeling of standard functions
does not happen by default from this change on.
Reviewed By: Szelethus
Differential Revision: https://reviews.llvm.org/D151225
Nikita Popov [Tue, 16 May 2023 08:55:44 +0000 (10:55 +0200)]
[ValueTracking] Directly use KnownBits shift functions
Make ValueTracking directly call the KnownBits shift helpers, which
provides more precise results.
Unfortunately, ValueTracking has a special case where sometimes we
determine non-zero shift amounts using isKnownNonZero(). I have my
doubts about the usefulness of that special-case (it is only tested
in a single unit test), but I've reproduced the special-case via an
extra parameter to the KnownBits methods.
Differential Revision: https://reviews.llvm.org/D151816
Matthias Springer [Thu, 1 Jun 2023 07:00:08 +0000 (09:00 +0200)]
[mlir][tensor] TrackingListener: Find replacement ops through cast-like ExtractSliceOps
Certain ExtractSliceOps, that do extract all elements from the destination, are treated like casts when looking for replacement ops. Such ExtractSliceOps are typically rank expansions.
Differential Revision: https://reviews.llvm.org/D151804
Matthias Springer [Thu, 1 Jun 2023 06:47:00 +0000 (08:47 +0200)]
[mlir][tensor] Add pattern to drop redundant insert_slice rank expansion
Drop insert_slice rank expansions if they are directly followed by an inverse rank reduction.
Differential Revision: https://reviews.llvm.org/D151800
Manas [Thu, 1 Jun 2023 06:41:42 +0000 (12:11 +0530)]
[mlir][arith] Disallow zero ranked tensors for select's condition
Zero ranked tensor (say tensor<i1>) when used for arith.select's condition,
crashes optimizer during bufferization. This patch puts a constraint on
condition to be either scalar or of matching shape as to its result.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D151270
Petr Hosek [Thu, 1 Jun 2023 06:04:16 +0000 (06:04 +0000)]
Revert "[Fuchsia] Pass through LLVM_ENABLE_HTTPLIB to stage 2"
This reverts commit
80614e162222e857d8767174284701aec69381c4.
Petr Hosek [Fri, 26 May 2023 22:11:24 +0000 (22:11 +0000)]
[BOLT][CMake] Redo the build and install targets
The existing BOLT install targets are broken on Windows becase they
don't properly handle the output extension. We cannot use the existing
LLVM macros since those make assumptions that don't hold for BOLT. This
change instead implements custom macros following the approach used by
Clang and LLD.
Differential Revision: https://reviews.llvm.org/D151595
Phoebe Wang [Thu, 1 Jun 2023 05:38:08 +0000 (13:38 +0800)]
[X86][BF16] Fix 2 crashes with vector broadcast
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D151808
Guillaume Chatelet [Wed, 31 May 2023 12:40:10 +0000 (12:40 +0000)]
[libc] Reduce math tests runtime
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D151798
wangpc [Thu, 1 Jun 2023 04:44:21 +0000 (12:44 +0800)]
[RISCV][NFC] Add isF argument to SchedSEWSet
So that we can remove `SchedSEWSetF` and simplify some code.
Reviewed By: michaelmaitland
Differential Revision: https://reviews.llvm.org/D151790
Piyou Chen [Thu, 1 Jun 2023 03:24:03 +0000 (20:24 -0700)]
[RISCV] check pointer before dereference
Encountered ASAN crash and found it dereference without check pointer.
Reviewed By: kito-cheng, eklepilkina
Differential Revision: https://reviews.llvm.org/D151716
Joshua Cao [Tue, 30 May 2023 08:53:06 +0000 (01:53 -0700)]
[SCEV] Compute AddRec range computations using different type BECount
Before this patch, we can only use the MaxBECount for an AddRec's range
computation if the MaxBECount has <= bit width of the AddRec. This patch
reasons that if a MaxBECount has > bit width, and is <= the max value of
AddRec's bit width, we can still use the MaxBECount.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D151698
Joshua Cao [Wed, 31 May 2023 03:40:10 +0000 (20:40 -0700)]
[SCEV][NFC] Refactor range computation for AddRec to pass around APInt
Joshua Cao [Thu, 1 Jun 2023 02:23:55 +0000 (19:23 -0700)]
[SCEV] Fix verification of SCEV multiples.
Craig Topper [Thu, 1 Jun 2023 03:31:24 +0000 (20:31 -0700)]
[RISCV] Update some tests that used "interrupt"="user". NFC
Support for this was removed previously. Change them to "supervisor" since
they were testing generic "interrupt" things.
zhanglimin [Thu, 1 Jun 2023 03:13:47 +0000 (11:13 +0800)]
[Analysis][LoongArch] Add sign extension for i32 parameters and returns
In LoongArch ABI spec, we can see that in the LP64D ABI, unsigned 32-bit
types, such as unsigned int, are stored in general-purpose registers as
proper sign extensions of their 32-bit values.
Reference:
https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_abi_lp64d
Reviewed By: SixWeining, xen0n
Differential Revision: https://reviews.llvm.org/D151794
Kevin Gleason [Thu, 1 Jun 2023 01:10:42 +0000 (18:10 -0700)]
[mlir][bytecode] Error if requested bytecode version is unsupported
Currently desired bytecode version is clamped to the maximum. This allows requesting bytecode versions that do not exist. We have added callsite validation for this in StableHLO to ensure we don't pass an invalid version number, probably better if this is managed upstream. If a user wants to use the current version, then omitting `setDesiredBytecodeVersion` is the best way to do that (as opposed to providing a large number).
Adding this check will also properly error on older version numbers as we increment the minimum supported version. Silently claming on minimum version would likely lead to unintentional forward incompatibilities.
Separately, due to bytecode version being `int64_t` and using methods to read/write uints, we can generate payloads with invalid version numbers:
```
mlir-opt file.mlir --emit-bytecode --emit-bytecode-version=-1 | mlir-opt
<stdin>:0:0: error: bytecode version
18446744073709551615 is newer than the current version 5
```
This is fixed with version bounds checking as well.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D151838
Jason Molenda [Thu, 1 Jun 2023 01:34:40 +0000 (18:34 -0700)]
Setting to control addressable bits in high memory
On AArch64, it is possible to have a program that accesses both low
(0x000...) and high (0xfff...) memory, and with pointer authentication,
you can have different numbers of bits used for pointer authentication
depending on whether the address is in high or low memory.
This adds a new target.process.highmem-virtual-addressable-bits
setting which the AArch64 Mac ABI plugin will use, when set, to
always set those unaddressable high bits for high memory addresses,
and will use the existing target.process.virtual-addressable-bits
setting for low memory addresses.
This patch does not change the existing behavior when only
target.process.virtual-addressable-bits is set. In that case, the
value will apply to all addresses.
Not yet done is recognizing metadata in a live process connection
(gdb-remote qHostInfo) or a Mach-O corefile LC_NOTE to set the
correct number of addressing bits for both memory ranges. That
will be a future change.
Differential Revision: https://reviews.llvm.org/D151292
rdar://
109746900
Ellis Hoag [Thu, 1 Jun 2023 01:16:08 +0000 (18:16 -0700)]
Fix clang driver tests for cspgo in lld
The tests introduced by https://reviews.llvm.org/D151589 were failing
because I guess some test platforms don't have `lld`. Similar tests add
`-B%S/Inputs/lld` to the clang commands so lets try this here to fix the
tests.
```
clang: error: invalid linker name in argument '-fuse-ld=lld'
```
LLVM GN Syncbot [Thu, 1 Jun 2023 01:15:34 +0000 (01:15 +0000)]
[gn build] Port
dc124cda7c78
Nikolas Klauser [Thu, 1 Jun 2023 01:14:32 +0000 (18:14 -0700)]
[libc++] Optimize for_each for segmented iterators
```
---------------------------------------------------
Benchmark old new
---------------------------------------------------
bm_for_each/1 3.00 ns 2.98 ns
bm_for_each/2 4.53 ns 4.57 ns
bm_for_each/3 5.82 ns 5.82 ns
bm_for_each/4 6.94 ns 6.91 ns
bm_for_each/5 7.55 ns 7.75 ns
bm_for_each/6 7.06 ns 7.45 ns
bm_for_each/7 6.69 ns 7.14 ns
bm_for_each/8 6.86 ns 4.06 ns
bm_for_each/16 11.5 ns 5.73 ns
bm_for_each/64 43.7 ns 4.06 ns
bm_for_each/512 356 ns 7.98 ns
bm_for_each/4096 2787 ns 53.6 ns
bm_for_each/32768 20836 ns 438 ns
bm_for_each/262144 195362 ns 4945 ns
bm_for_each/1048576 685482 ns 19822 ns
```
Reviewed By: ldionne, Mordante, #libc
Spies: arichardson, libcxx-commits
Differential Revision: https://reviews.llvm.org/D151274
Nikolas Klauser [Thu, 1 Jun 2023 01:14:24 +0000 (18:14 -0700)]
[libc++] Introduce __for_each_segment and use it in copy/move
This simplifies the code inside copy/move and makes it easier to apply the optimization to other algorithms.
Reviewed By: ldionne, Mordante, #libc
Spies: arichardson, libcxx-commits
Differential Revision: https://reviews.llvm.org/D151265
Ellis Hoag [Wed, 31 May 2023 21:17:35 +0000 (14:17 -0700)]
[lld] add context-sensitive PGO options for MachO
Enable support for CSPGO for lld MachO targets.
Since lld MachO does not support `-plugin-opt=`, we need to create the `--cs-profile-generate` and `--cs-profile-path=` options and propagate them in `Darwin.cpp`. These flags are not supported by ld64.
Also outline code into `getLastCSProfileGenerateArg()` to share between `CommonArgs.cpp` and `Darwin.cpp`.
CSPGO is already implemented for ELF (https://reviews.llvm.org/D56675) and COFF (https://reviews.llvm.org/D98763).
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D151589
David Blaikie [Thu, 1 Jun 2023 00:35:39 +0000 (00:35 +0000)]
lldb: Fix cross-cu-reference test to explicitly request that feature
David Blaikie [Wed, 31 May 2023 23:27:52 +0000 (23:27 +0000)]
[DebugInfo][Split DWARF][LTO]: Ensure only a single CU is emitted
Split DWARF doesn't handle LTO of any form (roughly there's an
assumption that each dwo file will have one CU - it's not explicitly
documented, nor explicitly handled, so the ecosystem isn't really well
understood/tested/etc).
This had previously been handled by implementing (& disabling by
default) the `-split-dwarf-cross-cu-references` flag, which would
disable use of ref_addr across two dwo CUs.
This worked for a while, at least in LTO (it didn't address Split
DWARF+Full LTO, but that's an unlikely combination, as the benefits of
Split DWARF are more limited in a full LTO build) - because the only
source of cross-CU references was inlined functions, so by making those
non-cross-CU (by moving the referenced inlined function DWARF
description into the referencing CU) the result was one CU per dwo.
But recently the Function Specialization pass was added to the ThinLTO
pipeline, which caused imported functions that may not be inlined to be
emitted by a backend compile. This meant foreign CU entities (not just
abstract origins/cross-CU referenced entities)/standalone foreign CUs
could be emitted by a backend compile.
The end result was, due to a bug* in binutils dwp (I think basically
it saw two CUs in a single dwo and reprocessed the offsets in the shared
debug_str_offsets.dwo section) this situation lead to corrupted strings.
So to make this more robust, I've generalized the definition of the
`-split-dwarf-cross-cu-references` flag (perhaps it should be renamed at
this point, but it's /really/ niche, doubt anyone's using it - more or
less there for experimentation when we get around to figuring out
spec'ing LTO+Split DWARF) to mean "single CU in a dwo file" and added
more general handling for this.
There's certainly some weird corner cases that could come up in terms of
"how do we choose which CU to put everything in" - for now it's "first
come, first served" which is probably going to be OK for ThinLTO - the
base module will have the first functions and first CU, imported
fragments will come after that. For LTO the choice will be fairly
arbitrary - but, again, essentially whichever module comes first.
* Arguably a bug in binutils dwp, but since the feature isn't well
specified, I'd rather avoid dabbling in this uncertain area and ensure
LLVM doesn't produce especially novel DWARF (dwos with multiple CUs)
regardless of whether binutils dwp would/should be fixed. I'm not
confident debuggers could read such a dwo file well, etc.
Jan Svoboda [Wed, 31 May 2023 17:44:23 +0000 (10:44 -0700)]
[clang] NFCI: Use `DirectoryEntryRef` in framework lookup
This removes one use of the deprecated `DirectoryEntry::getName()`.
Jan Svoboda [Wed, 31 May 2023 06:38:51 +0000 (23:38 -0700)]
[clang] NFCI: Use the `*Ref()` variant on search paths
This removes some uses of the deprecated `DirectoryEntry::getName()`.
Jan Svoboda [Wed, 31 May 2023 06:38:13 +0000 (23:38 -0700)]
[clang] NFCI: Use `FileEntryRef` in `PPLexerChange`
This removes some uses of the deprecated `FileEntry::getName()`.
Daniel Thornburgh [Wed, 31 May 2023 22:56:10 +0000 (15:56 -0700)]
[Fuchsia] Pass through LLVM_ENABLE_HTTPLIB to stage 2
Mike Rostecki [Wed, 31 May 2023 22:04:47 +0000 (15:04 -0700)]
[docs] Use ExecutorAddr::toPtr() in ORC documentation.
The partial move from JITTargetAddress to ExecutorAddr in
8b1771bd9f30 did not
update the ORC or Kaleidoscope documents. This patch fixes the inconsistency.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D150458
Joseph Huber [Wed, 24 May 2023 12:59:37 +0000 (07:59 -0500)]
[OpenMP] Remove 'keep_alive' functionality from the device RTL
The OpenMP DeviceRTL uses a hacky workaround to keep certain runtime
calls alive. This used a function that prevented them from being
optimized out. We needed this hack because the 'OpenMPOpt' pass likes to
introduce new runtime calls into the TU. This then interacted badly with
the method of linking the bitcode file per-TU like we do with Nvidia.
The OpenMPOpt pass would then generate a runtime call to a function that
was never linked in.
This should not be a problem anymore because we unconditionally link in
the `libomptarget.devicertl.a` runtime library. This should thus only
extract symbols that are undefined. So, if we do end up with an
unresolved reference it will be resolved by the static library.
The downside to this is that if we are doing non-LTO NVPTX compilation
that introduces one of these calls it will be linked outside the module
and therefore provide the overhead of an external function call.
However, removing this flag should make optimizing things easier. We
will need to see if that performance is a problem.
Reviewed By: ye-luo
Differential Revision: https://reviews.llvm.org/D151324
Jan Svoboda [Wed, 31 May 2023 06:35:23 +0000 (23:35 -0700)]
[clang] NFCI: Use `DirectoryEntryRef` in `PrecompiledPreamble`
This removes some uses of the deprecated `DirectoryEntry::getName()`.
Jan Svoboda [Wed, 31 May 2023 06:34:40 +0000 (23:34 -0700)]
[clang] NFCI: Use `DirectoryEntryRef` for `ModuleMap::BuiltinIncludeDir`
This removes some uses of the deprecated `DirectoryEntry::getName()`.
Jan Svoboda [Wed, 31 May 2023 05:12:07 +0000 (22:12 -0700)]
[clang] NFCI: Use `DirectoryEntryRef` in `ASTWriter`
This removes the call to deprecated `DirectoryEntry::getName()`.
Adrian Prantl [Fri, 26 May 2023 21:48:37 +0000 (14:48 -0700)]
HostInfoMacOS: Add a utility function for finding an SDK-specific tool
This is an API needed by swift-lldb.
https://reviews.llvm.org/D151591
Adrian Prantl [Fri, 26 May 2023 20:01:34 +0000 (13:01 -0700)]
Factor out xcrun into a function (NFC)
https://reviews.llvm.org/D151588
Peter Klausler [Sat, 6 May 2023 22:03:39 +0000 (15:03 -0700)]
[flang] CUDA Fortran - part 4/5: definability and characteristics
Extend the definability and procedure characteristics checking
infrastructure in semantics to check for context-dependent CUDA object
definability violations and problems with CUDA attribute incompatibility
in procedure interfaces.
Depends on https://reviews.llvm.org/D150159,
https://reviews.llvm.org/D150161, & https://reviews.llvm.org/D150162.
Differential Revision: https://reviews.llvm.org/D150163
Ellis Hoag [Wed, 31 May 2023 21:02:23 +0000 (14:02 -0700)]
[lld] Add --lto-debug-pass-manager option
Add support for printing the passes run for LTO.
Both ELF and COFF have `--lto-debug-pass-manager` (`-ltodebugpassmanager`) to print the compiler passes run during LTO. This is useful to check that a certain compiler pass is run in a test, e.g., https://reviews.llvm.org/D151589
Reviewed By: #lld-macho, MaskRay, int3
Differential Revision: https://reviews.llvm.org/D151746
Alan Zhao [Tue, 30 May 2023 23:27:14 +0000 (16:27 -0700)]
[clang] Fix crash when passing a braced-init list to a parentehsized aggregate init expression
The previous code incorrectly assumed that we would never call
warnBracedScalarInit(...) with a EK_ParenAggInitMember. This patch fixes
the bug by warning when a scalar member is initialized via a braced-init
list when performing a parentehsized aggregate initialization. This
behavior is consistent with parentehsized list aggregate initialization.
Fixes #63008
Reviewed By: shafik
Differential Revision: https://reviews.llvm.org/D151763