Commit Graph

436174 Commits

Author SHA1 Message Date
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
Alex Zinenko f3fae035c7 [mlir] use strided layout in structured codegen-related tests
All relevant operations have been switched to primarily use the strided
layout, but still support the affine map layout. Update the relevant
tests to use the strided format instead for compatibility with how ops
now print by default.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D134045
2022-09-17 08:11:28 +02:00
Emmmer edc1c9f610 [LLDB][RISCV] Add RVM and RVA instruction support for EmulateInstructionRISCV
Add:
- RVM and RVA instructions sets.
- corresponding unittests.

Further work:
- implement RVC, RVF, RVD, and RVV extension.

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D133670
2022-09-17 12:19:09 +08:00
Kazu Hirata 29c841ce93 Revert "[llvm] Remove llvm::is_trivially_{copy/move}_constructible (NFC)"
This reverts commit 01ffe31cbb.

A build breakage with GCC 7.3 has been reported:

https://reviews.llvm.org/D132311#3797053

FWIW, GCC 7.5 is OK according to Pavel Chupin.  I also personally
tested GCC 8.4.0.
2022-09-16 18:26:20 -07:00
Vladislav Dzhidzhoev 6cf11f4462 [GlobalISel][DebugInfo] Salvage trivially dead instructions
Use salvageDebugInfo for instructions erased as trivially dead in
GlobalISel.

It would be helpful to implement support of G_PTR_ADD and G_FRAME_INDEX
in salvageDebugInfo in future in order to preserve more variable
location.

Reviewed by: arsenm

Differential Revision: https://reviews.llvm.org/D133986
2022-09-17 03:54:55 +03:00
Maksim Panchenko f1a11d770e [BOLT][NFC] Remove unreachable assertion
Reviewed By: ayermolo

Differential Revision: https://reviews.llvm.org/D134094
2022-09-16 17:03:35 -07:00
Aart Bik 30b550f14c [mlir][sparse] add loop simplification to sparsification pass
Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D134090
2022-09-16 16:29:47 -07:00
Matheus Izvekov 52dce8900c
[clang] Fix AST representation of expanded template arguments.
Extend clang's SubstTemplateTypeParm to represent the pack substitution index.

Fixes PR56099.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Differential Revision: https://reviews.llvm.org/D128113
2022-09-17 01:24:46 +02:00
Peiming Liu b1d1964771 [mlir][sparse] Only try to compute a better iteraton graph when needed
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D134059
2022-09-16 22:53:32 +00:00
Michael Jones 70f1f302ca [libc][cmake] separate installing headers
Now libc headers can be installed separately from installing the rest of
the libc.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D133960
2022-09-16 15:50:28 -07:00
Kazu Hirata 6e30a9cc08 [Inliner] Retire DefaultInlineOrder (NFC)
DefaultInlineOrder was largely an exercise in generalizing the
traversal order of call sites within the inliner.

Now that the module inliner is starting to form its shape, there is no
point in sharing DefaultInlineOrder between the module inliner and the
CGSCC inliner.  DefaultInlineOrder and all the other inline orders are
mutually exclusive in the following sense:

- The use of DefaultInlineOrder doesn't make sense in the module
  inliner because there is no priority inherent in the order in which
  call sites are added to the list of call sites -- SmallVector.

- The use of any other inline order doesn't make sense in the CGSCC
  inliner because little prioritization can be done within one CGSCC.

This patch essentially reverts the addition of DefaultInlineOrder so
that the loop structure of Inliner.cpp looks like the state just
before we started working on the module inliner (circa June 2021).

At the same time, ww remove the choice of DefaultInlineOrder from
UseInlinePriority.

Differential Revision: https://reviews.llvm.org/D134080
2022-09-16 15:36:40 -07:00
Jacques Pienaar 55e4417bb9 [mlir][emacs] Enable loading bytecode files as text
Use auto-compression-mode to read bytecode files in human readable
manner.

Differential Revision: https://reviews.llvm.org/D133879
2022-09-16 15:08:55 -07:00
Alexey Bataev 5d13b12674 [SLP]Improve isUndefVector function by adding insertelement analysis.
Added the mask and the analysis of the buildvector sequence in the
isUndefVector function, improves codegen and cost estimation.

