Commit Graph

459473 Commits

Author SHA1 Message Date
Nikita Popov
0fc19e222b [SCEV] Use SmallDenseMap in SCEVRewriteVisitor (NFC) 2023-04-28 15:19:33 +02:00
Qiongsi Wu
fae9d4df8f [AIX][llvm-ar] Use the Correct Kind for Bitcode File Inputs
On AIX, when the input files are LLVM bitcode files, `llvm-ar` should set the archive kind to `K_AIXBIG` as well, instead of leaving it to the default `K_GNU`.

Reviewed By: daltenty

Differential Revision: https://reviews.llvm.org/D149377
2023-04-28 09:14:10 -04:00
Daniel Kiss
d75e70d7ae [AArch64] Add preserve_all calling convention.
Clang accepts preserve_all for AArch64 while it is missing form the backed.

Fixes #58145

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D135652
2023-04-28 14:55:38 +02:00
David Green
5ff493df29 [ARM] Update and regenerate pred-selectop test. NFC
Shift and fdiv tests have been added to show the reverse transform.
2023-04-28 13:47:14 +01:00
Nikita Popov
3ddd1ffb72 [SCEV] Don't invalidate past dependency-breaking instructions
When invalidating a value, we walk all users of that value and
invalidate them as well. This can be very expensive for large use
graphs.

However, we only need to invalidate a user U of instruction I if
SCEV(U) can depend on SCEV(I). This is not the case if U is an
instruction that always produces a SCEVUnknown, such as a load.
If the load pointer operand is invalidated, there is no need to
invalidate the load result, which is completely unrelated from a
SCEV perspective.

Differential Revision: https://reviews.llvm.org/D149323
2023-04-28 14:42:08 +02:00
Nikita Popov
0659000ff7 [LICM] Don't duplicate instructions just because they're free
D37076 makes LICM duplicate instructions into exit blocks if the
instruction is free. For GEPs, the motivation appears to be that
this allows the GEP to be folded into addressing modes, while
non-foldable users outside the loop might prevent this. TBH I don't
think LICM is the place to do this (why doesn't CGP apply this
heuristic itself?) but at least I understand the motivation.

However, the transform is also applied to all other "free"
instructions, which are just that (removed during lowering and not
"folded" in some way). For such instructions, this transform seems
somewhere between useless, counter-productive (undoing CSE/GVN) and
actively incorrect. For example, this transform can duplicate freeze
instructions, which is illegal.

This patch limits the transform to just foldable GEPs, though we
might want to drop it from LICM entirely as a followup.

This is a small compile-time improvement, because querying TTI cost
model for every single instruction is expensive.

Differential Revision: https://reviews.llvm.org/D149136
2023-04-28 14:31:23 +02:00
Yi Kong
78d8d01649 Revert "[BOLT] Parallelize legacy profile merging"
This reverts commit 35af20d9e0.

The patch caused a test failure.
2023-04-28 21:24:52 +09:00
Christian Ulmann
4030fff06a [PGO] Fix expensive test compilation error
This commit fixes a compilation error introduced in
https://reviews.llvm.org/D149361

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D149434
2023-04-28 12:17:01 +00:00
Mel Chen
de01dba7f2 [LV] Add tests for integer min max with index reduction pattern. (NFC)
The test case for signed max with index, include strict and non-strict
max.

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D146718
2023-04-28 05:13:23 -07:00
Florian Hahn
2c9d21a2a3
[VPlan] Turn Plan entry node into VPBasicBlock (NFCI).
The entry to the plan is the preheader of the vector loop and
guaranteed to be a VPBasicBlock. Make sure this is the case by
adjusting the type.

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D149005
2023-04-28 12:29:06 +01:00
Mariya Podchishchaeva
0fb84bc7fd [clang] Diagnose shadowing of lambda's template parameter by a capture
expr.prim.lambda.capture p5 says:
If an identifier in a capture appears as the declarator-id of a parameter of
the lambda-declarator's parameter-declaration-clause or as the name of a
template parameter of the lambda-expression's template-parameter-list,
the program is ill-formed.
and also has the following example:
```
auto h = [y = 0]<typename y>(y) { return 0; };
```
which now results in
```
error: declaration of 'y' shadows template parameter
  auto l1 = [y = 0]<typename y>(y) { return 0; };
             ^
note: template parameter is declared here
  auto l1 = [y = 0]<typename y>(y) { return 0; };
                             ^
```

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

