Commit Graph

436209 Commits

Author SHA1 Message Date
Kazu Hirata f55ed88936 [mlir] Use x.empty() instead of llvm::empty(x) (NFC)
I'm planning to deprecate and eventually remove llvm::empty.

Note that no use of llvm::empty requires the ability of llvm::empty to
determine the emptiness from begin/end only.
2022-09-18 10:53:49 -07:00
Kazu Hirata 3e720fa9dc Use std::decay_t (NFC) 2022-09-18 10:25:08 -07:00
Kazu Hirata 5e5a6c5b07 Use std::conditional_t (NFC) 2022-09-18 10:25:06 -07:00
Kazu Hirata 919b638eff [ADT] Use std::common_type_t (NFC) 2022-09-18 10:25:04 -07:00
Marc Auberer f52dd920d4 [InstCombine] Fix bug when folding x + (x | -x) to x & (x - 1)
Addresses concern: https://reviews.llvm.org/rG09cdddea0c4d284c2c22f5dfade40a60850c5ea7

There was a copy/paste mistake in the code. Updated code and test ref.

Differential Revision: https://reviews.llvm.org/D134135
2022-09-18 13:16:12 -04:00
Sanjay Patel 1d1d1e6f22 [InstCombine] fold full-shift of sdiv to icmp+extend
This is a disguised sign-bit test with offset:
(X / +DivC) >> (Width - 1) --> ext (X <= -DivC)
(X / -DivC) >> (Width - 1) --> ext (X >= +DivC)

https://alive2.llvm.org/ce/z/cO8JO4

We don't match/test poison in the sdiv constant because
that would be immediate undefined behavior.
2022-09-18 13:13:14 -04:00
Sanjay Patel 0ae6bc0771 [InstCombine] add tests for full-right-shift of sdiv; NFC 2022-09-18 13:13:14 -04:00
Aaron Puchert 1a14436c35 Make sure libLLVM users link with libatomic if needed
64-bit atomics are used in llvm/ADT/Statistic.h, which means that users
of libLLVM.so might also have to link with libatomic. To avoid having
to special-case the library here, we simply add all `LLVM_SYSTEM_LIBS`
as public link dependencies to libLLVM.

This fixes a build failure on PowerPC 32-bit.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D132799
2022-09-18 19:11:57 +02:00
Kazu Hirata d3b95ecc98 [ModuleInliner] Remove InlineOrder::front (NFC)
InlineOrder::front is a remnant from the era when we had a nested
"while" loops in the module inliner, with the inner one grouping the
call sites with the same caller.

Now that we have a simple "while" loop draining the priority queue, we
can just use InlineOrder::pop.

Differential Revision: https://reviews.llvm.org/D134121
2022-09-18 08:49:44 -07:00
Phoebe Wang 2f8a4acf1a [Clang][NFC] update predicate and reduce redundant check 2022-09-18 21:56:31 +08:00
Simon Pilgrim 47cfe71027 [DAG] MatchRotate - reuse existing LHSShiftArg/RHSShiftArg variables. NFC. 2022-09-18 14:35:10 +01:00
Jun Zhang 303526ef3a
[Docs] Add a link that refers to C++ standard modules in Clang modules doc
Currently there're two pages that both talk about "Modules" in clang, but
they're different. The one that describes C++ standard modules explicitly
spells out the difference but the other one which targeting Clang modules
doesn't.

This patch adds a link that refers to the C++ standard modules
one in Clang modules doc, as you usually got the later page when
googling. I believe this will make newcomers less confused.

Signed-off-by: Jun Zhang <jun@junz.org>

Differential Revision: https://reviews.llvm.org/D134105
2022-09-18 18:31:49 +08:00
Phoebe Wang 490de4ab47 [Clang][NFC] update obsolete check predicate 2022-09-18 18:00:36 +08:00
Nikolas Klauser 7afa1598a3 [libc++] Avoid including <tuple> in compressed_pair.h
compressed_pair is widely used in the library, but most of the uses don't use the tuple parts. To avoid including <tuple> everywhere, use the forward declaration instead in compressed_pair.h

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D133331
2022-09-18 10:49:35 +02:00
Chuanqi Xu 762962174e [Modules] Don't judge if we're compiling a module unit by LangOpts::CurrentModule.empty()
Closing https://github.com/llvm/llvm-project/issues/57778.

