Commit Graph

424942 Commits

Author SHA1 Message Date
Damian Rouson d1440ccaa5 [flang] expand the this_image test coverage
Add a test with a range of this_image() intrinsic function
invocations, including a comprehensive set of standard-conforming
keyword and non-keyword arguments with and without optional
arguments present and with argument positions covering all
possible orderings.  Also test that several non-conforming
this_image() invocations generate the correct error messages.

Differential Revision: https://reviews.llvm.org/D123331
2022-05-26 16:36:20 -07:00
Rahman Lavaee 4d8d2580c5 [Propeller] Promote functions with propeller profiles to .text.hot.
Today, text section prefixes (none, .unlikely, .hot, and .unkown) are determined based on PGO profile. However, Propeller may deem a function hot when PGO doesn't. Besides, when `-Wl,-keep-text-section-prefix=true` Propeller cannot enforce a global section ordering as the linker can only reorder sections within each output section (.text, .text.hot, .text.unlikely).

This patch promotes all functions with Propeller profiles (functions listed in the basic-block-sections profile) to .text.hot. The feature is hidden behind the flag `--bbsections-guided-section-prefix` which defaults to `true`.

The new implementation refactors the parsing of basic block sections profile into a new `BasicBlockSectionsProfileReader` analysis pass. This allows us to use the information earlier in `CodeGenPrepare` in order to set the functions text prefix. `BasicBlockSectionsProfileReader` will be used both by `BasicBlockSections` pass and `CodeGenPrepare`.

Differential Revision: https://reviews.llvm.org/D122930
2022-05-26 16:23:21 -07:00
Arthur Eubanks 36096c2b38 [NFC][JumpThreading] Remove InsertFreezeWhenUnfoldingSelect pass parameter
All callers pass true.

select-unfold-freeze.ll is now a subset of select.ll so delete it.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D126501
2022-05-26 16:13:34 -07:00
Philip Reames 8a3b6ba756 [RISCV] Add a subtarget feature to enable unaligned scalar loads and stores
A RISCV implementation can choose to implement unaligned load/store support. We currently don't have a way for such a processor to indicate a preference for unaligned load/stores, so add a subtarget feature.

There doesn't appear to be a formal extension for unaligned support. The RISCV Profiles (https://github.com/riscv/riscv-profiles/blob/main/profiles.adoc#rva20u64-profile) docs use the name Zicclsm, but a) that doesn't appear to actually been standardized, and b) isn't quite what we want here anyway due to the perf comment.

Instead, we can follow precedent from other backends and have a feature flag for the existence of misaligned load/stores with sufficient performance that user code should actually use them.

Differential Revision: https://reviews.llvm.org/D126085
2022-05-26 15:25:47 -07:00
Rafael Auler c09cd64e5c [BOLT] Fix AND evaluation bug in shrink wrapping
Fix a bug where shrink-wrapping would use wrong stack offsets
because the stack was being aligned with an AND instruction, hence,
making its true offsets only available during runtime (we can't
statically determine where are the stack elements and we must give up
on this case).

Reviewed By: Amir

Differential Revision: https://reviews.llvm.org/D126110
2022-05-26 14:59:28 -07:00
Sam Clegg 98ff205fd8 [lld][WebAssembly] Update test after 87628f5804 2022-05-26 14:57:17 -07:00
Jim Ingham 134d7f9a4b Store a by name list of signals with their actions in the Target
so that they can be used to prime new Process runs.  "process handle"
was also changed to populate the dummy target if there's no selected
target, so that the settings will get copied into new targets.

Differential Revision: https://reviews.llvm.org/D126259
2022-05-26 14:50:33 -07:00
Matthias Braun e267df8ce8 Use cmake Python3_EXECUTABLE variable instead of hardcoding 2022-05-26 14:48:45 -07:00
Sam Clegg 87628f5804 [lld][WebAssembly] Require double dash for modern linker flags
This matches the behaviour of the ELF backend (in fact this change
is mostly just copying directly from ELF/Options.td).

