Commit Graph

95729 Commits

Author SHA1 Message Date
Timm Bäder 11e52ecf74 [clang] Short-circuit trivial constructors when evaluating arrays
VisitCXXConstructExpr() will later do something similar, but for large
arrays, we should try to do it once an not for every element.

Fixes #56774

Differential Revision: https://reviews.llvm.org/D130791
2022-08-03 10:38:15 +02:00
Stanislav Gatev 817dd5e3fd [clang][dataflow] Rename member to make it clear that it isn't stable
Rename `DataflowAnalysisContext::getStableStorageLocation(QualType)`
to `createStorageLocation`, to make it clear that it doesn't return
a stable storage location.

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

Reviewed-by: ymandel, xazax.hun, gribozavr2
2022-08-03 06:25:02 +00:00
Stanislav Gatev c44c71843f [clang][dataflow] Make the type of the post visit callback consistent
Make the types of the post visit callbacks in `transferBlock` and
`runTypeErasedDataflowAnalysis` consistent.

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

Reviewed-by: ymandel, xazax.hun, gribozavr2
2022-08-03 05:58:38 +00:00
Nicolai Hähnle f7872cdce1 CommandLine: add and use cl::SubCommand::get{All,TopLevel}
Prefer using these accessors to access the special sub-commands
corresponding to the top-level (no subcommand) and all sub-commands.

This is a preparatory step towards removing the use of ManagedStatic:
with a subsequent change, these global instances will be moved to
be regular function-scope statics.

It is split up to give downstream projects a (albeit short) window in
which they can switch to using the accessors in a forward-compatible
way.

Differential Revision: https://reviews.llvm.org/D129118
2022-08-02 23:49:16 +02:00
Roy Jacobson 508c431ed9 [SemaCXX] Validate destructor is valid for dependent classes
We didn't check that a destructor's name matches the directly enclosing class if the class was dependent.
I enabled the check we already had for non-dependent types, which seems to work. Added appropriate tests.

Fixes GitHub issue #56772

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D130936
2022-08-02 21:50:54 +03:00
Yuanfang Chen 92c1bc6158 [CodeGen][inlineasm] assume the flag output of inline asm is boolean value
GCC inline asm document says that
"... the general rule is that the output variable must be a scalar
integer, and the value is boolean."

Commit e5c37958f9 lowers flag output of
inline asm on X86 with setcc, hence it is guaranteed that the flag
is of boolean value. Clang does not support ARM inline asm flag output
yet so nothing need to be worried about ARM.

See "Flag Output" section at
https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#OutputOperands

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

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D129954
2022-08-02 11:49:01 -07:00
Zakk Chen bb99d4b11d [RISCV][Clang] Support policy functions for Vector Mask Instructions.
We will switch all UndefValue to PoisonValue in follow up patches.

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D126749
2022-08-02 17:27:57 +00:00
Zakk Chen dffdca85ec [RISCV][Clang] Support policy functions for Vector Reduction
Instructions.

We will switch all UndefValue to PoisonValue in follow up patches.

Thanks for Kito to help on verification with their interanl testsuite.

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D126748
2022-08-02 17:27:56 +00:00
Zakk Chen 9caf2cc05c [RISCV][Clang] Support policy functions for Vector Comparison
Instructions.

We will switch all UndefValue to PoisonValue in follow up patches.

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D126746
2022-08-02 17:27:56 +00:00
Zakk Chen 7eddeb9e99 [RISCV][Clang] Support policy functions for vmerge, vfmerge and
vcompress.

We will switch all UndefValue to PoisonValue in follow up patches.

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D126745
2022-08-02 17:27:55 +00:00
Zakk Chen b1b22b4a85 [RISCV][Clang] Support policy functions for vneg, vnot, vncvt, vwcvt,
vwcvtu, vfabs and vfneg.

We will switch all UndefValue to PoisonValue in follow up patches.

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D126744
2022-08-02 17:27:55 +00:00
Alok Kumar Sharma 5ec6ea3dfd [clang][OpenMP][DebugInfo] Mark OpenMP generated functions as artificial
The Clang compiler generates internal functions for OpenMP. Current
patch marks these functions as artificial.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D111521
2022-08-02 21:24:46 +05:30
Aaron Ballman c783ca0de1 Revert "Missing tautological compare warnings due to unary operators"
This reverts commit 0cc3c184c7.

