-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for RISC-V Zce Extension #18
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… refs This patch fixes an issue in which ConstantAsMetadata arguments to a DIArglist, as well as the Constant values referenced by that metadata, would not be always be emitted correctly into bitcode. This patch fixes this issue firstly by searching for ConstantAsMetadata in DIArgLists (previously we would only search for them when directly wrapped in MetadataAsValue), and secondly by enumerating all of a DIArgList's arguments directly prior to enumerating the DIArgList itself. This patch also adds a number of asserts, and no longer treats the arguments to a DIArgList as optional fields when reading/writing to bitcode. Differential Revision: https://reviews.llvm.org/D100572
Some linters get rather upset upon seeing `std::unordered_map<const char*`, because it looks like a map of strings but isn't. lldb uses interned strings so this is not a problem. DenseMap is a better data structure for this anyways, so use that instead.
This way we can add support for other nodes without duplication. Differential Revision: https://reviews.llvm.org/D98774
It seems we can't find the symbols of static members on Windows? The bug is not relevant to what this test is actually testing so let's just XFAIL it.
These flags are being generated by `clang-scan-deps` and it makes sense to ensure it keeps doing so.
`InsertSequence` doesn't take ownership of the pointer so releasing this pointer is just leaking memory. Follow up to D100806 that was fixing other leak sanitizer test failures Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D100846
Eliminate empty shapes from the operands, partially fold all constant shape operands, and fix normal folding. Differential Revision: https://reviews.llvm.org/D100634
Objective-C++ is not yet suppoerted. rdar://76729552 Differential Revision: https://reviews.llvm.org/D100955
We found issues with a number of intrinsics when building them with C++, so it makes sense to guard these tests with some extra RUN lines to build the tests in C++ mode.
Document oldest libstdc++ as 4.8.3, remove a hack for a 4.6 issue. Differential Revision: https://reviews.llvm.org/D100465
This addresses post-commit feedback to cd64273.
"EmptyNodeIntrospection.inc.in" needs to be a source of the action, so that ninja knows to rerun this action if that input changes.
SmallSet may use operator `<` when we insert MIRef elements, so we cannot limit the comparison between different BBs. We allow MIRef() to be less that any initialized MIRef object, otherwise, we always reture false when compare between different BBs. Differential Revision: https://reviews.llvm.org/D101039
This operation a counterpart of `memref.reshape`. RFC [Reshape Ops Restructuring](https://llvm.discourse.group/t/rfc-reshape-ops-restructuring/3310) Differential Revision: https://reviews.llvm.org/D100971
It is proper to relax non-negative limitation of step_vector. Also this patch adds more combines for step_vector: (sub X, step_vector(C)) -> (add X, step_vector(-C)) Differential Revision: https://reviews.llvm.org/D100812
Split off from D100724. Reviewed By: xbolva00 Differential Revision: https://reviews.llvm.org/D101032
This patch adds strings content checking to printf-2.ll via --check-globals flag. Split off from D100724. Reviewed By: xbolva00 Differential Revision: https://reviews.llvm.org/D101034
Different distributions have different strategies migrating the `python` symlink. Debian and its derivatives provide `python-is-python2` and `python-is-python3`. If neither is installed, the user gets no `/usr/bin/python`. The clang-format-diff script and consequently `arc diff` can thus fail with a python not found error. Since we require python greater than 3.6 as part of llvm prerequisites (https://llvm.org/docs/GettingStarted.html#software), let's go ahead and update this shebang. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D100968
…indirectly_writable`" This reverts commit 0473318 which was failing for multiple people.
We don't have a specific instruction for these, so they should be expanded to whatever separate division & multiplication is needed.
…wo selects" This reverts commit 96dc8d7. It breaks a few builds.
- use `enableZceCMul`、`enableZceCNeg` instead of `hasStdExtZcea`
- fix: wrong Predicates - use switchs
This patch fully implements linker relaxation for RISC-V including relaxation for `R_RISCV_CALL`, `R_RISCV_HI20/LO12`, `R_RISCV_PCREL_HI20/LO12` and handling for `R_RISCV_ALIGN`. Just for reference/link, there were some previous efforts/discussion to implementation linker relaxation in D77694 and D79105. As linker relaxation is highly specific to RISC-V at the moment, most of the work are done in the `Target::finalizeContents()` function and isolated from generic code. For now I'm avoiding trying to come up with a common relaxation framework for multiple targets as their needs may be greatly different. The relaxation process is split into several passes: - For each executable input section, search its relocation vector for `R_RISCV_RELAX` and determine how to relax the previous relocation. - If the relocation is `R_RISCV_CALL` (auipc+jalr pair), try to relax to jal or c.jal if the jump target is in range. This assumes that the PC-relative offset can only become smaller during the relaxation process. - If the relocation is `R_RISCV_HI20/LO12` (absolute addressing) and the target symbol can be addressed from `__global_pointer$` (defaulted to `.sdata+0x800`), delete the `lui` and rewrite the lo part to use `gp` as source register. - If the relocation is `R_RISCV_PCREL_HI20/LO12`, this requires two-pass to relax as `PCREL_LO12` links to its `PCREL_HI20` for address calculation and they may appear in arbitrary order in an input section. To preserve the look up from `PCREL_LO12` the first pass relaxes/deletes`PCREL_LO12` and the second pass handles `PCREL_HI20`. The implementation is simpler than that in bfd because lld doesn't allow addends in `PCREL_LO12` (riscv-non-isa/riscv-elf-psabi-doc#184), and so both parts can be relaxed independently. - The range of bytes are deleted after processing relaxation for a whole input section. This requires adjusting section content, symbol addresses/sizes and relocation offsets, which is handled in `InputSectionBase::deleteRanges`. Compared to other approaches we use a algorithm that is not quadratic by sorting symbols, relocations and bytes to be deleted by offset. - After relaxation, handle alignment as symbols addresses are now fixed modulo section alignment. This is always enabled regardless of the `--relax` option as this is required for correctness. There are still some issues to solve: - `--emit-relocs` will be broken on relaxed section as currently it just copies the corresponding `.rela` section verbatim from input. It needs to be fixed to build relocation entries from the section's relocation vector. - ~~The patch adds two additional `RelExpr` (`R_RISCV_GPREL` and `R_RELAX_HINT`) which unfortunately makes it unable to fit into a 64-bit mask, so it is now changed back to sequential checking. I think it should be somehow split into target-independent (`R_ABS`, `R_PC`, ...) exprs and target-dependent (`R_RISCV_...`, `R_MIPS_...`) exprs which can overlap in numeric range, but it is probably out of the scope of this patch.~~ Differential Revision: https://reviews.llvm.org/D100835
fix: correct the value of offset and bits in fixup_riscv_zce_lwgp emmit R_RISCV_GPREL_ZCE_LWGP for lwgp fix: write16le -> write32le feta: define relocation type for lsgp fix: accept the symbol with %lo modifier feta: relax lw to lwgp & relocation lwgp fix: test case test: add testcase
remove instruction
ChunyuLiao
pushed a commit
to ChunyuLiao/corev-llvm-project
that referenced
this pull request
Nov 16, 2022
Found by msan -fsanitize-memory-use-after-dtor. ==8259==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x55dbec54d2b8 in dtorRecord(clang::interp::Block*, char*, clang::interp::Descriptor*) clang/lib/AST/Interp/Descriptor.cpp:150:22 #1 0x55dbec54bfcf in dtorArrayDesc(clang::interp::Block*, char*, clang::interp::Descriptor*) clang/lib/AST/Interp/Descriptor.cpp:97:7 openhwgroup#2 0x55dbec508578 in invokeDtor clang/lib/AST/Interp/InterpBlock.h:79:7 openhwgroup#3 0x55dbec508578 in clang::interp::Program::~Program() clang/lib/AST/Interp/Program.h:55:19 openhwgroup#4 0x55dbec50657a in operator() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:55:5 openhwgroup#5 0x55dbec50657a in std::__msan::unique_ptr<clang::interp::Program, std::__msan::default_delete<clang::interp::Program>>::~unique_ptr() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:261:7 openhwgroup#6 0x55dbec5035a1 in clang::interp::Context::~Context() clang/lib/AST/Interp/Context.cpp:27:22 openhwgroup#7 0x55dbebec1daa in operator() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:55:5 openhwgroup#8 0x55dbebec1daa in std::__msan::unique_ptr<clang::interp::Context, std::__msan::default_delete<clang::interp::Context>>::~unique_ptr() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:261:7 openhwgroup#9 0x55dbebe285f9 in clang::ASTContext::~ASTContext() clang/lib/AST/ASTContext.cpp:1038:40 openhwgroup#10 0x55dbe941ff13 in llvm::RefCountedBase<clang::ASTContext>::Release() const llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:101:7 openhwgroup#11 0x55dbe94353ef in release llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:159:38 openhwgroup#12 0x55dbe94353ef in release llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:224:7 openhwgroup#13 0x55dbe94353ef in ~IntrusiveRefCntPtr llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:191:27 openhwgroup#14 0x55dbe94353ef in clang::CompilerInstance::setASTContext(clang::ASTContext*) clang/lib/Frontend/CompilerInstance.cpp:178:3 openhwgroup#15 0x55dbe95ad0ad in clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:1100:8 openhwgroup#16 0x55dbe9445fcf in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:1047:11 openhwgroup#17 0x55dbe6b3afef in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:266:25 openhwgroup#18 0x55dbe6b13288 in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) clang/tools/driver/cc1_main.cpp:250:15 openhwgroup#19 0x55dbe6b0095f in ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) clang/tools/driver/driver.cpp:319:12 openhwgroup#20 0x55dbe6aff41c in clang_main(int, char**) clang/tools/driver/driver.cpp:395:12 openhwgroup#21 0x7f9be07fa632 in __libc_start_main openhwgroup#22 0x55dbe6a702e9 in _start Member fields were destroyed #0 0x55dbe6a7da5d in __sanitizer_dtor_callback_fields compiler-rt/lib/msan/msan_interceptors.cpp:949:5 #1 0x55dbec5094ac in ~SmallVectorImpl llvm/include/llvm/ADT/SmallVector.h:479:7 openhwgroup#2 0x55dbec5094ac in ~SmallVectorImpl llvm/include/llvm/ADT/SmallVector.h:612:3 openhwgroup#3 0x55dbec5094ac in llvm::SmallVector<clang::interp::Record::Base, 8u>::~SmallVector() llvm/include/llvm/ADT/SmallVector.h:1207:3 openhwgroup#4 0x55dbec508e79 in clang::interp::Record::~Record() clang/lib/AST/Interp/Record.h:24:7 openhwgroup#5 0x55dbec508612 in clang::interp::Program::~Program() clang/lib/AST/Interp/Program.h:49:26 openhwgroup#6 0x55dbec50657a in operator() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:55:5 openhwgroup#7 0x55dbec50657a in std::__msan::unique_ptr<clang::interp::Program, std::__msan::default_delete<clang::interp::Program>>::~unique_ptr() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:261:7 openhwgroup#8 0x55dbec5035a1 in clang::interp::Context::~Context() clang/lib/AST/Interp/Context.cpp:27:22 openhwgroup#9 0x55dbebec1daa in operator() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:55:5 openhwgroup#10 0x55dbebec1daa in std::__msan::unique_ptr<clang::interp::Context, std::__msan::default_delete<clang::interp::Context>>::~unique_ptr() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:261:7 openhwgroup#11 0x55dbebe285f9 in clang::ASTContext::~ASTContext() clang/lib/AST/ASTContext.cpp:1038:40 openhwgroup#12 0x55dbe941ff13 in llvm::RefCountedBase<clang::ASTContext>::Release() const llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:101:7 openhwgroup#13 0x55dbe94353ef in release llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:159:38 openhwgroup#14 0x55dbe94353ef in release llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:224:7 openhwgroup#15 0x55dbe94353ef in ~IntrusiveRefCntPtr llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:191:27 openhwgroup#16 0x55dbe94353ef in clang::CompilerInstance::setASTContext(clang::ASTContext*) clang/lib/Frontend/CompilerInstance.cpp:178:3 openhwgroup#17 0x55dbe95ad0ad in clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:1100:8 openhwgroup#18 0x55dbe9445fcf in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:1047:11 openhwgroup#19 0x55dbe6b3afef in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:266:25 openhwgroup#20 0x55dbe6b13288 in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) clang/tools/driver/cc1_main.cpp:250:15 openhwgroup#21 0x55dbe6b0095f in ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) clang/tools/driver/driver.cpp:319:12 openhwgroup#22 0x55dbe6aff41c in clang_main(int, char**) clang/tools/driver/driver.cpp:395:12 openhwgroup#23 0x7f9be07fa632 in __libc_start_main openhwgroup#24 0x55dbe6a702e9 in _start
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add support for RISC-V ZCEE extension. Add arch flags and new machine description for instruction used in zce.