Differential Revision: https://reviews.llvm.org/D126500
2022-05-26 14:42:52 -07:00
Fangrui Song 056dec5dc8 [Driver][test] Change -target i386-unknown-linux-gnu to --target=i386 and remove unused -o %t.o
Use a generic ELF triple to demonstrate that these apply to all ELF OSes.
Also migrate away from the legacy `-target ` spelling.
2022-05-26 14:41:04 -07:00
Sebastian Peryt d1c5da34a7 [DOC] Improve LangRef description of declare
This patch fixes formatting inside Functions section of declare
by making it consistent with the way how define is written.

Fixes #39844

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D125581
2022-05-26 14:34:34 -07:00
Sebastian Peryt 0f64945352 [DOC] Refactor Functions section in LangRef
This change is a small refactor of Functions section
to update placement of define syntax.

Reviewed By: RKSimon

Differential revision: https://reviews.llvm.org/D125831
2022-05-26 14:34:34 -07:00
Mehdi Amini c067a9dee5 Apply clang-tidy fixes for llvm-else-after-return in OpenMPDialect.cpp (NFC) 2022-05-26 21:29:58 +00:00
Mehdi Amini da3b8200e5 Apply clang-tidy fixes for performance-unnecessary-value-param in Bufferize.cpp (NFC) 2022-05-26 21:29:58 +00:00
Michael Kruse cc871cf6b5 [Polly][Test] Fix race condition while printing dot files.
The tests dot-scops.ll and dot-scops-npm.ll both wrote to the same file
scops.func.dot. If they are executed in parallel they will race for
the file. Fix by renaming func to func_npm in dot-scops-npm.ll so this
test writes dot scops.func_npm.dot.

Long-term, we will probably pass a file name (prefix) to the
printer pass such that we can use the guaranteed-unique LIT %t
placeholder in tests.
2022-05-26 15:58:53 -05:00
owenca 5bf44aa434 [clang-format][NFC] Refactor UnwrappedLineParser::parseBlock()
Differential Revision: https://reviews.llvm.org/D126358
2022-05-26 13:56:47 -07:00
Louis Dionne eb1b1f2411 [libc++][NFC] Fix whitespace 2022-05-26 16:52:23 -04:00
Sam Clegg 198815e18d [lld][WebAssembly] Avoid importing/exporting hidden symbols in shared libraries
We have some special handling for weakly defined symbols where we both
import and export them, but this is not needed for hidden symbols which
should never be imported or exported.

See https://github.com/emscripten-core/emscripten/pull/16972

This should also help with:
https://github.com/emscripten-core/emscripten/issues/15487

Differential Revision: https://reviews.llvm.org/D126491
2022-05-26 13:43:25 -07:00
owenca 5221875a95 [clang-format] Fix an invalid code generation in RemoveBracesLLVM
Fixes #55706.

Differential Revision: https://reviews.llvm.org/D126438
2022-05-26 13:38:04 -07:00
Sam Clegg 966427b847 [lld][WebAssemlby] Check for command line flags with missing arguments
I'm really not sure how this was overlooked when we first ported lld
to Wasm.  The upstream code in the ELF backend has these two lines but
for some reason they never make it into the Wasm version.

Differential Revision: https://reviews.llvm.org/D126497
2022-05-26 13:35:27 -07:00
William Huang 35b0955aa5 [ValueTracking] Added support to deduce PHI Nodes values being a power of 2
Add Value Tracking support to deduce induction variable being a power of 2, allowing urem optimizations

Reviewed By: davidxl

Differential Revision: https://reviews.llvm.org/D126018
2022-05-26 20:30:31 +00:00
Sanjay Patel c4c750058f [InstCombine] fold mul of signbit directly to X < 0 ? Y : 0
This is effectively NFC (intentionally no test diffs)
because we already have the related fold that converts
the 'and' pattern to select. So this is just an efficiency
improvement.
2022-05-26 16:19:15 -04:00
Sanjay Patel 899af021f4 [InstCombine] add tests for mul with sign-splat operand; NFC 2022-05-26 16:19:15 -04:00
Sanjay Patel 49f8b05137 [InstCombine] fold icmp equality with sdiv and SMIN
This extends the fold from D126410 / 3952c905ef
to allow for the only case where it works with signed
division:
https://alive2.llvm.org/ce/z/k7_ypu