The changes did not account for templated code where one instantiation
may trigger the diagnostic but other instantiations will not, as in:
```
template <int I, class T>
void foo(int x) {
    bool b1 = (x & sizeof(T)) == 8;
    bool b2 = (x & I) == 8;
    bool b3 = (x & 4) == 8;
}

void run(int x) {
    foo<4, int>(8);
}
```
2022-08-02 09:39:36 -04:00
Fangrui Song afb785f511 [Driver] Remove Separate form for XRay options
Supporting something like `-fxray-instruction-threshold= 1` is not intended.
2022-08-02 00:47:37 -07:00
Purva-Chaudhari 168d4e2945 Handles failing driver tests of clang
Added support for incremental mode 8 and 28 ie. `frontend::EmitBC:` and `frontend::PrintPreprocessedInput:`
Added supporting clang tests to test in clang-repl mode

Reviewed By: v.g.vassilev

Differential Revision: https://reviews.llvm.org/D125946
2022-08-02 12:29:26 +05:30
Chuanqi Xu 6d10733d44 [C++20] [Modules] Handle initializer for Header Units
Previously when we add module initializer, we forget to handle header
units. This results that we couldn't compile a Hello World Example with
Header Units. This patch tries to fix this.

Reviewed By: iains

Differential Revision: https://reviews.llvm.org/D130871
2022-08-02 11:24:46 +08:00
Chuanqi Xu 39cfde2366 Revert "[C++20] [Modules] Handle initializer for Header Units"
This reverts commit db6152ad66.

This commit fails in ppc64. Since we want to backport it to 15.x. So
revert it now to keep the patch complete.
2022-08-02 11:09:38 +08:00
Fangrui Song 29f852a151 [Driver] Remove deprecated -fsanitize-coverage-{black,white}list= 2022-08-01 19:39:25 -07:00
Fangrui Song 0bb3aafbd5 [docs] Regenerate clang/docs/ClangCommandLineReference.rst
Also update -ftime-trace='s help to fix a recommonmark error.
2022-08-01 19:31:25 -07:00
Chuanqi Xu db6152ad66 [C++20] [Modules] Handle initializer for Header Units
Previously when we add module initializer, we forget to handle header
units. This results that we couldn't compile a Hello World Example with
Header Units. This patch tries to fix this.

Reviewed By: iains

Differential Revision: https://reviews.llvm.org/D130871
2022-08-02 10:27:02 +08:00
Alex Brachet 9bf6eccae1 [clang] Only run test on x86 2022-08-02 00:56:05 +00:00
Ben Langmuir 98cf745a03 [clang] Only modify FileEntryRef names that are externally remapped
As progress towards having FileEntryRef contain the requested name of
the file, this commit narrows the "remap" hack to only apply to paths
that were remapped to an external contents path by a VFS. That was
always the original intent of this code, and the fact it was making
relative paths absolute was an unintended side effect.

Differential Revision: https://reviews.llvm.org/D130935
2022-08-01 15:45:51 -07:00
Alex Brachet 6b3fa58fde [clang] Make test agnostic to file seperator character 2022-08-01 22:12:04 +00:00
Alex Brachet 71f2d5c2d1 [clang] Re-enable test after marking it XFAIL
This test had to be disabled because ps4 targets don't support
-fuse-ld. Preferably, this should just be unsupported for ps4
targets. However no such lit feature exists so I have just gone
ahead and set the target explicitly. Moreover, this needs
to create a terminal link step, either an executable or shared
object to get the link error. With the change to the explicit
target I've had to also add -nostartfiles -nostdlib so that
clang doesn't pull crt files into the link which may not be
present. Again, this would likely be solved if this test
was unsupported for the one platform that disables -fuse-ld
2022-08-01 22:09:13 +00:00
Ben Langmuir b4c6dc2e66 [clang] Update code that assumes FileEntry::getName is absolute NFC
It's an accident that we started return asbolute paths from
FileEntry::getName for all relative paths. Prepare for getName to get
(closer to) return the requested path. Note: conceptually it might make
sense for the dependency scanner to allow relative paths and have the
DependencyConsumer decide if it wants to make them absolute, but we
currently document that it's absolute and I didn't want to change
behaviour here.

