platform/upstream/llvm.git
22 months ago[mlir][LLVMIR target] Fix llvm.freeze builder to prevent crashes
Krzysztof Drewniak [Wed, 7 Dec 2022 21:05:58 +0000 (21:05 +0000)]
[mlir][LLVMIR target] Fix llvm.freeze builder to prevent crashes

The freeze builder did not assign the result of creating the freeze
operation to $res, which meant that when subsequent translations (such
as a sext) tried to use that result or query its type, mlir-translate
would crash.

This fixes the issue and adds a test for it.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D139574

22 months ago[mlir][arith][tosa] Use extended mul in 32-bit `tosa.apply_scale`
Jakub Kuderski [Mon, 12 Dec 2022 19:39:57 +0000 (14:39 -0500)]
[mlir][arith][tosa] Use extended mul in 32-bit `tosa.apply_scale`

To not introduce 64-bit types that may be difficult to handle for some
targets.

Reviewed By: rsuderman, antiagainst

Differential Revision: https://reviews.llvm.org/D139777

22 months ago[Clang] Try to fix test on Windows (NFC)
Nikita Popov [Mon, 12 Dec 2022 19:35:29 +0000 (20:35 +0100)]
[Clang] Try to fix test on Windows (NFC)

Try to fix failure reported in
https://reviews.llvm.org/rG9466b49171dc#1154213 by making the
match more specific, as there are multiple dbg.declares that
could be matched.

22 months ago[mlgo] Use LLVM_HAVE_TFLITE instead of LLVM_HAVE_TF_API in C++ code (NFC)
Kazu Hirata [Mon, 12 Dec 2022 19:28:40 +0000 (11:28 -0800)]
[mlgo] Use LLVM_HAVE_TFLITE instead of LLVM_HAVE_TF_API in C++ code (NFC)

We use LLVM_HAVE_TFLITE as the key to enable the mlgo work these days,
and LLVM_HAVE_TF_API is defined whenever LLVM_HAVE_TF_API is defined.

I'm posting this patch because it's purely mechanical.

I'll post a follow-up patch to remove LLVM_HAVE_TF_API in non-C++
files, and that will not be as mechanical as this one.

Differential Revision: https://reviews.llvm.org/D139863

22 months ago[mlgo] Remove TENSORFLOW_C_LIB_PATH
Kazu Hirata [Mon, 12 Dec 2022 19:28:38 +0000 (11:28 -0800)]
[mlgo] Remove TENSORFLOW_C_LIB_PATH

We use LLVM_HAVE_TFLITE as the key to enable the MLGO bits.  We do not
use the "else" clause.

Differential Revision: https://reviews.llvm.org/D139860

22 months ago[ZOS] Convert tests to check 'target={{.*}}-zos{{.*}}'
Paul Robinson [Mon, 12 Dec 2022 19:24:02 +0000 (11:24 -0800)]
[ZOS] Convert tests to check 'target={{.*}}-zos{{.*}}'

Also add 'system-zos' as a lit feature and use it where needed.

Part of the project to eliminate special handling for triples in lit
expressions.

Differential Revision: https://reviews.llvm.org/D139444

22 months ago[HWASAN][NFC] Renamed [g|s]et_requested_size to [G|S]etRequestedSize.
Kirill Stoimenov [Fri, 9 Dec 2022 18:53:54 +0000 (18:53 +0000)]
[HWASAN][NFC] Renamed [g|s]et_requested_size to [G|S]etRequestedSize.

Reviewed By: kda

Differential Revision: https://reviews.llvm.org/D139727

22 months ago[COFF] Respect weak externals for mangled symbol searching
Shoaib Meenai [Sat, 10 Dec 2022 04:09:56 +0000 (20:09 -0800)]
[COFF] Respect weak externals for mangled symbol searching

We were previously ignoring weak externals during these searches (which
are used for the entry point, exports, and subsystem inference), which
differed from link.exe behavior. It also meant that we could get
different behavior when linking an object file directly vs. packaging it
into a static library, because static library symbol name directories
include weak externals.

Reviewed By: mstorsjo, yozhu

Differential Revision: https://reviews.llvm.org/D139764

22 months ago[gn] port 988ab0048daf
Nico Weber [Mon, 12 Dec 2022 18:52:03 +0000 (13:52 -0500)]
[gn] port 988ab0048daf

22 months ago[lldb] Make ParseTemplateParameterInfos return false if there are no template params
Arthur Eubanks [Thu, 8 Dec 2022 18:01:01 +0000 (10:01 -0800)]
[lldb] Make ParseTemplateParameterInfos return false if there are no template params

This factors out the check from various callers.

Reviewed By: Michael137

Differential Revision: https://reviews.llvm.org/D139649

22 months ago[ORC] Extract hasInitializerSection for testing (NFC)
Keith Smiley [Mon, 5 Dec 2022 18:21:46 +0000 (10:21 -0800)]
[ORC] Extract hasInitializerSection for testing (NFC)

Based on the discussion in https://reviews.llvm.org/D130221 and https://reviews.llvm.org/D139223

Differential Revision: https://reviews.llvm.org/D139347

22 months ago[NFC][SROA] `rewriteMemOpOfSelect()`: play nice with typed pointers for now
Roman Lebedev [Mon, 12 Dec 2022 18:15:33 +0000 (21:15 +0300)]
[NFC][SROA] `rewriteMemOpOfSelect()`: play nice with typed pointers for now

https://github.com/llvm/llvm-project/commit/89a6106ce50689c733be13aaef4be5f3f73708a2#commitcomment-92824429