Reviewed By: shafik, cor3ntin

Differential Revision: https://reviews.llvm.org/D148712
2023-04-28 07:26:30 -04:00
Bjorn Pettersson
cf59f649ff Re-apply "[Passes] Remove legacy PM versions of InstructionNamer and MetaRenamer"
A new attempt after removing uses of -instnamer in polly lit tests
in D148530.
2023-04-28 13:18:45 +02:00
Bjorn Pettersson
047a41446d [polly] Drop redundant use of -instnamer in polly MemAccess lit tests
Differential Revision: https://reviews.llvm.org/D148530
2023-04-28 13:18:45 +02:00
Luke Lau
32dbe0f5c0 [RISCV] Fix labels in fixed-vectors-fp test 2023-04-28 12:01:46 +01:00
Pierre Gousseau
ea7d6e658e Reland D147337 "[tsan] Add debugging interfaces into interface header."
This change the types to match the ones used in:
Darwin/debug_external.cpp
debugging.cpp

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D148214
2023-04-28 10:57:12 +00:00
Max Kazantsev
d5f1adcf66 [TEST][LICM] Add test cases on widenable condition hoisting opportunity
Patch by Aleksandr Popov!

Differential Revision: https://reviews.llvm.org/D149373
2023-04-28 17:53:39 +07:00
OCHyams
8dec295af0 Reapply D146987 "[Assignment Tracking] Enable by default"
See https://discourse.llvm.org/t/rfc-enable-assignment-tracking/69399

This sets the -Xclang -fexperimental-assignment-tracking flag to the value
enabled which means it will be enabled so long as none of the following are
true: it's an LTO build, LLDB debugger tuning has been specified, or it's an O0
build (no work is done in any case if -g is not specified or -gmlt is used).

This reverts commit 0ba922f600 which reverts
https://reviews.llvm.org/D146987
2023-04-28 11:34:53 +01:00
Animesh Kumar
578b2a36b6 [OpenMP] Add LIT test on task depend clause
The working of depend clause with iterator modifier
can be correctly tested by means of execution tests
and not at the LLVM IR level. These tests
are imported/inspired from the SOLLVE tests.

SOLLVE repo: https://github.com/SOLLVE/sollve_vv

Differential Revision: https://reviews.llvm.org/D146706
2023-04-28 15:53:41 +05:30
Lawrence Benson
cd68e17bc2 [AArch64] Add support for efficient bitcast in vector truncate store.
Following the changes in D145301, we now also support the efficient bitcast
when storing the bool vector. Previously, this was expanded.

Differential Revision: https://reviews.llvm.org/D148316
2023-04-28 11:19:45 +01:00
Ulrich Weigand
84539a2463 Revert "[LLD][ELF] Fix compressed-debug-level test on SystemZ"
This reverts commit f2404d589e,
which causes failures on Windows.
2023-04-28 12:19:17 +02:00
Nikita Popov
0aed0dbec2 [LCSSA] Don't invalidate entire loop in SCEV
We already invalidate each individual instruction for which LCSSA
is formed in formLCSSAForInstructions(), so I don't see a reason
why we would need to invalidate the entire loop on top of that.

I believe we also no longer need the instruction-level invalidation
now that SCEV looks through LCSSA phis, but I'll leave that for a
separate patch, as it's less obvious.

