Commit Graph

48149 Commits

Author SHA1 Message Date
wenhu1024 ece1f84498 [ventus][NFC] Pick VentusRISCVABI or RISCVABI conditionally according to target CPU 2025-02-10 17:44:43 +08:00
zhoujing 9b11eb8feb [NFC][fix] Fix test cases failure 2024-03-07 10:57:30 +08:00
Mifuns e4c88939fe
[#60][feat] Support barrier with memory scope parameter (#63)
Co-authored-by: qinfan <qinfan.wang@terapines.com>
2023-11-22 16:02:16 +08:00
zhoujing 198eea9938 [VENTUS][feat] Support varadic function && enable address space in vastart/vaend 2023-08-08 15:45:41 +08:00
zhoujing 967cb725c8 [VENTUS][RISCV][feat] Set ventus kernel for OpenCL kernel functions 2023-06-05 13:10:35 +08:00
zhoujingya 8ba248d102 [VENTUS][RISCV] Add vararg support
Because ventus riscv is designed specially for OpenCL language, we originally add or remove some language features mainly for serving OpenCL, but we now need to add customized `printf` function which is expected to be written in C, so we need also to add support for C language features in current ventus

Signed-off-by: zhoujingya <jing.zhou@terapines.com>
2023-04-13 15:00:35 +08:00
zhoujingya 553e65dcf7 Change barrier and work_group_barrier into builtin functions 2023-03-14 10:38:22 +08:00
zhoujing a92723f212 Update barrier intrinsics' name and modify barrier's encoding 2023-02-10 14:50:40 +08:00
zhoujing 18810a86c0 Update barrier&barriersub instructions, codegen test cases for barrier builtins and intrinsics 2023-02-10 10:27:46 +08:00
Aries 9c54c010b2 [clang] Add initial support to Ventus GPGPU calling convention for llvm IR codegen. 2022-12-14 11:31:30 +08:00
Weining Lu 47edc70866 [LoongArch] Specify registers used for exception handling
See definition in backend D134709 and the doc [1] for more detail.

With the benefit of this change, most libcxx and libcxxabi tests pass.

[1]: https://llvm.org/docs/ExceptionHandling.html

Reviewed By: xen0n, wangleiat

Differential Revision: https://reviews.llvm.org/D139177
2022-12-05 11:42:41 +08:00
Vitaly Buka 9e8787821f [test][CodeGen] Check noundef for omited return 2022-12-04 19:10:17 -08:00
Vitaly Buka 262d6d495c [test][CodeGen] Check noundef for return value 2022-12-04 19:10:17 -08:00
Kazu Hirata 35b4fbb559 [clang] Use std::nullopt instead of None in comments (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-04 15:57:24 -08:00
Fangrui Song eecb22d8e1 [SanitizerBinaryMetadata] Use weak __start_/__stop_ instead of dummy empty section
D130887 uses a dummy empty section `sanmd_covered` (with the SHF_GNU_RETAIN flag on
ELF) to prevent `undefined symbol: __start_sanmd_covered` if all `sanmd_covered`
are discarded by `ld --gc-sections` (in `-z start-stop-gc` mode).

The dummy `sanmd_covered` does not have the SHF_LINK_ORDER flag, so mixing it
with SHF_LINK_ORDER `sanmd_covered` causes an issue to GNU ld<2.36
(https://sourceware.org/bugzilla/show_bug.cgi?id=26256).

Similar to D98903 for SanitizerCoverage, let's make encapsulation symbols
undefined weak[1]. This additionally avoids size cost due to the dummy section and
symbol.

[1]: https://maskray.me/blog/2021-01-31-metadata-sections-comdat-and-shf-link-order

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D139276
2022-12-04 15:06:34 -08:00
John McIver ee13633c46 [NFC][clang] Strengthen checks in avx512fp16-builtins.c
* Add end-of-line check to load instructions
2022-12-04 14:57:43 +00:00
John McIver 2389488437 [NFC][clang] Strengthen checks in avx512f-builtins.c
* Add check to unnamed portion of nontemporal attribute
* Add end-of-line check to load instructions
2022-12-04 14:55:41 +00:00
qfrost 4178671b2e [clang][Windows]Ignore Options '/d1' 2022-12-03 22:47:59 +08:00
Vassil Vassilev dc4889357a [clang-repl] Support statements on global scope in incremental mode.
This patch teaches clang to parse statements on the global scope to allow:
```
./bin/clang-repl
clang-repl> int i = 12;
clang-repl> ++i;
clang-repl> extern "C" int printf(const char*,...);
clang-repl> printf("%d\n", i);
13
clang-repl> %quit
```

Generally, disambiguating between statements and declarations is a non-trivial
task for a C++ parser. The challenge is to allow both standard C++ to be
translated as if this patch does not exist and in the cases where the user typed
a statement to be executed as if it were in a function body.

Clang's Parser does pretty well in disambiguating between declarations and
expressions. We have added DisambiguatingWithExpression flag which allows us to
preserve the existing and optimized behavior where needed and implement the
extra rules for disambiguating. Only few cases require additional attention:
  * Constructors/destructors -- Parser::isConstructorDeclarator was used in to
    disambiguate between ctor-looking declarations and statements on the global
    scope(eg. `Ns::f()`).
  * The template keyword -- the template keyword can appear in both declarations
    and statements. This patch considers the template keyword to be a declaration
    starter which breaks a few cases in incremental mode which will be tackled
    later.
  * The inline (and similar) keyword -- looking at the first token in many cases
    allows us to classify what is a declaration.
  * Other language keywords and specifiers -- ObjC/ObjC++/OpenCL/OpenMP rely on
    pragmas or special tokens which will be handled in subsequent patches.

The patch conceptually models a "top-level" statement into a TopLevelStmtDecl.
The TopLevelStmtDecl is lowered into a void function with no arguments.
We attach this function to the global initializer list to execute the statement
blocks in the correct order.

Differential revision: https://reviews.llvm.org/D127284
2022-12-03 07:18:07 +00:00
Jan Svoboda 7806a92868 [clang][modules][deps] Serialize inputs into PCMs using the "as requested" name
This patch changes the PCM serialization logic to refer to input files by their "requested" name. This fixes a bug where the dependency scanner reports the "final" file paths, which can result in failed explicit compiles due to the `module.modulemap` file not being surrounded by the expected framework directory structure.

Depends on D135634.

Reviewed By: benlangmuir, Bigcheese

Differential Revision: https://reviews.llvm.org/D135636
2022-12-02 16:12:16 -08:00
Volodymyr Sapsai 642c6638a3 Reland "[clang][deps] During scanning don't emit warnings-as-errors that are ignored with diagnostic pragmas."
This reverts commit 2f8ac18048.

After committing a fix for previous buildbot failures in D138970,
re-landing the original change.
2022-12-02 14:30:41 -08:00
Jan Svoboda d3804b88e9 [clang][deps] Fix test failures on AIX 2022-12-02 13:10:07 -08:00
Akira Hatanaka 1127e479e8 Don't revisit the subexpressions of PseudoObjectExpr when building a
ParentMap

The assertion that is removed in this patch was failing when ObjC dot
notation expressions appear in both sides of an assignment (see the test
case in arc-repeated-weak.mm). Visit the PseudoObjectExpr once when the
syntactic expression is visited and return without visiting the
subexpressions when it's visited again when the semantic expressions are
visited.

Differential Revision: https://reviews.llvm.org/D139171
2022-12-02 11:41:09 -08:00
Mitch Phillips c414bbefe4 Make -fsanitize=scudo use scudo_standalone. Delete check-scudo.
Leaves the implementation and tests files in-place for right now, but
deletes the ability to build the old sanitizer-common based scudo. This
has been on life-support for a long time, and the newer scudo_standalone
is much better supported and maintained.

Also patches up some GWP-ASan wording, primarily related to the fact
that -fsanitize=scudo now is scudo_standalone, and therefore the way to
reference the GWP-ASan options through the environment variable has
changed.

Future follow-up patches will delete the original scudo, and migrate all
its tests over to be part of the scudo_standalone test suite.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D138157
2022-12-02 11:29:41 -08:00
Fangrui Song 9f07256a51 [Driver] -p: change from unused warning to error for most targets
AIX and OpenBSD seem to use -p. For most targets (at least FreeBSD and Linux),
-p is legacy (GCC freebsd has a warning). We don't want the uses to grow, so
making -p an alias for -pg is not recommended. I think the uses are small.

Reviewed By: mgorny

Differential Revision: https://reviews.llvm.org/D138255
2022-12-02 18:57:48 +00:00
Jan Svoboda 50fd6604b7 Reapply "[clang][modules][deps] Including module maps are affecting"
This reverts commit f0ce827c69.
This reapplies commit 83973cf157.
The new test now should pass on Windows thanks to commit 4d6483e91b.
2022-12-02 10:46:48 -08:00
Jan Svoboda 4d6483e91b Reapply "[clang][modules][deps] Parent module maps are affecting"
This reverts commit 67f34054d6.
This reapplies commit f99e5a9106.
This improves commit 8ab388e158 that unsucessfully attempted to forward-fix Windows test failure.
2022-12-02 10:32:47 -08:00
Paul Robinson 64e4d03c68 [lit][AIX] Convert clang tests to use 'target={{.*}}-aix{{.*}}'
Part of the project to eliminate special handling for triples in lit
expressions.

Differential Revision: https://reviews.llvm.org/D137437
2022-12-02 09:44:15 -08:00
Vlad Serebrennikov eba4efcb05 [clang] Remove unused bookmark in CWG360 test (NFC) 2022-12-02 11:52:19 +03:00
Jan Svoboda 67f34054d6 Revert "[clang][modules][deps] Parent module maps are affecting"
This reverts commit f99e5a9106.
2022-12-01 21:39:51 -08:00
Jan Svoboda f0ce827c69 Revert "[clang][modules][deps] Including module maps are affecting"
This reverts commit 83973cf157.
2022-12-01 21:39:51 -08:00
Jan Svoboda 83973cf157 [clang][modules][deps] Including module maps are affecting
With this patch, we mark module maps that include an affecting `extern` module map as also affecting. This is a generalization of D137197: now we don't require the importing module map to describe parent of the extern module.

Depends on D137198.

Reviewed By: Bigcheese

Differential Revision: https://reviews.llvm.org/D137206
2022-12-01 20:16:17 -08:00
Jan Svoboda f99e5a9106 [clang][modules][deps] Parent module maps are affecting
Currently, the algorithm for gathering affecting module maps includes only those defining modules that include some headers. This is not entirely correct, though. Some module maps might be "importing" module maps for `extern` submodules. Such parent module maps are affecting - they do change semantics of the compilation. This patch adds parent module maps into the set of affecting module maps.

Depends on D137197.

Reviewed By: Bigcheese

Differential Revision: https://reviews.llvm.org/D137198
2022-12-01 20:16:17 -08:00
Jan Svoboda ed07fe71d7 [clang][modules][deps] Transitive module maps are not affecting
Currently, the algorithm for gathering affecting module maps includes those defining transitive dependencies. This seems like an over-approximation, since those don't change the semantics of current module build.

(With this patch, `ModulesToProcess` only ever holds modules whose headers will be serialized into the current PCM.)

Reviewed By: Bigcheese

Differential Revision: https://reviews.llvm.org/D137197
2022-12-01 20:16:17 -08:00
Jan Svoboda 935a07ed21 [clang][deps][lex] Avoid canonicalization of remapped framework directories
In D134923, the scanner introduced canonicalization of framework directories when reporting module map paths in order to increase module sharing. However, if we canonicalize framework directory that plays a role in a VFS remapping, and later try to use that module map to build the module, header lookup can fail. This happens when the module headers are remapped using the original framework path.

This patch fixes that. The implementation relies on the fact that the chain of directories in VFS remapping are assigned `DirectoryEntry` objects distinct from their on-disk counterparts. If we detect that case, we avoid the canonicalization.

Reviewed By: benlangmuir

Differential Revision: https://reviews.llvm.org/D135841
2022-12-01 19:59:54 -08:00
Mitch Phillips 850defb861 Add assembler plumbing for sanitize_memtag
Extends the Asm reader/writer to support reading and writing the
'.memtag' directive (including allowing it on internal global
variables). Also add some extra tooling support, including objdump and
yaml2obj/obj2yaml.

Test that the sanitize_memtag IR attribute produces the expected asm
directive.

Uses the new Aarch64 MemtagABI specification
(https://github.com/ARM-software/abi-aa/blob/main/memtagabielf64/memtagabielf64.rst)
to identify symbols as tagged in object files. This is done using a
R_AARCH64_NONE relocation that identifies each tagged symbol, and these
relocations are tagged in a special SHT_AARCH64_MEMTAG_GLOBALS_STATIC
section. This signals to the linker that the global variable should be
tagged.

Reviewed By: fmayer, MaskRay, peter.smith

Differential Revision: https://reviews.llvm.org/D128958
2022-12-01 10:50:34 -08:00
Vlad Serebrennikov f5993fc775 [clang] Add test for CWG36
Reviewed By: #clang-language-wg, aaron.ballman, erichkeane

Differential Revision: https://reviews.llvm.org/D138822
2022-12-01 21:10:28 +03:00
Shafik Yaghmour ef10f81985 [Clang] Adjust assert from Sema::BuildCXXTypeConstructExpr
Currently Sema::BuildCXXTypeConstructExpr asserts that list initialization must
mean we have an InitListExpr as well. We have several cases of valid code the
result in CXXTemporaryObjectExpr in the AST instead for list initialization.
Commit 1ae689c seems to indicate that this is not unexpected, although may be a
design issue

This fixes:

  https://github.com/llvm/llvm-project/issues/58302
  https://github.com/llvm/llvm-project/issues/58753
  https://github.com/llvm/llvm-project/issues/59100

Differential Revision: https://reviews.llvm.org/D138947
2022-12-01 09:40:18 -08:00
Paul Robinson aa149687dc [PS4/PS5] Canonicalize tests to use 'target=.*-(ps4|ps5)'
This allows grepping for ps4 or ps5 to continue to work.
2022-12-01 07:21:07 -08:00
Vlad Serebrennikov 3f950ad589 [clang] Add test for CWG360
P1787: "CWG360 is resolved by applying access control to using-declarations."
[[ http://eel.is/c++draft/class.access#general-4.sentence-3 | class.access.general#4 ]]: "When a using-declarator is named, access control is applied to it, not to the declarations that replace it."

Reviewed By: #clang-language-wg, aaron.ballman

Differential Revision: https://reviews.llvm.org/D139090
2022-12-01 17:23:26 +03:00
Shoaib Meenai df43ec30ab [Driver] Add test for -stdlib++-isystem with -nostdinc
This further clarifies the intent of the flag.
2022-11-30 23:09:28 -08:00
Xiang1 Zhang 94c5df8a76 [AMX] Support AMX-FP16 new intrinsic interface
We support AMX-FP16 isa in https://reviews.llvm.org/D135941 now.
The old  intrinsic interface need to manually write tile registers.
So we support its new intrinsic interface to let it be able to do register allocation.

Reviewed By: LuoYuanke

Differential Revision: https://reviews.llvm.org/D138987
2022-12-01 09:47:53 +08:00
gonglingqin 624401612c [LoongArch] Add remaining intrinsics for CRC check instructions
After D137316 implements the intrinsics of the first crc check instruction
and related diagnosis, this patch implements the intrinsics of all remaining
crc check instructions.

Differential Revision: https://reviews.llvm.org/D138418
2022-12-01 09:40:50 +08:00
Shoaib Meenai 658a503937 [Driver] Only check -nostdinc++ for -stdlib++-isystem
A drive-by change in 53c98d85a8 made
-stdlib++-isystem be suppressed by -nostdinc and -nostdlibinc in
addition to -nostdinc++. However, that's contrary to the intent of the
flag. It's common to provide your own C++ headers (e.g. when building
libc++ by itself or as a compiler-rt dependency) but rely on the system
C headers, and having -stdlib++-isystem only look at -nostdinc++ allows
us to customize both the C header path (via -nostdinc or -nostdlibinc)
and the C++ header path (via -stdlib++-isystem) at the toolchain level
but still let users of the toolchain provide their own C++ headers. Add
a comment explaining the rationale to make it clearer.
2022-11-30 16:55:51 -08:00
Marco Elver b95646fe70 Revert "Use-after-return sanitizer binary metadata"
This reverts commit d3c851d3fc.

Some bots broke:

- https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8796062278266465473/overview
- https://lab.llvm.org/buildbot/#/builders/124/builds/5759/steps/7/logs/stdio
2022-11-30 23:35:50 +01:00
Paul Robinson b6a73d06ba [analyzer] Test depends on windows as host, not target 2022-11-30 14:11:51 -08:00
Paul Robinson 2fbcf8b9b3 [Hexagon] Convert tests to check 'target=hexagon-.*'
Part of the project to eliminate special handling for triples in lit
expressions.
2022-11-30 13:36:10 -08:00
Paul Robinson 57b1c0250d [Windows] Canonicalize on 'target=.*-windows'
Part of the project to eliminate special handling for triples in lit
expressions.
2022-11-30 12:07:27 -08:00
Paul Robinson b8da574c0d [PS4/PS5] Convert tests to check 'target=<triple>'
Part of the project to eliminate special handling for triples in lit
expressions.
2022-11-30 12:02:30 -08:00
Sanjay Patel e71b81cab0 [InstCombine] canonicalize trunc + insert as bitcast + shuffle, part 1 (2nd try)
The first attempt was reverted because a clang test changed
unexpectedly - the file is already marked with a FIXME, so
I just updated it this time to pass.

Original commit message:
This is the main patch for converting a truncated scalar that is
inserted into a vector to bitcast+shuffle. We could go either way
on patterns like this, but this direction will allow collapsing a
pair of these sequences on the motivating example from issue

The patch is split into 3 parts to make it easier to see the
progression of tests diffs. We allow inserting/shuffling into a
different size vector for flexibility, so there are several test
variations. The length-changing is handled by shortening/padding
the shuffle mask with undef elements.

In part 1, handle the basic pattern:
inselt undef, (trunc T), IndexC --> shuffle (bitcast T), IdentityMask

Proof for the endian-dependency behaving as expected:
https://alive2.llvm.org/ce/z/BsA7yC

The TODO items for handling shifts and insert into an arbitrary base
vector value are implemented as follow-ups.

Differential Revision: https://reviews.llvm.org/D138872
2022-11-30 14:52:20 -05:00