22 months ago[test] Fix dr324.c again for non-writeable source directories
Jordan Rupprecht [Mon, 12 Dec 2022 18:11:19 +0000 (10:11 -0800)]
[test] Fix dr324.c again for non-writeable source directories

In general, the source tree is not assumed to be writeable, so modifying `%s` does not work for all CI systems. Instead of touching `%s`, copy it to a writeable dir using `%t`, and touch it there.
Actually, `dr0xx.c` isn't really needed at all, so just create a new `dep.c` file in the build tree.

This was recently added in cb088e8c3abf30456e2891f90b5194d0070c387a, fixed in 1481fcf780bde7b115aa395064d71749b1a40889, and fixed again in d16c59013056f1bf8844ded8faeb0cf01b1c3613.

22 months ago[lit] Use 'target=' in a few more places
Paul Robinson [Mon, 12 Dec 2022 17:58:14 +0000 (09:58 -0800)]
[lit] Use 'target=' in a few more places

Missed these on the first pass.

Part of the project to eliminate special handling for triples in lit
expressions.

22 months ago[OpenMP] add offload tests with reduction on complex data types
Ye Luo [Mon, 12 Dec 2022 17:35:26 +0000 (11:35 -0600)]
[OpenMP] add offload tests with reduction on complex data types

Differential Revision: https://reviews.llvm.org/D139856

22 months agoEmit CAS loop for min/max atomics.
Doru Bercea [Wed, 7 Dec 2022 16:37:11 +0000 (10:37 -0600)]
Emit CAS loop for min/max atomics.

22 months ago[NFC][SCEV][LoopUnroll] Add tests where treating `or` as `add` raises expansion cost
Roman Lebedev [Mon, 12 Dec 2022 16:30:42 +0000 (19:30 +0300)]
[NFC][SCEV][LoopUnroll] Add tests where treating `or` as `add` raises expansion cost

From https://reviews.llvm.org/rG46db90cc71d1#1154128

22 months ago[mlir][runner] Add more printMemref functions.
bixia1 [Mon, 12 Dec 2022 16:26:23 +0000 (08:26 -0800)]
[mlir][runner] Add more printMemref functions.

Add printMemref for complex data types and index type. Add printMemref for 1d
type beyond f32.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D139475

22 months ago[InstrProf] Fix bug when merging empty profile with multiple threads
Ellis Hoag [Sat, 10 Dec 2022 01:12:30 +0000 (17:12 -0800)]
[InstrProf] Fix bug when merging empty profile with multiple threads

When merging profiles with multiple threads, the `mergeWriterContexts()` function is used to merge profile data between writers. This must be in sync with `loadInput()` which merges profiles to a single writer. This diff merges the profile kind correctly in `mergeWriterContexts()` to fix a subtle bug.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D139755

22 months ago[libc][bazel] Mark all libc public functions to have "default" visibility.
Siva Chandra Reddy [Thu, 8 Dec 2022 23:26:21 +0000 (23:26 +0000)]
[libc][bazel] Mark all libc public functions to have "default" visibility.

For the bazel build, we also build all source files with
-fvisibility=hidden.

Reviewed By: gchatelet

Differential Revision: https://reviews.llvm.org/D139678

22 months ago[RISCV] Allow fractional LMUL for reduction start value
Philip Reames [Mon, 12 Dec 2022 16:53:35 +0000 (08:53 -0800)]
[RISCV] Allow fractional LMUL for reduction start value

For reductions, we need to put the start value into a source vector. For fractional LMULs, we can perform the operation at the original LMUL.  For LMUL > 1, we eventually want to use a scalar insert, but that's outside the scope of this patch.

Differential Revision: https://reviews.llvm.org/D139747

22 months ago[AMDGPU] Make use of !listremove. NFCI.
Jay Foad [Mon, 12 Dec 2022 11:31:20 +0000 (11:31 +0000)]
[AMDGPU] Make use of !listremove. NFCI.

This only affects the order of implicit operands in some MIR tests.

Differential Revision: https://reviews.llvm.org/D139829

22 months agoFix module build after removing None.h from STLExtras.h
Steven Wu [Mon, 12 Dec 2022 16:57:53 +0000 (08:57 -0800)]
Fix module build after removing None.h from STLExtras.h

Add declaration for NoneType in BitcodeConvenience.h.

22 months ago[Clang] Update compiler-rt sanitizer test to use opaque pointers (NFC)
Nikita Popov [Mon, 12 Dec 2022 16:26:52 +0000 (17:26 +0100)]
[Clang] Update compiler-rt sanitizer test to use opaque pointers (NFC)

22 months ago[opt] Clean up code related to parsing legacy passes for new PM driver. NFC
Bjorn Pettersson [Mon, 12 Dec 2022 16:11:40 +0000 (17:11 +0100)]
[opt] Clean up code related to parsing legacy passes for new PM driver. NFC

Just some minor cleanups given that `opt -passname` syntax is dead
for the new pass manager driver.

22 months ago[Analysis] Remove TFUtils.cpp
Kazu Hirata [Mon, 12 Dec 2022 16:38:55 +0000 (08:38 -0800)]
[Analysis] Remove TFUtils.cpp

Differential Revision: https://reviews.llvm.org/D139773

22 months ago[reland][Alignment][NFC] Remove access to deprecated GlobalObject::getAlignment from...
Guillaume Chatelet [Mon, 12 Dec 2022 16:37:51 +0000 (16:37 +0000)]
[reland][Alignment][NFC] Remove access to deprecated GlobalObject::getAlignment from llvm

