aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CIR
AgeCommit message (Collapse)AuthorFilesLines
2025-09-03[OpenACC] Change lowering signature for 'destroy' (#156716)Erich Keane1-3/+7
Patch #156545 is introducing a different syntax for the 'destroy' section of a recipe, which takes the 'original' value as the first argument, and the one-to-be-destroyed as the 2nd. This patch corrects the lowering to match that signature.
2025-09-03[CIR] Upstream Atomic init for ComplexType (#156518)Amr Hesham1-5/+7
This change adds support for Atomic init for ComplexType Issue: https://github.com/llvm/llvm-project/issues/141365
2025-09-03[CIR] Upstream FPToFPBuiltin ACosOp (#156356)Amr Hesham3-0/+30
Upstream support for FPToFPBuiltin ACosOp
2025-09-02[CIR] Add handling for volatile loads and stores (#156124)Andy Kaylor5-14/+51
This fills in the missing pieces to handle volatile loads and stores in CIR. This addresses https://github.com/llvm/llvm-project/issues/153280
2025-09-02[CIR][NFC] Fix build issue after AST modification (#156493)Amr Hesham1-2/+2
Fix the build issue after AST modification
2025-09-02[OpenACC] Add NYI for pointer/VLA arguments to recipes (#156465)Erich Keane1-0/+14
As mentioned in a previous review, we aren't properly generating init/destroy/copy (combiner will need to be done correctly too!) regions for recipe generation. In the case where these have 'bounds', we can do a much better job of figuring out the type and how much needs to be done, but that is going to be its own engineering effort. For now, add an NYI as a note to come back to this.
2025-09-02[CIR][NFC] Reorder GenExprComplex and add errors for unhandled visitors ↵Amr Hesham1-431/+519
(#156241) - Reorder the CIRGenExprComplex functions to be similar to OCG. - Add errors for unhandled visitors. - Rename the test file to be similar to `complex-mul-div`. Issue: https://github.com/llvm/llvm-project/issues/141365
2025-09-02[CIR] Add support for emitting VTTs and related ojects (#155721)Andy Kaylor5-16/+201
This adds support for emitting virtual table tables (VTTs) and construction vtables.
2025-08-30[CIR] Implement VAArgExpr for ComplexType (#156092)Amr Hesham1-0/+6
This change adds support VAArgExpr for ComplexExpr Issue: https://github.com/llvm/llvm-project/issues/141365
2025-08-29[OpenACC] 'reduction' init lowering for +, |, ^, || (#155924)Erich Keane1-7/+15
These four operators have an initial value of 0, so they are able to use C/C++ 'zero init'. This patch adds the infrastructure to the Sema init calculations to differentiate based on the reduction operator, then enables emission of the inits in CodeGen (which should work for all inits, once generated). The rest of this test is just updating validation to make sure that the inits happen correctly for all 4 operators.
2025-08-29[CIR] Complex Unary plus and minus with promoted type (#155486)Amr Hesham1-8/+4
This change adds support for Complex unary plus and minus expressions with promoted type Issue: https://github.com/llvm/llvm-project/issues/141365
2025-08-29[CIR] Upstream Re-Throw with no return (#154994)Amr Hesham9-5/+161
This change adds support for the throw op without sub expression and with noreturn Issue #154992
2025-08-29[CIR] Add value initialization for scalar types (#156036)Morris Hafner1-5/+14
2025-08-29[CIR] DivOp & CompoundAssignmentDiv between ComplexType and ScalarType (#155167)Amr Hesham1-3/+27
This change adds support for DivOp and CompoundAssignmentDiv between ComplexType and ScalarType Issue: https://github.com/llvm/llvm-project/issues/141365
2025-08-28[OpenACC] Partial Reduction recipe Lowering (#155635)Erich Keane1-13/+139
This patch implements basic reduction recipe lowering, plus adds a bunch of tests for it that should be meaningful later. At the moment, all this does is ensure that we get the init 'alloca' set right (the actual initializer isn't done correctly yet, and will be in a followup), an empty combiner (though the type of certain operations probably has to be different as well, when we get to those), and a full-destruction, as we already have the infrastructure for it.
2025-08-27[CIR] Add initial support for virtual base classes (#155534)Andy Kaylor6-72/+169
This adds support for declaring a class with a virtual base class and initializing the vptr in the constructor. This does not yet handle constructors that require a virtual table table (VTT) implicit argument.
2025-08-27[CIR][NFC] Add errors for unhandled AggExprEmitter visitors (#155469)Andy Kaylor1-0/+199
There are a lot of required handlers in AggExprEmitter that are currently missing. Because the ASTVisitor has fallbacks, this means we just silently ignore whatever expressions are not explicitly handled. This patch adds handlers where we know they will be needed and just issues a diagnostic. This exposed failures in a few tests. In one case, we should have handled constant initialization earlier, which would have avoided going to the AggExprEmitter at all. I added a stub with a missing feature marker to allow that case to work as it had. Another test required us to ignore cast expressions that should be ignored, so I partially implemented the cast visitor. Finally, there's a case where the test was just accepting a bad result. I changed that case to XFAIL until it can be properly fixed.
2025-08-27[clang] NFC: reintroduce clang/include/clang/AST/Type.h (#155050)Matheus Izvekov5-5/+5
This reintroduces `Type.h`, having earlier been renamed to `TypeBase.h`, as a redirection to `TypeBase.h`, and redirects most users to include the former instead. This is a preparatory patch for being able to provide inline definitions for `Type` methods which would otherwise cause a circular dependency with `Decl{,CXX}.h`. Doing these operations into their own NFC patch helps the git rename detection logic work, preserving the history. This patch makes clang just a little slower to build (~0.17%), just because it makes more code indirectly include `DeclCXX.h`.
2025-08-27[clang] NFC: rename clang/include/clang/AST/Type.h to TypeBase.h (#155049)Matheus Izvekov5-5/+5
This is a preparatory patch, to be able to provide inline definitions for `Type` functions which depend on `Decl{,CXX}.h`. As the latter also depends on `Type.h`, this would not be possible without some reorganizing. Splitting this rename into its own patch allows git to track this as a rename, and preserve all git history, and not force any code reformatting. A later NFC patch will reintroduce `Type.h` as redirection to `TypeBase.h`, rewriting most places back to directly including `Type.h` instead of `TypeBase.h`, leaving only a handful of places where this is necessary. Then yet a later patch will exploit this by making more stuff inline.
2025-08-27[CIR] More atomic load and store (#155168)Sirui Mu1-4/+17
This patch adds support for `__atomic_load_n` and `__atomic_store_n` that were missed by #153814.
2025-08-26[CIR] Add support for initializing classes with multiple vtables (#155275)Andy Kaylor2-10/+100
This adds support for initializing the vptr members in a class that requires multiple vtables because of multiple inheritence. This still does not handle virtual bases.
2025-08-26[clang] NFC: introduce Type::getAsEnumDecl, and cast variants for all ↵Matheus Izvekov7-39/+12
TagDecls (#155463) And make use of those. These changes are split from prior PR #155028, in order to decrease the size of that PR and facilitate review.
2025-08-26[CIR] Add VTTAddrPointOp (#155048)Andy Kaylor3-1/+89
This adds the definition, verification, and lowering for CIR's VTTAddrPointOp. This is a bit ahead of the current codegen implementation, which doesn't yet have support for emitting VTT definitions, but since this doesn't depend on any of the other work in progress, it is being upstreamed in advance.
2025-08-26[OpenACC] Add C tests for recipe generation, fix NYIerichkeane1-1/+2
I realized while messing with other things that I'd written all of the recipe tests for C++, so this patch adds a bunch of tests for C mode. The assert wasn't quite accurate (as C default init doesn't really do anything/have an AST node), so that is corrected. Also, the lack of cir.copy causes some of the firstprivate tests to be incomplete, so added TODOs for that as well.
2025-08-25[clang] NFC: change more places to use Type::getAsTagDecl and friends (#155313)Matheus Izvekov7-39/+19
This changes a bunch of places which use getAs<TagType>, including derived types, just to obtain the tag definition. This is preparation for #155028, offloading all the changes that PR used to introduce which don't depend on any new helpers.
2025-08-25[CIR] Add support for emitting multi-vtables (#155027)Andy Kaylor1-23/+18
This change adds support for emitting multiple tables in a global vtable object to handle the case of multiple-inheritence.
2025-08-23[CIR] Upstream DivOp for ComplexType (#153796)Amr Hesham3-10/+308
This change adds support for the division operation between two complex types Issue: #141365
2025-08-22[CIR] Add verifier for vtable initializer (#155031)Andy Kaylor1-3/+6
This adds verification for the initializer, if present, of any global passed to the `cir.vtable.address_point` op.
2025-08-22[CIR][NFC] Fix build warning in getCIRSourceLanguage (#155029)Andy Kaylor2-5/+8
The getCIRSourceLanguage wasn't returning a value if the source language was anything other than C or C++. This change updates that function to return a std::optional value and only adds the source language attribute if one was returned.
2025-08-22[CIR] Add support for emitting vtables (#154808)Andy Kaylor10-9/+371
This adds a simplified version of the code to emit vtables. It does not yet handle RTTI or cases that require multiple vtables.
2025-08-21[CIR] Handle FunctionToPointerDecay casts (#153657) (#154060)Justin Riddell2-14/+85
Add upstream support for handling implicit FunctionToPointerDecay casts
2025-08-21[CIR] Add CIR vtable attribute (#154415)Andy Kaylor2-1/+40
This adds the #cir.vtable attribute definition and verification. Generation of the vtable will be implemented in a later change.
2025-08-21[CIR][Dialect] Add SourceLangAttr (#152511)7mile2-0/+23
This patch upstreams `SourceLangAttr` and its CodeGen logic in the CGM, which encodes the source language in CIR.
2025-08-21[CIR] Upstream GotoSolver pass (#154596)Andres-Salamanca3-0/+59
This PR upstreams the GotoSolver pass. It works by walking the function and matching each label to a goto. If a label is not matched to a goto, it is removed and not lowered.
2025-08-21[CIR][NFC] Use Op::create to create CIR operations in CIRGenBuilder (#154540)Sirui Mu1-18/+19
2025-08-20[CIR][NFC] Fix warning in MemOrder lowering (#154609)Andy Kaylor1-2/+1
This fixes a warning about having a default case in a fully covered enum switch statement.
2025-08-20[CIR] Add atomic load and store operations (#153814)Sirui Mu5-19/+375
This patch adds support for atomic loads and stores. Specifically, it adds support for the following intrinsic calls: - `__atomic_load` and `__atomic_store`; - `__c11_atomic_load` and `__c11_atomic_store`.
2025-08-20[CIR] Add support for string literal lvalues in ConstantLValueEmitter (#154514)Morris Hafner3-2/+20
2025-08-20[CIR] Add constant attribute to GlobalOp (#154359)Morris Hafner6-10/+14
This patch adds the constant attribute to cir.global, the appropriate lowering to LLVM constant and updates the tests. --------- Co-authored-by: Andy Kaylor <akaylor@nvidia.com>
2025-08-20[CIR] Implement__builtin_va_arg (#153834)Morris Hafner5-0/+62
Part of https://github.com/llvm/llvm-project/issues/153286. Depends on https://github.com/llvm/llvm-project/pull/153819. This patch adds support for __builtin_va_arg by adding the cir.va.arg operator. Unlike the incubator it doesn't depend on any target specific lowering (yet) but maps to llvm.va_arg.
2025-08-20[CIR] Add support for base classes in type conversion safety check (#154385)Morris Hafner1-7/+8
This patch enables the record layout computation of types that are derived more than once.
2025-08-20[CIR] Implement MemberExpr with VarDecl for ComplexType (#154307)Amr Hesham2-17/+17
This change adds support for MemberExpr with VarDecl ComplexType Issue: https://github.com/llvm/llvm-project/issues/141365
2025-08-19[CIR] Fix access to bitfields inside a union (#154398)Andres-Salamanca1-2/+3
This PR fixes the access to bitfields inside a union. Previously, we were using a `getMemberOp` to access the field, but because it is a union, `getMemberOp` would always use index `0`. For example, given: ```c typedef union { int x; int y : 4; int z : 8; } demo; ``` ```mlir !rec_demo = !cir.record<union "demo" {!s32i, !u8i, !u8i}> ``` In the case of: ```c d.y = 2; ``` It would generate: ```mlir cir.get_member %0[0] {name = "y"} : !cir.ptr<!rec_demo> -> !cir.ptr<!s32i> ``` with a return type of `!s32i`, when it should be `!u8i`. the get_member verifier would detect that the return type does not match the `y` member. To fix this, we now use `bitcast` to get the start of the union.
2025-08-19[CIR] Use zero-initializer for partial array fills (#154161)Andy Kaylor5-12/+146
If an array initializer list leaves eight or more elements that require zero fill, we had been generating an individual zero element for every one of them. This change instead follows the behavior of classic codegen, which creates a constant structure with the specified elements followed by a zero-initializer for the trailing zeros.
2025-08-19[CIR][NFC] Fix regression by #153819 (#154346)Sirui Mu1-4/+5
This patch fixes a regression introduced by #153819. The evaluation order of the arguments to `emitVAStart` is unspecified, but the test requires the arguments to be evaluated in left-to-right order. It's a bit strange that the pre-merge checks did not catch this. The tests failed on my local machine, which runs Fedora 42 with gcc 15.2.1 .
2025-08-19[OpenACC] Implement 'firstprivate' clause copy lowering (#154150)Erich Keane3-25/+89
This patch is the last of the 'firstprivate' clause lowering patches. It takes the already generated 'copy' init from Sema and uses it to generate the IR for the copy section of the recipe. However, one thing that this patch had to do, was come up with a way to hijack the decl registration in CIRGenFunction. Because these decls are being created in a 'different' place, we need to remove the things we've added. We could alternatively generate these 'differently', but it seems worth a little extra effort here to avoid having to re-implement variable initialization.
2025-08-19[CIR] Implement MemberExpr support for ComplexType (#154027)Amr Hesham3-3/+31
This change adds support for the MemberExpr ComplexType Issue: https://github.com/llvm/llvm-project/issues/141365
2025-08-19[CIR] Implement Statement Expressions (#153677)Morris Hafner6-43/+141
Depends on #153625 This patch adds support for statement expressions. It also changes emitCompoundStmt and emitCompoundStmtWithoutScope to accept an Address that the optional result is written to. This allows the creation of the alloca ahead of the creation of the scope which saves us from hoisting the alloca to its parent scope.
2025-08-19[CIR] Upstream __builtin_va_start and __builtin_va_end (#153819)Morris Hafner6-7/+98
Part of #153286
2025-08-18[CIR] Implement codegen for inline assembly without input and output ↵Iris Shi5-2/+143
operands (#153546) - Part of #153267 https://github.com/llvm/clangir/blob/main/clang/lib/CIR/CodeGen/CIRAsm.cpp