Metric: SLP.NumVectorInstructions

Program                                                                                       SLP.NumVectorInstructions
                                                                          results                   results0 diff
test-suite :: External/SPEC/CFP2017rate/526.blender_r/526.blender_r.test 27362.00                  27360.00 -0.0%

Metric: size..text

Program                                                                                                           size..text
                                                                   results     results0    diff
test-suite :: External/SPEC/CFP2017rate/508.namd_r/508.namd_r.test   805299.00   806035.00  0.1%

526.blender_r - some extra code is vectorized.
508.namd_r - some extra code is optimized out.

Differential Revision: https://reviews.llvm.org/D133891
2022-09-16 14:36:38 -07:00
Siva Chandra Reddy 7fb96fb5d3 [libc] Add implementation of POSIX "uname" function.
Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D134065
2022-09-16 21:21:29 +00:00
Siva Chandra Reddy 9050a59c66 [libc][Obvious] Fix typo in struct rlimit name - remove the "_t" suffix. 2022-09-16 21:07:17 +00:00
Chris Bieneman 10378c4505 [HLSL] Enable availability attribute
Some HLSL functionality is gated on the target shader model version.
Enabling the use of availability markup allows us to diagnose
availability issues easily in the frontend.

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D134067
2022-09-16 16:04:27 -05:00
Sotiris Apostolakis b827e7c600 [SelectOpti] Restrict load sinking
This is a follow-up to D133777, which resolved a use-after-free case but
did not cover all possible memory bugs due to misplacement of loads.

In short, the overall problem was that sinked loads could be moved after
state-modifying instructions leading to memory bugs.

The solution is to restrict load sinking unless it is found to be sound.
i) Within a basic block (to-be-sinked load and select-user are in the same BB),
loads can be sinked only if there is no intervening state-modifying instruction.
This is a conservative approach to avoid resorting to alias analysis to detect
potential memory overlap.
ii) Across basic blocks, sinking of loads is avoided. This is because going over
multiple basic blocks looking for memory conflicts could be computationally
expensive and also unlikely to allow loads to sink. Further, experiments showed
that not sinking these loads has a slight positive performance effect.
Maybe for some of these loads, having some separation allows enough time
for the load to be executed in time for its user. This is not the case for
floating point operations that benefit more from sinking.

The solution in D133777 was essentially undone in this patch,
since the latter is a complete solution to the observed problem.

Overall, the performance impact of this patch is minimal.
Tested on two internal Google workloads with instrPGO.
Search application showed <0.05% perf difference,
while the database one showed a slight improvement,
but not statistically significant.

Reviewed By: davidxl

Differential Revision: https://reviews.llvm.org/D133999
2022-09-16 20:50:46 +00:00
Siva Chandra Reddy f5cbbb9988 [libc] Add implementation of POSIX setrlimit and getrlimit functions.
Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D134016
2022-09-16 20:50:28 +00:00
Teresa Johnson c2cf93c1a9 [WPD/LTT] Lower type test feeding assumes via phi correctly
This fixes https://github.com/llvm/llvm-project/issues/57616.

Type test lowering in ThinLTO modules relies on having type id
summaries set up for the referenced types, which provide the type
test resolution. If there is no summary, the type tests are lowered
to false. At the very least, a default type id summary gives the
type tests a resolution of Unknown, which is handled correctly (ignored
by the first invocation of LTT, and lowered to true by the second).

WPD sets up the type id summaries (with a default type test resolution)
as it is processing the type tests, but only does this for the patterns
handled by WPD, which is a type test directly feeding an assume. In the
case of type tests feeding an assume via a phi, the type id summary was
not being set up, leading to the type tests being lowered to false
incorrectly.

Fix this by adding the default type id summary entries for all type ids
used on globals during index-only WPD.

This is not an issue for hybrid (split-lto-unit) LTO, as in that case
the type test resolution is determined and set up during LTT, since the
type definitions are in the regular LTO split module, and exported via
the summary to the ThinLTO split module.