Differential Revision: https://reviews.llvm.org/D139836

22 months ago[AArch64][GlobalISel] Lower formal arguments of AAPCS & ms_abi variadic functions.
Vladislav Dzhidzhoev [Mon, 1 Aug 2022 14:02:25 +0000 (17:02 +0300)]
[AArch64][GlobalISel] Lower formal arguments of AAPCS & ms_abi variadic functions.

Reimplemented SelectionDAG code for GlobalISel.

Fixes https://github.com/llvm/llvm-project/issues/54079

Differential Revision: https://reviews.llvm.org/D130903

22 months ago[CodeGen] Fix a warning
Kazu Hirata [Mon, 12 Dec 2022 16:27:12 +0000 (08:27 -0800)]
[CodeGen] Fix a warning

This patch fixes:

  clang/lib/CodeGen/CGOpenMPRuntime.cpp:6098:8: error: lambda capture
  'this' is not used [-Werror,-Wunused-lambda-capture]

22 months ago[Clang] Convert some tests to opaque pointers (NFC)
Nikita Popov [Mon, 12 Dec 2022 16:13:39 +0000 (17:13 +0100)]
[Clang] Convert some tests to opaque pointers (NFC)

These were tests where update_cc_test_checks.py was rerun after
the conversion.

22 months ago[Clang] Convert various tests to opaque pointers (NFC)
Nikita Popov [Mon, 12 Dec 2022 16:01:34 +0000 (17:01 +0100)]
[Clang] Convert various tests to opaque pointers (NFC)

These were all tests where no manual fixup was required.

22 months ago[lldb] Remove redundant XFAIL
Paul Robinson [Fri, 9 Dec 2022 19:39:20 +0000 (11:39 -0800)]
[lldb] Remove redundant XFAIL

The test is `UNSUPPORTED: system-linux` so the XFAIL for linux is
redundant.

Part of the project to eliminate special handling for triples in lit
expressions.

Differential Revision: https://reviews.llvm.org/D139734

22 months ago[mlir][arith] Simplify muli emulation with mului_extended
Jakub Kuderski [Mon, 12 Dec 2022 15:54:20 +0000 (10:54 -0500)]
[mlir][arith] Simplify muli emulation with mului_extended

Using `arith.mului_extended` makes it much simpler to emulate wide
integer multiplication.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D139776

22 months ago[InstCombine] try to fold a pair of insertelements into one insertelement
Sanjay Patel [Mon, 12 Dec 2022 15:02:56 +0000 (10:02 -0500)]
[InstCombine] try to fold a pair of insertelements into one insertelement

This replaces patches that tried to convert related patterns to shuffles
(D138872, D138873, D138874 - reverted/abandoned) but caused codegen
problems and were questionable as a canonicalization because an
insertelement is a simpler op than a shuffle.

This detects a larger pattern -- insert-of-insert -- and replaces with
another insert, so this hopefully does not cause any problems.

As noted by TODO items in the code and tests, this could go a lot further.
But this is enough to reduce the motivating test from issue #17113.

Example proofs:
https://alive2.llvm.org/ce/z/NnUv3a

I drafted a version of this for AggressiveInstCombine, but it seems that
would uncover yet another phase ordering gap. If we do generalize this to
handle the full range of potential patterns, that may be worth looking at
again.

Differential Revision: https://reviews.llvm.org/D139668

22 months ago[clang] Allow using BareMetal toolchain with LLVM_ENABLE_PER_TARGET_RUNTIME_DIR compi...
Michael Platings [Mon, 12 Dec 2022 15:36:06 +0000 (15:36 +0000)]
[clang] Allow using BareMetal toolchain with LLVM_ENABLE_PER_TARGET_RUNTIME_DIR compiler-rt

If you build compiler-rt with LLVM_ENABLE_PER_TARGET_RUNTIME_DIR then
the library filename will be "libclang_rt.builtins.a" instead of
"libclang_rt.builtins-<ARCH>.a"

The ToolChain::getCompilerRT method uses the "libclang_rt.builtins.a"
name if it can find the file in the library directories. If it can't
then it falls back to using "libclang_rt.builtins-<ARCH>.a". This
change adds the library directory such that "libclang_rt.builtins.a"
can be found.

Differential Revision: https://reviews.llvm.org/D139822

22 months ago[X86] X86TTIImpl::getIntImmCost - use APInt::isInt/isSignedInt directly
Simon Pilgrim [Mon, 12 Dec 2022 15:20:18 +0000 (15:20 +0000)]
[X86] X86TTIImpl::getIntImmCost - use APInt::isInt/isSignedInt directly

Avoid some getSExtValue()/getZExtValue() calls

Hopefully we can remove some of the getBitWidth() constraints as well, as many are just there as a proxy for legal types (albeit assuming x86_64).

22 months ago[OpenMP][OMPIRBuilder] Migrate code to emit target region functions from clang to...
Jan Sjodin [Tue, 6 Dec 2022 19:26:50 +0000 (14:26 -0500)]
[OpenMP][OMPIRBuilder] Migrate code to emit target region functions from clang to OMPIRBuilder

This patch moves some of the logic on how to emit target region functions and
adds emitTargetRegionFunction to the OpenMPIRBuilder. Also the
OpenMPOffloadMandatory flag is added to the config.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D139634

