Skip to content

LLVM and SPIRV-LLVM-Translator pulldown (WW45) #7259

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

Merged
merged 794 commits into from
Nov 4, 2022

Conversation

Fznamznon
Copy link
Contributor

@Fznamznon Fznamznon commented Nov 2, 2022

hokein and others added 30 commits October 31, 2022 11:19
The OpenMP standard specifies the region inside to be a structured
block. This means that branches into or out of the region is not
permitted but branches are permitted inside the OpenMP single region.
This is currently modeled by having a region of kind `AnyRegion` for
all the OpenMP ops. In future we can have a more strictly defined
region.

Fixes #58396.

Reviewed By: peixin

Differential Revision: https://reviews.llvm.org/D137023
…shift

((X >> C) - Y) + Z --> (Z - Y) + (X >> C)

Fix AArch part: #55714

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D136158
When streaming mode is enabled, lower some operations and disable some code paths;
to force generateing code compatible to streaming mode.
Add streaming-mode flag for new sve-fixed-length testing files:
build_vector.ll
concat.ll
extract-subvector.ll
extract-vector-elt.ll
int-shifts.ll
loads.ll
shuffle.ll
stores.ll

Differential Revision: https://reviews.llvm.org/D135564
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
    intel#2 0x55dbec508578 in invokeDtor clang/lib/AST/Interp/InterpBlock.h:79:7
    intel#3 0x55dbec508578 in clang::interp::Program::~Program() clang/lib/AST/Interp/Program.h:55:19
    intel#4 0x55dbec50657a in operator() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:55:5
    intel#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
    intel#6 0x55dbec5035a1 in clang::interp::Context::~Context() clang/lib/AST/Interp/Context.cpp:27:22
    intel#7 0x55dbebec1daa in operator() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:55:5
    intel#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
    intel#9 0x55dbebe285f9 in clang::ASTContext::~ASTContext() clang/lib/AST/ASTContext.cpp:1038:40
    intel#10 0x55dbe941ff13 in llvm::RefCountedBase<clang::ASTContext>::Release() const llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:101:7
    intel#11 0x55dbe94353ef in release llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:159:38
    intel#12 0x55dbe94353ef in release llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:224:7
    intel#13 0x55dbe94353ef in ~IntrusiveRefCntPtr llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:191:27
    intel#14 0x55dbe94353ef in clang::CompilerInstance::setASTContext(clang::ASTContext*) clang/lib/Frontend/CompilerInstance.cpp:178:3
    intel#15 0x55dbe95ad0ad in clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:1100:8
    intel#16 0x55dbe9445fcf in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:1047:11
    intel#17 0x55dbe6b3afef in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:266:25
    intel#18 0x55dbe6b13288 in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) clang/tools/driver/cc1_main.cpp:250:15
    intel#19 0x55dbe6b0095f in ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) clang/tools/driver/driver.cpp:319:12
    intel#20 0x55dbe6aff41c in clang_main(int, char**) clang/tools/driver/driver.cpp:395:12
    intel#21 0x7f9be07fa632 in __libc_start_main
    intel#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
    intel#2 0x55dbec5094ac in ~SmallVectorImpl llvm/include/llvm/ADT/SmallVector.h:612:3
    intel#3 0x55dbec5094ac in llvm::SmallVector<clang::interp::Record::Base, 8u>::~SmallVector() llvm/include/llvm/ADT/SmallVector.h:1207:3
    intel#4 0x55dbec508e79 in clang::interp::Record::~Record() clang/lib/AST/Interp/Record.h:24:7
    intel#5 0x55dbec508612 in clang::interp::Program::~Program() clang/lib/AST/Interp/Program.h:49:26
    intel#6 0x55dbec50657a in operator() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:55:5
    intel#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
    intel#8 0x55dbec5035a1 in clang::interp::Context::~Context() clang/lib/AST/Interp/Context.cpp:27:22
    intel#9 0x55dbebec1daa in operator() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:55:5
    intel#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
    intel#11 0x55dbebe285f9 in clang::ASTContext::~ASTContext() clang/lib/AST/ASTContext.cpp:1038:40
    intel#12 0x55dbe941ff13 in llvm::RefCountedBase<clang::ASTContext>::Release() const llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:101:7
    intel#13 0x55dbe94353ef in release llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:159:38
    intel#14 0x55dbe94353ef in release llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:224:7
    intel#15 0x55dbe94353ef in ~IntrusiveRefCntPtr llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:191:27
    intel#16 0x55dbe94353ef in clang::CompilerInstance::setASTContext(clang::ASTContext*) clang/lib/Frontend/CompilerInstance.cpp:178:3
    intel#17 0x55dbe95ad0ad in clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:1100:8
    intel#18 0x55dbe9445fcf in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:1047:11
    intel#19 0x55dbe6b3afef in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:266:25
    intel#20 0x55dbe6b13288 in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) clang/tools/driver/cc1_main.cpp:250:15
    intel#21 0x55dbe6b0095f in ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) clang/tools/driver/driver.cpp:319:12
    intel#22 0x55dbe6aff41c in clang_main(int, char**) clang/tools/driver/driver.cpp:395:12
    intel#23 0x7f9be07fa632 in __libc_start_main
    intel#24 0x55dbe6a702e9 in _start
