Kazu Hirata [Sat, 3 Dec 2022 05:11:44 +0000 (21:11 -0800)]
[llvm] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated. The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Sat, 3 Dec 2022 05:11:42 +0000 (21:11 -0800)]
[utils] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated. The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.
This is part of an effort to migrate from
llvm::Optional to std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Sat, 3 Dec 2022 05:11:40 +0000 (21:11 -0800)]
[tools] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated. The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Sat, 3 Dec 2022 05:11:39 +0000 (21:11 -0800)]
[DebugInfo] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated. The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Sat, 3 Dec 2022 05:11:37 +0000 (21:11 -0800)]
[Transforms] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated. The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Sat, 3 Dec 2022 04:36:08 +0000 (20:36 -0800)]
[CodeGen] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated. The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Sat, 3 Dec 2022 04:36:06 +0000 (20:36 -0800)]
[Target] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated. The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Sat, 3 Dec 2022 04:36:04 +0000 (20:36 -0800)]
[Bitcode] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated. The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Sat, 3 Dec 2022 04:05:20 +0000 (20:05 -0800)]
[IR] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated. The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Sat, 3 Dec 2022 03:43:04 +0000 (19:43 -0800)]
[Analysis] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated. The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Sat, 3 Dec 2022 03:04:57 +0000 (19:04 -0800)]
[ADT, Support] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated. The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Differential Revision: https://reviews.llvm.org/D139241
Xiaodong Liu [Sat, 3 Dec 2022 03:00:18 +0000 (11:00 +0800)]
[LoongArch] Use tablegen size for getInstSizeInBytes
Correct the pseudo atomic instruction size for branch
relaxation and branch folding passes.
Inspired by D118175, D118009 and D117970.
Depends on D138481
Reviewed By: SixWeining, gonglingqin, xen0n
Differential Revision: https://reviews.llvm.org/D138469
Kazu Hirata [Sat, 3 Dec 2022 02:53:00 +0000 (18:53 -0800)]
[llvm] Add support for hashing std::optional
The credit for the hashing code, taken from D138934, goes to Ramkumar
Ramachandra. The test comes from OptionalTest.cpp and updated for
std::optional.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Differential Revision: https://reviews.llvm.org/D139240
Peter Klausler [Fri, 4 Nov 2022 23:39:52 +0000 (16:39 -0700)]
[flang] Warn about more continuation lines than the standard permits
f18 doesn't have any limit on continuation lines in fixed or free form
source (other than available memory), but the standard does. Emit
a portability warning when it is exceeded.
Differential Revision: https://reviews.llvm.org/D139055
Guilhem [Sat, 3 Dec 2022 00:48:27 +0000 (16:48 -0800)]
[llvm-objcopy] Fix --section-add when section contain empty bytes
Implicit cast between char* and StringRef when writing sections.
Reproduce:
```
$> llvm-objcopy --dump-section=name=name.data out.wasm
$> llvm-objcopy --remove-section=name out.wasm out_no_name.wasm
$> llvm-objcopy --add-section=name=name.data out_no_name.wasm out_new_name.wasm
# With wasm-objdump -h we can see that the name section is not totally copied in the new wasm file (if it actually contain empty bytes)
```
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/D139210
Kazu Hirata [Sat, 3 Dec 2022 00:25:07 +0000 (16:25 -0800)]
[mlir] Fix an unused variable warning
This patch fixes:
mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp:646:18: error:
unused variable 'dimRank' [-Werror,-Wunused-variable]
Peter Klausler [Sat, 3 Dec 2022 00:13:09 +0000 (16:13 -0800)]
[flang][examples] Fix build of flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp (take 2)
Need to add casts to std::string.
Jan Svoboda [Fri, 2 Dec 2022 23:52:21 +0000 (15:52 -0800)]
[clang][modules][deps] Serialize inputs into PCMs using the "as requested" name
This patch changes the PCM serialization logic to refer to input files by their "requested" name. This fixes a bug where the dependency scanner reports the "final" file paths, which can result in failed explicit compiles due to the `module.modulemap` file not being surrounded by the expected framework directory structure.
Depends on D135634.
Reviewed By: benlangmuir, Bigcheese
Differential Revision: https://reviews.llvm.org/D135636
Jan Svoboda [Fri, 2 Dec 2022 23:43:48 +0000 (15:43 -0800)]
[clang][modules] Serialize VFS overlay paths into PCMs
With implicitly built modules, the importing `CompilerInstance` assumes PCMs were built in a "compatible way" (i.e. with similarly set up instance). Either because their context hash matches, or because this instance has just built them.
There are some use-cases, however, where this assumption doesn't hold, libclang/c-index-test being one of them. There, the importing instance (or `ASTUnit`) is being set up while the PCM file is being deserialized. Until now, we've assumed the serialized paths to input files are the actual on-disk files, meaning the default physical VFS was always able to resolve them. This won't be the case after D135636. Therefore, this patch makes sure `ASTUnit` is initialized with the same VFS as the PCM it's deserializing - by storing paths to the VFS overlay files into the PCM itself.
For the VFS overlay files to be adopted at the very start of PCM deserialization, they are stored in a new section in the unhashed control block, together with header search paths and system header prefixes. The move to the unhashed control block should be safe: if two modules were built with different header search paths and they produced different results, the hashed part of the PCM file will reflect that.
Reviewed By: akyrtzi, benlangmuir
Differential Revision: https://reviews.llvm.org/D135634
Peter Klausler [Wed, 30 Nov 2022 23:20:49 +0000 (15:20 -0800)]
[flang] Enforce more restrictions on I/O data list items
12.6.3p5 requires an I/O data list item to have a defined I/O procedure
if it is polymorphic. (We could defer this checking to the runtime,
but no other Fortran compiler does so, and we would also have to be
able to catch the case of an allocatable or pointer direct component
in the absence of a defined I/O subroutine.)
Also includes a patch to name resolution that ensures that a
SELECT TYPE construct entity is polymorphic in the domain of a
CLASS IS guard.
Also ensures that non-defined I/O of types with PRIVATE components
is caught.
Differential Revision: https://reviews.llvm.org/D139050
Vasileios Porpodas [Fri, 2 Dec 2022 23:03:38 +0000 (15:03 -0800)]
[NFC] Cleanup: Replace BB->InstList.splice() with BB->splice()
Differential Revision: https://reviews.llvm.org/D139236
chenglin.bi [Fri, 2 Dec 2022 23:54:49 +0000 (07:54 +0800)]
[InstCombine] fold icmp + select pattern by distributive laws
`C ? (Y != X) : (Z != X) --> (C ? Y : Z) != X`
`C ? (Y == X) : (Z == X) --> (C ? Y : Z) == X`
https://alive2.llvm.org/ce/z/-frXfs
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D139076
Matt Arsenault [Fri, 2 Dec 2022 22:25:57 +0000 (17:25 -0500)]
Analysis: Update some tests for opaque pointers
StackSafetyAnalysis/lifetime.ll had one bitcast removed that may have
mattered. The concluded lifetime is longer based on the underlying
alloca, instead of the bitcasted pointer so left that as a pointless
cast.
local.ll memintrin.ll needed some manual fixes
Matt Arsenault [Fri, 2 Dec 2022 22:28:07 +0000 (17:28 -0500)]
StackSafetyAnalysis: Don't use anonymous values in test
Matt Arsenault [Thu, 1 Dec 2022 14:42:20 +0000 (09:42 -0500)]
APFloat: Simplify makeSmallestNormalized implementation
Jan Svoboda [Fri, 2 Dec 2022 21:36:04 +0000 (13:36 -0800)]
Use CTAD on llvm::SaveAndRestore
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D139229
Peter Klausler [Fri, 4 Nov 2022 21:29:49 +0000 (14:29 -0700)]
[flang] Enforce restrictions on intrinsic assignment
When the left-hand side of an intrinsic assignment statement is
polymorphic, the LHS must be a whole allocatable variable or
component and may not be a coarray (10.2.2.1p1(1)).
Differential Revision: https://reviews.llvm.org/D139049
Tue Ly [Fri, 2 Dec 2022 23:12:17 +0000 (18:12 -0500)]
[libc][Obvious] Update error bounds for uint_test.QuickMulHiTests.
Bill Wendling [Fri, 2 Dec 2022 23:03:41 +0000 (15:03 -0800)]
[NFC] Remove unneeded #include files.
Peiming Liu [Fri, 2 Dec 2022 23:00:52 +0000 (23:00 +0000)]
[mlir][sparse][bufferization] cleanup bufferization attributes after SparsificationAndBufferizationPass
Reviewed By: aartbik, springerm
Differential Revision: https://reviews.llvm.org/D139218
Tue Ly [Wed, 23 Nov 2022 04:39:17 +0000 (23:39 -0500)]
[libc][math] Implement full multiplication and quick_mul_hi for UInt class.
Implement full multiplication `UInt<A> * UInt<B> -> UInt<A + B>` and
`quick_mul_hi` that returns the higher half of the product `UInt<A> * UInt<A>`.
These 2 functions will be used for dyadic floating point class.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D138541
Jason Molenda [Fri, 2 Dec 2022 22:39:41 +0000 (14:39 -0800)]
Leave DW_OP_addr addresses as load addresses in DWARFExpression
DWARFExpression::Evaluate will convert DW_OP_addr addresses in
a DWARF expression into load addresses on the expression stack
when there is a StackFrame in the ExecutionContext, this from
a change in 2018 in https://reviews.llvm.org/D46362. At the
time this was handling a case that came up in swift programs,
and is no longer necessary. I generalized this conversion to
a load address when a Target is available in
https://reviews.llvm.org/D137682 to make a test case possible;
this change broke a use case that Ted reported.
This change removes my test case, and removes this conversion
of a DW_OP_addr into a load address in some instances.
Differential Revision: https://reviews.llvm.org/D139226
Joseph Huber [Fri, 2 Dec 2022 19:30:35 +0000 (13:30 -0600)]
[libc] Skip tests that depend on undefined targets
When we search through the dependencies for a test we somtimes query
`get_target_property` on a target that has not been defined. This is the
case for targets that have minimal entrypoints defined such as the WIP
GPU target. This patch changes all tests whose dependencies are
undefined to be skipped entirely.
Reviewed By: sivachandra, lntue, michaelrj
Differential Revision: https://reviews.llvm.org/D139216
Peter Klausler [Thu, 3 Nov 2022 23:17:00 +0000 (16:17 -0700)]
[flang] Disallow NULL() as an expression where it cannot appear
A NULL() pointer is generally not a valid expression (as opposed to
a variable) apart from some initialization contexts and some actual
arguments.
Differential Revision: https://reviews.llvm.org/D139047
Volodymyr Sapsai [Fri, 2 Dec 2022 22:30:41 +0000 (14:30 -0800)]
Reland "[clang][deps] During scanning don't emit warnings-as-errors that are ignored with diagnostic pragmas."
This reverts commit
2f8ac1804827026b44f429dce02730da18a73c50.
After committing a fix for previous buildbot failures in D138970,
re-landing the original change.
Kazu Hirata [Fri, 2 Dec 2022 22:25:13 +0000 (14:25 -0800)]
[ModuleInliner] Add MLPriority
This patch adds MLPriority as the first step toward the ML-based
function inlining with the module inliner.
For now, MLPriority is completely identical to CostPriority.
Once this patch lands, I'm planning to:
- integrate NoInferenceModelRunner,
- memoize the priority computation so that the priority remains the
same for given values of metrics even with the noise injected during
training, and
- port/take more features into account.
Differential Revision: https://reviews.llvm.org/D139140
Matt Arsenault [Fri, 2 Dec 2022 21:45:18 +0000 (16:45 -0500)]
Fix some test files with executable permissions
Peter Klausler [Wed, 2 Nov 2022 22:32:17 +0000 (15:32 -0700)]
[flang] Change error to portability warning
The standard does *not* require that a real or imaginary part of a complex
literal constant be a scalar if it is a named constant. Downgrade a
recently installed check to a portability warning, and document it.
Differential Revision: https://reviews.llvm.org/D139046
River Riddle [Mon, 7 Nov 2022 23:35:43 +0000 (15:35 -0800)]
[mlir][docs] Group the docs for defining dialect components
This moves the documentation for defining dialects, attributes/types,
and operations into a new `DefiningDialects` folder. This helps to
keep the documentation grouped together, making it easier to find
related documentation.
Differential Revision: https://reviews.llvm.org/D137594
Kazu Hirata [Fri, 2 Dec 2022 21:37:57 +0000 (13:37 -0800)]
[Inline] Add a basic test for the module inliner
The new test ensures that the module inliner works with all currently
supported priority modes.
Different priority modes result in no difference in terms of the
output for these simple cases, so this is more of a "better than
nothing" test.
Differential Revision: https://reviews.llvm.org/D139222
River Riddle [Wed, 26 Oct 2022 01:29:53 +0000 (18:29 -0700)]
[mlir] Remove support for non-prefixed accessors
This finishes off a year long pursuit to LLVMify the generated
operation accessors, prefixing them with get/set. Support for
any other accessor naming is fully removed after this commit.
https://discourse.llvm.org/t/psa-raw-accessors-are-being-removed/65629
Differential Revision: https://reviews.llvm.org/D136727
Krzysztof Parzyszek [Fri, 2 Dec 2022 21:30:14 +0000 (13:30 -0800)]
[Hexagon] Remove most Optionals in favor of std::optional
Kazu Hirata [Fri, 2 Dec 2022 21:31:13 +0000 (13:31 -0800)]
[ModuleInliner] Initialize variables (NFC)
This patch initializes all class variables in InlineOrder.cpp for
safety just in case we miss them in constructors. Currently, all
these variables are properly initialized in their respective
constructors.
Differential Revision: https://reviews.llvm.org/D139225
Hanhan Wang [Fri, 2 Dec 2022 01:04:09 +0000 (17:04 -0800)]
[mlir] Factor more common utils to IndexingUtils
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D139159
Matt Arsenault [Fri, 2 Dec 2022 20:45:38 +0000 (15:45 -0500)]
AArch64/GlobalISel: Convert tests to opaque pointers
inttoptr_add.ll had a mangled bitcast constantexpr.
translate-gep.ll: Restored a 0 GEP
Matt Arsenault [Fri, 2 Dec 2022 20:46:37 +0000 (15:46 -0500)]
GlobalISel: Replace bitcast test pointer usage
This won't be meaningful with opaque pointers (I guess we could leave
a ptr to ptr bitcast, or allow same sized address space bitcasts).
Matt Arsenault [Fri, 2 Dec 2022 20:39:59 +0000 (15:39 -0500)]
AArch64/GlobalISel: Regenerate test checks
Try to shrink the diff in the opaque pointer conversion. Had to work
around some update_mir_test_checks bugs. It seems to struggle when the
successor list is empty around the blank line checks it inserts.
Peter Klausler [Wed, 2 Nov 2022 18:11:23 +0000 (11:11 -0700)]
[flang] Don't emit spurious error for polymorphic actual argument in PURE
Definability checking is unconditionally flagging the use of a polymorphic
variable as an actual argument for a procedure reference in a PURE subprogram
unless the corresponding dummy is INTENT(IN). This isn't necessary, since
an INTENT(OUT) polymorphic dummy is already caught as an error in the definition
of the callee, which must also be PURE; and an INTENT(IN OUT) or intent-free
dummy is allowed to be passed a polymorphic actual in a PURE context, with
any attempt to deallocate it being caught in the callee.
So add a flag to the definability checker to disable the "polymorphic
definition in PURE context" check when using it to check actual arguments.
Differential Revision: https://reviews.llvm.org/D139044
Peter Klausler [Fri, 2 Dec 2022 21:14:49 +0000 (13:14 -0800)]
[flang][examples] Fix usage of EnumToString()
EnumToString() now returns a string_view; usage in
examples/FlangOmpReport/FlangOmpReportVisitor.cpp
needs to be updated. Pushing without review to get
flang build bots back up.
Jan Svoboda [Fri, 2 Dec 2022 21:09:50 +0000 (13:09 -0800)]
[clang][deps] Fix test failures on AIX
Matthias Springer [Fri, 2 Dec 2022 20:22:20 +0000 (21:22 +0100)]
Revert "[mlir][tensor] Fold rank-reducing extract_slice with inverse expand_shape"
This reverts commit
a076f57a1a6b6d775aa4f11ac678d1c43ab33fb1.
Matthias Springer [Fri, 2 Dec 2022 20:22:04 +0000 (21:22 +0100)]
Revert "[mlir][tensor] Fold rank-reducing insert_slice with inverse collapse_shape"
This reverts commit
1522a3b7b34b41cf0b17678e4a8687797f44a3f0.
Matt Arsenault [Thu, 24 Nov 2022 02:23:47 +0000 (21:23 -0500)]
GlobalIFunc: Make allowed constant expressions stricter
This was allowing getelementptr with offsets, which doesn't make
sense. My initial attempt to use stripPointerCasts broke a few tests
involving aliases; add a new targeted verifier test for aliases.
This also provides the fix from D138537 for free, and also adds
support for addrspacecast (D138538) for free. Merge the tests in from
those.
I'm not really sure why findBaseObject exists; it seems redundant with
stripPointerCasts* (I'm also not really sure why getelementptrs are
allowed off of functions).
Matt Arsenault [Sat, 15 Jun 2019 19:25:28 +0000 (15:25 -0400)]
SROA: Simplify addrspacecasted allocas with volatile accesses
If the alloca is accessed through an addrspacecasted pointer, allow
the normal changes on the alloca. Cast back to the original use
address space instead of the new alloca's natural address space.
Matt Arsenault [Sun, 27 Nov 2022 21:01:51 +0000 (16:01 -0500)]
Sanitizers: Convert SanitizerBinaryMetadata tests to opaque pointers
Matt Arsenault [Sun, 27 Nov 2022 18:49:08 +0000 (13:49 -0500)]
SymbolRewriter: Convert test to opaque pointers
Matt Arsenault [Sun, 27 Nov 2022 00:21:01 +0000 (19:21 -0500)]
GlobalSplit: Convert tests to opaque pointers
Louis Dionne [Fri, 2 Dec 2022 20:20:15 +0000 (12:20 -0800)]
[libc++][NFC] Fix typo in comment
Peter Klausler [Wed, 2 Nov 2022 16:59:10 +0000 (09:59 -0700)]
[flang] Restore C702 check for ProcEntity symbols
A recent change moved some checking code from name resolution into
declaration checking, and inadvertently disabled C702 checking for
procedure entities. Fix.
Differential Revision: https://reviews.llvm.org/D139043
Volodymyr Sapsai [Wed, 30 Nov 2022 01:49:40 +0000 (17:49 -0800)]
[clang][Driver] Don't overwrite `DiagnosticsEngine::IgnoreAllWarnings`, rely on `DiagnosticOptions::IgnoreWarnings` value.
Driver overwrites `DiagnosticsEngine::IgnoreAllWarnings` based on `-w` flag
without taking into account `DiagnosticOptions::IgnoreWarnings` that is
propagated to `DiagnosticsEngine` in `ProcessWarningOptions` (called from
`CompilerInstance::createDiagnostics`). It makes it hard to manipulate
`DiagnosticOptions` directly and pushes towards string-based API.
Most of in-tree tools use `DiagnosticOptions` already, so migrate
`clang_parseTranslationUnit_Impl` to use it too. Don't parse `-w`
directly but rely on
```
def w : Flag<["-"], "w">, HelpText<"Suppress all warnings">, Flags<[CC1Option]>,
MarshallingInfoFlag<DiagnosticOpts<"IgnoreWarnings">>;
```
Allows to reland D138252.
Differential Revision: https://reviews.llvm.org/D138970
Philip Reames [Fri, 2 Dec 2022 19:45:53 +0000 (11:45 -0800)]
[RISCV] Fold low 12 bits into instruction during frame index elimination
Fold the low 12 bits of an immediate offset into the offset field of the using instruction. That using instruction will be a load, store, or addi which performs an add of a signed 12-bit immediate as part of it's operation. Splitting out the low bits allows the high bits to be generated via a single LUI instead of needing an LUI/ADDI pair.
The codegen effect of this is mostly converting cases where "split addi" kicks in to using LUI + a folded offset. There are a couple of straight dynamic instruction count wins, and using a canonical LUI is probably better than a chain of SP adds if the dynamic instruction count is equal.
Differential Revision: https://reviews.llvm.org/D139037
Krzysztof Parzyszek [Fri, 2 Dec 2022 17:35:05 +0000 (09:35 -0800)]
TargetTransformInfo: convert Optional to std::optional
Recommit: added missing "#include <cstdint>".
Akira Hatanaka [Fri, 2 Dec 2022 19:41:09 +0000 (11:41 -0800)]
Don't revisit the subexpressions of PseudoObjectExpr when building a
ParentMap
The assertion that is removed in this patch was failing when ObjC dot
notation expressions appear in both sides of an assignment (see the test
case in arc-repeated-weak.mm). Visit the PseudoObjectExpr once when the
syntactic expression is visited and return without visiting the
subexpressions when it's visited again when the semantic expressions are
visited.
Differential Revision: https://reviews.llvm.org/D139171
Krzysztof Parzyszek [Fri, 2 Dec 2022 19:33:24 +0000 (11:33 -0800)]
Revert "TargetTransformInfo: convert Optional to std::optional"
This reverts commit
b83711248cb12639e7ef7303cfbb4452b4067e85.
Some buildbots are failing.
Mitch Phillips [Thu, 1 Dec 2022 23:35:04 +0000 (15:35 -0800)]
Make -fsanitize=scudo use scudo_standalone. Delete check-scudo.
Leaves the implementation and tests files in-place for right now, but
deletes the ability to build the old sanitizer-common based scudo. This
has been on life-support for a long time, and the newer scudo_standalone
is much better supported and maintained.
Also patches up some GWP-ASan wording, primarily related to the fact
that -fsanitize=scudo now is scudo_standalone, and therefore the way to
reference the GWP-ASan options through the environment variable has
changed.
Future follow-up patches will delete the original scudo, and migrate all
its tests over to be part of the scudo_standalone test suite.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D138157
Krzysztof Parzyszek [Fri, 2 Dec 2022 17:35:05 +0000 (09:35 -0800)]
TargetTransformInfo: convert Optional to std::optional
wren romano [Fri, 2 Dec 2022 02:29:22 +0000 (18:29 -0800)]
[mlir][sparse] LICM for SparseTensorReader::readCOO
This commit performs two related changes. First we adjust `readCOOValue` to take the `IsPattern` bool as a template parameter rather than a function argument. Second we factor `readCOOLoop` out from `readCOO`, and template it on `IsPattern` and `IsSymmetric`. Together this moves all the assertions and header-dependent conditionals out of the main for-loop of `readCOO`. The only remaining conditional is in the `IsSymmetric=true` variant: checking whether the element is on the diagonal or not (which cannot be lifted out of the loop).
Depends On D138363
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D138365
Peter Klausler [Thu, 1 Dec 2022 00:11:20 +0000 (16:11 -0800)]
[flang] Check discrepancies between local & available global subprograms
When a scope declares the name and perhaps some characteristics of
an external subprogram using any of the many means that Fortran supplies
for doing such a thing, and that external subprogram's definition is
available, check the local declaration against the external definition.
In particular, if the global definition's interface cannot be called
by means of an implicit interface, ensure that references are via an
explicit and compatible interface.
Further, extend call site checking so that when a local declaration
exists for a known global symbol and the arguments are valid for that
local declaration, the arguments are checked against the global's
interface, just are is already done when no local declaration exists.
Differential Revision: https://reviews.llvm.org/D139042
wren romano [Fri, 2 Dec 2022 02:18:33 +0000 (18:18 -0800)]
[mlir][sparse] Breaking up openSparseTensor to better support non-permutations
This commit updates how the `SparseTensorConversion` pass handles `NewOp`. It breaks up the underlying `openSparseTensor` function into two parts (`SparseTensorReader::create` and `SparseTensorReader::readSparseTensor`) so that the pass can inject code for constructing `lvlSizes` between those two parts. Migrating the construction of `lvlSizes` out of the runtime and into the pass is a necessary first step toward fully supporting non-permutations. (The alternative would be for the pass to generate a `FuncOp` for performing the construction and then passing that to the runtime; which doesn't seem to have any benefits over the design of this commit.) And since the pass now generates the code to call these two functions, this change also removes the `Action::kFromFile` value from the enum used by `_mlir_ciface_newSparseTensor`.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D138363
Fangrui Song [Fri, 2 Dec 2022 19:05:43 +0000 (19:05 +0000)]
[AsmPrinter] .addrsig_sym: remove isTransitiveUsedByMetadataOnly
With D135642 ignoring unregistered symbols, isTransitiveUsedByMetadataOnly added
by D101512 is no longer needed (the operation is potentially slow). There is a
`.addrsig_sym` directive for an only-used-by-metadata symbol but it does not
emit an entry.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D138362
Fangrui Song [Fri, 2 Dec 2022 18:57:48 +0000 (18:57 +0000)]
[Driver] -p: change from unused warning to error for most targets
AIX and OpenBSD seem to use -p. For most targets (at least FreeBSD and Linux),
-p is legacy (GCC freebsd has a warning). We don't want the uses to grow, so
making -p an alias for -pg is not recommended. I think the uses are small.
Reviewed By: mgorny
Differential Revision: https://reviews.llvm.org/D138255
Rong Xu [Fri, 2 Dec 2022 18:22:07 +0000 (10:22 -0800)]
[PGO][indirect-call-promotion] Add extra parameter check for musttail callsite
Indirect-call-promtion for musttail callsite needs stricter type check
with parameter. This patch adds the needed extra parameter type check.
Differential Revision: https://reviews.llvm.org/D139051
Jan Svoboda [Fri, 2 Dec 2022 18:45:20 +0000 (10:45 -0800)]
Reapply "[clang][modules][deps] Including module maps are affecting"
This reverts commit
f0ce827c6972009c5052f8447c6aadf4e4be6113.
This reapplies commit
83973cf157f7850eb133a4bbfa0f8b7958bad215.
The new test now should pass on Windows thanks to commit
4d6483e91bb8f4147ff4001e6a11e373d5198e1c.
Argyrios Kyrtzidis [Thu, 1 Dec 2022 00:12:35 +0000 (16:12 -0800)]
[lldb/unittests/CMakeLists.txt] Remove extra compiler flag `-include gtest_common.h`, NFC
This doesn't seem to be necessary anymore so remove it to be more consistent with rest of the LLVM projects
that don't use prefix headers.
Differential Revision: https://reviews.llvm.org/D139058
Peter Klausler [Mon, 24 Oct 2022 17:14:03 +0000 (10:14 -0700)]
[flang] Accommodate unknowable CHARACTER length in evaluate::ArrayConstructor<>
The internal representation for array constructors in expressions during semantic
analysis needs to be able to accommodate circumstances (e.g. TRIM(), substrings)
in which the length of the elements in the array is either unknown or cannot be
represented as a context-free integer expression.
Differential Revision: https://reviews.llvm.org/D139041
Jan Svoboda [Fri, 2 Dec 2022 18:26:23 +0000 (10:26 -0800)]
Reapply "[clang][modules][deps] Parent module maps are affecting"
This reverts commit
67f34054d6ea8e40fd10cb74441d5ccab004c75b.
This reapplies commit
f99e5a9106f08ad92a22c3b114d2052e5c502924.
This improves commit
8ab388e158528d9af5eb0376ef698b243d946f19 that unsucessfully attempted to forward-fix Windows test failure.
Argyrios Kyrtzidis [Thu, 1 Dec 2022 00:36:00 +0000 (16:36 -0800)]
[lldb] Fix the `dwarf` log descriptions
Differential Revision: https://reviews.llvm.org/D139061
chenglin.bi [Fri, 2 Dec 2022 18:01:47 +0000 (02:01 +0800)]
[InstCombine] Precommit tests for D139076; NFC
Peter Klausler [Fri, 11 Nov 2022 01:29:29 +0000 (17:29 -0800)]
[flang] Restore ENUM_CLASS() to be compilation-time code
Rework some recent changes to the ENUM_CLASS() macro so that
all of the construction of enumerator-to-name string mapping
data structures is again performed at compilation time.
Differential Revision: https://reviews.llvm.org/D137859
Paul Robinson [Fri, 4 Nov 2022 15:36:00 +0000 (08:36 -0700)]
[lit][AIX] Convert clang tests to use 'target={{.*}}-aix{{.*}}'
Part of the project to eliminate special handling for triples in lit
expressions.
Differential Revision: https://reviews.llvm.org/D137437
Paul Robinson [Fri, 4 Nov 2022 15:35:11 +0000 (08:35 -0700)]
[lit][AIX] Convert llvm tests to use 'target={{.*}}-aix{{.*}}'
Part of the project to eliminate special handling for triples in lit
expressions.
Differential Revision: https://reviews.llvm.org/D137436
Usman Nadeem [Wed, 30 Nov 2022 21:15:43 +0000 (13:15 -0800)]
[Flang][Driver] Handle target CPU and features
This patch:
- Adds target-feature and target-cpu to FC1Options.
- Moves getTargetFeatures() from Clang.cpp to CommonArgs.cpp.
- Processes target cpu and features in the flang driver. Right now
features are only added for AArch64/x86 because I only did basic
testing on them but it should generally work for others as well.
Option handling is similar to clang.
- Adds appropriate structures in TargetOptions and passes them to
the target machine.
What's missing:
- Adding the CPU info and the features as attributes in the LLVM IR
module.
- Processing target specific flags, e.g. SVE vector bits for AArch64,
ABI etc.
Differential Revision: https://reviews.llvm.org/D137995
Change-Id: Ib081a74ea98617674845518a5d2754edba596418
Jun Zhang [Fri, 2 Dec 2022 17:10:13 +0000 (01:10 +0800)]
Link with missing libs to fix broken shared unittest build
Oops, I think we should link with this as well.
Signed-off-by: Jun Zhang <jun@junz.org>
Jean Perier [Fri, 2 Dec 2022 16:57:01 +0000 (17:57 +0100)]
[flang] fix unused-but-set-parameter warning in ConvertExprToHLFIR.cpp
Some named value operands are not used yet (TODOs). Some compilers
complain about it. Remove names of unused parameters.
Differential Revision: https://reviews.llvm.org/D139207
Nicolas Vasilache [Sun, 13 Nov 2022 23:20:44 +0000 (15:20 -0800)]
[mlir][Linalg] NFC - Purge OpBuilder uses in favor of RewriterBase in places unrelated to op definitions
RewriterBase is the proper builder to use so one can listen to IR modifications (i.e. not just creation).
Differential Revision: https://reviews.llvm.org/D137922
Jun Zhang [Fri, 2 Dec 2022 15:34:59 +0000 (23:34 +0800)]
Link with missing libs to fix broken shared build
Signed-off-by: Jun Zhang <jun@junz.org>
Differential Revision: https://reviews.llvm.org/D139202
Pietro Albini [Thu, 17 Nov 2022 14:32:38 +0000 (15:32 +0100)]
[lldb] fix license header in TraceHTR.h
It seems like the license header got mangled somehow, joining multiple
lines together and splitting some lines across multiple ones. That is
causing errors in a license checker I'm using (called REUSE).
This commit restores the license header to the format used by the rest
of the files in the project.
Differential Revision: https://reviews.llvm.org/D138271
Benjamin Kramer [Fri, 2 Dec 2022 15:56:05 +0000 (16:56 +0100)]
[bazel] Add a missing dependency after
786cbb09ed
Quentin Colombet [Fri, 2 Dec 2022 14:41:29 +0000 (14:41 +0000)]
Re-apply "[mlir][MemRefToLLVM] Remove the code for lowering subview"
This reverts commit
d0650d108929985760d536d59e9927838dccc9b8.
Original commit message:
Subviews are supposed to be expanded before we hit the lowering
code.
The expansion is done with the pass called
expand-strided-metadata.
Add a test that demonstrate how these passes can be linked up to achieve
the desired lowering.
This patch is NFC in spirit but not in practice because `subview` gets
lowered into `reinterpret_cast(extract_strided_metadata, <some math>)`
which lowers in two memref descriptors (one for `reinterpert_cast` and
one for `extract_strided_metadata`), which creates some noise of the
form: `extractvalue(unrealized_cast(extractvalue[0]))[0]` that is
currently not simplified within MLIR but that is really just noop in
that case.
Differential Revision: https://reviews.llvm.org/D136377
Jean Perier [Fri, 2 Dec 2022 15:19:30 +0000 (16:19 +0100)]
[flang] Lower conversions to HLFIR
Differential Revision: https://reviews.llvm.org/D139196
Sanjay Patel [Fri, 2 Dec 2022 14:18:11 +0000 (09:18 -0500)]
[SDAG] bail out of mergeTruncStores() if there's any other use in the chain
This fixes the miscompile in issue #58883.
The test demonstrates that we gave up on store merging in that example.
This change should be strictly safe (just adds another clause
to avoid the transform), and it does not prohibit any existing
valid optimizations based on regression tests. I want to believe
that it's also a sufficient fix (possibly overkill), but I'm not
sure how to prove that.
Differential Revision: https://reviews.llvm.org/D137791
Valery Pykhtin [Mon, 17 Oct 2022 11:30:45 +0000 (13:30 +0200)]
[AMDGPU] Scheduler: Don't revert the schedule if the register pressure isn't changed for a region
This one-linear fix improves compilation time for about ~40% on ASAN enabled code.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D136069
Valentin Clement [Fri, 2 Dec 2022 14:51:01 +0000 (15:51 +0100)]
[flang] Perform assignment to polymorphic allocatable with runtime call
Lower assignment to polymorphic allocatable to the `Assign` runtime
call.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D139192
Matthias Springer [Fri, 2 Dec 2022 10:46:14 +0000 (11:46 +0100)]
[mlir][bufferization] Make `TensorCopyInsertionPass` a test pass
TensorCopyInsertion should not have been exposed as a pass. This was a flaw in the original design. It is a preparation step for bufferization and certain transforms (that would otherwise be legal) are illegal between TensorCopyInsertion and actual rewrite to MemRef ops. Therefore, even if broken down as two separate steps internally, they should be exposed as a single pass.
This change affects the sparse compiler, which uses `TensorCopyInsertionPass`. A new `SparsificationAndBufferizationPass` is added to replace all passes in the sparse tensor pipeline from `TensorCopyInsertionPass` until the actual bufferization (rewrite to memref/non-tensor). It is generally unsafe to run arbitrary passes in-between, in particular passes that hoist tensor ops out of loops or change SSA use-def chains along tensor ops.
Differential Revision: https://reviews.llvm.org/D138915
Florian Hahn [Fri, 2 Dec 2022 14:34:34 +0000 (14:34 +0000)]
[DSE] Use precise loc for memcpy_chk during overwrite checks.
Extends the logic from D115167 to memcpy_chk.
Depends on D115167
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D139096
chenglin.bi [Fri, 2 Dec 2022 14:26:20 +0000 (22:26 +0800)]
[Instcombine] Code refactors for foldSelectOpOp; NFC
Reuse the code about find common operator.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D139075
Quentin Colombet [Fri, 2 Dec 2022 14:19:37 +0000 (14:19 +0000)]
Revert "[mlir][MemRefToLLVM] Remove the code for lowering subview"
This reverts commit
c8e15afa4caf74f0d8281ca3e44674f1f6c1bc52.
This breaks some integration tests, see
https://lab.llvm.org/buildbot/#/builders/220/builds/10446
I have to update a bunch of RUN lines in the tests to use the new
lowering scheme. Nothing complicated but let's keep the build clean
while I'm fixing that.
Jay Foad [Fri, 2 Dec 2022 14:07:11 +0000 (14:07 +0000)]
Revert "[AMDGPU] Speedup GCNDownwardRPTracker::advanceBeforeNext"
This reverts commit
2d09bec169277fb5a341249afacff532c7511756.
It was causing assertion failures in some out-of-tree tests.
Krzysztof Parzyszek [Fri, 2 Dec 2022 03:50:39 +0000 (21:50 -0600)]
Attributes: convert Optional to std::optional
Michael Buch [Fri, 2 Dec 2022 14:12:41 +0000 (14:12 +0000)]
Revert "[lldb][Target] Flush the scratch TypeSystem when owning lldb_private::Module gets unloaded"
This reverts commit
4df11394a10b3b15d2fb9bde8b831cf68785aa45.