Commit Graph

95716 Commits

Author SHA1 Message Date
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
Simon Pilgrim b3fd44dd6a Sema.h - fix Wdocumentation warnings. NFC. 2022-07-30 11:00:16 +01:00
Kazu Hirata 873888c179 Use is_sorted (NFC) 2022-07-29 21:18:42 -07:00
Kazu Hirata e5a1ccbf25 Use value instead of getValue (NFC) 2022-07-29 21:18:41 -07:00
Kazu Hirata a948117088 [clang] Use has_value instead of value (NFC) 2022-07-29 21:18:39 -07:00
Weverything fb7fa27f92 Preserve qualifiers when getting fully qualified type
15f3cd6bfc moved the handling of UsingType
to a later point in the function getFullyQualifiedType.  This moved it
after the removal of an ElaboratedType and its qualifiers.  However,
the qualifiers were not added back, causing the fully qualified type to
have a qualifier mismatch with the original type.  Make sure the
qualifers are added before continuing to fully qualify the type.
2022-07-29 19:42:54 -07:00
Shafik Yaghmour a0d6105162 [Clang] Fix handling of Max from getValueRange(...) in IntExprEvaluator::VisitCastExpr(...)
This is a follow-up to D130058 to fix how we handle the Max value we obtain from
getValueRange(...) in IntExprEvaluator::VisitCastExpr(...) which in the case of
an enum that contains an enumerator with the max integer value will overflow by
one.

The fix is to decrement the value of Max and use slt and ult for comparison Vs
sle and ule.`

Differential Revision: https://reviews.llvm.org/D130811
2022-07-29 19:17:42 -07:00
Aiden Grossman afb4efd3bc Fix lack of cc1 flag in llvmcmd sections when assertions are enabled
Currently when assertions are enabled, the cc1 flag is not
inserted into the llvmcmd section of object files with embedded
bitcode. This deviates from the normal behavior where this is
the first flag that is inserted. This error stems from incorrect
use of the function generateCC1CommandLine() which requires
manually adding in the -cc1 flag which is currently not done.

Reviewed By: jansvoboda11

Differential Revision: https://reviews.llvm.org/D130620
2022-07-29 18:51:48 -07:00
Sunho Kim 32f59b34b6 [clang-repl] Add missing link component.
OrcJIT was missing in LLVM_LINK_COMPONENTS.
2022-07-30 08:00:15 +09:00
Argyrios Kyrtzidis 944a86de7c [ASTWriter] Provide capability to output a PCM/PCH file that does not write out information about its output path
This is useful to enable sharing of the same PCH file even when it's intended for a different output path.

The only information this option disables writing is for `ORIGINAL_PCH_DIR` record which is treated as optional and (when present) used as fallback for resolving input file paths relative to it.

Differential Revision: https://reviews.llvm.org/D130710
2022-07-29 15:21:54 -07:00
Sunho Kim 65c9265f41 [clang-repl] Disable exectuion unitests on unsupported platform by lljit instance test.
The method used in 4191d661c7 was fragile because it didn't consider cross-platform builds and rely on enlisting unsupported targets. Uses the host-supports-jit mechanism to make an escape path. This should fix buildbot failures happening in upstream as well as out-of-tree.
2022-07-30 07:18:04 +09:00
Sam Estep a6ddc68487 [clang][dataflow] Handle multiple context-sensitive calls to the same function
This patch enables context-sensitive analysis of multiple different calls to the same function (see the `ContextSensitiveSetBothTrueAndFalse` example in the `TransferTest` suite) by replacing the `Environment` copy-assignment with a call to the new `popCall` method, which  `std::move`s some fields but specifically does not move `DeclToLoc` and `ExprToLoc` from the callee back to the caller.

To enable this, the `StorageLocation` for a given parameter needs to be stable across different calls to the same function, so this patch also improves the modeling of parameter initialization, using `ReferenceValue` when necessary (for arguments passed by reference).

This approach explicitly does not work for recursive calls, because we currently only plan to use this context-sensitive machinery to support specialized analysis models we write, not analysis of arbitrary callees.

Reviewed By: ymandel, xazax.hun

Differential Revision: https://reviews.llvm.org/D130726
2022-07-29 19:40:19 +00:00
skc7 09c4121123 Revert "Revert "[Clang][Attribute] Introduce maybe_undef attribute for function arguments which accepts undef values""
This reverts commit 4e1fe96.

Reverting this commit and fix the tests that caused failures due to
a35c64c.
2022-07-29 19:07:07 +00:00
Amy Kwan 4e1fe968c9 Revert "[Clang][Attribute] Introduce maybe_undef attribute for function arguments which accepts undef values"
This reverts commit a35c64ce23.

Reverting this commit as it causes various failures on LE and BE PPC bots.
2022-07-29 13:28:48 -05:00