This aligns with what was done for SVE, which consistently uses 32bit
immediates at the LLVM IR level.

Additionally, this change forces the intrinsic operands to be immediates
using ImmArg<>, which subsequently requires the codegenerator to match
TargetConstants instead of Constants.

Reviewed By: paulwalker-arm

Differential Revision: https://reviews.llvm.org/D136933
Only add the option processing and store the result. No attributes are
added to FIR yet.

Only the "off" and "fast" options are supported. "fast-honor-pragmas" is not applicable because we do not implement `#pragma clang fp contract()` in Fortran [1]. "on" is not supported because it is unclear how to fuse only within individual statements. gfortran also does not implement "on": treating it as an "off".

Currently the default value is "off" to preserve existing behavior. gfortran uses "fast" by default and that may be the right thing for flang-new after further discussion in the future, but that can be changed separately. gfortran's documentation is available [[ https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html | here ]].

[1] https://clang.llvm.org/docs/LanguageExtensions.html#extensions-to-specify-floating-point-flags

Reviewed By: vzakhari, awarzynski

Differential Revision: https://reviews.llvm.org/D136080
…int (__cdecl *)(int)' to '`anonymous-namespace'::Plus1FunctionRef::FuncT'"
…parate functions

Hopefully makes the code more readable and allows
us to re-use argument pretty-printing code from
the `CPlusPlusLanguage` plugin in a follow-up commit.

Differential Revision: https://reviews.llvm.org/D136934
This patch adds a way to extract the return type out
of the `CPlusPlusNameParser`. This will be useful
for cases where we want a function's basename *and* the
return type but not the function arguments; this is
currently not possible (the parser either gives us the
full name or just the basename). Since the parser knows
how to handle return types already we should just expose
this to users that need it.

**Testing**

* Added unit-tests

Differential Revision: https://reviews.llvm.org/D136935
This patch implements the `GetFunctionDisplayName` API which gets
used by the frame-formatting code to decide how to print a
function name.

Currently this API trivially returns `false`, so we try to parse
the demangled function base-name by hand. We try find the closing
parenthesis by doing a forward scan through the demangled name. However,
for arguments that contain parenthesis (e.g., function pointers)
this would leave garbage in the frame function name.

By re-using the `CPlusPlusLanguage` parser for this we offload the
need to parse function names to a component that knows how to do this
already.

We leave the existing parsing code in `FormatEntity` since it's used
in cases where a language-plugin is not available (and is not
necessarily C++ specific).

**Example**

For following function:
```
int foo(std::function<int(void)> const& func) { return 1; }
```

Before patch:
```
frame #0: 0x000000010000151c a.out`foo(func= Function = bar() )> const&) at sample.cpp:11:49
```

After patch:
```
frame #0: 0x000000010000151c a.out`foo(func= Function = bar() ) at sample.cpp:11:49
```

**Testing**

* Added shell test
…AFFINEQB(z,w,c)) -> GF2P8AFFINEQB(concat(x,z),concat(y,w),c)

Pulled out of D137026
The sme2 predicate was as AssemblerPredicate, not
AssemblerPredicateWithAll like all the other features, meaning it wasn't
included in +all. This fixes that inconsistency, allowing the
instructions to be decoded by default.

Differential Revision: https://reviews.llvm.org/D137016
This is a sibling to:
6064e92
...but we canonicalize the shl+add to shl+xor,
so the pattern is different than I expected:
https://alive2.llvm.org/ce/z/8CX16e

I have not found any patterns that are safe
to propagate no-wrap, so that is not included
here.
Now isa supports the variant args, which could simplify the codes
further. This patch simplify the uses in clang/Serialization
This patch adds the assembly/disassembly for the following instructions:

sqrshrn  : Signed saturating rounding shift right narrow by immediate and interleave
sqrshrun : Signed saturating rounding shift right unsigned narrow by immediate and interleave
uqrshrn  : Unsigned saturating rounding shift right narrow by immediate and interleave

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09

Differential Revision: https://reviews.llvm.org/D136690
Allowing us to test this feature (context: a recent crash in
semantic highlighting.)

Differential Revision: https://reviews.llvm.org/D137063
…untime call

The runtime function `AllocatableDeallocate/PointerDeallocate` is reponsible to
deallocate and finalize it. This patch just adds tests to make sure the correct
runtime function is called.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D137068
Exclude building googletest and LLVMTestingSupport libraries from
the `all` target.  If unittests are being built, these libraries will
be built as a dependency anyway.  If they are not being built, building
them makes little sense as they are not installed or used otherwise.

This will also make standalone builds of other projects easier, as it
makes it possible to include these directories without having to cover
them with additional conditions to prevent them from being built
unconditionally.

Differential Revision: https://reviews.llvm.org/D137035
The existing way of creating the predicate in the guard blocks uses
a boolean value per outgoing block. This increases the number of live
booleans as the number of outgoing blocks increases. The new way added
in this change is to store one integer to represent the outgoing block
we want to branch to, then at each guard block, an integer equality
check is performed to decide which a specific outgoing block is taken.

Using an integer reduces the number of live values and decreases
register pressure especially in cases where there are a large number
of outgoing blocks. The integer based approach is used when the
number of outgoing blocks crosses a threshold, which is currently set
to 32.

Patch by Ruiling Song.

Differential review: https://reviews.llvm.org/D127831
This reverts commit 6495932.  It broke
the flang-aarch64-out-of-tree buildbot.
PragmaIncludes captures the pragma-based header-mapping information, it is used
in the "Location => Header" step to determine the final spelling header for a
symbol (rather than the header directive).

The structure is by design to be used inside the include-cleaner library
and clangd.

Differential Revision: https://reviews.llvm.org/D136071
Update docs to describe the behaviour when a default-valued attribute is
used as an optional-group's anchor after D134993.

Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D136987
Be less strict about the `std::` namespace string. Depending
on platform it may contain an inline namespace, e.g., `__1`.
This patch moves intrinsic evaluate::Constant<T> lowering into its own
unit outside of ScalarExpr and genarr lowering so that it can
be used by the new lowering without any changes.

DerivedType lowering cannot be shared at that stage because it is too
correlated with the current lowering (requires structure constructor
and designator lowering).

The code had to be refactored quite a bit so that it could be carved
out, but the only "functional" change is that the length of character
arrays lowered by genarr is now `index` instead of `i64` (see test change).
One non-functional benefit of the change is that `toEvExpr` is not
needed anymore and some compile time copies of big constant arrays
that it was causing are removed (see old calls in previous genarr code),
although I am not sure any compile time speed-ups are visible here.

Differential Revision: https://reviews.llvm.org/D136955
david-arm and others added 15 commits November 2, 2022 08:39
This patch adds the assembly/disassembly for the following
predicate pair instructions:

pext:    Set pair of predicates from predicate-as-counter
whilelt: While incrementing signed scalar less than scalar
whilele: While incrementing signed scalar less than or equal to scalar
whilegt: While incrementing signed scalar greater than scalar
whilege: While incrementing signed scalar greater than or equal to scalar
whilelo: While incrementing unsigned scalar lower than scalar
whilels: While incrementing unsigned scalar lower or same as scalar
whilehs: While decrementing unsigned scalar higher or same as scalar
whilehi: While decrementing unsigned scalar higher than scalar

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09

Differential Revision: https://reviews.llvm.org/D136759
This patch extracts the testing logic from `op_tests.cpp` into
`memory_check_utils.h` so we can reuse it for mem* function integration
tests.

This makes testing consistent and thorough.
For instance this catches a bug that got unnoticed during submission of
D136595 and D135134. Integration test for memcmp was only testing a
single size.

This also leverages ASAN to make sure that data is not read / written
outside permitted boundaries

Differential Revision: https://reviews.llvm.org/D136865
This patch adds the assembly/disassembly for the following instructions:

ld1q : Gather load quadwords
st1q : Scatter store quadwords

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09

Differential Revision: https://reviews.llvm.org/D137167
Commit 359bc5c caused
 Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"'
failures in decomposeGEP when the GEP pointer operand is a vector.

Fix is to use DataLayout::getIndexTypeSizeInBits when fetching the
index size, as it will use the scalar type in case of a ptr vector.

Differential Revision: https://reviews.llvm.org/D137185
The new framework makes it explicit which processor feature is being
used and allows for easier per platform customization:
 - ARM cpu now uses trivial implementations to reduce code size.
 - Memcmp, Bcmp and Memmove have been optimized for x86
 - Bcmp has been optimized for aarch64.

This is a reland of https://reviews.llvm.org/D135134 (b3f1d58, 0284148)

Reviewed By: courbet

Differential Revision: https://reviews.llvm.org/D136595
This op dumps the associated payload IR to stderr. It has proven useful for printf-style debugging.

Differential Revision: https://reviews.llvm.org/D137151
Having all these instruction-specific overloads does not seem to
provide any compile-time benefit, so drop them in favor of the
generic methods accepting "const Instruction *". Only leave behind
the per-instruction AAQI overloads, which are part of the internal
implementation.
The proposed layout is test/extensions/[EXT|KHR|Company]

Signed-off-by: Sidorov, Dmitry <[email protected]>

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@71b9125
Make GEP returning vector of pointers in this case

Signed-off-by: Sidorov, Dmitry <[email protected]>

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@a33d3af
@Fznamznon Fznamznon added the disable-lint Skip linter check step and proceed with build jobs label Nov 2, 2022
@Fznamznon Fznamznon requested review from a team and pvchupin as code owners November 2, 2022 19:34
@Fznamznon Fznamznon requested a review from a team as a code owner November 3, 2022 18:55
@Fznamznon
Copy link
Contributor Author

Fznamznon commented Nov 4, 2022

Post commit fails are same as in a39c855 meaning they are unrelated. Precommit fail looks like infra issue, I'll submit an internal tracker.
@pvchupin , does it look good to go?

@pvchupin
Copy link
Contributor

pvchupin commented Nov 4, 2022

post-commit issues are caused by #7167
There is also another new one caused by #7130

It looks good to go.

@pvchupin
Copy link
Contributor

pvchupin commented Nov 4, 2022

/merge

@bb-sycl
Copy link
Contributor

bb-sycl commented Nov 4, 2022

Fri 04 Nov 2022 04:55:58 PM UTC --- Start to merge the commit into sycl branch. It will take several minutes.

@bb-sycl
Copy link
Contributor

bb-sycl commented Nov 4, 2022

Fri 04 Nov 2022 04:59:48 PM UTC --- Merge the branch in this PR to base automatically. Will close the PR later.

@bb-sycl bb-sycl merged commit 25d4b5a into intel:sycl Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disable-lint Skip linter check step and proceed with build jobs
Projects
None yet
Development

Successfully merging this pull request may close these issues.