Differential Revision: https://reviews.llvm.org/D149331
2023-04-28 12:17:26 +02:00
ManuelJBrito
575fdea70a [LangRef] Update shufflevector's semantics to return poison if the mask is undef
This patch changes the shufflevector's semantics to yield poison if the mask is undefined.
This allows the extraction of shufflevectors while also opening the door for more
optimization opportunities due to the fact that poison is more undefined than undef.

Differential Revision: https://reviews.llvm.org/D148637
2023-04-28 10:52:00 +01:00
Florian Hahn
07e5f57df4
[LV] Add tests for #60831.
Also contains an extra test mentioned in D144434.
2023-04-28 10:42:01 +01:00
Alexis Engelke
ab21beaccc [AArch64][FastISel] Handle CRC32 intrinsics
With a similar reason as D148023; some applications make heavy use of
the CRC32 intrinsic (e.g., as part of a hash function) and therefore
benefit from avoiding frequent SelectionDAG fallbacks. In our
application, we get a 2% compile-time improvement.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D148917
2023-04-28 11:29:23 +02:00
Luke Lau
8ead003d89 [VP] Add more functional SD opcodes to definitions
This defines more equivalent base SD opcodes for various VP nodes, so
that getVPForBaseOpcode can do more lookups of VP-equivalent operations.

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D148520
2023-04-28 10:19:12 +01:00
Luke Lau
bd6fa8656a [RISCV] Add tests for illegal fixed length vectors that need widened
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D148518
2023-04-28 10:19:01 +01:00
Jay Foad
31ec0a6845 [SimplifyCFG] Improve the way hoisting skips over non-matching instructions
D129370 introduced the idea that hoisting could skip over non-matching
instructions and continue to look for matching (hoistable) instructions,
but certain types of mismatch still aborted the whole hoisting attempt.

Fix this by splitting out some of the instruction matching checks into a
helper function.

Also forbid hoisting allocas past stacksave/stackrestore, completing the
fix started in D133730, to avoid regressing tests.

Differential Revision: https://reviews.llvm.org/D149365
2023-04-28 10:03:32 +01:00
Nikita Popov
103fc0f629 [SCEV] Replace IsAvailableOnEntry with block disposition
As far as I understand, the IsAvailableOnEntry() function basically
implements the same functionality as the properlyDominates() block
disposition. The primary difference (apart from a weaker
implementation) seems to be in this comment at the top:

    // Checks if the SCEV S is available at BB.  S is considered available at BB
    // if S can be materialized at BB without introducing a fault.

However, I don't really understand why there would be such a
requirement. It's my understanding that SCEV explicitly does not
care about trapping udiv instructions itself, and it's the job of
SCEVExpander's isSafeToExpand() to make sure these don't get
expanded if they may trap.

Differential Revision: https://reviews.llvm.org/D149344
2023-04-28 11:02:03 +02:00
Enna1
d961f66b28 [hwasan] fix false positive when hwasan-match-all-tag flag is enabled and short granules are used
When hwasan-match-all-tag flag is enabled and short granules are used, at the point checking if this is a short tag case, the tag from pointer is stored in X16 register,
which breaks the assumption that tag from shadow memory is stored in X16 register, this will cause a false positive.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D149252
2023-04-28 17:00:26 +08:00
Enna1
9baa85271d [hwasan][test] add test for hwasan-check-memaccess when hwasan-match-all-tag flag and short granules both used
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D149399
2023-04-28 16:57:31 +08:00
Andrzej Warzynski
e5d98c15cb Revert "[flang][driver] Allow main program to be in an archive"
This reverts commit 876df74dd4.

My understanding (based on https://reviews.llvm.org/D149429) is that
this patch has caused all of Flang's buildbots to fail. I'm not really
able to verify 100% as the buildbot UI is incredibly slow ATM. I am
reverting either way so that we can discuss the right solution offline.
2023-04-28 09:39:27 +01:00
OCHyams
9391177cbc [Assignment Tracking] Check getTypeSizeInBits result for scalable vector types
Without this patch, in `getAssignmentInfo` the result of `getTypeSizeInBits` is
cast to `uint64_t`, which a) is an operation that will eventually be
unsupported by the API according to the comments, and b) causes an assertion
failure if the type is a scalable vector. Don't cast the `TypeSize` to
`uint64_t` and check `isScalable` before getting the fixed size.