22 months ago[Clang] Update Profile tests to opaque pointers (NFC)
Nikita Popov [Mon, 12 Dec 2022 15:24:14 +0000 (16:24 +0100)]
[Clang] Update Profile tests to opaque pointers (NFC)

22 months ago[clang-tidy] Fix a couple additional cases in misc-use-anonymous-namespace only
Carlos Galvez [Thu, 1 Dec 2022 13:15:32 +0000 (13:15 +0000)]
[clang-tidy] Fix a couple additional cases in misc-use-anonymous-namespace only

- Do not analyze header files, since we don't want to promote
  using anonymous namespaces there.

- Do not warn about const/constexpr variables, those are implicitly
  static in C++ and they don't need to be moved to an anonymous
  namespace. Warning about redundant static in general could be
  implemented as a standalone check, moving away some of the
  functionality from this check.

This check has been introduced in the current release, thus
no mention of this change is needed in the Release Notes.

Differential Revision: https://reviews.llvm.org/D139113

22 months agoRevert "[scudo] Enable more warnings for standalone build"
Lei Huang [Mon, 12 Dec 2022 15:02:01 +0000 (10:02 -0500)]
Revert "[scudo] Enable more warnings for standalone build"

This reverts commit a2b0673dbe5d5d24194fbc33a9b0e21a414fa50b.
Broke ppc sanitizer bot: https://lab.llvm.org/buildbot/#/builders/19/builds/14037

22 months ago[Clang] Convert PCH tests to opaque pointers (NFC)
Nikita Popov [Mon, 12 Dec 2022 15:17:28 +0000 (16:17 +0100)]
[Clang] Convert PCH tests to opaque pointers (NFC)

22 months ago[CodeExtractor] Preserve entire scope of !DIVariables when moving them
Felipe de Azevedo Piovezan [Thu, 8 Dec 2022 20:08:20 +0000 (15:08 -0500)]
[CodeExtractor] Preserve entire scope of !DIVariables when moving them

When a dbg.value is moved into a new function, the corresponding
variable should have its entire scope chain reparented with the new
function. The current implementation drops the scope chain and replaces
it with a subprogram for the new function.

Differential Revision: https://reviews.llvm.org/D139671

22 months ago[opt] NewPM: `opt -passname` syntax is dead, long live `opt -passes=<pipeline>`!
Roman Lebedev [Mon, 12 Dec 2022 15:17:39 +0000 (18:17 +0300)]
[opt] NewPM: `opt -passname` syntax is dead, long live `opt -passes=<pipeline>`!

I've done final pass, and there are no more tests to update.
All other tests (=codegen tests) are using old pass manager.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D139677

22 months ago[SimplifyCFG] `FoldBranchToCommonDest()`: deal with mismatched IV's in PHI's in commo...
Roman Lebedev [Mon, 12 Dec 2022 15:01:57 +0000 (18:01 +0300)]
[SimplifyCFG] `FoldBranchToCommonDest()`: deal with mismatched IV's in PHI's in common successor block

This tries to approach the problem noted by @arsenm:
terrible codegen for `__builtin_fpclassify()`:
https://godbolt.org/z/388zqdE37

Just because the PHI in the common successor happens to have different
incoming values for these two blocks, doesn't mean we have to give up.
It's quite easy to deal with this, we just need to produce a select:
https://alive2.llvm.org/ce/z/000srb

Now, the cost model for this transform is rather overly strict,
so this will basically never fire. We tally all (over all preds)
the selects needed to the NumBonusInsts

Differential Revision: https://reviews.llvm.org/D139275

22 months ago[clangd] Add support for semantic token type "operator"
Christian Kandeler [Wed, 20 Jul 2022 16:05:44 +0000 (18:05 +0200)]
[clangd] Add support for semantic token type "operator"

Also add new modifier for differentiating between built-in and user-
provided operators.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D136594

22 months ago[Clang] Convert some OpenMP tests to opaque pointers (NFC)
Nikita Popov [Mon, 12 Dec 2022 14:53:31 +0000 (15:53 +0100)]
[Clang] Convert some OpenMP tests to opaque pointers (NFC)

22 months agoRevert D139836 "[Alignment][NFC] Remove deprecated GlobalObject::getAlignment"
Guillaume Chatelet [Mon, 12 Dec 2022 15:04:03 +0000 (15:04 +0000)]
Revert D139836 "[Alignment][NFC] Remove deprecated GlobalObject::getAlignment"

This breaks lldb.

This reverts commit f3f15ca27fbb433ad5a65b1a1e0a071d2e9af505.

22 months agoUse std::optional in Tooling/Inclusions.
Haojian Wu [Mon, 12 Dec 2022 15:00:51 +0000 (16:00 +0100)]
Use std::optional in Tooling/Inclusions.

22 months ago[clang-cl] Ignore #pragma managed/unmanaged
Sylvain Audi [Thu, 8 Dec 2022 15:42:11 +0000 (10:42 -0500)]
[clang-cl] Ignore #pragma managed/unmanaged

Those 2 pragmas are ignored by MSVC when not compiling with /CLR, which clang doesn't support.
Ignore them in clang -fms-extensions, to avoid -Wunknown-pragma warnings

Differential Revision: https://reviews.llvm.org/D139632

22 months ago[Alignment][NFC] Remove deprecated GlobalObject::getAlignment
Guillaume Chatelet [Mon, 12 Dec 2022 13:06:56 +0000 (13:06 +0000)]
[Alignment][NFC] Remove deprecated GlobalObject::getAlignment

Differential Revision: https://reviews.llvm.org/D139836