(X s/ Y) == SMIN --> (X == SMIN) && (Y == 1)
(X s/ Y) != SMIN --> (X != SMIN) || (Y != 1)

This is another improvement based on #55695.
2022-05-26 16:19:15 -04:00
Sanjay Patel ed5be1523f [InstCombine] reduce code duplication in icmp+div folds; NFC 2022-05-26 16:19:15 -04:00
Sanjay Patel 60682a0b85 [InstCombine] add tests for icmp with sdiv operand; NFC
Adapted from unsigned division tests from:
ea6171c108
2022-05-26 16:19:15 -04:00
Craig Topper 460781feef [LegalizeTypes] Fix bug in expensive checks verification
With a fix for an expensive checks build failure exposed by new RISC-V tests.
Something about expanding two rotates in type legalization caused a change
in the remapping tables that the expensive checks verifying wasn't expecting.
See comment in the code for how it was fixed.

Tests came from this commit that exposed the bug
[RISCV] Add test cases showing failure to remove mask on rotate amounts.

If the masking AND has multiple users we fail to remove it.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D126036
2022-05-26 13:13:32 -07:00
Craig Topper e9ac99b609 [RISCV] Simplfy creation of IndexVT in lowerMaskedGather/lowerMaskedScatter. NFC
The scalar element width is not a factor in how ContainerVT is
determined. We don't need to check the relative size of VT and
IndexVT.
2022-05-26 13:13:32 -07:00
LLVM GN Syncbot 75ac914b14 [gn build] Port b58a420ff4 2022-05-26 20:01:22 +00:00
Argyrios Kyrtzidis b4c83a13f6 [Tooling/DependencyScanning & Preprocessor] Refactor dependency scanning to produce pre-lexed preprocessor directive tokens, instead of minimized sources
This is a commit with the following changes:

* Remove `ExcludedPreprocessorDirectiveSkipMapping` and related functionality

Removes `ExcludedPreprocessorDirectiveSkipMapping`; its intended benefit for fast skipping of excluded directived blocks
will be superseded by a follow-up patch in the series that will use dependency scanning lexing for the same purpose.

* Refactor dependency scanning to produce pre-lexed preprocessor directive tokens, instead of minimized sources

Replaces the "source minimization" mechanism with a mechanism that produces lexed dependency directives tokens.

* Make the special lexing for dependency scanning a first-class feature of the `Preprocessor` and `Lexer`

This is bringing the following benefits:

    * Full access to the preprocessor state during dependency scanning. E.g. a component can see what includes were taken and where they were located in the actual sources.
    * Improved performance for dependency scanning. Measurements with a release+thin-LTO build shows ~ -11% reduction in wall time.
    * Opportunity to use dependency scanning lexing to speed-up skipping of excluded conditional blocks during normal preprocessing (as follow-up, not part of this patch).

For normal preprocessing measurements show differences are below the noise level.

Since, after this change, we don't minimize sources and pass them in place of the real sources, `DependencyScanningFilesystem` is not technically necessary, but it has valuable performance benefits for caching file `stat`s along with the results of scanning the sources. So the setup of using the `DependencyScanningFilesystem` during a dependency scan remains.

Differential Revision: https://reviews.llvm.org/D125486
Differential Revision: https://reviews.llvm.org/D125487
Differential Revision: https://reviews.llvm.org/D125488
2022-05-26 12:50:06 -07:00
Argyrios Kyrtzidis b58a420ff4 [Tooling/DependencyScanning] Rename refactorings towards transitioning dependency scanning to use pre-lexed preprocessor directive tokens
This is first of a series of patches for making the special lexing for dependency scanning a first-class feature of the `Preprocessor` and `Lexer`.
This patch only includes NFC renaming changes to make reviewing of the functionality changing parts easier.

Differential Revision: https://reviews.llvm.org/D125484
2022-05-26 12:49:51 -07:00
python3kgae 628b2bfad8 [DirectX] Update test for dxil-dis.
Update metadata index which changed for dx.valver.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D126311
2022-05-26 12:32:52 -07:00
Louis Dionne 92bbcfaa97 [libunwind] Tidy-up the testing configuration for libunwind
Start testing Apple backdeployment with older libunwinds, and stop
explicitly specifying the libunwind testing config, since it is
already selected correctly by default.