This can result in incorrect variable locations, see llvm.org/PR62346 (but is
better than crashing).

Reviewed By: paulwalker-arm

Differential Revision: https://reviews.llvm.org/D149137
2023-04-28 09:10:38 +01:00
Fangrui Song
e416515115 MC: Use parseEOL
The diagnostics have changed from "unexpected token" to clearer "expected newline"
2023-04-28 00:52:33 -07:00
Vitaly Buka
fc75c272f6 [NFC][HWASAN] Use named const instead of 0xf 2023-04-28 00:44:55 -07:00
Fangrui Song
eb7bff4fe7 RISCVAsmParser: Simplify with parseToken. NFC 2023-04-28 00:41:59 -07:00
Vitaly Buka
ab1094f0da [NFC][HWASAN] Remove unnecessary untag
Looks like HWASAN_ALIASING_MODE work around.
But any tagged pointer should be mapped, so load
should work.
2023-04-28 00:40:52 -07:00
Wang, Xin10
9c1e4ee690 [NFC]Fix 2 logic dead code
First, in CodeGenPrepare.cpp, line 6891, the VectorCond will always be false
because if not function will return at 6888.
Second, in SelectionDAGBuilder.cpp, line 5443, getSExtValue() will return
value as int type, but now we use unsigned Val to maintain it, which make the
if condition at 5452 meaningless.

Reviewed By: skan

Differential Revision: https://reviews.llvm.org/D149033
2023-04-28 03:02:59 -04:00
Noah Goldstein
4cd1b67491 [ValueTracking] Add logic for fshl/fshr(A, B, C) != 0 if A == B && A ! = 0
Having `A == B` is quite common for rotate patterns.

Alive2 Links:
    - https://alive2.llvm.org/ce/z/mPXi9c
    - https://alive2.llvm.org/ce/z/UfDHoI

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D149372
2023-04-28 01:57:37 -05:00
Noah Goldstein
74157bf6e2 [ValueTracking] Add tests for proving fshr/fshl is non-zero; NFC
Differential Revision: https://reviews.llvm.org/D149371
2023-04-28 01:57:31 -05:00
Jacob Hegna
587f4d2efc [MLGO] Replace explicit shape with initializer list. 2023-04-28 06:21:46 +00:00
Vedant Paranjape
cf9b3e55a2 [IVDescriptors] Add assert to isInductionPhi to check for invalid Phis
Phis that are present inside loop headers can only be Induction Phis
legally. This patch adds an assertion to isInductionPhi which checks for
the said legality and it also updates the docs of the said function to
reflect the given legality.

Differential Revision: https://reviews.llvm.org/D149041
2023-04-28 04:41:47 +00:00
Valentin Clement
03ad9d1be3
[flang][openacc] Generate acc.bound op when local array is passed without subscript
Add support to generate the acc.bound operation when the array is passed without
any subscripts. Without this patch, no bound is generated.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D149297
2023-04-27 21:03:52 -07:00
Ben Shi
229fcad7fc [lld][ELF] Support relocations R_AVR_LO8_LDI_GS/R_AVR_HI8_LDI_GS
Relocations R_AVR_LO8_LDI_GS/R_AVR_HI8_LDI_GS (indirect calls
via function pointers) only cover range 128KiB. They are
equivalent to R_AVR_LO8_LDI_PM/R_AVR_HI8_LDI_PM within this
range.