Previously it judge if we're compiling a module unit by
LangOpts::CurrentModule.empty(). But it is not true since we can specify
the module name by `-fmodule-name` option for arbitrary module unit.
Then this patch adjuest the judgement properly.
2022-09-18 16:43:30 +08:00
Benjamin Kramer b987fe4972 Silence unused variable warning in release builds. NFC 2022-09-18 09:15:32 +02:00
Shivam Gupta 4667821151 [NFC] Typo fix in ARCMTActions.h 2022-09-18 12:34:24 +05:30
Kazu Hirata 284f0397e2 [Transforms] Merge function attributes within InlineFunction (NFC)
In the past, we've had a bug resulting in a compiler crash after
forgetting to merge function attributes (D105729).

This patch teaches InlineFunction to merge function attributes.  This
way, we minimize the "time" when the IR is valid, but the function
attributes are not.

Differential Revision: https://reviews.llvm.org/D134117
2022-09-17 23:10:23 -07:00
Kazu Hirata cf355bf36e [Analysis] Introduce isSoleCallToLocalFunction (NFC)
We check to see if a given CallBase is a sole call to a local function
at multiple places in InlineCost.cpp.  This patch factors out the
common code.

Differential Revision: https://reviews.llvm.org/D134114
2022-09-17 20:59:54 -07:00
Yaxun (Sam) Liu 97b5736975 [SimplifyCFG] add a test for branch folding multiple BB
Reviewed by: Florian Hahn

Differential Revision: https://reviews.llvm.org/D132910
2022-09-17 21:17:55 -04:00
Kai Nacke ae35188f97 [GISel] Fix match tree emitter.
The following changes are necessasy to get the generated tree
matcher to compile:

- In CodeExpansions::declare(), the assert() prevents connecting
  two instructions. E.g. the match code
    (match (MUL $t, $s1, $s2),
           (SUB $d, $t, $s3)),
  results in two declarations of $t, one for the def and one for
  the use. Removing the assertion allows this construct.
  If $t is later used, it is one of the operands, which should be
  perfectly fine.
- The code emitted in GIMatchTreeVRegDefPartitioner::generatePartitionSelectorCode()
  is not compilable:
  - The value of NewInstrID should be emitted, not the name
  - Both calls involving getOperand() end with one parenthesis too many
- Swaps generated condition for the partition code in the latter function

It also changes the rules i2p_to_p2i, fabs_fabs_fold, and fneg_fneg_fold
to use the tree matcher for a linear match. These rules are tested by:

CodeGen/AArch64/GlobalISel/combine-fabs.mir
CodeGen/AArch64/GlobalISel/combine-fneg.mir
CodeGen/AArch64/GlobalISel/combine-ptrtoint.mir
CodeGen/AMDGPU/GlobalISel/combine-add-nullptr.mir

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D133257
2022-09-18 00:00:15 +00:00
Kazu Hirata 6e4fbd2f51 [ModuleInliner] Set Changed earlier (NFC)
It makes more sense to set Changed to true immediately after a
successful inlining.
2022-09-17 14:16:32 -07:00
isuckatcs 6931d311ea [analyzer] Cleanup some artifacts from non-POD array evaluation
Most of the state traits used for non-POD array evaluation were
only cleaned up if the ctors/dtors were inlined, since the cleanup
happened in ExprEngine::processCallExit(). This patch makes sure
they are removed even if said functions are not inlined.