Differential Revision: https://reviews.llvm.org/D134012
2022-09-16 13:50:01 -07:00
Lang Hames 47e9e58808 [ORC][ORC-RT][MachO] Reset __data and __common sections on library close.
If we want to be able to close and then re-open a library then we need to reset
the data section states when the library is closed. This commit updates
MachOPlatform and the ORC runtime to track __data and __common sections, and
reset the state in MachOPlatformRuntimeState::dlcloseDeinitialize.

This is only a first step to full support -- there are other data sections that
we're not capturing, and we'll probably want a more efficient representation
for the sections (rather than passing their string name over IPC), but this is
a reasonable first step.

This commit also contains a fix to MapperJITLinkMemoryManager that prevents it
from calling OnDeallocated twice in the case of an error.
2022-09-16 13:40:19 -07:00
Maksim Panchenko 1d5393526c [BOLT] Change base class of ExecutableFileMemoryManager
When we derive EFMM from SectionMemoryManager, it brings into EFMM extra
functionality, such as the registry of exception handling sections,
page permission management, etc. Such functionality is of no use to
llvm-bolt and can even be detrimental (see
https://github.com/llvm/llvm-project/issues/56726).

Change the base class of ExecutableFileMemoryManager to MemoryManager,
avoid registering EH sections, and skip memory finalization.

Fixes #56726

Reviewed By: yota9

Differential Revision: https://reviews.llvm.org/D133994
2022-09-16 13:39:12 -07:00
Maksim Panchenko 9742c25b98 [BOLT] Fix empty function emission in non-relocation mode
In non-relocation mode, every function is emitted in its own section. If
a function is empty, RuntimeDyld will still allocate 1-byte section
for the function and initialize it with zero. As a result, we will
overwrite the first byte of the original function contents with zero.
Such scenario can happen when the input function had only NOP
instructions which BOLT removes by default. Even though such functions
likely cause undefined behavior, it's better to preserve their contents.

Reviewed By: yota9

Differential Revision: https://reviews.llvm.org/D133978
2022-09-16 13:38:32 -07:00
Jessica Paquette 1076b31da8 [GlobalISel] Combine select + fcmp to fminnum/fmaxnum/fminimum/fmaximum
This is a partial port of the code used by the SelectionDAGBuilder to
translate selects.

In particular, see matchSelectPattern in ValueTracking.cpp. This is a
GISel-equivalent of the portion which handles fminnum/fmaxnum/fminimum/fmaximum.

I tried to set it up so it'd be easy to add the non-FP cases. Those are simpler.
On the AArch64-end, it seems like the FP cases are more important for perf
right now, so I bit the bullet and went at the more complicated problem. :)

I elected to do this as a post-legalize combine rather than in the
IRTranslator because

Deciding which fmax/fmin to use can depend on legalization rules
Philosophically-speaking (TM), putting it in a combine just feels cleaner

Being able to enable/disable the combine is handy
Another option would be to use the ValueTracking code in the IRTranslator and
match what SelectionDAGBuilder::visitSelect does. I think that may be somewhat
annoying since we'd need to write lowerings back into the selects in the
legalizer. I'm not strongly opposed to the approach.

We'd also want to be careful with vector selects once that's implemented,
which explicitly check if a vector select is legal on the target. That'd
probably need a hook.

From what I can tell, doing this as a combine is probably a cleaner option
long-term.

Differential Revision: https://reviews.llvm.org/D116702
2022-09-16 13:35:46 -07:00
Pengxuan Zheng 59365f33e2 [MachineCSE] Add a threshold to avoid spending too much time in isProfitableToCSE
Currently, it can become extremely costly to compute MayIncreasePressure if the
size of CSUses turns out to be very large. In that case, it's no longer cost
effective to keep computing MayIncreasePressure. Therefore, to limit the amount
of time spent in isProfitableToCSE, we simply conservatively assume
MayIncreasePressure if the size of CSUses is too large. This can reduce overall
compile time by 30% for some benchmarks.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D134003
2022-09-16 13:35:17 -07:00
Craig Topper 1121eca685 [VP][VE] Default VP_SREM/UREM to Expand and add generic expansion using VP_SDIV/UDIV+VP_MUL+VP_SUB.
I want to default all VP operations to Expand. These 2 were blocking
because VE doesn't support them and the tests were expecting them
to fail a specific way. Using Expand caused them to fail differently.

Seemed better to emulate them using operations that are supported.