But for function addresses beyond this range, GNU-ld emits
trampolines. And this patch implements corresponding thunks
for them in lld.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D147364
2023-04-28 11:42:06 +08:00
Thurston Dang
81d06268f4 [hwasan] Fix -Wunneeded-internal-declaration by declaring static inline
https://reviews.llvm.org/D149386 caused a buildbot error (https://lab.llvm.org/buildbot#builders/37/builds/21766):

'In file included from /b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/lib/hwasan/hwasan_interceptors.cpp:18:
/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/lib/hwasan/hwasan_checks.h:128:53: error: 'static' function 'PossiblyShortTagMatches' declared in header file should be declared 'static inline' [-Werror,-Wunneeded-internal-declaration]
__attribute__((always_inline, nodebug)) static bool PossiblyShortTagMatches('

This patch simply adds the inline annotation.

Differential Revision: https://reviews.llvm.org/D149402
2023-04-28 03:34:44 +00:00
Matthias Springer
77124386fe [mlir][tensor] Add transform to make tensor.pad loop-independent
Add a transform to make `tensor.pad` and `tensor.empty` ops independent of SCF loop IVs. Such ops can then be hoisted.

E.g.:
```
scf.for %iv = %lb to %ub step %step {
  %high = affine.apply affine_map<(d0)[s0] -> (s0 - d0)> (%i)[%ub]
  %p = tensor.pad %t low[5] high[%high] ...
  ...
}
```
Is transformed to:
```
%high_new = affine.apply affine_map<()[s0, s1] -> (-s0 + s1)> ()[%lb, %ub]
%p_hoistable = tensor.pad %t low[5] high[%high_new]
%dim = tensor.dim %t, %c0
%size = affine.apply affine_map<(d0)[s0, s1] -> (-d0 + s0 + s1 + 5)>(%iv)[%ub, %dim]
%slice = tensor.extract_slice %p_hoistable [0] [%size] [1]
```

Differential Revision: https://reviews.llvm.org/D143910
2023-04-28 11:46:32 +09:00
Jordan Rupprecht
fbf42f1fe2 Revert "[CodeGenPrepare] Estimate liveness of loop invariants when checking for address folding profitability"
This reverts commit 5344d8e10b.

It causes non-determinism when building clang. See the review thread on D143897.
2023-04-27 19:16:32 -07:00
Shao-Ce SUN
876df74dd4 [flang][driver] Allow main program to be in an archive
Add --undefined=_QQmain to the link line, so that a Fortran main program
will be included in the link job even if it is in an archive (unless we
are building a shared object). For now, this is only applied to the Gnu
toolchain.

We also add a section on the linker invocation to docs/FlangDriver.md.

The new tests require llvm-ar to construct an archive we can include in
the link job. This is a new dependency for flang/test (which already
depends on similar tools such as llvm-objdump).

See discussions in
https://github.com/llvm/llvm-project/issues/54787
which this patch fixes.

Reviewed By: awarzynski

Differential Revision: https://reviews.llvm.org/D134821
2023-04-28 09:53:25 +08:00
Joseph Huber
443d71527b [libc] Implement exit for the GPU partially
This patch implements the `exit` function on the GPU. This required
breaking the entrypoints calling eachother on `linux` since this doesn't
work with a non-aliased target. This is only partial support because
full support requires a malloc / free implementation for the exit
callbacks array.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D149363
2023-04-27 20:32:00 -05:00
Joseph Huber
f7d5e9bc4c [libc] Support the abs functions in the GPU libc.
This patch simply enables building the integer `abs` functions for the
GPU.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D149317
2023-04-27 20:31:59 -05:00
Joseph Huber
72bfe2c05a [libc] Support the string conversion methods on the GPU
This patch enables us to use the existing `libc` support for string
conversion functions on the GPU. This required setting the `fenv_t` and
long double configuration. As far as I am aware, long doubles are
converted to doubles on the GPU and the floating point environment is
just an `uint32_t`.

This code is still untested as we are still working out how to run the
unit tests on the GPU.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D149306
2023-04-27 20:31:58 -05:00