22 months ago[clang-tidy][NFC] Fix compiler warning in GlobListTest.cpp
Carlos Galvez [Mon, 12 Dec 2022 14:42:06 +0000 (14:42 +0000)]
[clang-tidy][NFC] Fix compiler warning in GlobListTest.cpp

22 months agoRecommit "[AArch64] Select SMULL for zero extended vectors when top bit is zero"
Zain Jaffal [Thu, 8 Dec 2022 06:21:53 +0000 (08:21 +0200)]
Recommit "[AArch64] Select SMULL for zero extended vectors when top bit is zero"

This is a recommit of f9e0390751cb5eefbbbc191f851c52422acacab1
The previous commit failed to handle cases where the zero extended operand is an extended `BUILD_VECTOR`.
We don't replace zext with a sext operand to select smull if any operand is `BUILD_VECTOR`

Original commit message:

we can safely replace a `zext` instruction with `sext` if the top bit is zero. This is useful because we can select `smull` when both operands are sign extended.

Reviewed By: fhahn, dmgreen

Differential Revision: https://reviews.llvm.org/D134711

22 months agoRevert "Revert "[AArch64] Select SMULL for zero extended vectors when top bit is...
Zain Jaffal [Mon, 12 Dec 2022 13:56:14 +0000 (13:56 +0000)]
Revert "Revert "[AArch64] Select SMULL for zero extended vectors when top bit is zero""

This reverts commit c07a01c2bb0d1f95689f809fd5be23829e364393.

22 months ago[Alignment][NFC] Use Align in Hexagon emit(local)?CommonSymbolSorted
Guillaume Chatelet [Mon, 12 Dec 2022 14:39:21 +0000 (14:39 +0000)]
[Alignment][NFC] Use Align in Hexagon emit(local)?CommonSymbolSorted

22 months ago[AArch64][SVE] Add some hadd sve codegen tests. NFC
David Green [Mon, 12 Dec 2022 14:35:01 +0000 (14:35 +0000)]
[AArch64][SVE] Add some hadd sve codegen tests. NFC

22 months ago[Clang] Convert PowerPC tests to opaque pointers (NFC)
Nikita Popov [Mon, 12 Dec 2022 13:50:54 +0000 (14:50 +0100)]
[Clang] Convert PowerPC tests to opaque pointers (NFC)

22 months ago[include-cleaner] Add a newline at end of the file, NFC
Haojian Wu [Mon, 12 Dec 2022 14:28:34 +0000 (15:28 +0100)]
[include-cleaner] Add a newline at end of the file, NFC

22 months ago[Alignment][NFC] Use Align in MCSymbol::declareCommon
Guillaume Chatelet [Mon, 12 Dec 2022 14:27:55 +0000 (14:27 +0000)]
[Alignment][NFC] Use Align in MCSymbol::declareCommon

22 months ago[nfc][DebugInfo] Move subprogram rewriting utility to header
Felipe de Azevedo Piovezan [Thu, 8 Dec 2022 18:33:55 +0000 (13:33 -0500)]
[nfc][DebugInfo] Move subprogram rewriting utility to header

This utility will be useful in subsequent patches, as such we expose it
in the DebugInfoMetadata header.

Depends on D139669

Differential Revision: https://reviews.llvm.org/D139670

22 months ago[Alignment][NFC] MCSymbol::getCommonAlignment returns MaybeAlign, improve documentation.
Guillaume Chatelet [Mon, 12 Dec 2022 13:56:18 +0000 (13:56 +0000)]
[Alignment][NFC] MCSymbol::getCommonAlignment returns MaybeAlign, improve documentation.

This one goes hand in hand with D139819

Reviewed By: courbet

Differential Revision: https://reviews.llvm.org/D139826

22 months ago[clang-tidy][NFC] Simply match processing in misc-use-anonymous-namespace
Carlos Galvez [Mon, 12 Dec 2022 13:36:29 +0000 (13:36 +0000)]
[clang-tidy][NFC] Simply match processing in misc-use-anonymous-namespace

No need for the templated function "processMatch", since
we can infer the type with llvm:isa.

22 months ago[include-cleaner] Include the reference type when printing the SymbolReference.
Haojian Wu [Mon, 12 Dec 2022 12:47:46 +0000 (13:47 +0100)]
[include-cleaner] Include the reference type when printing the SymbolReference.

This information is useful when printing the reference for debugging
purposes.

Differential Revision: https://reviews.llvm.org/D139835

22 months ago[Clang] Convert CXX tests to opaque pointers (NFC)
Nikita Popov [Mon, 12 Dec 2022 13:49:32 +0000 (14:49 +0100)]
[Clang] Convert CXX tests to opaque pointers (NFC)

22 months agoRevert "[Clang][NFC] Prevent lit tests from matching substrings in current path"
Nikita Popov [Mon, 12 Dec 2022 13:43:14 +0000 (14:43 +0100)]
Revert "[Clang][NFC] Prevent lit tests from matching substrings in current path"

This reverts commit bb48aa20e761e26226c6f909a07246781d68ba41.

Using placeholders inside CHECK-LABEL is not legal.

22 months ago[flang] Match alternative names for crtend in fastmath test
Tom Eccles [Mon, 12 Dec 2022 13:31:06 +0000 (13:31 +0000)]
[flang] Match alternative names for crtend in fastmath test

The fastmath test checks that crtfastmath.o is added between crtbeginS.o
and crtendS.o. On some systems, crtend is called crtend.o - match these
too.

Related to https://reviews.llvm.org/D138675