Differential Revision: https://reviews.llvm.org/D133643
2022-09-17 22:46:27 +02:00
Kazu Hirata 0a706be316 [mlir] Don't include SetVector.h (NFC) 2022-09-17 13:36:16 -07:00
Kazu Hirata f46245c3e9 [lld] Don't include SetVector.h (NFC) 2022-09-17 13:36:15 -07:00
Kazu Hirata 8009d236e5 [clang] Don't include SetVector.h (NFC) 2022-09-17 13:36:13 -07:00
LLVM GN Syncbot 51b6dece1e [gn build] Port e5e3dccd07 2022-09-17 19:55:35 +00:00
Aiden Grossman e5e3dccd07 [mlgo] Add in-development instruction based features for regalloc advisor
This patch adds in instruction based features to the regalloc advisor
gated behind a flag so a user can decide at runtime whether or not they
want to enable the feature. The features are only enabled when LLVM is
compiled in MLGO develpment mode (LLVM_HAVE_TF_API) is set to true.

To extract the instruction features, I'm taking a list of segments from
each LiveInterval and noting the start and end SlotIndices. This list is then
sorted based on the start SlotIndex and I iterate through each SlotIndex
to grab instructions, making sure to check for overlaps. This results in
a vector of opcodes and binary mapping matrix that maps live ranges to the
opcodes of the instructions within that LR.

Reviewed By: mtrofin

Differential Revision: https://reviews.llvm.org/D131930
2022-09-17 19:54:45 +00:00
Kazu Hirata 20d764aff0 [llvm] Don't including SetVector.h (NFC)
llvm/lib/ProfileData/RawMemProfReader.cpp uses SetVector without
including SetVector.h, so this patch adds an appropriate #include
there.
2022-09-17 12:36:43 -07:00
Fangrui Song 367997d0d6 [Support] Rename llvm::compression::{zlib,zstd}::uncompress to more appropriate decompress
This improves consistency with other places (e.g. llvm::compression::decompress,
llvm::object::Decompressor::decompress, llvm-objcopy).
Note: when zstd::uncompress was added, we noticed that the API `ZSTD_decompress`
is fine while the zlib API `uncompress` is a misnomer.
2022-09-17 12:35:17 -07:00
Kazu Hirata 31b91356bc [ModuleInliner] Don't include SetVector.h (NFC)
We don't use SetVector in the module inliner.
2022-09-17 12:17:52 -07:00
Kazu Hirata 6170437df5 [ModuleInliner] Remove unnecessary #includes (NFC)
While I am at it, this patch removes an unnecessary forward
declaration.
2022-09-17 12:05:35 -07:00
Kazu Hirata 5faf4bf195 [ModuleInliner] Move UseInlinePriority to InlineOrder.cpp (NFC)
UseInlinePriority specifies the priority function.  This patch
simplifies the code by moving UseInlinePriority closer to the actual
consumer -- the switch statement inside getInlineOrder.

Differential Revision: https://reviews.llvm.org/D134100
2022-09-17 11:41:28 -07:00
Sander de Smalen bed214cf0f [AArch64][SME] Add intrinsics for enabling/disabling ZA.
This adds the intrinsics:
* void @llvm.aarch64.sme.za.enable() -> smstart za
* void @llvm.aarch64.sme.za.disable()  -> smstop za

Reviewed By: aemerson

Differential Revision: https://reviews.llvm.org/D133894
2022-09-17 16:41:42 +00:00
Sander de Smalen 5fae000f36 [AArch64][SME] Disable tail-call optimization when streaming mode change or lazy-save may be required.
When a streaming mode change is (or may be) required for a call, it will
need to restore the original mode after the call, which prevents the use of
tail-call optimization. The same holds true for a call that requires the lazy-save
mechanism to be set up before the call, and possibly restored after.

More details about the SME attributes and design can be found
in D131562.

Reviewed By: aemerson

Differential Revision: https://reviews.llvm.org/D131579
2022-09-17 16:15:07 +00:00
Nikolas Klauser 87abc5013a [libc++][NFC] Inline the string constructors
This removes a lot of boilerplate code.

Reviewed By: ldionne, #libc

Spies: EricWF, libcxx-commits

