-
Notifications
You must be signed in to change notification settings - Fork 86
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
[CIR] Extend support for floating point attributes #572
base: main
Are you sure you want to change the base?
Commits on Nov 3, 2023
-
Revert "[CIR][CIRGen][Exception] Workaround internal testcase break"
This reverts commit 55c03f8
Configuration menu - View commit details
-
Copy full SHA for 94d428b - Browse repository at this point
Copy the full SHA 94d428bView commit details -
[CIR] Introduce exception info type
Incrementally design out support for try/catch and relationship with calls. This introduces an exception information type, which is will be returned somehow by throwing calls.
Configuration menu - View commit details
-
Copy full SHA for 9cbc015 - Browse repository at this point
Copy the full SHA 9cbc015View commit details
Commits on Nov 13, 2023
-
[CIR][CIRGen] Fix wrong assert
Silly mistake introduced in previous commit.
Configuration menu - View commit details
-
Copy full SHA for 21718ce - Browse repository at this point
Copy the full SHA 21718ceView commit details
Commits on Dec 12, 2023
-
[CIR] Add cir.std.find operation
This is going to be used to raise `cir.call`s to `std::find(...)` into `cir.std.find`.
Configuration menu - View commit details
-
Copy full SHA for 099f575 - Browse repository at this point
Copy the full SHA 099f575View commit details -
[CIR] Raise std::find call to cir.std.find
Also implement lowering back to `std::call` before lowering to LLVM.
Configuration menu - View commit details
-
Copy full SHA for 1e0e169 - Browse repository at this point
Copy the full SHA 1e0e169View commit details
Commits on Dec 13, 2023
-
[CIR][Lowering] Fix function ptr field lowering in a global struct (l…
…lvm#353) This PR fixes a global vars lowering with a funciton ptr field. Previously, the next code caused fail in the `foo` lowering: ``` static void myfun(int a) {} static struct { void (*func)(int flag); } const Handlers[] = { {myfun}, {myfun}, {myfun} }; void foo(int i, int flag) { Handlers[i].func(flag); } ```
Configuration menu - View commit details
-
Copy full SHA for dba066d - Browse repository at this point
Copy the full SHA dba066dView commit details -
[CIR][CodeGen] Fix flat offset lowering code to consider field alignm…
…ents. Before this fix conversion of flat offset to GlobalView indices could crash or compute invalid result.
Configuration menu - View commit details
-
Copy full SHA for cb09502 - Browse repository at this point
Copy the full SHA cb09502View commit details
Commits on Dec 14, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 59d6eb9 - Browse repository at this point
Copy the full SHA 59d6eb9View commit details -
[CIR] Vector types - part 1 (llvm#347)
This is the first part of implementing vector types and vector operations in ClangIR, issue llvm#284. This is enough to compile this test program. I haven't tried to do anything beyond that yet. ``` typedef int int4 __attribute__((vector_size(16))); int main(int argc, char** argv) { int4 a = { 1, argc, argc + 1, 4 }; int4 b = { 5, argc + 2, argc + 3, 8 }; int4 c = a + b; return c[1]; } ``` This change includes: * Fixed-sized vector types which are parameterized on the element type and the number of elements. For example, `!cir.vector<s32i x 4>`. (No scalable vector types yet; those will come later.) * New operation `cir.vec` which creates an object of a vector type with the given operands. * New operation `cir.vec_elem` which extracts an element from a vector. (The array subscript operation doesn't work here because the result is an rvalue, not an lvalue.) * Basic binary arithmetic operations on vector types, though only addition has been tested. There are no unary operators, comparison operators, casts, or shuffle operations yet. Those will all come later.
Configuration menu - View commit details
-
Copy full SHA for a8e47cf - Browse repository at this point
Copy the full SHA a8e47cfView commit details
Commits on Dec 19, 2023
-
[CIR][CodeGen][Lowering] Support multi-block case/default clauses (ll…
…vm#356) This PR adds a support for the multi-block case statements. Previously, the code example below caused crash in cir verification Lowering to the `llvm` dialect is pretty straightforward: the same logic as before is applied to all the region's blocks with no successors, i.e. we no longer think a case/default region contains only one block. The `CodeGen` part is a little bit tricky. Previously, any sub-statement of `case` or`default`, that was not any of them (i.e. neither `case` nor `default`) was processed with an insertion guard, meaning that the next sub-statement in the same clause was inserted again in the same block as the first one. It would be fine, once sub-statement didn't generate any blocks as well. For instance, ``` void foo(int a) { switch (a) { case 3: return; break; } } ``` The `return` statement actually emit a new block after, where the unreachable code with `break` should be inserted in. That's why we also need to update `lastCaseBlock` while generating `cir.switch` This is quite frequent bug in `llvm-test-suite`
Configuration menu - View commit details
-
Copy full SHA for bc1a644 - Browse repository at this point
Copy the full SHA bc1a644View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5fed9bd - Browse repository at this point
Copy the full SHA 5fed9bdView commit details -
[CIR][Passes] Introduce cir-lib-opt pass
This contains just the skeleton, but the idea is that this pass is going to contain transformations done on top CIR generated by the C/C++ idiom recognizer.
Configuration menu - View commit details
-
Copy full SHA for d58857d - Browse repository at this point
Copy the full SHA d58857dView commit details
Commits on Dec 20, 2023
-
[CIR] Fix issues pointed by github CI
Specify proper target triples to prevent issues on both Windows and MacOS regarding non-implemented ABI bits.
Configuration menu - View commit details
-
Copy full SHA for 15f763b - Browse repository at this point
Copy the full SHA 15f763bView commit details -
[CIR] Add iterator_{begin,end} ops
Only a skeleton for incremental work.
Configuration menu - View commit details
-
Copy full SHA for abcf931 - Browse repository at this point
Copy the full SHA abcf931View commit details -
[CIR][IdiomRecognizer] Recognize few variations for begin/end iterators
Initial step into modeling iterators in CIR. Right now it only looks at the member functions with .begin/.end function calls, it does not look at the iterator type, has no notion of forward/reverse iterators, nor filters based on the container types - those improvements will come next.
Configuration menu - View commit details
-
Copy full SHA for ee41cbd - Browse repository at this point
Copy the full SHA ee41cbdView commit details
Commits on Dec 21, 2023
-
[CIR][CodeGen] Use signed type for result of ptrdiff operation. (llvm…
…#355) Before this fix attached test case has been failing due to type mismatch (signed vs unsigned).
Configuration menu - View commit details
-
Copy full SHA for 073a014 - Browse repository at this point
Copy the full SHA 073a014View commit details -
[CIR] support -std=gnu89 (llvm#358)
Tiny PR, support `-std=gnu89` option This is quite frequent bug in `llvm-test-suite`
Configuration menu - View commit details
-
Copy full SHA for be3f6f7 - Browse repository at this point
Copy the full SHA be3f6f7View commit details -
[CIR][CodeGen] support extern var in function (llvm#359)
This PR "adds" the support of extern vars in function body. Actually, I just erased an assert. Any reason it was there? ``` int foo() { extern int optind; return optind; } ``` This is quite frequent bug in `llvm-test-suite`
Configuration menu - View commit details
-
Copy full SHA for ffd5ae3 - Browse repository at this point
Copy the full SHA ffd5ae3View commit details -
[CIR][Codegen] Adds Stack save-restore ops (llvm#346)
This PR adds `cir.stack_save` and `cir.stack_restore` operations.
Configuration menu - View commit details
-
Copy full SHA for 6c4bf4c - Browse repository at this point
Copy the full SHA 6c4bf4cView commit details -
[CIR][Lowering][Bugfix] Lower nested breaks in switch statements (llv…
…m#357) This PR fixes lowering of the next code: ``` void foo(int x, int y) { switch (x) { case 0: if (y) break; break; } } ``` i.e. when some sub statement contains `break` as well. Previously, we did this trick for `loop`: process nested `break`/`continue` statements while `LoopOp` lowering if they don't belong to another `LoopOp` or `SwitchOp`. This is why there is some refactoring here as well, but the idea is stiil the same: we need to process nested operations and emit branches to the proper blocks. This is quite frequent bug in `llvm-test-suite`
Configuration menu - View commit details
-
Copy full SHA for 1ef7eab - Browse repository at this point
Copy the full SHA 1ef7eabView commit details -
[CIR] Change mock std::array iterator definitions
This is how both libc++ and libstdc++ implement iterator in std::array, stick to those use cases for now. We could add other variations in the future if there are others around.
Configuration menu - View commit details
-
Copy full SHA for d5b3cc1 - Browse repository at this point
Copy the full SHA d5b3cc1View commit details -
[CIR][IdiomRecognizer] Make iterator recognition more strict
- Check whether container is part of std, add a fixed list of available containers (for now only std::array) - Add a getRawDecl method to ASTRecordDeclInterface - Testcases
Configuration menu - View commit details
-
Copy full SHA for 8fb3356 - Browse repository at this point
Copy the full SHA 8fb3356View commit details
Commits on Dec 22, 2023
-
[CIR] Cleanup idiom-recognizer and lib-opt options
This was a bit half backed, give it some love.
Configuration menu - View commit details
-
Copy full SHA for 28bf4ec - Browse repository at this point
Copy the full SHA 28bf4ecView commit details -
[CIR][LibOpt] Add a first transformation: std::find to memchr
Inspired by similar work in libc++, pointed to me by Louis Dionne and Nikolas Klauser. This is initial, very conservative and not generalized yet: works for `char`s within a specific version of `std::find`.
Configuration menu - View commit details
-
Copy full SHA for 2fdc25b - Browse repository at this point
Copy the full SHA 2fdc25bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1139cfe - Browse repository at this point
Copy the full SHA 1139cfeView commit details
Commits on Dec 26, 2023
-
Revert "[mlir][llvm] Fixes CallOp builder for the case of indirect call"
This reverts commit bbaa147.
Configuration menu - View commit details
-
Copy full SHA for 8d37db3 - Browse repository at this point
Copy the full SHA 8d37db3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 67da9e6 - Browse repository at this point
Copy the full SHA 67da9e6View commit details
Commits on Jan 4, 2024
-
[CIR][Lowering][Bugfix] Lower ScopeOp with return op (llvm#364)
`ScopeOp` may end with `ReturnOp` instead of `YieldOp`, that is not expected now. This PR fix this. The reduced example is: ``` int foo() { { return 0; } } ``` This is quite frequent bug in `llvm-test-suite`
Configuration menu - View commit details
-
Copy full SHA for cb185ad - Browse repository at this point
Copy the full SHA cb185adView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7d4101a - Browse repository at this point
Copy the full SHA 7d4101aView commit details -
[CIR][CIRGen][NFC] Enhance alloca helpers (llvm#367)
One more step towards variable length array support. This PR adds one more helper for the `alloca` instruction and re-use the existing ones. The reason is the following: right now there are two possible ways to insert alloca: either to a function entry block or to the given block after all the existing alloca instructions. But for VLA support we need to insert alloca anywhere, right after an array's size becomes known. Thus, we add one more parameter with the default value - insertion point. Also, we don't want copy-paste the code, and reuse the existing helpers, but it may be a little bit confusing to read.
Configuration menu - View commit details
-
Copy full SHA for f88ee31 - Browse repository at this point
Copy the full SHA f88ee31View commit details -
[CIR][Lowering] add cir.ternary to scf.if lowering (llvm#368)
This PR adds `cir.ternary` lowering. There are two approaches to lower `cir.ternary` imo: 1. Use `scf.if` op. 2. Use `cf.cond_br` op. I choose `scf.if` because `scf.if` + canonicalization produces `arith.select` whereas `cf.cond_br` requires scf lifting. In many ways `scf.if` is more high-level and closer to `cir.ternary`. A separate `cir.yield` lowering is required since we cannot directly replace `cir.yield` in the ternary op lowering -- the yield operands may still be illegal and doing so produces `builtin.unrealized_cast` ops. I couldn't figured out a way to solve this issue without adding a separate lowering pattern. Please let me know if you know a way to solve this issue.
Configuration menu - View commit details
-
Copy full SHA for 403ae40 - Browse repository at this point
Copy the full SHA 403ae40View commit details -
[CIR][CIRGen] supports struct copy from function call result (llvm#369)
This PR fixes the next case ``` typedef struct { } A; A create() { A a; return a; } void foo() { A a; a = create(); } ``` i.e. when a struct is assigned to a function call result
Configuration menu - View commit details
-
Copy full SHA for b21e81e - Browse repository at this point
Copy the full SHA b21e81eView commit details -
Configuration menu - View commit details
-
Copy full SHA for ead25fe - Browse repository at this point
Copy the full SHA ead25feView commit details -
[CIR][Lowering] Support lowering of cir.const with GlobalViewAttr (ll…
…vmgh-352) (llvm#363) The error manifested in code like ``` int a[16]; int *const p = a; void foo() { p[0]; } ``` It's one the most frequent errors in current llvm-test-suite. I've added the test to globals.cir which is currently XFAILed, I think @gitoleg will fix it soon. Co-authored-by: Bruno Cardoso Lopes <bcardosolopes@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for be13b81 - Browse repository at this point
Copy the full SHA be13b81View commit details -
[CIR][CIRGen] emit cir.zero for constant string literals (llvm#373)
This PR addresses llvm#248 . Currently string literals are always lowered to a `cir.const_array` attribute even if the string literal only contains null bytes. This patch make the CodeGen emits `cir.zero` for these string literals.
Configuration menu - View commit details
-
Copy full SHA for f387e1a - Browse repository at this point
Copy the full SHA f387e1aView commit details -
[CIR][CIRGen] Lvalues and comma expression (llvm#376)
Currently, codegen of lvalue comma expression would crash: ```cpp int &foo1(); int &foo2(); void c1() { int &x = (foo1(), foo2()); // CRASH } ``` This simple patch fixes this issue.
Configuration menu - View commit details
-
Copy full SHA for 2bde4fe - Browse repository at this point
Copy the full SHA 2bde4feView commit details
Commits on Jan 9, 2024
-
[CIR] Replace AnyType with CIR_AnyType (llvm#371)
This PR addresses llvm#90. It introduces a new type constraint `CIR_AnyType` which allows CIR types and MLIR floating-point types. Present `AnyType` constraints are replaced with the new `CIR_AnyType` constraint.
Configuration menu - View commit details
-
Copy full SHA for 6a0e742 - Browse repository at this point
Copy the full SHA 6a0e742View commit details -
[CIR][CIRGen] Support array def after decl with unknown bound (llvm#375)
Arrays can be first declared without a known bound, and then defined with a known bound. For example: ```cpp extern int data[]; int test() { return data[1]; } int data[3] {1, 2, 3}; ``` Currently `clangir` crashes on generating CIR for this case. This is due to the type of the `data` definition being different from its declaration. This patch adds support for such a case.
Configuration menu - View commit details
-
Copy full SHA for 1d442f6 - Browse repository at this point
Copy the full SHA 1d442f6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0affd8d - Browse repository at this point
Copy the full SHA 0affd8dView commit details -
[CIR][Transforms][NFC] Refactor MergeCleanups pass (llvm#384)
Breaks the pass into smaller more manageable rewrites.
Configuration menu - View commit details
-
Copy full SHA for 3aeb3e0 - Browse repository at this point
Copy the full SHA 3aeb3e0View commit details
Commits on Jan 10, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 006dfd0 - Browse repository at this point
Copy the full SHA 006dfd0View commit details -
[CIR][Transforms][Bugfix] Do not use-after-free in MergeCleanups and …
…IdiomRecognizer. (llvm#389) Some tests started failing under `-DLLVM_USE_SANITIZER=Address` due to trivial use-after-free errors.
Configuration menu - View commit details
-
Copy full SHA for 67859c4 - Browse repository at this point
Copy the full SHA 67859c4View commit details -
[CIR][IR] Implement loop's conditional operation (llvm#391)
Like SCF's `scf.condition`, the `cir.condition` simplifies codegen of loop conditions by removing the need of a contitional branch. It takes a single boolean operand which, if true, executes the body region, otherwise exits the loop. This also simplifies lowering and the dialect it self. A new constraint is now enforced on `cir.loops`: the condition region must terminate with a `cir.condition` operation. A few tests were removed as they became redundant, and others where simplified. The merge-cleanups pass no longer simplifies compile-time constant conditions, as the condition body terminator is no longer allowed to be terminated with a `cir.yield`. To circumvent this, a proper folder should be implemented to fold constant conditions, but this was left as future work. Co-authored-by: Bruno Cardoso Lopes <bcardosolopes@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 58ccd20 - Browse repository at this point
Copy the full SHA 58ccd20View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8fa0bbb - Browse repository at this point
Copy the full SHA 8fa0bbbView commit details -
[CIR][CIRGen][NFC] Support yielding values in LexicalScope
Once the LexicalScope goes out of scope, its cleanup process will also check if a return was set to be yielded, and, if so, generate the yield with the respective value. ghstack-source-id: 9305d2ba5631840937721755358a774dc9e08b90 Pull Request resolved: llvm#312
Configuration menu - View commit details
-
Copy full SHA for ada6175 - Browse repository at this point
Copy the full SHA ada6175View commit details -
[CIR][CIRGen][NFC] Return scope result in compound stmt builders
Instead of returning a boolean indicating whether the statement was handled, returns the ReturnExpr of the statement if there is one. It also adds some extra bookkeeping to ensure that the result is returned when needed. This allows for better support of GCC's `ExprStmt` extension. The logical result was not used: it was handled but it would never fail. Any errors within builders should likely be handled with asserts and unreachables since they imply a programmer's error in the code. ghstack-source-id: 2319cf3f12e56374a52aaafa4304e74de3ee6453 Pull Request resolved: llvm#313
Configuration menu - View commit details
-
Copy full SHA for d744421 - Browse repository at this point
Copy the full SHA d744421View commit details -
[CIR][CIRGen] Partially support statement expressions return values
Adds support for GCC statement expressions return values as well as StmtExpr LValue emissions. To simplify the lowering process, the scope return value is not used. Instead, a temporary allocation is created on the parent scope where the return value is stored. For classes, a second scope is created around this temporary allocation to ensure any destructors are called. This does not implement the full semantics of statement expressions. ghstack-source-id: 64e03fc3df45975590ddbcab44959c2b49601101 Pull Request resolved: llvm#314
Configuration menu - View commit details
-
Copy full SHA for 50d414a - Browse repository at this point
Copy the full SHA 50d414aView commit details
Commits on Jan 11, 2024
-
[CIR][CIRGen][Exceptions] More on try statemet codegen: wrap with cir…
….scope Incremental work, test coming soon. This code path isn't exercised just yet.
Configuration menu - View commit details
-
Copy full SHA for fbb25ae - Browse repository at this point
Copy the full SHA fbb25aeView commit details -
Configuration menu - View commit details
-
Copy full SHA for b0dd640 - Browse repository at this point
Copy the full SHA b0dd640View commit details -
Configuration menu - View commit details
-
Copy full SHA for 439217e - Browse repository at this point
Copy the full SHA 439217eView commit details
Commits on Jan 12, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 7463d87 - Browse repository at this point
Copy the full SHA 7463d87View commit details -
[CIR] Introduce cir.try_call operation
This will be used for any calls happening inside try regions. More refactoring. For now it's incremental work, still some mileage to cover before I can introduce a testcase. The current implementation mimics cir.call, pieces are going to change in following commits.
Configuration menu - View commit details
-
Copy full SHA for d3e07d2 - Browse repository at this point
Copy the full SHA d3e07d2View commit details
Commits on Jan 16, 2024
-
[CIR][CIRGen] Add constraints to inline assembly (llvm#351)
The next step for inline assembly. Sorry, maybe it looks too big on the first glance. And it's kind of hard to extract something well-grained from the code and introduce it as a separate PR, but I try. Actually there is nothing really interesting done here, and the next will (I hope :) ) simplify your review process. 1) In this PR we introduce operand's constraints and the task is to collect them (and maybe transform a little) 2) There are two big functions copy-pasted from the traditional `Codegen` and I doubt they need to be reviewed. 3) We still don't do anything CIR-specific. Basically, we just work with strings in the same way like traditional `Codegen` does. 4) We just iterate over the input and output operands and collect the constraints 5) We still follow to the traditional `CodeGen` and don't do anything new, except a separate function that collects constraints infos in the very beginning of the `buildStmt`. Also, I renamed `AsmDialect` to `AsmFlavor` as you asked in llvm#326
Configuration menu - View commit details
-
Copy full SHA for 2d58e58 - Browse repository at this point
Copy the full SHA 2d58e58View commit details -
[CIR][Lowering] Support lowering of const arrays of structs (llvm#370)
This PR fixes CIR lowering for the next case. ``` void foo() { struct { int a; int b; } a[1] = {{0,1}}; } ``` Note, we don't create attribute here and lower such const arrays as values.
Configuration menu - View commit details
-
Copy full SHA for b91b91c - Browse repository at this point
Copy the full SHA b91b91cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 11024a5 - Browse repository at this point
Copy the full SHA 11024a5View commit details -
[CIR] Fix int constant type verification (llvm#386)
When introducing attribute `#cir.int`, the constant type verification is not updated. If a `cir.const` operation produces an integral constant from a `#cir.int` attribute, the integer's type is not verified: ```mlir %1 = cir.const(#cir.int<0> : !cir.int<s, 8>) : !cir.int<u, 8> // Not verified: !cir.int<s, 8> differs from !cir.int<u, 8> ``` The corresponding test is also wrong but fail to be detected. This patch fixes this issue.
Configuration menu - View commit details
-
Copy full SHA for e881544 - Browse repository at this point
Copy the full SHA e881544View commit details -
[CIR] Vector types, part 2 (llvm#387)
This is part 2 of implementing vector types and vector operations in ClangIR, issue llvm#284. Create new operation `cir.vec.insert`, which changes one element of an existing vector object and returns the modified vector object. The input and output vectors are prvalues; this operation does not touch memory. The assembly format and the order of the arguments match that of llvm.insertelement in the LLVM dialect, since the operations have identical semantics. Implement vector element lvalues in class `LValue`, adding member functions `getVectorAddress()`, `getVectorPointer()`, `getVectorIdx()`, and `MakeVectorElt(...)`. The assembly format for operation `cir.vec.extract` was changed to match that of llvm.extractelement in the LLVM dialect, since the operations have identical semantics. These two features, `cir.vec.insert` and vector element lvalues, are used to implement `v[n] = e`, where `v` is a vector. This is a little tricky, because `v[n]` isn't really an lvalue, as its address cannot be taken. The only place it can be used as an lvalue is on the left-hand side of an assignment. Implement unary operators on vector objects (except for logical not on a vector mask, which will be covered in a future commit for boolean vectors). The code for lowering cir.unary for all types, in `CIRUnaryOpLowering::matchAndRewrite`, was largely rewritten. Support for unary `+` on non-vector pointer types was added. (It was already supported and tested in AST->ClangIR CodeGen, but was missing from ClangIR->LLVM Dialect lowering.) Add tests for all binary vector arithmetic operations other than relational operators and shift operators. There were all working after the previous vector types commit, but only addition had beet tested at the time. Co-authored-by: Bruno Cardoso Lopes <bcardosolopes@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 5a6fe55 - Browse repository at this point
Copy the full SHA 5a6fe55View commit details -
[CIR][IR] Implement
cir.continue
operationDetaches the representation of the C/C++ `continue` statement into a separate operation. This simplifies mostly lowering and verifications related to `continue` statements, as well as the definition and lowering of the `cir.yield` operation. A few checks regarding region terminators were also removed from the lowering stage, since they are already enforced by MLIR. ghstack-source-id: 1810a48ada88fe7ef5638b0758a2298d9cfbdb8b Pull Request resolved: llvm#394
Configuration menu - View commit details
-
Copy full SHA for 9989230 - Browse repository at this point
Copy the full SHA 9989230View commit details -
[CIR][IR] Implement
cir.break
operationSame rationale as `cir.continue`, it detaches the representation of the C/C++ `break` statement into a separate operation. This simplifies lowering and verifications related to `break` statements, as well as the definition and lowering of the `cir.yield` operation. ghstack-source-id: 929cf96c3abe51d717c2fa6ca9e0073e42e770c6 Pull Request resolved: llvm#395
Configuration menu - View commit details
-
Copy full SHA for 65880d7 - Browse repository at this point
Copy the full SHA 65880d7View commit details -
[CIR][IR] Deprecate
cir.yield nosuspend
This changes the `cir.await` operation to expect a `cir.condition` as the terminator for the ready region. This simplifies the `cir.await` while also simplifying the `cir.yield`. If `cir.condition` holds a true value, then the `cir.await` will continue the coroutine, otherwise, it will suspend its execution. The `cir.condition` op was also updated to allow `cir.await` as its parent operation. ghstack-source-id: 1ebeb2cfbdeff6f289936d16354cba534e093ea7 Pull Request resolved: llvm#396
Configuration menu - View commit details
-
Copy full SHA for 2f48e4a - Browse repository at this point
Copy the full SHA 2f48e4aView commit details -
[CIR][IR] Deprecate
cir.yield fallthrough
Instead of having a `cir.yield fallthrough` operation, the default branching behavior of the parent operation is denoted by `cir.yield`. In other words, a `cir.yield` operation in a switch case region represents the default branching behavior of the switch operation, which is a fallthrough. The `cir.yield` operation now represents the default branching behavior of the parent operation's region. For example, in a if-else region, a `cir.yield` operation represents a branch to the exit block. ghstack-source-id: 713c457dfb2228fbdf63ba72dd6396665512bb9d Pull Request resolved: llvm#397
Configuration menu - View commit details
-
Copy full SHA for 1ee5f18 - Browse repository at this point
Copy the full SHA 1ee5f18View commit details -
[CIR] TryCallOp: add blocks, arguments, proper interface impl and tes…
…tcase - Add cir.try_call parsing. - Add block destinations and hookup exception info type. - Properly implement interface methods. Printer is still missing, but coming next.
Configuration menu - View commit details
-
Copy full SHA for 92cceb7 - Browse repository at this point
Copy the full SHA 92cceb7View commit details
Commits on Jan 17, 2024
-
[CIR][Exceptions] Simplify cir.try_call
After some discussions with @sitio-couto, it might be better if we use a simplified version that doesn't take the labels into account just yet. `cir.try_call` should have the same semantics as `cir.break`, in the sense that it needs further expansion when getting rid of structured control flow. Early lowering here would complicate CIR generated code and make it harder to analyse. Further CIR to CIR passes will properly expand this at some point prior to LLVM lowering.
Configuration menu - View commit details
-
Copy full SHA for 1273f07 - Browse repository at this point
Copy the full SHA 1273f07View commit details -
Configuration menu - View commit details
-
Copy full SHA for d98b9f0 - Browse repository at this point
Copy the full SHA d98b9f0View commit details
Commits on Jan 18, 2024
-
[CIR][CIRGen][Exceptions] More prep work on landing-pad like logic
We can now handle more of EHScope::Catch and lay out the skeleton for CIR's version of that, adding tons of asserts for cases not currently handled. As part of this we're able to build the clause list as part of CatchOp based on the handlers, and create allocation for the exception_info type. In the next part (where we currently hit an assert) of this work, the CatchOp will then get its regions populated. Incremental steps into getting basic exceptions to work, not enough for a testcase just yet.
Configuration menu - View commit details
-
Copy full SHA for 0d91f68 - Browse repository at this point
Copy the full SHA 0d91f68View commit details -
[CIR][CIRGen][Exceptions] Complete buildCatchDispatchBlock
Doesn't do a lot of things compared to LLVM traditional codegen, one more step towards basic exception support. No testcase possible just yet.
Configuration menu - View commit details
-
Copy full SHA for bcfacd1 - Browse repository at this point
Copy the full SHA bcfacd1View commit details -
[CIR] Add cir.resume op and use it in cir.catch
- Add an extra CatchOp region to hold fallback (where EH usually resumes or rethrows as part of try/catch). - Emit `cir.resume` on the fallback region. Incremental step into the next assertion, still missing pieces before adding the first testcase.
Configuration menu - View commit details
-
Copy full SHA for 4aa8ff9 - Browse repository at this point
Copy the full SHA 4aa8ff9View commit details
Commits on Jan 19, 2024
-
[CIR][CIRGen] Support wide string literals (llvm#399)
This commit supports the codegen of wide string literals, including `wchar_t` string literals, `char16_t` string literals, and `char32_t` string literals. I'm not following the proposal in llvm#374. The clang frontend doesn't record the literal string. It only records the encoded code units for wide string literals. So I believe that a dedicated string attribute with an encoding tag as described in llvm#374 may not be that helpful as I thought.
Configuration menu - View commit details
-
Copy full SHA for 7a4e5c3 - Browse repository at this point
Copy the full SHA 7a4e5c3View commit details
Commits on Jan 22, 2024
-
[CIR][OpenMP] Initial commit for OpenMP support in CIR (llvm#382)
This patch introduces initial support for: ``` pragma omp parallel ``` This patch doesn't add support for any of the `parallel` clauses, including variable privatization; thus, all variables are handled as shared. This PR fixes issue llvm#285.
Configuration menu - View commit details
-
Copy full SHA for c003cb3 - Browse repository at this point
Copy the full SHA c003cb3View commit details -
[CIR][Interfaces] Implement LoopOpInterface
Adds an interface to generically handle lowering and analysis of loop operations in CIR. It can also perform verification of invariants common to all loop operations. ghstack-source-id: 0e413b14ea063a2b0d75aeaca0af88e547c15277 Pull Request resolved: llvm#405
Configuration menu - View commit details
-
Copy full SHA for 8e6cad9 - Browse repository at this point
Copy the full SHA 8e6cad9View commit details -
[CIR][Lowering][NFC] Refactor LoopOp lowering
Leverages the new LoopOpInterface for lowering instead of the LoopOp operation. This is a step towards removing the LoopOp operation. ghstack-source-id: 28c1294833a12669d222a293de76609d2cf19148 Pull Request resolved: llvm#406
Configuration menu - View commit details
-
Copy full SHA for b41ff5f - Browse repository at this point
Copy the full SHA b41ff5fView commit details -
[CIR][IR] Refactor do-while loops
Creates a separate C/C++ operation for do-while loops, while keeping the LoopOpInterface to generically handle loops. This simplifies the IR generation and printing/parsing of do-while loops. It also allows us to define it regions in the order that they are executed, which is useful for the lifetime analysis. ghstack-source-id: b4d9517197b8f82ae677dc2684101fe5762b21b7 Pull Request resolved: llvm#407
Configuration menu - View commit details
-
Copy full SHA for 979ea99 - Browse repository at this point
Copy the full SHA 979ea99View commit details -
[CIR][IR] Refactor while loops
Creates a separate C/C++ operation for while loops, while keeping the LoopOpInterface to generically handle loops. This simplifies the IR generation and printing/parsing of while loops. ghstack-source-id: 29a6d7530263a4f96dbe6ce3052875831126005d Pull Request resolved: llvm#408
Configuration menu - View commit details
-
Copy full SHA for 4541cfa - Browse repository at this point
Copy the full SHA 4541cfaView commit details -
This patch completes the deprecation of the generic `cir.loop` operation by adding a new `cir.for` operation and removing the `cir.loop` op. The new representation removes some bloat and places the regions in order of execution. ghstack-source-id: 886e0dacc632e5809015e2212810d690ef3ec294 Pull Request resolved: llvm#409
Configuration menu - View commit details
-
Copy full SHA for 7bd9fe3 - Browse repository at this point
Copy the full SHA 7bd9fe3View commit details
Commits on Jan 23, 2024
-
[CIR][CIRGen][Exceptions] Populate catch clauses and fix order of ope…
…rations More machinery for exceptions. This time around we finally emit a cir.catch and fix the order of emitting operations. This allows a testcase to be added. I also added `CatchParamOp`, which fetches the arguments for the clauses from the !cir.eh_info object. Work coming next: - Dtors. - Use cir.try instead of cir.scope. - Eesume. - Documentation.`
Configuration menu - View commit details
-
Copy full SHA for bc1b7c9 - Browse repository at this point
Copy the full SHA bc1b7c9View commit details
Commits on Jan 25, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 7acd41f - Browse repository at this point
Copy the full SHA 7acd41fView commit details
Commits on Jan 26, 2024
-
[CIR] Remove LLVM_ENABLE_PROJECTS support
ghstack-source-id: 855519648a4bf2dced501f96e6de1b9b164d85ad Pull Request resolved: llvm#424
Configuration menu - View commit details
-
Copy full SHA for 3cf377a - Browse repository at this point
Copy the full SHA 3cf377aView commit details
Commits on Jan 27, 2024
-
[CIR] Make MLIRCIR depend on MLIRCIRInterfaces
This is currently missing and Debug builds are failing without it.
Configuration menu - View commit details
-
Copy full SHA for e4f7839 - Browse repository at this point
Copy the full SHA e4f7839View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1de9a22 - Browse repository at this point
Copy the full SHA 1de9a22View commit details
Commits on Jan 29, 2024
-
[CIR] Move CI to CLANG_ENABLE_CIR
ghstack-source-id: 0706d6bb81b5b8eefb04146719b4443aedb29ab1 Pull Request resolved: llvm#427
Configuration menu - View commit details
-
Copy full SHA for 8d26c92 - Browse repository at this point
Copy the full SHA 8d26c92View commit details
Commits on Jan 30, 2024
-
[CIR][CIRGen][Exceptions] Use cir.try instead of cir.scope
One more step towards completing try/catch.
Configuration menu - View commit details
-
Copy full SHA for 1cd5a4b - Browse repository at this point
Copy the full SHA 1cd5a4bView commit details -
[CIR][CIRGen][NFC] Make buildCall more generic by using CIRCallOpInte…
…rface This is prep work for introducing cir.try_call inside cir.try scopes.
Configuration menu - View commit details
-
Copy full SHA for d1d7b19 - Browse repository at this point
Copy the full SHA d1d7b19View commit details -
[CIR][CIRGen][Exceptions] Use cir.try_call within cir.try regions
One more incremental step towards try/catch: properly use cir.try_call instead of regular cir.call when within a cir.try region.
Configuration menu - View commit details
-
Copy full SHA for 1390496 - Browse repository at this point
Copy the full SHA 1390496View commit details
Commits on Jan 31, 2024
-
[CIR] Add a new volatile flag to distinguish volatile accesses (llvm#402
) This patch adds a new `volatile` tag to the following operations to distinguish volatile loads and stores from normal loads and stores: - `cir.load` - `cir.store` - `cir.get_bitfield` - `cir.set_bitfield` Besides, this patch also updates the CodeGen and LLVMIR lowering code to start emitting CIR and LLVMIR operations with volatile flag.
Configuration menu - View commit details
-
Copy full SHA for fae636d - Browse repository at this point
Copy the full SHA fae636dView commit details -
[CIR] Vector types, comparison operators (llvm#432)
This is part 3 of implementing vector types and vector operations in ClangIR, issue llvm#284. Create new operation `cir.vec.cmp` which implements the relational comparison operators (`== != < > <= >=`) on vector types. A new operation was created rather than reusing `cir.cmp` because the result is a vector of a signed intergral type, not a `bool`. Add CodeGen and Lowering tests for vector comparisons. Fix the floating-point comparison predicate when lowering to LLVM. To handle NaN values correctly, the comparisons need to be ordered rather than unordered. (Except for `!=`, which needs to be unordered.) For example, "ueq" was changed to "oeq".
Configuration menu - View commit details
-
Copy full SHA for 1da7e33 - Browse repository at this point
Copy the full SHA 1da7e33View commit details -
[CIR][CIRGen] Add missing visitor for ParenExpr (llvm#428)
Compilation of the following test ``` void foo6(A* a1) { A a2 = (*a1); } ``` fails with. ``` NYI UNREACHABLE executed at /home/huawei/cir/repo/llvm-project/clang/lib/CIR/CodeGen/CIRGenExprAgg.cpp:175! ``` Commit adds required visitor and fixes the issue.
Configuration menu - View commit details
-
Copy full SHA for 000f9f7 - Browse repository at this point
Copy the full SHA 000f9f7View commit details -
[CIR][CodeGen][BugFix] use proper base type for derived class (llvm#404)
In the original codegen a new type is created for the base class, while in CIR we were rewriting the type being processed (due tp misused pointers). This PR fix this, and also makes CIR codegen even with the original one.
Configuration menu - View commit details
-
Copy full SHA for e1ad7ee - Browse repository at this point
Copy the full SHA e1ad7eeView commit details -
[CIR][CodeGen] Initial variable length array support (llvm#398)
This is a first PR for variable length array support. There are one (or more :) ) ahead. Basically, we already did lot's of preliminary job in order to land VLA in CIR in llvm#367 llvm#346 llvm#340. So now we add initial VLA support itself. Most of the changes are taken from the original codegen, so there is nothing to be scary of) I added just one test, and basically that's all we can test right now. Later, I will add more, from the original codegen tests.
Configuration menu - View commit details
-
Copy full SHA for 3f9153d - Browse repository at this point
Copy the full SHA 3f9153dView commit details -
Configuration menu - View commit details
-
Copy full SHA for a602024 - Browse repository at this point
Copy the full SHA a602024View commit details -
Configuration menu - View commit details
-
Copy full SHA for c5e3476 - Browse repository at this point
Copy the full SHA c5e3476View commit details -
[CIR][CIRGen] Handle __extension__ keyword (llvm#421)
Support \_\_extension\_\_ keyword in CIRGen
Configuration menu - View commit details
-
Copy full SHA for eced6fa - Browse repository at this point
Copy the full SHA eced6faView commit details -
[CIR][CIRGen] Add missing case to 'isNullValue' (llvm#433)
Support for BoolAttr in isNullValue
Configuration menu - View commit details
-
Copy full SHA for efb9922 - Browse repository at this point
Copy the full SHA efb9922View commit details
Commits on Feb 2, 2024
-
[CIR][CIRGen] Support for section atttribute (llvm#422)
This PR adds support for section("$name") attribute
Configuration menu - View commit details
-
Copy full SHA for 87c4338 - Browse repository at this point
Copy the full SHA 87c4338View commit details -
[CIR][CIRGen][Bugfix] Fix bool zero initialization (llvm#411)
Support missing zero initialization of Bools
Configuration menu - View commit details
-
Copy full SHA for 765e5dc - Browse repository at this point
Copy the full SHA 765e5dcView commit details -
[CIR][Lowering] Support conversion of cir.zero to dense consts (llvm#413
) Compiling the given c-code ``` void foo() { int i [2][1] = { { 1 }, { 0 } }; long int li[2][1] = { { 1 }, { 0 } }; float fl[2][1] = { { 1 }, { 0 } }; double d [2][1] = { { 1 }, { 0 } }; } ``` leads to compilation error ``` unknown element in ConstArrayAttr UNREACHABLE executed at /home/huawei/cir/repo/van/llvm-project/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp:951! ``` PR implements conversion the cir.zero attr to dense constant and fixed this error.
Configuration menu - View commit details
-
Copy full SHA for 58b5474 - Browse repository at this point
Copy the full SHA 58b5474View commit details -
[CIR][CodeGen] Initial support for dynamic_cast (llvm#426)
This PR introduces CIR CodeGen support for `dynamic_cast`. The full feature set of `dynamic_cast` is not fully implemented in this PR as it's already pretty large. This PR only include support for downcasting and sidecasting a pointer or reference. `dynamic_cast<void *>` is not yet implemented.
Configuration menu - View commit details
-
Copy full SHA for 7b4745e - Browse repository at this point
Copy the full SHA 7b4745eView commit details -
[CIR][CIRGen] Add codegen for branch prediction info builtins (llvm#439)
Initial support for the following builtins: ``` __builtin_expect __builtin_expect_with_probability __builtin_unpredictable ``` This PR supports codegen for this builtins on "-O0" compilation pipeline.
Configuration menu - View commit details
-
Copy full SHA for 323e0c1 - Browse repository at this point
Copy the full SHA 323e0c1View commit details -
[CIR][CIRGen] Handle ternary op inside if cond (llvm#440)
Support for ConditionalOperator inside the if condition stmt
Configuration menu - View commit details
-
Copy full SHA for 615a367 - Browse repository at this point
Copy the full SHA 615a367View commit details -
Configuration menu - View commit details
-
Copy full SHA for a010209 - Browse repository at this point
Copy the full SHA a010209View commit details -
[CIR][CIRGen] Support dynamic_cast to void ptr (llvm#442)
This patch adds CIRGen for downcasting a pointer to the complete object through `dynamic_cast<void *>`. Together with llvm#426 , the full functionality of `dynamic_cast` should be supported in CIRGen after this PR merges.
Configuration menu - View commit details
-
Copy full SHA for c35b579 - Browse repository at this point
Copy the full SHA c35b579View commit details -
[CIR][CodeGen][Lowering] Supports arrays with trailing zeros (llvm#393)
This PR adds support for constant arrays with trailing zeros. The original `CodeGen` does the following: once a constant array contain trailing zeros, a struct with two members is generated: initialized elements and `zeroinitializer` for the remaining part. And depending on some conditions, `memset` or `memcpy` are emitted. In the latter case a global const array is created. Well, we may go this way, but it requires us to implement [features](https://github.com/llvm/clangir/blob/main/clang/lib/CIR/CodeGen/CIRGenDecl.cpp#L182) that are not implemented yet. Another option is to add one more parameter to the `constArrayAttr` and utilize it during the lowering. So far I chose this way, but if you have any doubts, we can discuss here. So we just emit constant array as usually and once there are trailing zeros, lower this arrray (i.e. an attribute) as a value. I added a couple of tests and will add more, once we agree on the approach. So far I marked the PR as a draft one.
Configuration menu - View commit details
-
Copy full SHA for d54e041 - Browse repository at this point
Copy the full SHA d54e041View commit details -
[CIR][LibOpt] Extend std::find optimization to all calls with raw poi…
…nters (llvm#400) This also adds a missing check whether the pointer returned from `memchr` is null and changes the result to `last` in that case.
Configuration menu - View commit details
-
Copy full SHA for e7e05a8 - Browse repository at this point
Copy the full SHA e7e05a8View commit details
Commits on Feb 3, 2024
-
[CIR][CIRGen] Implement "if consteval" code generation (llvm#446)
Emit the false-branch of the consteval if statement, if any.
Configuration menu - View commit details
-
Copy full SHA for 6094902 - Browse repository at this point
Copy the full SHA 6094902View commit details
Commits on Feb 4, 2024
-
[CIR] Allow mlir::UnknownLoc in function op (llvm#448)
Originally, the location associated with a function is checked to be an `mlir::FileLineColLoc` before the function is lowered to an LLVMIR FuncOp. However, runtime function declarations do not have such locations. This patch further allows `mlir::UnknownLoc` to be associated with a function.
Configuration menu - View commit details
-
Copy full SHA for da3343a - Browse repository at this point
Copy the full SHA da3343aView commit details
Commits on Feb 5, 2024
-
[CIR][CodeGen] Const structs with bitfields (llvm#412)
This PR adds a support for const structs with bitfields. Now only global structs are supported, the support of the local ones can be added more or less easily - there is one ugly thing need to be done though) So .. what is all about. First of all - as usually, I'm sorry for the big PR. But it's hard to break it down to peaces. The good news is that in the same time it's a copy-pasta from the original codegen, no surprises here. Basically, the most hard place to read is `ConstantAggregateBuilder::addBits` copied with minimum of changes. The main problem - and frankly speaking I have no idea why it's done this way in the original codegen - is that the data layout is different for such structures, I mean literally another type is used. For instance, the code: ``` struct T { int X : 15; int Y : 6; unsigned Z : 9; int W; }; struct T GV = { 1, 5, 256, -1}; ``` is represented in LLVM IR (with no CIR enabled) as: ``` %struct.T = type { i32, i32 } %struct.Inner = type { i8, i32 } @gv = dso_local global { i8, i8, i8, i8, i32 } ... ``` i.e. the global var `GV` is looks like a struct of single bytes (up to the last field, which is not a btfield). And my guess is that we want to have the same behavior in CIR. So we do. The main problem is that we have to treat the same data differently - and this is why one additional `bitcast` is needed when we create a global var. Actually, there was a comment there - and I really wonder where it came from. But anyways, I don't really like this and don't see any good workaround here. Well, maybe we may add a kind of map in order to store the correspondence between types and do a bitcast more wisely. The same is true for the const structs with bitfields defined locally.
Configuration menu - View commit details
-
Copy full SHA for 38bd933 - Browse repository at this point
Copy the full SHA 38bd933View commit details -
[CIR][Lowering][Bugfix] Fix lowering of bool_to_int cast (llvm#450)
The minimal bug repro: ``` #include <stdbool.h> #include <stdint.h> void bar() { bool x = true; uint8_t y = (uint8_t)x; } ``` Fails on verification stage: ``` loc("repro.c":5:24): error: integer width of the output type is smaller or equal to the integer width of the input type fatal error: error in backend: The pass manager failed to lower CIR to LLVMIR dialect! ``` The problem is that in some cases lowering from CIR emits the invalid zext operation. PR fixes this issue by emitting the llvm.bitcast instead of llvm.zext in such cases.
Configuration menu - View commit details
-
Copy full SHA for 113b787 - Browse repository at this point
Copy the full SHA 113b787View commit details
Commits on Feb 6, 2024
-
Configuration menu - View commit details
-
Copy full SHA for cb53cf8 - Browse repository at this point
Copy the full SHA cb53cf8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 671ffc7 - Browse repository at this point
Copy the full SHA 671ffc7View commit details -
[CIR][CIRGen] Add suppport for local typedefs (llvm#451)
The change is taken from original codegen.
Configuration menu - View commit details
-
Copy full SHA for 72e9f23 - Browse repository at this point
Copy the full SHA 72e9f23View commit details -
[CIR][CIRGen][BugFix] Fix building of calls (llvm#452)
The issue is that the CIR codegen assumes that function pointer is always result of cir.load op. But it isn't true because the funcion pointer may be result of other operations (f.e cir.call).
Configuration menu - View commit details
-
Copy full SHA for 013a653 - Browse repository at this point
Copy the full SHA 013a653View commit details -
Configuration menu - View commit details
-
Copy full SHA for e95a5c4 - Browse repository at this point
Copy the full SHA e95a5c4View commit details
Commits on Feb 7, 2024
-
Configuration menu - View commit details
-
Copy full SHA for c3e6388 - Browse repository at this point
Copy the full SHA c3e6388View commit details
Commits on Feb 8, 2024
-
[CIR][CIRGen] Add codegen for global compound literals (llvm#454)
This PR adds support for global compound literals. The implementation is almost the same as in original codegen. But the original codegen can reuse the value of emitted compound literal global variable in case then the init expression of new variable and this variable are the same. It's easy to implement this feature. But I can't find any test-case then this feature will be applied. So I decided to ignore this optimization opportunity to avoid mistakes.
Configuration menu - View commit details
-
Copy full SHA for 4f89aa7 - Browse repository at this point
Copy the full SHA 4f89aa7View commit details -
[CIR][CodeGen] VLA support next step (llvm#453)
Here is the next step in VLA support. Basically, these changes handle different expressions, like `int (*a[5])[n]` or `sizeof(a[n])`. I took tests from the original `codegen` - they don't check anything, just verify we don't fail. There is still an issue with a proper cleanup - there are cases when `stack_save` doesn't dominate a corresponded `stack_restore`. For example in the next example: ``` void test(unsigned x) { while (1) { char a[x]; if (x > 5) break; ++x; } } ``` Look like `break` here doesn't lead to `stack_restore`. But I would say this is less related to VLA, though probably I need to fix this as well.
Configuration menu - View commit details
-
Copy full SHA for 6c29cd4 - Browse repository at this point
Copy the full SHA 6c29cd4View commit details -
[CIR][CIRGen][Bugfix] Emit valid type for evaluated const (llvm#456)
This PR fixes the issue connected with folding a simple boolean expresion pattern (f.e. `0 && RHS = 0`). The problem is that the scalar expression emitter always creates a `cir.bool` attribute as a result of expression. But in some cases the result expression should be a `cir.int` attr.
Configuration menu - View commit details
-
Copy full SHA for 06da08a - Browse repository at this point
Copy the full SHA 06da08aView commit details
Commits on Feb 9, 2024
-
[CIR][CIRGen][Exceptions][NFC] Add skeleton for some missing function…
… start/end functionality
Configuration menu - View commit details
-
Copy full SHA for 101c4c0 - Browse repository at this point
Copy the full SHA 101c4c0View commit details -
[CIR][CIRGen] Support for local const arrays (llvm#458)
The change is taken from the original llvm codegen.
Configuration menu - View commit details
-
Copy full SHA for b63a943 - Browse repository at this point
Copy the full SHA b63a943View commit details
Commits on Feb 10, 2024
-
[CIR][CIRGen][NFC] Relax asserts for using decls and namespace alias
Originally those are only used for debug info generation, so get a bit more specific on what's missing here.
Configuration menu - View commit details
-
Copy full SHA for ad2de47 - Browse repository at this point
Copy the full SHA ad2de47View commit details
Commits on Feb 12, 2024
-
[CIR][CIRGen] Fix in replacing of no_proto func (llvm#460)
When replacing the no-proto functions with it's real definition, codegen assumes that only `cir.call` operation may use the replaced function. Such behaviour leads to compilation error because of the `cir.get_global` op can also use the function to get pointer to function. This PR adds handle the case with `cir.get_global` operation and fixes the issue.
Configuration menu - View commit details
-
Copy full SHA for 877a15e - Browse repository at this point
Copy the full SHA 877a15eView commit details -
Configuration menu - View commit details
-
Copy full SHA for c976e4b - Browse repository at this point
Copy the full SHA c976e4bView commit details -
Configuration menu - View commit details
-
Copy full SHA for d7f09ca - Browse repository at this point
Copy the full SHA d7f09caView commit details
Commits on Feb 13, 2024
-
[CIR][Lowering] add lowering of bool attribute (llvm#461)
This PR adds missing case to lowerCirAttrAsValue.
Configuration menu - View commit details
-
Copy full SHA for a1d0b22 - Browse repository at this point
Copy the full SHA a1d0b22View commit details -
[CIR][CIRGen][Exceptions] Prep work for using cir.try_call outside ci…
…r.try The final destination here is to support cir.try_calls that are not within a `try {}` statement in C++. This only affect untested paths that will assert a bit later than before, testcase coming soon.
Configuration menu - View commit details
-
Copy full SHA for 49bcdd2 - Browse repository at this point
Copy the full SHA 49bcdd2View commit details
Commits on Feb 14, 2024
-
[CIR][CodeGen] Locally inited structures with bitfields (llvm#463)
The second part of the job started in llvm#412 , now about local structures. As it was mentioned previously, sometimes the layout for structures with bit fields inited with constants differ from the originally created in `CIRRecordLayoutBuilder` and it cause `storeOp` verification fail due to different structure type was used to allocation. This PR fix it. An example: ``` typedef struct { int a : 4; int b : 5; int c; } D; void bar () { D d = {1,2,3}; } ``` Well, I can't say I'm proud of these changes - it seems like a type safety violation, but looks like it's the best we can do here. The original codegen doesn't have this problem at all, there is just a `memcpy` there, I provide LLVM IR just for reference: ``` %struct.D = type { i16, i32 } @__const.bar.d = private unnamed_addr constant { i8, i8, i32 } { i8 33, i8 0, i32 3 }, align 4 ; Function Attrs: noinline nounwind optnone uwtable define dso_local void @bar() #0 { entry: %d = alloca %struct.D, align 4 call void @llvm.memcpy.p0.p0.i64(ptr align 4 %d, ptr align 4 @__const.bar.d, i64 8, i1 false) ret void } ```
Configuration menu - View commit details
-
Copy full SHA for 6d83a86 - Browse repository at this point
Copy the full SHA 6d83a86View commit details -
[CIR][CIRGen] Introduce cir.unreachable operation (llvm#447)
In llvm#426 we confirmed that CIR needs a `cir.unreachable` operation to mark unreachable program points [(discussion)](llvm#426 (comment)). This PR adds it.
Configuration menu - View commit details
-
Copy full SHA for d3b91b5 - Browse repository at this point
Copy the full SHA d3b91b5View commit details -
[CIR][CIRGen] Add missing case to VisitMemberExpr (llvm#464)
This PR adds support for evaluating constants in member exprs. The change is taken from original codegen.
Configuration menu - View commit details
-
Copy full SHA for 19350cf - Browse repository at this point
Copy the full SHA 19350cfView commit details -
[CIR][CIRGen][Exceptions] Add unwind attribute
- Add it to functions but not yet on calls. - Add more skeleton for tagging function attributes. - Testcases One more incremental step towards cir.try_call outside cir.try scopes.
Configuration menu - View commit details
-
Copy full SHA for e3d14fd - Browse repository at this point
Copy the full SHA e3d14fdView commit details
Commits on Feb 15, 2024
-
[CIR][CodeGen] Inline assembly: adds operands (llvm#465)
The next step in inline-assembly support: we add instruction operands! Nothing interesting, just some copy-pasta from the `codegen` with some sort of simplifications for now. Well, I'm not sure `functional-type` is the best way to print operands though it's used in mlir's `InlineAsmOp`. But anyways, maybe you have a better idea. There are two or three steps ahead, so we are not that far from being able to run something!
Configuration menu - View commit details
-
Copy full SHA for e0dc80f - Browse repository at this point
Copy the full SHA e0dc80fView commit details -
Configuration menu - View commit details
-
Copy full SHA for b5e684e - Browse repository at this point
Copy the full SHA b5e684eView commit details
Commits on Feb 16, 2024
-
[CIR][CodeGen] Adds clobbers to inline assembly (llvm#469)
One more tiny step! This a tiny PR that adds clobbers to constraint string. Note, that `~{dirflag},~{fpsr},~{flags}` is a [X86](https://github.com/llvm/clangir/blob/main/clang/lib/Basic/Targets/X86.h#L281) dependent clobbers. Basically, the next things remain: - lowering - store the results of the `cir.asm`
Configuration menu - View commit details
-
Copy full SHA for da2e461 - Browse repository at this point
Copy the full SHA da2e461View commit details
Commits on Feb 17, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 559da04 - Browse repository at this point
Copy the full SHA 559da04View commit details
Commits on Feb 20, 2024
-
[CIR][Lowering] Handle unsupported types for CIR-MLIR type conversion (…
…llvm#471) * Pointers to CIR types that do not have converters (e.g. cir.struct) cause crashes due to passing null types to construct mlir::MemRefType. * This commit adds checks for pointers and alloca lowering to fail gracefully if the underlying type can not be converted.
Configuration menu - View commit details
-
Copy full SHA for 321ca2b - Browse repository at this point
Copy the full SHA 321ca2bView commit details -
[CIR][CIRGen] Support for zero initialization of arrays (llvm#468)
As in original codegen this PR uses the do-while loop to initialize the array elements with the filler expression. But unlike the original codegen we allocates the temporary variable on stack. Allocation is necessary to store the pointer to the first uniinitialized element.
Configuration menu - View commit details
-
Copy full SHA for e846fd2 - Browse repository at this point
Copy the full SHA e846fd2View commit details -
[CIR][CodeGen][Bugfix] Fix storage size for bitfields (llvm#462)
This PR fixes a bug caused by `IntType` size limitations in CIR (and by some magic of numbers as well). As you know, we need to create a storage for bit fields that usually contain several of them. There next code fails with `IntType` size check which exceeds 64 bits. ``` typedef struct { uint8_t a; uint8_t b; uint8_t c; int d: 2; int e: 2; int f: 4; int g: 25; int h: 3; int i: 4; int j: 3; int k: 8; int l: 14; } D; void foo() { D d; } ``` Note, if we remove first three fields (or even one) everything will be fine even without this fix, because [this](https://github.com/llvm/clangir/blob/main/clang/lib/CIR/CodeGen/CIRRecordLayoutBuilder.cpp#L553) check won't pass. The bug is kind of hard to reproduce and I would say it's a rare case. I mean the problem is not only in the number of bit fields that form together something bigger than 64 bits. ### Several details Well, while iterating over the bit fields in some struct type, we need to stop accumulating bit fields in one storage and start to do the same in another one. Basically, we operate with `Tail` and `StartBitOffset` where the former is an offset of the next field. And once `Tail - StartBitOffset >= 64` we say that it's not possible to create a storage of such size due to `IntType` size limitation. Sounds reasonable. But it can be a case when we can not afford to take the next field because its `Tail` in turn leads to a storage of the size bigger then 64. Thus, we want to check it as well. From the implementation point of view I added one more check to the `IsBetterAsSingleFieldRun` in order to have all these checks for size in a single place. And the check I mentioned before were saving us from hitting this issue.
Configuration menu - View commit details
-
Copy full SHA for 72eccae - Browse repository at this point
Copy the full SHA 72eccaeView commit details
Commits on Feb 21, 2024
-
Configuration menu - View commit details
-
Copy full SHA for b82fdb0 - Browse repository at this point
Copy the full SHA b82fdb0View commit details
Commits on Feb 22, 2024
-
[CIR][Codegen] Fix bitfields unary and binary ops (llvm#477)
This PR fixes a couple of NIY features for bit fields. Basically, such expressions with bit fields `x->a++` and `x->a |= 42` are supported now. The main problem is `UnOp` verification - now it can be defined both by `loadOp` and by `GetBitfieldOp` or even by `CastOp`. So shame on me, I removed a test from `invalid.cir`
Configuration menu - View commit details
-
Copy full SHA for 624f2be - Browse repository at this point
Copy the full SHA 624f2beView commit details -
[CIR][CIRGen] Fix calling a function through a function pointer (llvm…
…#467) CIR codegen always casts the no-proto function pointer to `FuncOp`. But the function pointer may be result of cir operations (f.e. `cir.load`). As a result in such cases the function pointer sets to `nullptr`. That leads to compilation error. So this PR removes the unecessary cast to 'FuncOp' and resolves the issue.
Configuration menu - View commit details
-
Copy full SHA for 876101b - Browse repository at this point
Copy the full SHA 876101bView commit details -
[CIR] initial support for pointer-to-data-member type (llvm#401)
This patch adds initial support for the pointer-to-data-member type. Specifically, this commit includes: - New ops, types, and attributes: - CodeGen for pointer-to-data-member types and values - Lower C++ pointer-to-member type - Lower C++ expression `&C::D` - Lower C++ expression `c.*p` and `c->*p` This patch only includes an initial support. The following stuff related to pointer-to-member types are not supported yet: - Pointer to member function; - Conversion from `T Base::*` to `T Derived::*`; - LLVMIR lowering.
Configuration menu - View commit details
-
Copy full SHA for c2bca4a - Browse repository at this point
Copy the full SHA c2bca4aView commit details
Commits on Feb 29, 2024
-
[CIR][NFC] Add unimplemented feature guard for dialect code (llvm#481)
As discussed in pull llvm#401 , The present `UnimplementedFeature` class is made for the CIRGen submodule and we need similar facilities for code under `clang/lib/CIR/Dialect/IR`. This NFC patch adds a new `CIRDialectUnimplementedFeature` class that provides unimplemented feature guards for CIR dialect code.
Configuration menu - View commit details
-
Copy full SHA for 85a48c7 - Browse repository at this point
Copy the full SHA 85a48c7View commit details -
[CIR][Lowering] More cir.asm lowering (llvm#472)
This PR adds lowering for `cir.asm`. Also, two flags were added to the `cir.asm` : `hasSideEffects` and `isStackAligned` in order to match with the llvm dialect. Also, I added several simple tests for lowering. I'm not sure but most likely the next PR will be the last one in this story about assembly support )
Configuration menu - View commit details
-
Copy full SHA for 9a69667 - Browse repository at this point
Copy the full SHA 9a69667View commit details
Commits on Mar 5, 2024
-
[CIR][CIRGen] Emit
cir.unreachable
on implicit returns (llvm#486)This patch changes the emission of implicit returns from functions whose return type is not `void`. Instead of emitting `cir.return`, this PR aligns to the original clang CodeGen and emits a `cir.unreachable` operation. Related issue: llvm#457 .
Configuration menu - View commit details
-
Copy full SHA for 0ba4f5a - Browse repository at this point
Copy the full SHA 0ba4f5aView commit details -
[CIR][CIRGen] Add support for builtin bit operations (llvm#474)
This PR adds CIRGen support for the following built-in bit operations: - `__builtin_ffs{,l,ll,g}` - `__builtin_clz{,l,ll,g}` - `__builtin_ctz{,l,ll,g}` - `__builtin_clrsb{,l,ll,g}` - `__builtin_popcount{,l,ll,g}` - `__builtin_parity{,l,ll,g}` This PR adds a new operation, `cir.bits`, to represent such bit operations on the input integers. LLVMIR lowering support is not included in this PR. > [!NOTE] > As a side note, C++20 adds the `<bit>` header which includes some bit operation functions with similar functionalities to the built-in functions mentioned above. However, these standard library functions have slightly different semantics than the built-in ones and this PR does not include support for these standard library functions. Support for these functions may be added later, or amended into this PR if the reviewers request so. Co-authored-by: Bruno Cardoso Lopes <bcardosolopes@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 116a86d - Browse repository at this point
Copy the full SHA 116a86dView commit details -
[CIR] Vector types - part 4 (llvm#490)
This is part 4 of implementing vector types and vector operations in ClangIR, issue llvm#284. This change has three small additions. Implement a "vector splat" conversion, which converts a scalar into vector, initializing all the elements of the vector with the scalar. Implement incomplete initialization of a vector, where the number of explicit initializers is less than the number of elements in the vector. The rest of the elements are implicitly zero initialized. Implement conversions between different vector types. The language rules require that the two types be the same size (in bytes, not necessarily in the number of elements). These conversions are always implemented with a bitcast. The first two changes only required changes to the AST -> ClangIR code gen. There are no changes to the ClangIR dialect, so no changes to the LLVM lowering were needed. The third part only required a change to a validation rule. The code to implement a vector bitcast was already present. The compiler just needed to stop rejecting it as invalid ClangIR.
Configuration menu - View commit details
-
Copy full SHA for 19de5fc - Browse repository at this point
Copy the full SHA 19de5fcView commit details -
[CIR][CIRGen] Support for __builtin_expect (llvm#478)
This PR adds the new `cir.expect` opcode which is similar to llvm.expect intricnsics. Codegen of `__builtin_expect` emits `cir.expect` opcode. Then `cir.expect` will be lowered to `llvm.expect` intrinsic. When implementing __builtin_expect I faced with minor issue. CIR lowering of `if` often emits the lllvm IR with redundant cast instructions. Like this: ``` %0 = call i64 @llvm.expect.i64(i64 %any, i64 1), !dbg !13 %1 = icmp ne i64 %0, 0 %2 = zext i1 %0 to i8 // redundant %3 = trunc i8 %1 to i1 // redundant br i1 %3, label %l1, label %l2 ``` But the llvm pass `LowerExpectIntrinsicPass` (that should replace `llvm.expect` with branch metadata) performs only simple pattern-matching. And it can't handle this zext/trunc intructions. So this pass in such cases just removes the `llvm.expect` without updating a branch metadata. In this reason this PR also avoid emitting the redundant zext/cast instruction sequence.
Configuration menu - View commit details
-
Copy full SHA for 9d55d0f - Browse repository at this point
Copy the full SHA 9d55d0fView commit details
Commits on Mar 6, 2024
-
[CIR][CIRGen] Partial support for
offsetof
(llvm#492)Support `offset` expression in case when we can evaluate offset expression as integer.
Configuration menu - View commit details
-
Copy full SHA for 6191da3 - Browse repository at this point
Copy the full SHA 6191da3View commit details -
[CIR][CIRGen] Support for CStyleCastExprClass in buildCastLValue (llv…
…m#494) Change is taken from original llvm codegen
Configuration menu - View commit details
-
Copy full SHA for 2ab8d1e - Browse repository at this point
Copy the full SHA 2ab8d1eView commit details
Commits on Mar 7, 2024
-
[CIR] Add
cir.trap
operation (llvm#496)This PR adds the `cir.trap` operation, which corresponds to the `__builtin_trap` builtin function. When executed, the operation terminates the program abnormally in an implementation-defined manner. This PR also includes CIRGen and LLVM lowering support for the new operation.
Configuration menu - View commit details
-
Copy full SHA for bfc16da - Browse repository at this point
Copy the full SHA bfc16daView commit details
Commits on Mar 8, 2024
-
[CIR][FrontendTool] Fix overly conservative compatible flags
Remove check since paths that aren't related to ClangIR shouldn't be affected at all, even if the flag is ON. Also, this conservative error message wasn't tested.
Configuration menu - View commit details
-
Copy full SHA for e10f9d9 - Browse repository at this point
Copy the full SHA e10f9d9View commit details
Commits on Mar 9, 2024
-
[CIR] Vector ternary operator (llvm#500)
Implement the vector version of the ternary (`?:`) operator. This is a separate MLIR op than the regular `?:` operator because the vector version is not short-circuiting and always evaluates all its arguments.
Configuration menu - View commit details
-
Copy full SHA for 62e97a7 - Browse repository at this point
Copy the full SHA 62e97a7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 062b69e - Browse repository at this point
Copy the full SHA 062b69eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 460cffa - Browse repository at this point
Copy the full SHA 460cffaView commit details
Commits on Mar 11, 2024
-
Configuration menu - View commit details
-
Copy full SHA for cc4fddd - Browse repository at this point
Copy the full SHA cc4fdddView commit details -
Configuration menu - View commit details
-
Copy full SHA for 26e1ad1 - Browse repository at this point
Copy the full SHA 26e1ad1View commit details
Commits on Mar 12, 2024
-
[CIR][Lowering] Add LLVMIR lowering support for CIR bit operations (l…
…lvm#501) This PR adds the LLVMIR lowering support for CIR bit operations. For `cir.bit.clz`, `cir.bit.ctz`, and `cir.bit.popcount`, they can be lowered directly to LLVM intrinsic calls to `@llvm.ctlz`, `@llvm.cttz`, and `@llvm.ctpop`, respectively. For the other three bit operations, namely `cir.bit.clrsb`, `cir.bit.ffs`, and `cir.bit.parity`, they are lowered to a sequence of LLVM IR instructions that implements their functionalities. This lowering scheme is also used by the original clang CodeGen.
Configuration menu - View commit details
-
Copy full SHA for 1ee9340 - Browse repository at this point
Copy the full SHA 1ee9340View commit details -
[CIR][CIRGen] Enable support of bool increment (llvm#493)
CIRGenFunction::buildFromMemory can handle the `cir.bool` values. So we no longer need to emit the `NIY` error here.
Configuration menu - View commit details
-
Copy full SHA for 829dd95 - Browse repository at this point
Copy the full SHA 829dd95View commit details -
[CIR][CIRGen] Inline asm: operand attributes (llvm#491)
This is the next step in inline assembly support and it's more like a service PR and mostly dedicated to the in/out argument types. Also, operand attributes are added and it's the last change in the `cir.asm` operation afaik. But I would wait untill the next PR, which will contain more examples and maybe will help us to get more readable format for the operation. Note, that we have to add an attribute for each operand - because the lowering of the llvm dialect to LLVM IR iterates over them in the same order. The next PR will be last one (so far) in the series of PRs dedicated to the inline assembly support. It will add storing of the results.
Configuration menu - View commit details
-
Copy full SHA for d7d62a6 - Browse repository at this point
Copy the full SHA d7d62a6View commit details -
[CIR] Vector type cleanup and refactoring (llvm#503)
Three small changes, all cleanup or refactoring in nature. 1. Fix the assemblyFormat for all the vector operations in the ClangIR dialect so that vector types appear in ClangIR as `!cir.vector<type x n>` instead of as just `<type x n>`. When I first created the vector ops, I forgot to use `qualified` as necessary when writing out types. This change fixes that. There is no change in behavior, but there is a change to the text version of ClangIR, which required changing the ClangIR expected results and ClangIR inputs in the tests. 2. Create a new `cir.vec.splat` operation and use that for "vector splat", i.e. a conversion from a scalar to a vector. A "vector splat" conversion had been implemented with `cir.vec.create` before. This change results in different ClangIR and different LLVM IR, which again required updating the tests, but no noticeable change in compiler behavior. 3. Create an `IntegerVector` type constraint, which requires that the given type be a vector whose element type is an integer. It can be any integral type, and the vector can be of any size. Use the new type constraint in the definition of `cir.vec.ternary`, whose condition operand must be an `IntegerVector`. Remove the integral type check from `VecTernaryOp::verify`, since doing the check there is now redundant. The only possibly visible change is to the text of an error message when validation of `cir.vec.ternary` fails. The expected output of a validation test was updated with the new message.
Configuration menu - View commit details
-
Copy full SHA for 108d233 - Browse repository at this point
Copy the full SHA 108d233View commit details -
[CIR][Codegen][Lowering] Introduce new bitfield layout (llvm#487)
This PR intends to fix some problems with packed structures support, so the llvm#473 will work. Basically, the main problem for the packed structures support is an absence of arbitrary sized integers in CIR. Well, one workaround is to use `mlir::IntegerType` for that, but it's kind of wrong way (please correct me if I'm wrong). Another way is to introduce this type in CIR. So far I suggest this way: instead of arbitrary sized integers we will create an array of bytes for bitfield storages whenever they doesn't fit into the CIR `IntType`. Well, the original codegen creates storages with alignment 8 - so it can be `i24` storage type for instance. Previously, we just created storages that could be represented as CIR `IntType`: 8, 16, 32, 64. And it was working before I came up with a necessity to support packed structures. At first glance it's not a problem - just add `determinePacked` method from the original codegen and that's it. But it turned out that this method _infers_ the fact if a structure is packed or not. It doesn't use the AST attribute for that as one could think - it works with offsets and alignments of fields. Thus, we either need to invent our own way to determine packed structures (which is error prone and maybe not doable at all) or try to use the existing one. Also, we go closer to the original lllvm's data layout in this case. 1) I had to move the lowering details from the `LoweringPrepare` to the `LowerToLLVM`, because it's not possible to do a `load` from the array of bytes to the integer type - and it's ok in llvm dialect. Thus, all the math operations can be expressed without any problems. Basically the most of the diff you see is because of the changes in the lowering. The remaining part is more or less easy to read. 2) There are minor changes in `CIRRecordLayoutBuilder` - as described above, we use may generate an array of bytes as a storage. 3) Some cosmetic changes in `CIRGenExpr` - since we don't want to infer the storage type again and just use the one stored in the `CIRGenBitFieldInfo`. 4) Helpers are introduced in the lowering - but nothing hard - just shifts and logical ops. 5) I removed `bitfield-ops` test - because now the test cases covered there are all in `bitfields.c` and `bitfields.cpp` . So ... This is still a suggestion, though I believe it's a good one. So you are welcome to discuss, suggest another ways to solve the problem and etc.
Configuration menu - View commit details
-
Copy full SHA for 47c2e56 - Browse repository at this point
Copy the full SHA 47c2e56View commit details -
[CIR][CIRGen] Add support for ctor/dtor based array init/destroy
Still missing lowering support, which will come next.
Configuration menu - View commit details
-
Copy full SHA for 65f27ad - Browse repository at this point
Copy the full SHA 65f27adView commit details
Commits on Mar 14, 2024
-
Configuration menu - View commit details
-
Copy full SHA for a7910b8 - Browse repository at this point
Copy the full SHA a7910b8View commit details -
Configuration menu - View commit details
-
Copy full SHA for c550e90 - Browse repository at this point
Copy the full SHA c550e90View commit details -
[CIR][CIRGen][NFC] Skeleton for atomics support
This doesn't change existing functionality, for existing crashes related to atomics we just hit asserts a bit further now, but no support added just yet. Next set of commits will introduce functionlity with testcases.
Configuration menu - View commit details
-
Copy full SHA for 15903b6 - Browse repository at this point
Copy the full SHA 15903b6View commit details -
[CIR][CIRGen][Atomics][NFC] Skeleton for constant order codegen
Just like previous commit, add more infra pieces, still NFC since all relevant testcases hit asserts, just a bit deeper.
Configuration menu - View commit details
-
Copy full SHA for 2c680f1 - Browse repository at this point
Copy the full SHA 2c680f1View commit details
Commits on Mar 15, 2024
-
[CIR][Codegen] Initial support for packed structures (llvm#473)
This PR adds a support for packed structures. Basically, now both `pragma pack(...)` and `__attribute__((aligned(...)))` should work. The only problem is that `getAlignment` is not a total one - I fix only a couple of issues I faced with - for struct types and arrays.
Configuration menu - View commit details
-
Copy full SHA for 90786c8 - Browse repository at this point
Copy the full SHA 90786c8View commit details -
[CIR][CIRGen] Support for initialization of unions. (llvm#495)
PR adds support for initialization of unions. The change is copy-pasted from the original CodeGen.
Configuration menu - View commit details
-
Copy full SHA for 3d86b46 - Browse repository at this point
Copy the full SHA 3d86b46View commit details -
[CIR][CIRGen] Support for __builtin_prefetch (llvm#504)
This PR adds support for `__builtin_prefetch`. CIRGen of this builtin emits the new 'cir.prefetch' opcode. Then `cir.prefetch` lowers to `llvm.prefetch` intrinsic. Co-authored-by: Bruno Cardoso Lopes <bcardosolopes@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 7c7c4ff - Browse repository at this point
Copy the full SHA 7c7c4ffView commit details -
[CIR] Add MemRead/MemWrite markers to bitfield ops (llvm#507)
This PR adds MemRead/MemWrite markers to the `GetBitfieldOp` and `SetBitfieldOp` (as discussed in llvm#487) Also, minor renaming in the `SetBitfieldOp` --------- Co-authored-by: Bruno Cardoso Lopes <bcardosolopes@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 1f8f096 - Browse repository at this point
Copy the full SHA 1f8f096View commit details -
[CIR][CIRGen] Support for __builtin_constant_p (llvm#506)
This PR adds support for `__builtin_constant_p`. Implementation introduces the new `cr.is_constant` opcode to it during the codegeneration of builtin. Codegeneration is taken from the original llvm codegen.
Configuration menu - View commit details
-
Copy full SHA for 2a0fcd5 - Browse repository at this point
Copy the full SHA 2a0fcd5View commit details
Commits on Mar 19, 2024
-
[CIR][CIRGen] Support for C++20 three-way comparison (llvm#485)
This patch adds CIRGen support for the C++20 three-way comparison operator `<=>`. The binary operator is directly lowered to existing CIR operations. Most of the changes are tests.
Configuration menu - View commit details
-
Copy full SHA for 9fde505 - Browse repository at this point
Copy the full SHA 9fde505View commit details
Commits on Mar 21, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 3896c0e - Browse repository at this point
Copy the full SHA 3896c0eView commit details
Commits on Mar 22, 2024
-
[CIR][CIRGen] Support for compound literal lvalue (llvm#515)
This change is taken from the original codegen.
Configuration menu - View commit details
-
Copy full SHA for fd354e5 - Browse repository at this point
Copy the full SHA fd354e5View commit details -
[CIR][CIRGen] Support for __attribute__((fallthrough)) statement (llv…
…m#517) This PR adds handling of AttributedStmt to support fallthrough attribute.
Configuration menu - View commit details
-
Copy full SHA for 8d87565 - Browse repository at this point
Copy the full SHA 8d87565View commit details -
[CIR][CIRGen] Add handling __extension__ keyword for lvalue (llvm#519)
This change is taken from the original codegen
Configuration menu - View commit details
-
Copy full SHA for c9dd759 - Browse repository at this point
Copy the full SHA c9dd759View commit details
Commits on Apr 2, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 670f30d - Browse repository at this point
Copy the full SHA 670f30dView commit details
Commits on Apr 3, 2024
-
[CIR] Introduce a flattening pass (llvm#516)
We start our journey towards `goto` support and this is a first step on this way. There are some discussion in llvm#508 and according to the plan we do the following here: - a new pass called `cir-flatten-cfg` that is a stub now but later will be responsible for the regions inlining. The pass works only if `-emit-flat-cir` is passed in cmd line. Thus, the clang behavior is not changed here from the user's point of view. - The pass will be accomplished with `goto` solver later, so we talk about several passes that are mandatory for the lowering into `llvm` dialect. There are at least two clients of this pass that will be affected: `clang` itself and `cir-opt`, so we need a common point for them: and `populateCIRFlatteningPasses` and `populateCIRToLLVMPasses` guarantee that `CIR` will be in the correct state for all the clients, whatever new passes we will add later.
Configuration menu - View commit details
-
Copy full SHA for 49b609b - Browse repository at this point
Copy the full SHA 49b609bView commit details -
[CIR][CIRGen] Add support for __atomic_add_fetch
This introduces CIRGen and LLVM lowering for the first of a bunch of these atomic operations, incremental work should generelize the current constructs.
Configuration menu - View commit details
-
Copy full SHA for e58a597 - Browse repository at this point
Copy the full SHA e58a597View commit details
Commits on Apr 5, 2024
-
[CIR] shufflevector and convertvector built-ins (llvm#530)
Implement `__builtin_shufflevector` and `__builtin_convertvector` in ClangIR. This change contributes to the implemention of issue llvm#284. `__builtin_convertvector` is implemented as a cast. LLVM IR uses the same instructions for arithmetic conversions of both individual scalars and entire vectors. So ClangIR does the same. The code for handling conversions, in both CodeGen and Lowering, is cleaned up to correctly handle vector types. To simplify the lowering code and avoid `if (type.isa<VectorType>())` statements everywhere, the utility function `elementTypeIfVector` was added to `LowerToLLVM.cpp`. `__builtin_shufflevector` has two forms, only one of which appears to be documented. The documented form, which takes a variable-sized list of integer constants for the indices, is implemented with the new ClangIR operation `cir.vec.shuffle.ints`. This operation is lowered to the `llvm.shufflevector` op. The undocumented form, which gets the indices from a vector operand, is implemented with the new ClangIR operation `cir.vec.shuffle.vec`. LLVM IR does not have an instruction for this, so it gets lowered to a long series of `llvm.extractelement` and `llvm.insertelement` operations.
Configuration menu - View commit details
-
Copy full SHA for d18777b - Browse repository at this point
Copy the full SHA d18777bView commit details
Commits on Apr 6, 2024
-
[CIR] Add support for byteswap intrinsic (llvm#523)
This PR adds support for the following intrinsic functions: - `__builtin_bswap{16, 32, 64}` - `_byteswap_{ushort, ulong, uint64}` This PR adds a new `cir.bswap` operation to represent such an intrinsic call. CIRGen and LLVMIR lowering for the new operation is included in this PR.
Configuration menu - View commit details
-
Copy full SHA for 84851f8 - Browse repository at this point
Copy the full SHA 84851f8View commit details -
[CIR] GNU vector type cleanup (llvm#531)
This is the final commit for issue llvm#284. Vector types other than GNU vector types will be covered by other yet-to-be-created issues. Now that GNU vector types (the ones defined via the vector_size attribute) are implemented, do a final cleanup of the assertions and other checks related to vector types. Remove `UnimplementedFeature::cirVectorType()`. Deal with the remaining calls to that function. When the that is not yet implemented has to do with Arm SVE vectors, the assert was changed to `UnimplementedFeature::scalableVectors()` instead. The assertion was removed in cases where the code correctly handle GNU vector types. While cleaning up the assertion checks, I noticed that BinOp handling of vector types wasn't quite complete. Any special handling for integer or floating-point types wasn't happening when the operands were vector types. To fix this, split `BinOpInfo::Ty` into two fields, `FullType` and `CompType`. `FullType` is the type of the operands. `CompType` is normally the same as `FullType`, but is the element type when `FullType` is a vector type.
Configuration menu - View commit details
-
Copy full SHA for 4b49152 - Browse repository at this point
Copy the full SHA 4b49152View commit details
Commits on Apr 8, 2024
-
Configuration menu - View commit details
-
Copy full SHA for a853799 - Browse repository at this point
Copy the full SHA a853799View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8ba2142 - Browse repository at this point
Copy the full SHA 8ba2142View commit details -
[CIR][CIRGen] Add support for __atomic_fetch_binop
Note this is different from __atomic_binop_fetch. See added docs.
Configuration menu - View commit details
-
Copy full SHA for eaea071 - Browse repository at this point
Copy the full SHA eaea071View commit details -
Configuration menu - View commit details
-
Copy full SHA for a5c9aca - Browse repository at this point
Copy the full SHA a5c9acaView commit details
Commits on Apr 9, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 7f4768b - Browse repository at this point
Copy the full SHA 7f4768bView commit details
Commits on Apr 10, 2024
-
[CIR][CIRGen] Add missing CIRGen for generic bit operation builtins (l…
…lvm#540) This patch adds the CIRGen for the following builtin functions: - `__builtin_clzg`; - `__builtin_ctzg`; - `__builtin_popcountg`. CIRGen for these three functions are missing in the original PR which introduces CIR bit ops.
Configuration menu - View commit details
-
Copy full SHA for 459f6f5 - Browse repository at this point
Copy the full SHA 459f6f5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7804db0 - Browse repository at this point
Copy the full SHA 7804db0View commit details -
[CIR][CIRGen] Add support for __attribute__((constructor))
Also add skeleton for upcoming dtor support.
Configuration menu - View commit details
-
Copy full SHA for ccd551b - Browse repository at this point
Copy the full SHA ccd551bView commit details
Commits on Apr 11, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 06cf3c3 - Browse repository at this point
Copy the full SHA 06cf3c3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 17c8db6 - Browse repository at this point
Copy the full SHA 17c8db6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 58b8bc7 - Browse repository at this point
Copy the full SHA 58b8bc7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 90710ce - Browse repository at this point
Copy the full SHA 90710ceView commit details -
Configuration menu - View commit details
-
Copy full SHA for a0e3c1c - Browse repository at this point
Copy the full SHA a0e3c1cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 91685f8 - Browse repository at this point
Copy the full SHA 91685f8View commit details
Commits on Apr 12, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 6233ee0 - Browse repository at this point
Copy the full SHA 6233ee0View commit details -
Configuration menu - View commit details
-
Copy full SHA for a1bc344 - Browse repository at this point
Copy the full SHA a1bc344View commit details -
Configuration menu - View commit details
-
Copy full SHA for 906c314 - Browse repository at this point
Copy the full SHA 906c314View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7865351 - Browse repository at this point
Copy the full SHA 7865351View commit details -
Configuration menu - View commit details
-
Copy full SHA for 84ebc8c - Browse repository at this point
Copy the full SHA 84ebc8cView commit details
Commits on Apr 15, 2024
-
[CIR][Codegen] IfOp flattening (llvm#537)
This PR perform flattening for `cir::IfOp` Basically, we just move the code from `LowerToLLVM.cpp` to `FlattenCFG.cpp`. There are several important things though I would like to highlight. 1) Consider the next code from the tests: ``` cir.func @foo(%arg0: !s32i) -> !s32i { %4 = cir.cast(int_to_bool, %arg0 : !s32i), !cir.bool cir.if %4 { %5 = cir.const(#cir.int<1> : !s32i) : !s32i cir.return %5 : !s32i } else { %5 = cir.const(#cir.int<0> : !s32i) : !s32i cir.return %5 : !s32i } cir.return %arg0 : !s32i } ``` The last `cir.return` becomes unreachable after flattening and hence is not reachable in the lowering. So we got the next error: ``` error: 'cir.return' op expects parent op to be one of 'cir.func, cir.scope, cir.if, cir.switch, cir.do, cir.while, cir.for' cir.return %arg0 : !s32i ``` the parent after lowering is `llvm.func`. And this is only the beginning - the more operations will be flatten, the more similar fails will happen. Thus, I added lowering for the unreachable code as well in `LowerToLLVM.cpp`. But may be you have another solution in your mind. 2) Please, pay attention on the flattening pass - I'm not that familiar with `mlir` builders as you are, so may be I'm doing something wrong. The idea was to start flattening from the most nested operations. 3) As you requested in llvm#516, `cir-to-llvm-internal` is renamed to `cir-flat-to-llvm`. The only thing remain undone is related to the following: > Since it would be wrong to run cir-flat-to-llvm without running cir-flatten-cfg, we should make cir-flat-to-llvm pass to require cir-flatten-cfg pass to be run before. And I'm not sure I know how to do it exactly - is there something similar to pass dependencies from LLVM IR? 4) The part of `IfOp` lowering related to elimination of the vain casts for condition branch moved directly to the lowering of `BrCondOp` with some refactoring and guarding. 5) Just note, that now `cir-opt` is able to dump the flat cir as well: `cir-opt -cir-flat-cfg`
Configuration menu - View commit details
-
Copy full SHA for 440f02e - Browse repository at this point
Copy the full SHA 440f02eView commit details -
[CIR] Add initial support for bit-precise integer types (llvm#538)
This PR adds initial support for the bit-precise integer type `_BitInt(N)`. This type goes into the C23 standard, and has already been supported by clang since 2020, previously known as `_ExtInt(N)`. This PR is quite simple and straight-forward. Basically it leverages the existing `cir.int` type to represent such types. Previously `cir.int` verifies that its width must be a multiple of 8, and this verification has been removed in this PR.
Configuration menu - View commit details
-
Copy full SHA for 12fb4ed - Browse repository at this point
Copy the full SHA 12fb4edView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7380a63 - Browse repository at this point
Copy the full SHA 7380a63View commit details -
Configuration menu - View commit details
-
Copy full SHA for 275f0e4 - Browse repository at this point
Copy the full SHA 275f0e4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 267dd72 - Browse repository at this point
Copy the full SHA 267dd72View commit details
Commits on Apr 16, 2024
-
[CIR][LLVMLowering] Lower cir.objectsize (llvm#545)
Lowers `cir.objectsize` to `llvm.objectsize`
Configuration menu - View commit details
-
Copy full SHA for a53950f - Browse repository at this point
Copy the full SHA a53950fView commit details
Commits on Apr 17, 2024
-
[CIR][LLVMLowering] Fix handling of dense array conversions from cons…
…t arrays We were lacking handling of trailing zeros for constant arrays.
Configuration menu - View commit details
-
Copy full SHA for 62c6a86 - Browse repository at this point
Copy the full SHA 62c6a86View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2db13d8 - Browse repository at this point
Copy the full SHA 2db13d8View commit details -
[CIR][CodeGen] Inline assembly: store the results (llvm#512)
This PR adds storing of the results of inline assembly operation. This is a **final** step (I hope: ) ) from my side to support inline assembly. There are some features that remains unimplemented, but basic things should work now, For example, we can do addition and get the results - I explicitly added several tests for that, so you can test them in real. For instance, the next program being compiled with CIR should give you 7 as the result: ``` int add(int x, int y) { int a; __asm__("addl %[y], %[x]" : "=r" (a) : [x] "r" (x), [y] "r" (y) ); return a; } int main() { printf("run %d\n", add(3, 4)); return 0; } ``` So, the main thing remains is pretty printing. As I said I added several examples, and may be it will become more clear how to print better. Also, I added several tests from original codegen in order to check that we don't fail. And I can add some checks there as well when we come to better solution on printing.
Configuration menu - View commit details
-
Copy full SHA for 730ffda - Browse repository at this point
Copy the full SHA 730ffdaView commit details -
Revert "[CIR][LLVMLowering] Lower cir.objectsize (llvm#545)"
This reverts commit 87a61f3. It's deleting code it isn't supposed to touch.
Configuration menu - View commit details
-
Copy full SHA for 8b4c7e0 - Browse repository at this point
Copy the full SHA 8b4c7e0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5348562 - Browse repository at this point
Copy the full SHA 5348562View commit details -
Configuration menu - View commit details
-
Copy full SHA for 043f8dc - Browse repository at this point
Copy the full SHA 043f8dcView commit details -
[CIR][CodeGen] Flattening for ScopeOp and LoopOpInterface (llvm#546)
This PR is the next step towards goto support and adds flattening for `ScopeOp` and `LoopOpInterface`. Looks like I can't separate this operations and create two PRs, since some errors occur if I do so, e.g. `reference to block defined in another region`. Seems we need to flatten both operations in the same time. Given it's a copy-pasta, I think there is no need to try to make several PRs. I added several tests - just copied them from the lowering part just to demonstrate how it looks like. Note, that changes in `dot.cir` caused by `BrCondOp` updates in the previous PR, when we removed the following casts: ``` %20 = llvm.zext %19 : i1 to i8 %21 = llvm.trunc %20 : i8 to i1 llvm.cond_br %21 ... ```
Configuration menu - View commit details
-
Copy full SHA for 7740a8d - Browse repository at this point
Copy the full SHA 7740a8dView commit details -
[CIR][Codegen] Fix union init with constant (llvm#548)
Minor fix for the case when union fields have different sizes and union is inited with a constant. Example: ``` typedef union { short a; int b; } A; ```
Configuration menu - View commit details
-
Copy full SHA for 080f276 - Browse repository at this point
Copy the full SHA 080f276View commit details -
[CIR][CodeGen][Lowering] Support Integer overflow with fwrap (llvm#539)
This PR fixes some cases when a program compiled with `-fwrapv` fails with `NYI` . Basically, the default behavior is no overlap: ``` void baz(int x, int y) { int z = x - y; } ``` LLVM IR (no CIR enabled): ``` %sub = sub nsw i32 %0, %1 ``` and with `-fwrapv` : ``` %sub = sub i32 %0, %1 ``` We need something similar in CIR. The only way I see how to implement it is to add a couple of attributes to the `BinOp` to make things even with the llvm dialect. Well, are there any other ideas? --------- Co-authored-by: Bruno Cardoso Lopes <bcardosolopes@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 95e11a5 - Browse repository at this point
Copy the full SHA 95e11a5View commit details
Commits on Apr 18, 2024
-
[CIR][CIRGen] Clean up call arrangement
Catch up with upstream and also update Address.h with one more helper method for `cir::Address`.
Configuration menu - View commit details
-
Copy full SHA for 4c07a3c - Browse repository at this point
Copy the full SHA 4c07a3cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4361c2d - Browse repository at this point
Copy the full SHA 4361c2dView commit details -
Configuration menu - View commit details
-
Copy full SHA for c1311f5 - Browse repository at this point
Copy the full SHA c1311f5View commit details -
Configuration menu - View commit details
-
Copy full SHA for dce1725 - Browse repository at this point
Copy the full SHA dce1725View commit details
Commits on Apr 19, 2024
-
Configuration menu - View commit details
-
Copy full SHA for c0061fc - Browse repository at this point
Copy the full SHA c0061fcView commit details -
[CIR] Add
cir.dyn_cast
operation (llvm#483)This PR adds the `cir.dyn_cast` operation for representing `dynamic_cast` in C++. It contains the following contents: - [x] A new `cir.dyn_cast` operation. - [x] ~Two new attributes that will be attached to `cir.dyn_cast` operations:~ - [x] ~`#cir.dyn_cast_info` attributes, which gives general information about a dynamic cast (e.g. the source RTTI pointer, the dest RTTI pointer, etc.)~ - [x] ~`#cir.downcast_info` attribute, which gives even more detailed information about a dynamic cast that is a down-cast. These information will be used when rewriting the `cir.dyn_cast` operation with more fundamental CIR operations.~ - [x] CIRGen support for the new operation and attributes. - [x] Rewrite the new operation with more fundamental CIR operations in LoweringPrepare. ~This is a draft PR. Now I only added the new operation / attributes, and updated the CIRGen part. The LoweringPrepare for the new operation is not implemented. Hopefully the draft can get some initial feedbacks from the community and make sure it is on the right direction so we don't waste time on wrong things.~ Related issue: llvm#470 .
Configuration menu - View commit details
-
Copy full SHA for b5429f1 - Browse repository at this point
Copy the full SHA b5429f1View commit details -
[CIR][Codegen] TernaryOp flattening (llvm#550)
This PR adds flattening for the `cir.ternary`. This PR is just a copy pasta from the lowering + tests added/fixed. Given the complexity of `switch` flattening, I decided to open one more PR for flattening.
Configuration menu - View commit details
-
Copy full SHA for 73da668 - Browse repository at this point
Copy the full SHA 73da668View commit details -
[CIR][CIRGen][NFC] Update buildPointerWithAlignment with LLVM upstrea…
…m codegen approach
Configuration menu - View commit details
-
Copy full SHA for 536d4c2 - Browse repository at this point
Copy the full SHA 536d4c2View commit details -
[CIR] Add support for long double type (llvm#536)
This PR adds support for the `long double` type in C/C++. It includes a new CIR type `!cir.long_double` to represent the `long double` type. CIRGen and LLVMIR lowering support for the new type is also added. Since the underlying floating point format used by a `long double` value is implementation-defined, the `!cir.long_double` type is parameterized to include information about the underlying floating point format. Specifically, a `long double` value may have one of the following formats: 1) IEEE-754 binary64 format (i.e. the same format used by `double`); 2) x87 80-bit floating point format; 3) IEEE-754 binary128 format; 4) PowerPC double double format. This PR invents 3 more CIR types to represent the above floating-point formats, and `!cir.long_double` is parameterized by another CIR floating-point type which represents its underlying format: - `!cir.long_double<!cir.double>` represents the 1st variant above; - `!cir.long_double<!cir.f80>` represents the 2nd variant above; - `!cir.long_double<!cir.f128>` represents the 3rd variant above; - `!cir.long_double<!cir.ppc_doubledouble>` represents the 4th variant above. Co-authored-by: Bruno Cardoso Lopes <bcardosolopes@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 8daf005 - Browse repository at this point
Copy the full SHA 8daf005View commit details -
[CIR][CIRGen] Introduce initial support for ASTAllocaAddressSpace (ll…
…vm#551) ASTAllocaAddressSpace is a target-specific definition specificed by the codegen target info. In this commit, initial support is introduced which asserts that only the default (no qualifier) address space is supported.
Configuration menu - View commit details
-
Copy full SHA for 1c3cd0a - Browse repository at this point
Copy the full SHA 1c3cd0aView commit details
Commits on Apr 20, 2024
-
[CIR] Introduce StructLayoutAttr
Mostly NFC. StructType currently holds optional member variables to track layout specific information. Those are lazily computed at time of layout queries. Change the implementation to use an attribute as the internal implementation - later on we should perhaps incorporate parsing/printing. This is pre req work for computing alignment based on elements offsets, very soon we're gonna also store of array of offsets.
Configuration menu - View commit details
-
Copy full SHA for 9327912 - Browse repository at this point
Copy the full SHA 9327912View commit details -
[CIR] Extend StructLayoutAttr to support querying offset for members
Testcase not added because we are not using the printers and parsers, but upcoming atomic work will exercise the path and testcases.
Configuration menu - View commit details
-
Copy full SHA for 8ef3b36 - Browse repository at this point
Copy the full SHA 8ef3b36View commit details
Commits on Apr 22, 2024
-
[CIR][CodeGen] Adds SwitchOp flattening (llvm#549)
This PR adds flattening for `SwitchOp`. Despite of the previous PRs, here we have to introduce an operation for the flattening, since later we'll need to create `llvm.switch` in the lowering. So `cir.flat.switch` is a new operation, which barely copied from the dialect. I added several tests as well.
Configuration menu - View commit details
-
Copy full SHA for 9c305cb - Browse repository at this point
Copy the full SHA 9c305cbView commit details -
[CIR][NFC] Improve verifier related error messages (llvm#553)
Fix `CastOp::Verify` and invalid.cir error message. Let these error messages with consistent format. llvm#318
Configuration menu - View commit details
-
Copy full SHA for b51fcf7 - Browse repository at this point
Copy the full SHA b51fcf7View commit details -
Configuration menu - View commit details
-
Copy full SHA for b64cb19 - Browse repository at this point
Copy the full SHA b64cb19View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5d9a961 - Browse repository at this point
Copy the full SHA 5d9a961View commit details
Commits on Apr 23, 2024
-
Configuration menu - View commit details
-
Copy full SHA for b61cf01 - Browse repository at this point
Copy the full SHA b61cf01View commit details -
[CIR] Lower certain
cir.cmp3way
operations to LLVM intrinsics (llvm……#556) LLVM recently added two families of intrinsics named `llvm.scmp.*` and `llvm.ucmp.*` that generate potentially better code for three-way comparison operations. This PR lowers certain `cir.cmp3way` operations to these intrinsics. Not all `cir.cmp3way` operations can be lowered to these intrinsics. The qualifying conditions are: 1) the comparison is between two integers, and 2) the comparison produces a strong ordering. `cir.cmp3way` operations that are not qualified are not affected by this PR. Qualifying `cir.cmp3way` operations may still need some canonicalization work before lowering. The "canonicalized" form of a qualifying three-way comparison operation yields -1 for lt, 0 for eq, and 1 for gt. This PR converts those non-canonicalized but qualifying `cir.cmp3way` operations to their canonical forms in the LLVM lowering prepare pass. This PR addresses llvm#514 .
Configuration menu - View commit details
-
Copy full SHA for 77f4a0c - Browse repository at this point
Copy the full SHA 77f4a0cView commit details -
[CIR][CIRGen] Atomics: Add skeleton for compare and exchange
NFCI. Any input code still hits an assertion, just a bit down the road.
Configuration menu - View commit details
-
Copy full SHA for da1dd0f - Browse repository at this point
Copy the full SHA da1dd0fView commit details
Commits on Apr 24, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 68fe3ed - Browse repository at this point
Copy the full SHA 68fe3edView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9daae1b - Browse repository at this point
Copy the full SHA 9daae1bView commit details
Commits on Apr 25, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 7402372 - Browse repository at this point
Copy the full SHA 7402372View commit details -
[CIR][CIRGen] Add dynamic builtin alloca intrinsics support (llvm#547)
This patch adds the CIRGen for the following builtin functions: - `alloca`; - `_alloca`; - `__builtin_alloca`; - `__builtin_alloca_uninitialized`. Missing support to add in the future: - Non-default auto initialization setting. The default is to not initialize the allocated buffer, which is simpler to implement. This commit is leaving the skeleton to implement this feature following clang's codegen pattern. - It may be possible that the frontend has set non-default address space for the alloca's return value. This is the case for OpenCL or AMDGPU codes for example. This is handled in clang codegen via address space cast, and is left for future implementation. This commit introduces a guard-rail around this behaviour.
Configuration menu - View commit details
-
Copy full SHA for 96722f7 - Browse repository at this point
Copy the full SHA 96722f7View commit details -
[CIR[CIRGen][NFC] Refactor build switch op (llvm#552)
Make logic cleaner and more extensible. Separate collecting `SwitchStmt` information and building op logic into different functions. Add more UT to cover nested switch, which also worked before this pr. This pr is split from llvm#528.
Configuration menu - View commit details
-
Copy full SHA for 7cda6e9 - Browse repository at this point
Copy the full SHA 7cda6e9View commit details -
[CIR][NFC] Create LLVM intrinsic calls through `createCallLLVMIntrins…
…icOp` (llvm#564) This PR does not introduce any functional changes. It cleans up code in `LowerToLLVM.cpp` and creates all LLVM intrinsic calls through the unified `createCallLLVMIntrinsicOp` function, as suggested by [this comment](llvm#556 (comment)) in llvm#556 . Some LLVM intrinsics already have specialized LLVMIR operations. CIR operations that depend on these intrinsics are lowered to those specialized operations rather than `llvm.call_intrinsic` operation.
Configuration menu - View commit details
-
Copy full SHA for 116e184 - Browse repository at this point
Copy the full SHA 116e184View commit details -
[CIR][Lowering] Add MLIR lowering support for CIR cos operations (llv…
Configuration menu - View commit details
-
Copy full SHA for ded2fa7 - Browse repository at this point
Copy the full SHA ded2fa7View commit details -
[CIR] Remove redundant error from parseConstantValue (llvm#567)
ASMParser::parseAttribute is responsible for emitting its own errors or forwarding errors of the parsers below it. There is no reason to emit a subsequent error as it doesn't add extra information to the user. As a driveby, beutify a bit the tests that "relied" on this error and make the expected error easier to read by moving it to the line before.
Configuration menu - View commit details
-
Copy full SHA for 5718db5 - Browse repository at this point
Copy the full SHA 5718db5View commit details
Commits on Apr 26, 2024
-
Configuration menu - View commit details
-
Copy full SHA for a1cb2c0 - Browse repository at this point
Copy the full SHA a1cb2c0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 80f74eb - Browse repository at this point
Copy the full SHA 80f74ebView commit details -
[CIR][Lowering] Add long double types for cos operation lowering (llv…
Configuration menu - View commit details
-
Copy full SHA for 26a5b07 - Browse repository at this point
Copy the full SHA 26a5b07View commit details -
Configuration menu - View commit details
-
Copy full SHA for 67fa2b7 - Browse repository at this point
Copy the full SHA 67fa2b7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 426233f - Browse repository at this point
Copy the full SHA 426233fView commit details -
Configuration menu - View commit details
-
Copy full SHA for ccddaa4 - Browse repository at this point
Copy the full SHA ccddaa4View commit details
Commits on Apr 27, 2024
-
Configuration menu - View commit details
-
Copy full SHA for e197d4e - Browse repository at this point
Copy the full SHA e197d4eView commit details
Commits on Apr 30, 2024
-
[CIR] Support lowering GlobalOp and GetGlobalOp to memref (llvm#574)
This commit introduce CIRGlobalOpLowering and CIRGetGlobalOpLowering for lowering to memref.
Configuration menu - View commit details
-
Copy full SHA for 97b7280 - Browse repository at this point
Copy the full SHA 97b7280View commit details
Commits on May 1, 2024
-
TO BE UPSTREAMED !! [MLIR] Extend floating point parsing support
Parsing support for floating point types was missing a few features: 1. Parsing floating point attributes from integer literals was supported only for types with bitwidth smaller or equal to 64. 2. Downstream users could not use `AsmParser::parseFloat` to parse float types which are printed as integer literals. This commit addresses both these points. It extends `Parser::parseFloatFromIntegerLiteral` to support arbitrary bitwidth, and exposes a new API to parse arbitrary floating point given an fltSemantics as input. The usage of this new API is introduced in the Test Dialect.
Configuration menu - View commit details
-
Copy full SHA for f780f38 - Browse repository at this point
Copy the full SHA f780f38View commit details -
[CIR] Extend support for floating point attributes
This commit extends the support for floating point attributes parsing by using the new `AsmParser::parseFloat(fltSemnatics, APFloat&)` interface. As a drive-by, this commit also harmonizes the cir.fp print/parse namespace usage, and adds the constraint of supporting only "CIRFPType"s for cir.fp in tablegen instead of verifying it manually in the parsing logic.
Configuration menu - View commit details
-
Copy full SHA for d3d3988 - Browse repository at this point
Copy the full SHA d3d3988View commit details