Differential Revision: https://reviews.llvm.org/D126470
2022-05-26 15:29:39 -04:00
Stella Stamenova 75acec818e [lldb] Fix enums-layout test on Windows
The test was broken by: https://reviews.llvm.org/D125604
2022-05-26 12:16:52 -07:00
Will Hawkins 84b9985f5f
[lldb] Fix broken bad-address-breakpoint test
After changing the "fallback" behavior when a user sets a breakpoint
without specifying a module the bad-address-breakpoint test case failed
incorrectly. This patch updates that test case in order to more
thoroughly discover an illegal address and use that as the means for
testing whether a breakpoint set at an illegal address fails to resolve.

Differential revision: https://reviews.llvm.org/D126109
2022-05-26 12:16:11 -07:00
Joel E. Denny 48ca3a5ebb [OpenMP] Extend omp teams to permit nested omp atomic
OpenMP 5.2, sec. 10.2 "teams Construct", p. 232, L9-12 restricts what
regions can be strictly nested within a `teams` construct.  This patch
relaxes Clang's enforcement of this restriction in the case of nested
`atomic` constructs unless `-fno-openmp-extensions` is specified.
Cases like the following then seem to work fine with no additional
implementation changes:

```
 #pragma omp target teams map(tofrom:x)
 #pragma omp atomic update
 x++;
```

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D126323
2022-05-26 14:59:16 -04:00
Louis Dionne 3bba72e653 [libc++] Time tests during CI 2022-05-26 14:58:29 -04:00
Mircea Trofin 6ddc4cd1c2 Fix break introduced by D124306
argparse.BooleanOptionalAction is not supported until python 3.9.
2022-05-26 11:55:19 -07:00
Aaron Ballman 6273b5cbcd Roll back use of #warning for header deprecations
e5ccd66801 and
5029dce492 added deprecation warnings to
the <stdbool.h> and <stdnoreturn.h> headers, respectively, because the
headers are deprecated in C2x.

However, there are system headers that include these headers
unconditionally, and #warning diagnostics within system headers are
shown to users instead of suppressed, which means these deprecation
warnings are being triggered in circumstances that users have no
control over except to disable all the warnings through the
_CLANG_DISABLE_CRT_DEPRECATION_WARNINGS macro or other means.

This removes the problematic #warning uses until we find a more
palatable solution.
2022-05-26 14:51:39 -04:00
Adrian Tong 7c13ae6490 Give option to use isCopyInstr to determine which MI is
treated as Copy instruction in MCP.

This is then used in AArch64 to remove copy instructions after taildup
ran in machine block placement

Differential Revision: https://reviews.llvm.org/D125335
2022-05-26 18:43:16 +00:00
Jason Molenda ea6d0c4b2a One further tweak for realpathing filepath to match dyld
I missed one place I need to realpath the build artifact path,
to make it match the path we get back from dyld.
2022-05-26 11:24:56 -07:00
Zongwei Lan ad73ce318e [Target] use getSubtarget<> instead of static_cast<>(getSubtarget())
Differential Revision: https://reviews.llvm.org/D125391
2022-05-26 11:22:41 -07:00
Jason Molenda bd67468645 Check that a FileSpec has a Directory component before using
A follow on to my patch for https://reviews.llvm.org/D126435
hit by an x86_64 linux bot; I assumed that a FileSpec had a
directory component and checked if the first character was a
'~'.  This was not a valid assumption.
2022-05-26 11:12:37 -07:00
Jason Molenda 8a467284d5 Defer source path remap tilde expansion until source file use
When reading source path remappings out of a dSYM, lldb currently
does tilde expansion -- expanding the tilde-username and checking
that the destination pathname exists, for each dSYM with the path
remappings.  This cost happens during lldb's initial process launch
/ load, an especially perf-sensitive time.  Inside Apple, we have
dSYMs with source path remappings pointing to NFS directories where
these extra stats for every dSYM can be very expensive if the network
is slow.