@simoll mentioned on Discord that VE has some expansion downstream. Not
sure if its done like this or in the VE target.

Reviewed By: frasercrmck, efocht

Differential Revision: https://reviews.llvm.org/D133514
2022-09-16 13:19:02 -07:00
Xing Xue 8ace9ea258 [libc++][lit][AIX] Enable test case last_write_time.pass.cpp for AIX
Summary:
This patch enables libc++ LIT test case last_write_time.pass.cpp for AIX. Because system call utimensat() of AIX which is used in the libc++ implementation of last_write_time() does not accept the times parameter with a negative tv_sec or tv_nsec field, testing of setting file time to before epoch time is excluded for AIX.

Reviewed by: ldionne, libc++

Differential Revision: https://reviews.llvm.org/D133124
2022-09-16 16:08:40 -04:00
Craig Topper 61595c45af [RISCV] Simplify some code in vector fp<->int handling. NFC
We changed the way container types are selected since this code
was written. We no longer need to use the largest type.
2022-09-16 12:56:42 -07:00
Aiden Grossman c0bc461999 [Clang] Give error message for invalid profile path when compiling IR
Before this patch, when compiling an IR file (eg the .llvmbc section
from an object file compiled with -Xclang -fembed-bitcode=all) and
profile data was passed in using the -fprofile-instrument-use-path
flag, there would be no error printed (as the previous implementation
relied on the error getting caught again in the constructor of
CodeGenModule which isn't called when -x ir is set). This patch
moves the error checking directly to where the error is caught
originally rather than failing silently in setPGOUseInstrumentor and
waiting to catch it in CodeGenModule to print diagnostic information to
the user.

Regression test added.

Reviewed By: xur, mtrofin

Differential Revision: https://reviews.llvm.org/D132991
2022-09-16 19:45:57 +00:00
David Majnemer 8a868d8859 Revert "Revert "[clang, llvm] Add __declspec(safebuffers), support it in CodeView""
This reverts commit cd20a18286 and adds a
"let Heading" to NoStackProtectorDocs.
2022-09-16 19:39:48 +00:00
Kazu Hirata e0bc76eb23 [ModuleInliner] Move InlinePriority and its derived classes to InlineOrder.cpp (NFC)
These classes are referred to only from getInlineOrder in
InlineOrder.cpp.  This patch hides the entire class declarations and
definitions in InlineOrder.cpp.

Differential Revision: https://reviews.llvm.org/D134056
2022-09-16 12:32:16 -07:00
Stanislav Mekhanoshin 167826ee12 [AMDGPU] Fix runline for windows in sdag-print-divergence.ll. NFC. 2022-09-16 12:15:08 -07:00
Abhina Sreeskantharajan ce19343114 [test] Use host platform specific error message substitution
This patch modifies the testcase to use error substitution so it will pass on all platforms.

Reviewed By: fanbo-meng, zibi

Differential Revision: https://reviews.llvm.org/D134034
2022-09-16 15:13:45 -04:00
Jakub Kuderski a0debaa936 [mlir][arith] Remove misleading comment in EmulateWideInt. NFC.
At the request of @Mogball.
2022-09-16 15:02:47 -04:00
Amir Ayupov e002523b65 [BOLT] Verify externally referenced blocks against jump table targets
For functions with references to internal offsets from data, verify externally
referenced blocks against the set of jump table targets. Mark the function
as non-simple if there are any unclaimed data to code references.

Reviewed By: #bolt, maksfb

Differential Revision: https://reviews.llvm.org/D132495
2022-09-16 11:44:33 -07:00
Stanislav Mekhanoshin a0c8f5fefa [SDAG] Print divergence in SDNode::dump
If target does not support divergence the field is set to false
and not printed.

Differential Revision: https://reviews.llvm.org/D133984
2022-09-16 11:43:34 -07:00
Wei Yi Tee a4f8e3d240 Revert "[clang][dataflow] Replace `transfer(const Stmt *, ...)` with `transfer(const CFGElement *, ...)` in `Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel`."
This reverts commit 41f235d268.

Details at https://lab.llvm.org/buildbot#builders/139/builds/28171.
Breakage due to API change.
2022-09-16 18:07:35 +00:00