22 months ago[mlir][bufferize] Fix typo in EmptyTensorElimination
Matthias Springer [Mon, 12 Dec 2022 13:16:41 +0000 (14:16 +0100)]
[mlir][bufferize] Fix typo in EmptyTensorElimination

The structure of the code has changed a while ago and the code was not updated properly.

There is no test case for this because we do currently not have an op
that could trigger this bug.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D139838

22 months ago[mlir][bufferize] Implement BufferizableOpInterface for tensor.empty
Matthias Springer [Mon, 12 Dec 2022 13:16:28 +0000 (14:16 +0100)]
[mlir][bufferize] Implement BufferizableOpInterface for tensor.empty

The op is not bufferizable but should be analyzable (for `EliminateEmptyTensors`, which uses the bufferization infrastructure).

Also improve debugging functionality and error messages.

Also adds a missing pass to the sparse pipeline. (tensor.empty should be replaced with bufferization.alloc_tensor, but it sometimes used to work without depending on how the tensor.empty is used. Now we always fail explicitly.)

22 months ago[Alignment][NFC] Use Align in MCSymbol::setCommon
Guillaume Chatelet [Mon, 12 Dec 2022 09:44:12 +0000 (09:44 +0000)]
[Alignment][NFC] Use Align in MCSymbol::setCommon

This patch supersedes D138705.

Differential Revision: https://reviews.llvm.org/D139819

22 months ago[flang] Perform polymorphic pointer association with runtime call
Valentin Clement [Mon, 12 Dec 2022 13:04:17 +0000 (14:04 +0100)]
[flang] Perform polymorphic pointer association with runtime call

pointer association to a polymorphic pointer needs to potentially
update the element size in the descriptor. Update the pointer association
to polymoprhic pointer with a runtime call to PointerAssociate.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D139825

22 months ago[PowerPC][GISel] add the missing verify option - NFC
Chen Zheng [Mon, 12 Dec 2022 12:59:27 +0000 (12:59 +0000)]
[PowerPC][GISel] add the missing verify option - NFC

22 months ago[PowerPC][GISel] support 32 bit load/store
Chen Zheng [Sun, 9 Oct 2022 08:45:59 +0000 (08:45 +0000)]
[PowerPC][GISel] support 32 bit load/store

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D135535

22 months ago[mlir] make DiagnosedSilenceableError(LogicalResult) ctor private
Alex Zinenko [Wed, 2 Nov 2022 15:22:43 +0000 (15:22 +0000)]
[mlir] make DiagnosedSilenceableError(LogicalResult) ctor private

Now we have more convenient functions to construct silenceable errors
while emitting diagnostics, and the constructor is ambiguous as it
doesn't tell whether the logical error is silencebale or definite.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D137257

22 months ago[clangd] Fix a typo "Features.h" => "Feature.h" in IWYU pragma.
Haojian Wu [Mon, 12 Dec 2022 12:40:36 +0000 (13:40 +0100)]
[clangd] Fix a typo "Features.h" => "Feature.h" in IWYU pragma.

22 months ago[PowerPC][GISel] support 64 bit load/store
Chen Zheng [Sun, 9 Oct 2022 03:31:00 +0000 (03:31 +0000)]
[PowerPC][GISel] support 64 bit load/store

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D134792

22 months ago[Test] Regenerate checks in turn-to-invariant.ll
Max Kazantsev [Mon, 12 Dec 2022 12:16:09 +0000 (19:16 +0700)]
[Test] Regenerate checks in turn-to-invariant.ll

Due to changes in update script, it now has 'define' prefix in every check,
which is distracting.

22 months ago[clangd] Remove a gest-internal header, NFC
Haojian Wu [Mon, 12 Dec 2022 12:14:24 +0000 (13:14 +0100)]
[clangd] Remove a gest-internal header, NFC

gmock-more-matchers.h is a private header, we should use gmock.h which
is already included in the test.

22 months ago[llvm-exegesis][X86] Add memory pipe counters to SLM model
Simon Pilgrim [Mon, 12 Dec 2022 11:28:22 +0000 (11:28 +0000)]
[llvm-exegesis][X86] Add memory pipe counters to SLM model

There might not be any exposed alu pipe counters for us to measure - but the sum of load/store uop counters seems to give a really good approximation to memory controller usage - even for more complex instructions like cmpxchg

22 months ago[Test] Add some IndVars test with swapped true/false branches
Max Kazantsev [Mon, 12 Dec 2022 12:05:33 +0000 (19:05 +0700)]
[Test] Add some IndVars test with swapped true/false branches

Just to make sure our transforms work correctly with them.

22 months ago[mlir] Fix -Wstrict-prototypes warning
Tom Eccles [Mon, 5 Dec 2022 12:07:51 +0000 (12:07 +0000)]
[mlir] Fix -Wstrict-prototypes warning

These warnings prevent compilation using clang and
-DLLVM_ENABLE_WERROR=On.

Differential revision: https://reviews.llvm.org/D139322

22 months ago[NFC] Removal of complex deinterleaving i64 test cases
Nicholas Guy [Mon, 12 Dec 2022 12:02:00 +0000 (12:02 +0000)]
[NFC] Removal of complex deinterleaving i64 test cases

The tests in question are not particularly useful for testing complex
deinterleaving, especially due to i64 complex adds not being supported in mve.
The tests are being removed as they are hitting an unrelated pre-existing
condition regarding register spilling.