Differential Revision: https://reviews.llvm.org/D130934
2022-08-01 14:48:37 -07:00
Alex Brachet 4b8f375c9f [clang] Temporarily expect failure from test 2022-08-01 21:11:21 +00:00
Alex Brachet 9028966a71 [clang] Don't create executable in test 2022-08-01 20:59:40 +00:00
Alex Brachet 1ccded0fc1 [clang] Fix build when targeting ps4
-fuse-ld is not available for ps4 targets
2022-08-01 20:31:01 +00:00
Alex Brachet 5fd03b00ee [Driver] Re-run lld with --reproduce when it crashes
This was discussed on https://discourse.llvm.org/t/rfc-generating-lld-reproducers-on-crashes/58071/12

When lld crashes, or errors when -gen-reproducer=error
and -fcrash-diagnostics=all clang will re-run lld with
--reproduce=$temp_file for easily reproducing the
crash/error.

Differential Revision: https://reviews.llvm.org/D120175
2022-08-01 20:01:01 +00:00
Zakk Chen 8e51917b39 [RISCV][Clang] Add tests for all supported policy functions. (NFC)
In order to make the review easier, I split a lot of tests from
https://reviews.llvm.org/D126742

Reviewed By: rogfer01

Differential Revision: https://reviews.llvm.org/D126743
2022-08-01 17:42:43 +00:00
Zakk Chen 71fd66161d [RISCV][Clang] Support RVV policy functions.
1. Add policy functions support and tests for vadd, vmv, vfmv and all load
   instructions except segment load. I didn't add all combination of policy
   functions in test because it seem not to make sense.
2. Rename HasUnMaskedOverloaded to SupportOverloading.
3. vmv.s.x for ta policy could not have overloaded API.
4. This patch does not support all operations, I will have other follow-up
   patches support all.

[RFC] https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/137

Reviewed By: kito-cheng, fakepaper56, fakepaper56

Differential Revision: https://reviews.llvm.org/D126742
2022-08-01 17:32:08 +00:00
Gabriel Ravier 5674a3c880 Fixed a number of typos
I went over the output of the following mess of a command:

(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z |
 parallel --xargs -0 cat | aspell list --mode=none --ignore-case |
 grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n |
 grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less)

and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).

Differential Revision: https://reviews.llvm.org/D130827
2022-08-01 13:13:18 -04:00
Chris Bieneman 5dbb92d8cd [HLSL] CodeGen HLSL Resource annotations
HLSL Resource types need special annotations that the backend will use
to build out metadata and resource annotations that are required by
DirectX and Vulkan drivers in order to provide correct data bindings
for shader exeuction.

This patch adds some of the required data for unordered-access-views
(UAV) resource binding into the module flags. This data will evolve
over time to cover all the required use cases, but this should get
things started.

Depends on D130018.

Differential Revision: https://reviews.llvm.org/D130019
2022-08-01 11:19:43 -05:00
Simon Pilgrim b978fa2844 OffloadBundler.cpp - fix Wdocumentation warnings. NFC.
Fix param list instead of embedding \p tag
2022-08-01 15:24:47 +01:00
Dominik Adamski d90b7bf2c5 Add support for lowering simd if clause to LLVM IR
Scope of changes:
  1) Added new function to generate loop versioning
  2) Added support for if clause to applySimd function
  2) Added tests which confirm that lowering is successful

If ifCond is specified, then collapsed loop is duplicated and if branch
is added. Duplicated loop is executed if simd ifCond is evaluated to false.

Reviewed By: Meinersbur

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