This patch instead keeps the source path mapping in the original
tilde-username terms and does the tilde expansion when we need
to read a specific source file from one of the modules.  We'll
be stat'ing all of those inodes to load the source file anyway,
so the fact that we do the tilde expansion on every source file
we load, it doesn't cost us significantly.

Differential Revision: https://reviews.llvm.org/D126435
rdar://77091379

(cherry picked from commit c274b6e583)
2022-05-26 11:12:37 -07:00
Bruno Cardoso Lopes ce54b22657 [Clang][CoverageMapping] Fix switch counter codegen compile time explosion
C++ generated code with huge amount of switch cases chokes badly while emitting
coverage mapping, in our specific testcase (~72k cases), it won't stop after hours.
After this change, the frontend job now finishes in 4.5s and shrinks down `@__covrec_`
by 288k when compared to disabling simplification altogether.

There's probably no good way to create a testcase for this, but it's easy to
reproduce, just add thousands of cases in the below switch, and build with
`-fprofile-instr-generate -fcoverage-mapping`.

```
enum type : int {
 FEATURE_INVALID = 0,
 FEATURE_A = 1,
 ...
};

const char *to_string(type e) {
  switch (e) {
  case type::FEATURE_INVALID: return "FEATURE_INVALID";
  case type::FEATURE_A: return "FEATURE_A";}
  ...
  }

```

Differential Revision: https://reviews.llvm.org/D126345
2022-05-26 11:05:15 -07:00
Mircea Trofin f15c60218d [UpdateTestChecks] Auto-generate stub bodies for unused prefixes
This is scoped to autogenerated tests.

The goal is to support having each RUN line specify a list of
check-prefixes where one can specify potentially redundant prefixes. For example,
for X86, if one specified prefixes for  both AVX1 and AVX2, and the codegen happened to
match today, one of the prefixes would be used and the onther one not.
If the unused prefix were dropped, and later, codegen differences were
introduced, one would have to go figure out where to add what prefix
(paraphrasing
https://lists.llvm.org/pipermail/llvm-dev/2021-February/148326.html)

To avoid getting errors due to unused prefixes, whole directories can be
opted out (as discussed on that thread), but that means that tests that
aren't autogenerated in such directories could have undetected unused
prefix bugs.

This patch proposes an alternative that both avoids the above, dir-level
optout, and supports the main autogen scenario discussed first. The autogen
tool appends at the end of the test file the list of unused prefixes,
together with a note explaining that is the case. Each prefix is set up
to always pass.

This way, unexpected unused prefixes are easily discoverable, and
expected cases "just work".

Differential Revision: https://reviews.llvm.org/D124306
2022-05-26 10:23:10 -07:00
Florian Hahn 6af5f5697c
[SCEV] Collect conditions from assumes same way as for branches.
Also collect conditions from assume up-front in applyLoopGuards.
This allows re-using the logic to handle logical ANDs as assume
conditions.

It should should pave the road for a fix for #55645.
2022-05-26 18:17:13 +01:00
David Penry 917dc0749b [ARM] Recognize t2LoopEnd for software pipelining
- Add t2LoopEnd to TargetInstrInfo::analyzeBranch and
  related functions.  As there are many side effects of
  analyzing a branch, only do so if software pipelining
  is enabled to maintain previous behavior when pipelining
  is not desired.
- Make sure that t2LoopEndDec is immediately followed by
  a t2B when it is synthesized from a t2LoopEnd. This is
  done because the t2LoopEnd might have acquired a
  fall-through path, but IfConversion assumes that
  fall-through are only possible on analyzable branches.

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D126322
2022-05-26 09:55:42 -07:00
Mike Rice 0a5cfbf7b2 [OpenMP] Use the align clause value from 'omp allocate' for globals
Refactor the code that handles the align clause of 'omp allocate' so
it can be used with globals as well as local variables.

Differential Revision: https://reviews.llvm.org/D126426
2022-05-26 09:51:48 -07:00
Owen Anderson 939a43461b Revert "Replace the custom linked list in LeaderTableEntry with TinyPtrVector."
This reverts commit 1e91149844.

Pending further discussion.
2022-05-26 09:50:36 -07:00