Differential Revision: https://reviews.llvm.org/D128081
2022-09-17 18:00:11 +02:00
Evgeny Shulgin 510383626f [Clang] Support label at end of compound statement
Implements paper P2324R2
https://wg21.link/p2324r2
https://github.com/cplusplus/papers/issues/1006

Reviewed By: cor3ntin

Differential Revision: https://reviews.llvm.org/D133887
2022-09-17 15:34:56 +00:00
Dmitry Polukhin 133b6d7db9 [clang][C++20] Fix clang/clangd assert/crash after compilation errors
After compilation errors, expression a transformation result may not be usable.
It triggers an assert in RemoveNestedImmediateInvocation and SIGSEGV in case of
builds without asserts. This issue significantly affects clangd because source
may not be valid during typing. Tests cases that I attached was reduce from huge
C++ translation unit.

Test Plan: check-clang

Differential Revision: https://reviews.llvm.org/D133948
2022-09-17 07:37:19 -07:00
Florian Hahn 7914e53e31
[ConstraintElimination] Fix crash when combining results.
f213128b29 didn't account for the possibility that the result of
decompose may be empty. Fix that by explicitly checking. Use a newly
introduced helper to also reduce some duplication.

Thanks @bjope for finding the issue!
2022-09-17 14:47:38 +01:00
Shivam Gupta 78533528cf [NFC] Fix a comment in InitializePasses.h 2022-09-17 19:09:26 +05:30
Aaron Ballman 7772624f3b Add code examples to the potentially breaking changes
It may help users to better understand the change by showing them a
contrived code example which demonstrates the difference in behavior.
2022-09-17 08:44:13 -04:00
Nikolas Klauser d3a0ac92e9 [libc++] Add test to ensure that type trait aliases in dependent return types can be mangled
Reviewed By: ldionne, #libc

Spies: libcxx-commits, jeroen.dobbelaere

Differential Revision: https://reviews.llvm.org/D133196
2022-09-17 14:25:09 +02:00
Aaron Ballman aa9a656b03 Fix release note formatting and style; NFC
Uses double backticks where appropriate, changes some instances of
GH12345 to be Issue 12345, etc.
2022-09-17 08:21:33 -04:00
Aaron Ballman 1b2efe8d87 Fix this test to be more robust
The test is failing because it lacks a target triple, so the number of
diagnostics differs between Windows and Linux targets.

This should correct the issue found by:
https://lab.llvm.org/buildbot/#/builders/109/builds/46804
2022-09-17 08:06:16 -04:00
Aaron Ballman 5d92d0b0f8 Correctly diagnose use of long long literals w/o a suffix
We would diagnose use of `long long` as an extension in C89 and C++98
modes when the user spelled the type `long long` or used the `LL`
literal suffix, but failed to diagnose when the literal had no suffix
but required a `long long` to represent the value.
2022-09-17 07:55:10 -04:00
Christian Sigg a6e91040ea [Bazel] Allow lit_test() macro to be used from other repos.
Wrap implicit dependencies in Label() so that they refer to @llvm-project, see https://bazel.build/rules/lib/Label#Label.

This change allows lit_test() to be used from other bazel repositories.
2022-09-17 11:06:07 +02:00
Filipp Zhinkin fa67e281b2 [ARM] Add more tests on instructions fusion with comparison with zero; NFC
Baseline tests for D131786
2022-09-17 11:49:58 +03:00
Daniel Bertalan 3493f1a107
[lld-macho] Simplify base address calculation for init offsets (NFC) 2022-09-17 10:23:05 +02:00
Xiang Li 8b2f8b3098 [NFC} update CodeGenHLSL tests to use cc1 instead of driver-mode 2022-09-17 00:11:44 -07:00
Alex Zinenko 83df43f3a2 [mlir] use strided layouts in vector transfer on memrefs
One of the vector transformation patterns has been indiscriminately
converting layouts to affine maps. Leverage the strided form when
possible.

Reviewed By: nicolasvasilache, dcaballe

Differential Revision: https://reviews.llvm.org/D134047
2022-09-17 08:11:30 +02:00