- Jan 31, 2024
-
-
Tianlan Zhou authored
### Description clang don't evaluate the object argument of `static operator()` and `static operator[]` currently, for example: ```cpp #include <iostream> struct Foo { static int operator()(int x, int y) { std::cout << "Foo::operator()" << std::endl; return x + y; } static int operator[](int x, int y) { std::cout << "Foo::operator[]" << std::endl; return x + y; } }; Foo getFoo() { std::cout << "getFoo()" << std::endl; return {}; } int main() { std::cout << getFoo()(1, 2) << std::endl; std::cout << getFoo()[1, 2] << std::endl; } ``` `getFoo()` is expected to be called, but clang don't call it currently (17.0.2). This PR fixes this issue. Fixes #67976. ### Walkthrough - **clang/lib/Sema/SemaOverload.cpp** - **`Sema::CreateOverloadedArraySubscriptExpr` & `Sema::BuildCallToObjectOfClassType`** Previously clang generate `CallExpr` for static operators, ignoring the object argument. In this PR `CXXOperatorCallExpr` is generated for static operators instead, with the object argument as the first argument. - **`TryObjectArgumentInitialization`** `const` / `volatile` objects are allowed for static methods, so that we can call static operators on them. - **clang/lib/CodeGen/CGExpr.cpp** - **`CodeGenFunction::EmitCall`** CodeGen changes for `CXXOperatorCallExpr` with static operators: emit and ignore the object argument first, then emit the operator call. - **clang/lib/AST/ExprConstant.cpp** - **`ExprEvaluatorBase::handleCallExpr`** Evaluation of static operators in constexpr also need some small changes to work, so that the arguments won't be out of position. - **clang/lib/Sema/SemaChecking.cpp** - **`Sema::CheckFunctionCall`** Code for argument checking also need to be modify, or it will fail the test `clang/test/SemaCXX/overloaded-operator-decl.cpp`. ### Tests - **Added:** - **clang/test/AST/ast-dump-static-operators.cpp** Verify the AST generated for static operators. - **clang/test/SemaCXX/cxx2b-static-operator.cpp** Static operators should be able to be called on const / volatile objects. - **Modified:** - **clang/test/CodeGenCXX/cxx2b-static-call-operator.cpp** - **clang/test/CodeGenCXX/cxx2b-static-subscript-operator.cpp** Matching the new CodeGen. ### Documentation - **clang/docs/ReleaseNotes.rst** Update release notes. --------- Co-authored-by:Shafik Yaghmour <shafik@users.noreply.github.com> Co-authored-by:
cor3ntin <corentinjabot@gmail.com> Co-authored-by:
Aaron Ballman <aaron@aaronballman.com>
-
michaelrj-google authored
The epoll_wait functions are syscall wrappers that were requested by upstream users. This patch adds them, as well as their header and types. The tests are currently incomplete since they require epoll_create to properly test epoll_wait. That will be added in a followup patch since this one is already very large.
-
Felipe de Azevedo Piovezan authored
The current implementation of DebugNames is _only_ using hashes to compute the bucket number. Once inside the bucket, it reverts back to string comparisons, even though not all hashes inside a bucket are identical. This commit changes the behavior so that we check the hash before comparing strings. Such check is so important that it speeds up a simple benchmark by 20%. In other words, the following expression evaluation time goes from 1100ms to 850ms. ``` bin/lldb \ --batch \ -o "b CodeGenFunction::GenerateCode" \ -o run \ -o "expr Fn" \ -- \ clang++ -c -g test.cpp -o /dev/null &> output ``` (Note, these numbers are considering the usage of IDX_parent)
-
Craig Topper authored
If the input is non-zero, this intrinsic should also return a non-zero value.
-
Craig Topper authored
The alignment is directly encoded in the attribute. There doesn't seem to be a good reason to give the possible alignments a name.
-
Craig Topper authored
ConstantExpr does not use HungOffUses. If we know that the Instruction the Operator subclass can represent also does not use HungOffUses, we can be more efficient than falling back to User::getOperand.
-
Zixu Wang authored
-
fabrizio-indirli authored
Enable the fusion of parallel loops also when the 1st loop contains multiple write accesses to the same buffer, if the accesses are always on the same indices. Fix LIT test cases whose loops were not being fused. Signed-off-by:Fabrizio Indirli <Fabrizio.Indirli@arm.com>
-
Wanyi authored
Number of threads will automatically be set to a good value
-
Vyacheslav Levytskyy authored
This PR fixes https://github.com/llvm/llvm-project/issues/79057 and improves code generation for opaque pointers by replacing the culprit SPIRVGlobalRegistry::getOpTypePointer() call with a more appropriate SPIRVGlobalRegistry::getOrCreateSPIRVPointerType() call. The latter function works together with the `DuplicatesTracker` (`SPIRVGeneralDuplicatesTracker DT;` from `class SPIRVGlobalRegistry`) to trace existence of previous definitions of opaque pointers. This allows to produce just one `OpTypePointer` command for all identical opaque pointers definitions and to return the very same type record for subsequent `SPIRVGlobalRegistry::createSPIRVType()` invocations. This PR alone improves code generation by producing a single needed definition per all opaque pointers to i8 of the same address space instead of multiple identical definitions produced before the patch. From the root cause analysis of https://github.com/llvm/llvm-project/issues/79057 we see also that this PR resolves the problem of inconsistency between keeping multiple instruction for identical opaque pointer types and just a single record for all such instructions in the `DuplicatesTracker`, and so it also resolves the issue with crashes on creation of a struct with opaque pointer fields due to the fact that now such struct fields refer to the same operand `<id>` having a required record in the data structure used for dependencies analysis (see https://github.com/llvm/llvm-project/issues/79057).
-
Vyacheslav Levytskyy authored
prevent undefined behaviour of SPIR-V Backend non-asserts builds when dealing with token type (#78437) The goal of this PR is to fix the issue when use of token type in LLVM intrinsic causes undefined behavior of SPIR-V Backend code generator when assertions are disabled: https://github.com/llvm/llvm-project/issues/78434 Among possible fix options, discussed in the https://github.com/llvm/llvm-project/issues/78434 issue description, the option to generate a meaningful error before execution arrives at the `llvm_unreachable` call looks like a better solution for now, because SPIR-V doesn't support token type anyway without additional extensions. The PR is to generate a user-friendly error message and exit without generating a stack dump when such a usage of token type was detected that would lead to undefined behavior of SPIR-V Backend code generator.
-
Vyacheslav Levytskyy authored
The goal of this PR is to fix the issue of global unnamed variables causing SPIR-V Backend code generation to crash: https://github.com/llvm/llvm-project/issues/78278 The reason for the crash is that GlobalValue's getGlobalIdentifier() would fail for unnamed global variable when trying to access the first character of the name (see lib/IR/Globals.cpp:150). This leads to assert in Debug and undefined behaviour in Release builds. The proposed fix generates a name of an unnamed global variable as __unnamed_<unsigned number>, in a style of similar existing LLVM implementation (see lib/IR/Mangler.cpp:131). A new class member variable is added into `SPIRVInstructionSelector` class to keep track of the number we give to anonymous global values to generate the same name every time when this is needed. The patch adds a new LIT test with the smallest implementation of reproducer ll code.
-
Joel Wee authored
-
Daniel Chen authored
This PR adds lowering the reference to a function that returns a procedure pointer. It also fixed intrinsic ASSOCIATED to take such argument. --------- Co-authored-by:jeanPerier <jperier@nvidia.com>
-
Nick Desaulniers authored
To build libc docs: - Configure with `-DLLVM_ENABLE_SPHINX=ON -DLIBC_INCLUDE_DOCS=ON` - Build with `ninja docs-libc-html`
-
Matthias Springer authored
After #75103, `MLPrgramTransforms` depends on `BufferizationDialect`. Also fix an unrelated compile error in `GreedyPatternRewriteDriver.cpp`. (This was not failing on CI. I may be running an old compiler locally.)
-
Shengchen Kan authored
To share code for folding broadcast in #79761
-
Thomas Preud'homme authored
Currently cast from FP to int is implemented by clamping on the min and max integer values in the floating-point domain and then converting to integer. However, the max int values are often non representable in the floating-point input type due to lack of mantissa bits. This patch instead use a select acting on a compare against max int + 1 which is representable in floating-point. It also has a special lowering for cases where the integer range is wider than the floating-point range to clamp the infinite values.
-
Stefan Gränitz authored
This function is used in `jitlink-check` lines in LIT tests. In #78371 I missed to swap initial instruction bytes for systems that store the constants as big-endian.
-
- Jan 30, 2024
-
-
Benjamin Maxwell authored
This folded casts into `memref.transpose` without updating the result type of the transpose op, which resulted in IR that failed to verify for statically sized memrefs. i.e. ```mlir %cast = memref.cast %0 : memref<?x4xf32> to memref<?x?xf32> %transpose = memref.transpose %cast : memref<?x?xf32> to memref<?x?xf32> ``` would fold to: ```mlir // Fails verification: %transpose = memref.transpose %cast : memref<?x4xf32> to memref<?x?xf32> ```
-
Ryan Holt authored
There is currently no lowering out of `ml_program` in the LLVM repository. This change adds a lowering to `memref` so that it can be lowered all the way to LLVM. This lowering was taken from the [reference backend in torch-mlir](https://github.com/llvm/torch-mlir/commit/f41695360019bde71d52ca7548944d5488779e12 ). I had tried implementing the `BufferizableOpInterface` for `ml_program` instead of adding a new pass but that did not work because `OneShotBufferize` does not visit module-level ops like `ml_program.global`.
-
Simon Pilgrim authored
-
Hirofumi Nakamura authored
[clang-format] Support of TableGen tokens with unary operator like form, bang operators and numeric literals. (#78996) Adds the support for tokens that have forms like unary operators. - bang operators: `!name` - cond operator: `!cond` - numeric literals: `+1`, `-1` cond operator are one of bang operators but is distinguished because it has very specific syntax.
-
Joseph Huber authored
Summary: This test was added to test the generated header. Unfortunately this doesn't work if the header is never generated. Add a check to make sure the user has included it in the list of headers.
-
Nico Weber authored
-
Nico Weber authored
-
Louis Dionne authored
-
Louis Dionne authored
-
Boian Petkantchin authored
There are assumptions of matching/consistent paths of execution under SPMD that allow to have pure collective communication operations.
-
Billy Laws authored
'arm64ecpe' was chosen arbitrarily as gcc MinGW doesn't provide EC support.
-
erichkeane authored
The 'gang' clause takes a 'gang-arg-list', which is one of three 'tag' values, followed by either an 'int-expr' or a 'size-expr', both of which we already have parsing functions for. The optional tag values are only slightly complicated, as one is a keyword (static), so mild modifications needed to be made for that.
-
Hristo Hristov authored
I got tripped twice after: 7b462251 Let's at least mention these in the `Contributing.rst` doc.
-
Guillaume Chatelet authored
-
David Benjamin authored
This aligns std::deque with std::vector w.r.t. hardening checks. There's probably more that can be done with iterators, but start with this. This caught a bug with one of libc++'s tests. One of the erase calls in asan_caterpillar.pass.cpp was a no-op because the iterators were in the other order. (deque::erase happened to cleanly do nothing when the distance is negative.) Fixes #63809
-
Alexey Bataev authored
-
Joseph Huber authored
Summary: Recent patches have added some missing intrinsic functions NVPTX. This patch gets rid of all the remaining uses of inline assembly. The one change that wasn't directly replaced with a built-in was the `pack` and `unpack` implementations. However, using the generic C implementation is equivalent to the output SASS when run through PTXAS.
-
Jay Foad authored
Change the implementation of getLastCalleeSavedAlias to use RegUnits instead of register aliases. This is much faster on targets like AMDGPU which define a very large number of overlapping register tuples. No functional change intended. If PhysReg overlaps multiple CSRs then getLastCalleeSavedAlias(PhysReg) could conceivably return a different arbitrary one, but currently it is only used for some debug printing anyway. Differential Revision: https://reviews.llvm.org/D146734
-
Florian Hahn authored
Add custom combine to lower load <3 x i8> as the more efficient sequence below: ldrb wX, [x0, #2] ldrh wY, [x0] orr wX, wY, wX, lsl #16 fmov s0, wX At the moment, there are almost no cases in which such vector operations will be generated automatically. The motivating case is non-power-of-2 SLP vectorization: https://github.com/llvm/llvm-project/pull/77790
-
Alex Bradbury authored
Adds unsafe-fp-math, no-infs-fp-math, no-nans-fp-math, approx-func-fp-math, and no-signed-zeros-fp-math function attributes. This allows code generators using the LLVMIR dialect to match the codegen of Clang.
-
ita-sc authored
This patch fix connection for LLDB for remote gdb server running on RISC-V. You can test connection with OpenOCD or qemu-riscv64.
-