22 months ago[ARM][CodeGen] Add integer support for complex deinterleaving
Nicholas Guy [Thu, 8 Dec 2022 13:56:38 +0000 (13:56 +0000)]
[ARM][CodeGen] Add integer support for complex deinterleaving

Differential Revision: https://reviews.llvm.org/D139628

22 months ago[AArch64][SVE][Fixed length] Fix div miscompile
Peter Waller [Thu, 8 Dec 2022 11:09:20 +0000 (11:09 +0000)]
[AArch64][SVE][Fixed length] Fix div miscompile

The prior code worked before SVE DIV was enabled 128 bit vectors.
With 128 bit vectors, when run on a 256 bit machine, it would split and
do a signed unpack, but this resulted in one full vector and one empty
vector with a half-sized predicate. The effect was that only half the
elements were treated correctly.

The fix is to bisect the vector, sign extend, do the division, truncate
and then concat.

Fixes #59357.

Differential Revision: https://reviews.llvm.org/D139618

22 months ago[UpdateTestChecks] Match define for labels
Sebastian Neubauer [Mon, 12 Dec 2022 11:28:45 +0000 (12:28 +0100)]
[UpdateTestChecks] Match define for labels

Previously, the label also matched function calls with the function
name, which caused tests to fail because the label matched on the wrong
line.
Add the `define` prefix, so only function defines are matched.

Differential Revision: https://reviews.llvm.org/D139006

22 months ago[flang] match alternate names for crtbegin in fastmath test
Tom Eccles [Mon, 12 Dec 2022 11:28:21 +0000 (11:28 +0000)]
[flang] match alternate names for crtbegin in fastmath test

The fastmath test checks that crtfastmath.o is added between crtbeginS.o
and crtend.o. On some systems the first file is instead called
crtbegin.o - match these too.

Related to https://reviews.llvm.org/D138675

22 months ago[Clang][NFC] Prevent lit tests from matching substrings in current path
Sameer Sahasrabuddhe [Mon, 12 Dec 2022 11:01:43 +0000 (16:31 +0530)]
[Clang][NFC] Prevent lit tests from matching substrings in current path

22 months ago[IndVars][NFC] Separate creation of condition and replacement in foldExit
Max Kazantsev [Mon, 12 Dec 2022 10:48:42 +0000 (17:48 +0700)]
[IndVars][NFC] Separate creation of condition and replacement in foldExit

It is a preparatory step for further improvements.

22 months ago[sanitizers][windows] Correctly override functions with backward jmps
Markus Böck [Mon, 12 Dec 2022 10:45:31 +0000 (11:45 +0100)]
[sanitizers][windows] Correctly override functions with backward jmps

To reproduce: Download and run the latest Firefox ASAN build (https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.v2.mozilla-central.latest.firefox.win64-asan-opt/artifacts/public/build/target.zip) on Windows 11 (version 10.0.22621 Build 22621); it will crash on launch. Note that this doesn't seem to crash on another Windows 11 VM I've tried, so I'm not sure how reproducible it is across machines, but it reproduces on my machine every time.

The problem seems to be that when overriding the memset function in OverrideFunctionWithRedirectJump(), the relative_offset is stored as a uptr. Per the Intel x64 instruction set reference (https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf - warning: large PDF), on page 646 the jmp instruction (specifically the near jump flavors that start with E9, which are the ones the OverrideFunctionWithRedirectJump() considers) treats the offset as a signed displacement. This causes an incorrect value to be stored for REAL(memset) which points to uninitialized memory, and a crash the next time that gets called.

The fix is to simply treat that offset as signed. I have also added a test case.

Fixes https://github.com/llvm/llvm-project/issues/58846

Differential Revision: https://reviews.llvm.org/D137788

22 months agoFix mismatch in kate !bang operator list
Simon Pilgrim [Mon, 12 Dec 2022 10:42:51 +0000 (10:42 +0000)]
Fix mismatch in kate !bang operator list

Differential Revision: https://reviews.llvm.org/D139642

22 months agosanmd: improve precision of UAR analysis
Dmitry Vyukov [Sun, 11 Dec 2022 09:37:46 +0000 (10:37 +0100)]
sanmd: improve precision of UAR analysis

Only mark functions that have address-taken locals
as requiring UAR checking.

On a large internal app this reduces number of marked functions
from 78441 to 66618. Mostly small, trivial getter/setter-type
functions are unmarked, but also some amount of larger
number-crunching-type functions are unmarked as well.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D139811

22 months ago[IndVars][NFC] Separate invariant condition creation and cond replacement
Max Kazantsev [Mon, 12 Dec 2022 10:01:03 +0000 (17:01 +0700)]
[IndVars][NFC] Separate invariant condition creation and cond replacement

This separation is a preparatory step for further improvements in this code.
Also simplifies this function's API.

22 months ago[mlir][Transform] NFC - Return omitted loop construct in transform.tile_reduction_xxx ops
Nicolas Vasilache [Mon, 12 Dec 2022 10:13:54 +0000 (02:13 -0800)]
[mlir][Transform] NFC - Return omitted loop construct in transform.tile_reduction_xxx ops

22 months agoRevert "[AAPointerInfo] track multiple constant offsets for each use"
Sameer Sahasrabuddhe [Mon, 12 Dec 2022 08:20:52 +0000 (13:50 +0530)]
Revert "[AAPointerInfo] track multiple constant offsets for each use"

Assertion fired in openmp-offload-amdgpu-runtime:
https://lab.llvm.org/buildbot/#/builders/193/builds/23177

This reverts commit c2a0baad1fbb21fe111fef83ec93c2d7923b9b0c.