Signed-off-by: Dominik Adamski <dominik.adamski@amd.com>
2022-08-01 04:43:32 -05:00
Frederic Cambus 892e6e2200 [clang] Update Clang version from 15 to 16 in scan-build.1.
Similar to D110763.
2022-08-01 10:34:55 +02:00
Chuanqi Xu 834a878367 [C++2b] [Modules] Handle HaveModules with C++2b
Closing https://github.com/llvm/llvm-project/issues/56803. The root
cause for this bug is that we lack a good method to detect the language
mdoe when parsing the command line. There is a FIXME too. Dut to we lack
a good solution now, keep the workaround.
2022-08-01 16:06:34 +08:00
Serge Pavlov 2bb7c54621 [Clang] Remove unused parameter. NFC
BinaryOperator::getFPFeatures get parameter, which is not used. Similar
methods of other AST nodes do not have any parameter.
2022-08-01 14:53:13 +07:00
David Green ef9df0dc00 [ARM] Simplify ArchGuard predicates in arm_neon.h.
__ARM_ARCH >= 8 is implied by defined(__aarch64__), so we don't need to
guard against both together.
2022-08-01 08:20:23 +01:00
Fangrui Song dc900eeaf2 [test] Fix threadlocal_address.cpp after D129833
Older Darwin does not support thread_local:

error: thread-local storage is not supported for the current target
  thread_local int j = 0;
2022-07-31 23:49:33 -07:00
Chuanqi Xu 39dd8dcf20 [NFC] Fix test failure in windows 2022-08-01 14:14:02 +08:00
Chuanqi Xu bacdf80f42 Use @llvm.threadlocal.address intrinsic to access TLS variable
This is successor for D125291. This revision would try to use
@llvm.threadlocal.address in clang to access TLS variable. The reason
why the OpenMP tests contains a lot of change is that they uses
utils/update_cc_test_checks.py to update their tests.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D129833
2022-08-01 11:05:00 +08:00
Sunho Kim 773d51ce3b [clang-repl] XFAIL windows properly in simple-exception test case.
We don't have proper exception support in LLJIT on windows yet. We have to xfail windows machine, but the previous check missed out some targets.
2022-08-01 09:06:35 +09:00
Kazu Hirata 71336d03f1 Use llvm::any_of (NFC) 2022-07-31 15:17:08 -07:00
Kazu Hirata ed29930519 [Sema] Remove an unused forward declaration (NFC) 2022-07-31 15:17:00 -07:00
Jun Zhang 9caee577ef
[clang-repl] Fix incorrect return code
Without this patch, clang-repl incorrectly pass some tests when there's
error occured.

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

Differential Revision: https://reviews.llvm.org/D130422
2022-07-31 19:07:05 +08:00
Jun Zhang 3da1395383
[CodeGen][NFC] Use isa_and_nonnull instead of explicit check
Signed-off-by: Jun Zhang <jun@junz.org>
2022-07-31 13:03:24 +08:00
Sunho Kim a8f2e24e48 [clang-repl] Disable building when LLVM_STATIC_LINK_CXX_STDLIB is ON.
We have seen random symbol not found "__cxa_throw" error in fuschia build bots and out-of-tree users. The understanding have been that they are built without exception support, but it turned out that these platforms have LLVM_STATIC_LINK_CXX_STDLIB ON so that they link libstdc++ to llvm statically. The reason why this is problematic for clang-repl is that by default clang-repl tries to find symbols from symbol table of executable and dynamic libraries loaded by current process. It needs to load another libstdc++, but the platform that had LLVM_STATIC_LINK_CXX_STDLIB turned on is usally those with missing or obsolate shared libstdc++ in the first place -- trying to load it again would be destined to fail eventually with a risk to introuduce mixed libstdc++ versions.

A proper solution that doesn't take a workaround is statically link the same libstdc++ by clang-repl side, but this is not possible with old JIT linker runtimedyld. New just-in-time linker JITLink handles this relatively well, but it's not availalbe in majority of platforms. For now, this patch just disables the building of clang-repl when LLVM_STATIC_LINK_CXX_STDLIB is ON and removes the "__cxa_throw" check in exception unittest as well as reverting previous exception check flag patch.

Reviewed By: v.g.vassilev

Differential Revision: https://reviews.llvm.org/D130788
2022-07-31 05:42:57 +09:00
Kazu Hirata 16eaeaded5 Use is_contained (NFC) 2022-07-30 10:35:54 -07:00
Simon Pilgrim 91d9b7b407 DependencyScanningTool.h - fix Wdocumentation warning. NFC. 2022-07-30 11:00:35 +01:00