22 months ago[MLIR] Vectorize tensor.extract on n-D tensor (n >= 2)
Andrzej Warzynski [Wed, 19 Oct 2022 17:04:31 +0000 (17:04 +0000)]
[MLIR] Vectorize tensor.extract on n-D tensor (n >= 2)

This patch implements the vectorization of tensor.extract for arbitrary
tensors. It basically extends https://reviews.llvm.org/D133786 by adding
support for n-D tensors (n >= 2). This is implemented by essentially
flattening the indices.

When benchmarking the vectorized code, we have observed that it is
slower than the scalar code. That's most likely due to sub-optimal (and,
in general slow) gather loads. More work is needed to identify an
implementation and/or a representation that would lead to better code.
In the meantime, the vectorization of n-D tensors (where n >= 2) has to
be explicitly enabled. This can be done either via:
  * transfer dialect's `vectorize_nd_extract` attribute,
  * dedicated bool argument in the `vectorize` method from
    "Vectorization.cpp".
The second option was added to control the new functionality through
means other than the transfer dialect.

Related discussion: https://github.com/iree-org/iree/issues/9198

Differential Revision: https://reviews.llvm.org/D137660

22 months ago[IndVars][NFC] Remove redundant param in optimizeLoopExitWithUnknownExitCount
Max Kazantsev [Mon, 12 Dec 2022 08:21:33 +0000 (15:21 +0700)]
[IndVars][NFC] Remove redundant param in optimizeLoopExitWithUnknownExitCount

There was a crippled version of this transform for Inverted predicate, so the same
query was done twice. Advanced version of this transform wasn't implemented for
inverted condition. Thus, the code was hard to read. The only real purpose of the
Inverted param was to make a simple isKnownPredicateAt query.

Instead if this, use evaluatePredicateAt to solve the task for both inverted and
non-inverted predicate. This slightly changes the order of queries, but effectively
it should save some time by avoiding duplicating queries, and simplifies the code a lot.

I also could not find any evidence that we ever eliminate anything with Inverted = true,
but conservatively preserved the current behavior. Maybe we can remove it and save
some compile time.

Differential Revision: https://reviews.llvm.org/D139814
Reviewed By: nikic

22 months ago[Assignment Tracking][13/*] Account for assignment tracking in SROA
OCHyams [Mon, 12 Dec 2022 09:18:59 +0000 (09:18 +0000)]
[Assignment Tracking][13/*] Account for assignment tracking in SROA

The Assignment Tracking debug-info feature is outlined in this RFC:

https://discourse.llvm.org/t/
rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir

Split dbg.assign intrinsics into fragments similarly to what SROA already does
for dbg.declares, except that there's many more intrinsics to split. The
function migrateDebugInfo generates new dbg.assigns intrinsic for each part of
a split store.

Reviewed By: jmorse

Differential Revision: https://reviews.llvm.org/D133296

22 months agoFix 5bb06c7cce6bdcffb3ced29fa733c0dbb1b63c41 build on windows.
Andrew Browne [Mon, 12 Dec 2022 09:22:05 +0000 (01:22 -0800)]
Fix 5bb06c7cce6bdcffb3ced29fa733c0dbb1b63c41 build on windows.

```
C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\lib\Transforms\Instrumentation\DataFlowSanitizer.cpp(1062,37): error: call to constructor of 'llvm::APInt' is ambiguous
                                    llvm::APInt(32, dbgloc.getLine(), false));
                                    ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\include\llvm/ADT/APInt.h(108,3): note: candidate constructor
  APInt(unsigned numBits, uint64_t val, bool isSigned = false)
  ^
C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\include\llvm/ADT/APInt.h(134,3): note: candidate constructor
  APInt(unsigned numBits, unsigned numWords, const uint64_t bigVal[]);
  ^
1 error generated.
```

22 months ago[LoongArch] Test CodeGen/LoongArch/intrinsic-la32.c with -O2. NFC.
gonglingqin [Mon, 12 Dec 2022 09:13:52 +0000 (17:13 +0800)]
[LoongArch] Test CodeGen/LoongArch/intrinsic-la32.c with -O2. NFC.

To avoid excessive redundancy in test cases, use -O2 instead of -O0
for testing.

22 months ago[mlir] fixes to transform::SequenceOp
Alex Zinenko [Tue, 6 Dec 2022 14:17:33 +0000 (15:17 +0100)]
[mlir] fixes to transform::SequenceOp

Harden the verifier to check that the block argument type matches the
operand type, when present. This was overlooked when transform dialect
types were introduced.

Fix the builders to preserve the insertion point before creating the
block, otherwise the insertion point is updated to be within the block
by `createBlock` and never reset to be after the sequence op itself,
leading all following operations to be created in the unexpected to
the caller place.

Reviewed By: chelini, springerm

Differential Revision: https://reviews.llvm.org/D139427

22 months ago[ProfileData] llvm::Optional => std::optional
Fangrui Song [Mon, 12 Dec 2022 09:11:55 +0000 (09:11 +0000)]
[ProfileData] llvm::Optional => std::optional

22 months ago[include-cleaner] Add a unique_ptr-style member expr test in WalkASTTest.
Haojian Wu [Mon, 12 Dec 2022 08:52:06 +0000 (09:52 +0100)]
[include-cleaner] Add a unique_ptr-style member expr test in WalkASTTest.

This is a test I missed to mention in https://reviews.llvm.org/D139087.

Reviewed By: VitaNuo

Differential Revision: https://reviews.llvm.org/D139696