Skip to content
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][CIRGen] Improve switch support for unrecheable code #528

Closed
wants to merge 1,536 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
1536 commits
Select commit Hold shift + click to select a range
94d428b
Revert "[CIR][CIRGen][Exception] Workaround internal testcase break"
bcardosolopes Nov 3, 2023
1ef7eab
[CIR][Lowering][Bugfix] Lower nested breaks in switch statements (#357)
gitoleg Dec 21, 2023
d5b3cc1
[CIR] Change mock std::array iterator definitions
bcardosolopes Dec 21, 2023
8fb3356
[CIR][IdiomRecognizer] Make iterator recognition more strict
bcardosolopes Dec 21, 2023
28bf4ec
[CIR] Cleanup idiom-recognizer and lib-opt options
bcardosolopes Dec 22, 2023
2fdc25b
[CIR][LibOpt] Add a first transformation: std::find to memchr
bcardosolopes Dec 22, 2023
1139cfe
[mlir][llvm] Fixes CallOp builder for the case of indirect call
gitoleg Dec 22, 2023
cb09502
[CIR][CodeGen] Fix flat offset lowering code to consider field alignm…
yugr Dec 13, 2023
8d37db3
Revert "[mlir][llvm] Fixes CallOp builder for the case of indirect call"
gitoleg Dec 26, 2023
cb185ad
[CIR][Lowering][Bugfix] Lower ScopeOp with return op (#364)
gitoleg Jan 4, 2024
7d4101a
[CIR][CodeGen] Support lowering of cir.const with ZeroAttr. (#365)
yugr Jan 4, 2024
67da9e6
[CIR][Lowering][Bugfix] explicit lowering for the indirect call
gitoleg Dec 26, 2023
f88ee31
[CIR][CIRGen][NFC] Enhance alloca helpers (#367)
gitoleg Jan 4, 2024
403ae40
[CIR][Lowering] add cir.ternary to scf.if lowering (#368)
Kuree Jan 4, 2024
b21e81e
[CIR][CIRGen] supports struct copy from function call result (#369)
gitoleg Jan 4, 2024
ead25fe
[CIR][CodeGen] Fix lowering for class types (#378)
philnik777 Jan 4, 2024
be13b81
[CIR][Lowering] Support lowering of cir.const with GlobalViewAttr (gh…
yugr Jan 4, 2024
f387e1a
[CIR][CIRGen] emit cir.zero for constant string literals (#373)
Lancern Jan 4, 2024
2bde4fe
[CIR][CIRGen] Lvalues and comma expression (#376)
Lancern Jan 4, 2024
6a0e742
[CIR] Replace AnyType with CIR_AnyType (#371)
Lancern Jan 9, 2024
1d442f6
[CIR][CIRGen] Support array def after decl with unknown bound (#375)
Lancern Jan 9, 2024
0affd8d
[CIR][CIRGen] Implement constant evaluation for integral builtins (#381)
philnik777 Jan 9, 2024
3aeb3e0
[CIR][Transforms][NFC] Refactor MergeCleanups pass (#384)
sitio-couto Jan 9, 2024
006dfd0
[CIR][NFC] Enable the formatting workflow for llvm/clangir and format…
philnik777 Jan 10, 2024
67859c4
[CIR][Transforms][Bugfix] Do not use-after-free in MergeCleanups and …
yugr Jan 10, 2024
58ccd20
[CIR][IR] Implement loop's conditional operation (#391)
sitio-couto Jan 10, 2024
8fa0bbb
[CIR][NFC] Canonicalize the names of the lowering classes
philnik777 Jan 10, 2024
ada6175
[CIR][CIRGen][NFC] Support yielding values in LexicalScope
sitio-couto Jan 10, 2024
d744421
[CIR][CIRGen][NFC] Return scope result in compound stmt builders
sitio-couto Jan 10, 2024
50d414a
[CIR][CIRGen] Partially support statement expressions return values
sitio-couto Jan 10, 2024
9cbc015
[CIR] Introduce exception info type
bcardosolopes Nov 3, 2023
fbb25ae
[CIR][CIRGen][Exceptions] More on try statemet codegen: wrap with cir…
bcardosolopes Jan 11, 2024
b0dd640
[CIR][NFC] Update comment for implemented fix
bcardosolopes Jan 11, 2024
21718ce
[CIR][CIRGen] Fix wrong assert
bcardosolopes Nov 13, 2023
439217e
[CIR] Add a CIRCallOpInterface, on top of CallOpInterface
bcardosolopes Jan 11, 2024
7463d87
[CIR][NFC] Refactor cir.call into a tablegen helper class
bcardosolopes Jan 12, 2024
d3e07d2
[CIR] Introduce cir.try_call operation
bcardosolopes Jan 12, 2024
2d58e58
[CIR][CIRGen] Add constraints to inline assembly (#351)
gitoleg Jan 16, 2024
b91b91c
[CIR][Lowering] Support lowering of const arrays of structs (#370)
gitoleg Jan 16, 2024
11024a5
[CIR][CIRGen] Implement unary floating point builtins (#383)
philnik777 Jan 16, 2024
e881544
[CIR] Fix int constant type verification (#386)
Lancern Jan 16, 2024
5a6fe55
[CIR] Vector types, part 2 (#387)
dkolsen-pgi Jan 16, 2024
9989230
[CIR][IR] Implement `cir.continue` operation
sitio-couto Jan 16, 2024
65880d7
[CIR][IR] Implement `cir.break` operation
sitio-couto Jan 16, 2024
2f48e4a
[CIR][IR] Deprecate `cir.yield nosuspend`
sitio-couto Jan 16, 2024
1ee5f18
[CIR][IR] Deprecate `cir.yield fallthrough`
sitio-couto Jan 16, 2024
92cceb7
[CIR] TryCallOp: add blocks, arguments, proper interface impl and tes…
bcardosolopes Jan 16, 2024
1273f07
[CIR][Exceptions] Simplify cir.try_call
bcardosolopes Jan 17, 2024
d98b9f0
[CIR] TryCallOp: improve printing
bcardosolopes Jan 17, 2024
0d91f68
[CIR][CIRGen][Exceptions] More prep work on landing-pad like logic
bcardosolopes Jan 18, 2024
bcfacd1
[CIR][CIRGen][Exceptions] Complete buildCatchDispatchBlock
bcardosolopes Jan 18, 2024
4aa8ff9
[CIR] Add cir.resume op and use it in cir.catch
bcardosolopes Jan 18, 2024
7a4e5c3
[CIR][CIRGen] Support wide string literals (#399)
Lancern Jan 19, 2024
c003cb3
[CIR][OpenMP] Initial commit for OpenMP support in CIR (#382)
fabianmcg Jan 22, 2024
8e6cad9
[CIR][Interfaces] Implement LoopOpInterface
sitio-couto Jan 22, 2024
b41ff5f
[CIR][Lowering][NFC] Refactor LoopOp lowering
sitio-couto Jan 22, 2024
979ea99
[CIR][IR] Refactor do-while loops
sitio-couto Jan 22, 2024
4541cfa
[CIR][IR] Refactor while loops
sitio-couto Jan 22, 2024
7bd9fe3
[CIR][IR] Refactor for loops
sitio-couto Jan 22, 2024
bc1b7c9
[CIR][CIRGen][Exceptions] Populate catch clauses and fix order of ope…
bcardosolopes Jan 23, 2024
7acd41f
[CIR] Fix a few depends to only apply to ClangIR
lanza Jan 25, 2024
e4f7839
[CIR] Make MLIRCIR depend on MLIRCIRInterfaces
lanza Jan 27, 2024
3cf377a
[CIR] Remove LLVM_ENABLE_PROJECTS support
lanza Jan 26, 2024
1de9a22
[CIR][Interfaces] Temporarily disable verifier to get out of circular…
lanza Jan 27, 2024
8d26c92
[CIR] Move CI to CLANG_ENABLE_CIR
lanza Jan 29, 2024
1cd5a4b
[CIR][CIRGen][Exceptions] Use cir.try instead of cir.scope
bcardosolopes Jan 30, 2024
d1d7b19
[CIR][CIRGen][NFC] Make buildCall more generic by using CIRCallOpInte…
bcardosolopes Jan 30, 2024
1390496
[CIR][CIRGen][Exceptions] Use cir.try_call within cir.try regions
bcardosolopes Jan 30, 2024
fae636d
[CIR] Add a new volatile flag to distinguish volatile accesses (#402)
Lancern Jan 31, 2024
1da7e33
[CIR] Vector types, comparison operators (#432)
dkolsen-pgi Jan 31, 2024
000f9f7
[CIR][CIRGen] Add missing visitor for ParenExpr (#428)
YazZz1k Jan 31, 2024
e1ad7ee
[CIR][CodeGen][BugFix] use proper base type for derived class (#404)
gitoleg Jan 31, 2024
3f9153d
[CIR][CodeGen] Initial variable length array support (#398)
gitoleg Jan 31, 2024
a602024
[CIR][CIRGen][Bugfix] Fix source location in ctors (#415)
YazZz1k Jan 31, 2024
c5e3476
[CIR][CIRGen] Handle initilization of arrays (#431)
YazZz1k Jan 31, 2024
eced6fa
[CIR][CIRGen] Handle __extension__ keyword (#421)
YazZz1k Jan 31, 2024
efb9922
[CIR][CIRGen] Add missing case to 'isNullValue' (#433)
YazZz1k Jan 31, 2024
87c4338
[CIR][CIRGen] Support for section atttribute (#422)
YazZz1k Feb 2, 2024
765e5dc
[CIR][CIRGen][Bugfix] Fix bool zero initialization (#411)
YazZz1k Feb 2, 2024
58b5474
[CIR][Lowering] Support conversion of cir.zero to dense consts (#413)
YazZz1k Feb 2, 2024
7b4745e
[CIR][CodeGen] Initial support for dynamic_cast (#426)
Lancern Feb 2, 2024
323e0c1
[CIR][CIRGen] Add codegen for branch prediction info builtins (#439)
YazZz1k Feb 2, 2024
615a367
[CIR][CIRGen] Handle ternary op inside if cond (#440)
YazZz1k Feb 2, 2024
a010209
[CIR][CIRGen] Support check for zero-init pointers (#441)
YazZz1k Feb 2, 2024
c35b579
[CIR][CIRGen] Support dynamic_cast to void ptr (#442)
Lancern Feb 2, 2024
d54e041
[CIR][CodeGen][Lowering] Supports arrays with trailing zeros (#393)
gitoleg Feb 2, 2024
e7e05a8
[CIR][LibOpt] Extend std::find optimization to all calls with raw poi…
philnik777 Feb 2, 2024
6094902
[CIR][CIRGen] Implement "if consteval" code generation (#446)
keryell Feb 3, 2024
da3343a
[CIR] Allow mlir::UnknownLoc in function op (#448)
Lancern Feb 4, 2024
38bd933
[CIR][CodeGen] Const structs with bitfields (#412)
gitoleg Feb 5, 2024
113b787
[CIR][Lowering][Bugfix] Fix lowering of bool_to_int cast (#450)
YazZz1k Feb 5, 2024
cb53cf8
[CIR][CIRGen][Exceptions] Connect the unwind region to the rest of Ca…
bcardosolopes Feb 6, 2024
671ffc7
[CIR][CIRGen][Exceptions] Add support for catch_all
bcardosolopes Feb 6, 2024
72e9f23
[CIR][CIRGen] Add suppport for local typedefs (#451)
YazZz1k Feb 6, 2024
013a653
[CIR][CIRGen][BugFix] Fix building of calls (#452)
YazZz1k Feb 6, 2024
e95a5c4
[CIR][CIRGen][Exceptions] Handle a catch_all corner case
bcardosolopes Feb 6, 2024
c3e6388
[CIR][CIRGen] Implement "if constexpr" code generation (#436)
keryell Feb 7, 2024
4f89aa7
[CIR][CIRGen] Add codegen for global compound literals (#454)
YazZz1k Feb 8, 2024
6c29cd4
[CIR][CodeGen] VLA support next step (#453)
gitoleg Feb 8, 2024
06da08a
[CIR][CIRGen][Bugfix] Emit valid type for evaluated const (#456)
YazZz1k Feb 8, 2024
101c4c0
[CIR][CIRGen][Exceptions][NFC] Add skeleton for some missing function…
bcardosolopes Feb 9, 2024
b63a943
[CIR][CIRGen] Support for local const arrays (#458)
YazZz1k Feb 9, 2024
ad2de47
[CIR][CIRGen][NFC] Relax asserts for using decls and namespace alias
bcardosolopes Feb 10, 2024
877a15e
[CIR][CIRGen] Fix in replacing of no_proto func (#460)
YazZz1k Feb 12, 2024
c976e4b
[CIR][CIRGen][Exceptions][NFC] Re-arrange CallLikeOp building
bcardosolopes Feb 12, 2024
d7f09ca
[CIR][CIRGen][Exceptions][NFC] Reuse lexical scope instead of custom …
bcardosolopes Feb 12, 2024
a1d0b22
[CIR][Lowering] add lowering of bool attribute (#461)
YazZz1k Feb 13, 2024
49bcdd2
[CIR][CIRGen][Exceptions] Prep work for using cir.try_call outside ci…
bcardosolopes Feb 13, 2024
6d83a86
[CIR][CodeGen] Locally inited structures with bitfields (#463)
gitoleg Feb 14, 2024
d3b91b5
[CIR][CIRGen] Introduce cir.unreachable operation (#447)
Lancern Feb 14, 2024
19350cf
[CIR][CIRGen] Add missing case to VisitMemberExpr (#464)
YazZz1k Feb 14, 2024
e3d14fd
[CIR][CIRGen][Exceptions] Add unwind attribute
bcardosolopes Feb 14, 2024
e0dc80f
[CIR][CodeGen] Inline assembly: adds operands (#465)
gitoleg Feb 15, 2024
b5e684e
[CIR][NFC] Refactor more call related mechanisms
bcardosolopes Feb 15, 2024
da2e461
[CIR][CodeGen] Adds clobbers to inline assembly (#469)
gitoleg Feb 16, 2024
559da04
[CIR][NFC] Use an attribute alias for extra_func_attrs
bcardosolopes Feb 17, 2024
321ca2b
[CIR][Lowering] Handle unsupported types for CIR-MLIR type conversion…
mrsoliman Feb 20, 2024
e846fd2
[CIR][CIRGen] Support for zero initialization of arrays (#468)
YazZz1k Feb 20, 2024
72eccae
[CIR][CodeGen][Bugfix] Fix storage size for bitfields (#462)
gitoleg Feb 20, 2024
b82fdb0
[CIR] introduce CIR floating-point types (#385)
Lancern Feb 21, 2024
624f2be
[CIR][Codegen] Fix bitfields unary and binary ops (#477)
gitoleg Feb 22, 2024
876101b
[CIR][CIRGen] Fix calling a function through a function pointer (#467)
YazZz1k Feb 22, 2024
c2bca4a
[CIR] initial support for pointer-to-data-member type (#401)
Lancern Feb 22, 2024
85a48c7
[CIR][NFC] Add unimplemented feature guard for dialect code (#481)
Lancern Feb 29, 2024
9a69667
[CIR][Lowering] More cir.asm lowering (#472)
gitoleg Feb 29, 2024
0ba4f5a
[CIR][CIRGen] Emit `cir.unreachable` on implicit returns (#486)
Lancern Mar 5, 2024
116a86d
[CIR][CIRGen] Add support for builtin bit operations (#474)
Lancern Mar 5, 2024
19de5fc
[CIR] Vector types - part 4 (#490)
dkolsen-pgi Mar 5, 2024
9d55d0f
[CIR][CIRGen] Support for __builtin_expect (#478)
YazZz1k Mar 5, 2024
6191da3
[CIR][CIRGen] Partial support for `offsetof` (#492)
YazZz1k Mar 6, 2024
2ab8d1e
[CIR][CIRGen] Support for CStyleCastExprClass in buildCastLValue (#494)
YazZz1k Mar 6, 2024
bfc16da
[CIR] Add `cir.trap` operation (#496)
Lancern Mar 7, 2024
e10f9d9
[CIR][FrontendTool] Fix overly conservative compatible flags
bcardosolopes Mar 8, 2024
62e97a7
[CIR] Vector ternary operator (#500)
dkolsen-pgi Mar 9, 2024
062b69e
[CIR][CIRGen][NFC] Use proper help with shouldEmitRTTI and clean up
bcardosolopes Mar 9, 2024
460cffa
[CIR][CIRGen][RTTI] Handle vtables in face of -fno-rtti
bcardosolopes Mar 9, 2024
cc4fddd
[CIR][CIRGen] Emit more delete calls
bcardosolopes Mar 11, 2024
26e1ad1
[CIR][CIRGen][NFC] Expand skeleton for constructing array types
bcardosolopes Mar 11, 2024
1ee9340
[CIR][Lowering] Add LLVMIR lowering support for CIR bit operations (#…
Lancern Mar 12, 2024
829dd95
[CIR][CIRGen] Enable support of bool increment (#493)
YazZz1k Mar 12, 2024
d7d62a6
[CIR][CIRGen] Inline asm: operand attributes (#491)
gitoleg Mar 12, 2024
108d233
[CIR] Vector type cleanup and refactoring (#503)
dkolsen-pgi Mar 12, 2024
47c2e56
[CIR][Codegen][Lowering] Introduce new bitfield layout (#487)
gitoleg Mar 12, 2024
65f27ad
[CIR][CIRGen] Add support for ctor/dtor based array init/destroy
bcardosolopes Mar 12, 2024
a7910b8
[CIR][CIRGen] Lower C++ array init and destroy
bcardosolopes Mar 14, 2024
c550e90
[CIR][LoweringPrepare] Add a missing store for current array idx
bcardosolopes Mar 14, 2024
15903b6
[CIR][CIRGen][NFC] Skeleton for atomics support
bcardosolopes Mar 14, 2024
2c680f1
[CIR][CIRGen][Atomics][NFC] Skeleton for constant order codegen
bcardosolopes Mar 14, 2024
90786c8
[CIR][Codegen] Initial support for packed structures (#473)
gitoleg Mar 15, 2024
3d86b46
[CIR][CIRGen] Support for initialization of unions. (#495)
YazZz1k Mar 15, 2024
7c7c4ff
[CIR][CIRGen] Support for __builtin_prefetch (#504)
YazZz1k Mar 15, 2024
1f8f096
[CIR] Add MemRead/MemWrite markers to bitfield ops (#507)
gitoleg Mar 15, 2024
2a0fcd5
[CIR][CIRGen] Support for __builtin_constant_p (#506)
YazZz1k Mar 15, 2024
9fde505
[CIR][CIRGen] Support for C++20 three-way comparison (#485)
Lancern Mar 19, 2024
3896c0e
[CIR][Rebase] Add CountAttributed enum case in a switch
lanza Mar 21, 2024
fd354e5
[CIR][CIRGen] Support for compound literal lvalue (#515)
YazZz1k Mar 22, 2024
8d87565
[CIR][CIRGen] Support for __attribute__((fallthrough)) statement (#517)
YazZz1k Mar 22, 2024
c9dd759
[CIR][CIRGen] Add handling __extension__ keyword for lvalue (#519)
YazZz1k Mar 22, 2024
670f30d
[CIR] Add MLIRCIREnumsGen as a dep to MLIRCIRInterfaces
lanza Apr 2, 2024
49b609b
[CIR] Introduce a flattening pass (#516)
gitoleg Apr 3, 2024
d18777b
[CIR] shufflevector and convertvector built-ins (#530)
dkolsen-pgi Apr 5, 2024
e58a597
[CIR][CIRGen] Add support for __atomic_add_fetch
bcardosolopes Apr 3, 2024
84851f8
[CIR] Add support for byteswap intrinsic (#523)
Lancern Apr 6, 2024
4b49152
[CIR] GNU vector type cleanup (#531)
dkolsen-pgi Apr 6, 2024
a853799
[CIR][CIRGen] Add support for other __atomic_{binop}_fetch
bcardosolopes Apr 8, 2024
8ba2142
[CIR][CIRGen] Add a verifier to catch binop_fetch's that do not suppo…
bcardosolopes Apr 8, 2024
eaea071
[CIR][CIRGen] Add support for __atomic_fetch_binop
bcardosolopes Apr 8, 2024
a5c9aca
[CIR][CIRGen] Add min/max atomic fetch variants
bcardosolopes Apr 8, 2024
7f4768b
[CIR][CIRGen] Add atomic load support
bcardosolopes Apr 9, 2024
459f6f5
[CIR][CIRGen] Add missing CIRGen for generic bit operation builtins (…
Lancern Apr 10, 2024
7804db0
[CIR][CIRGen] Add atomic store support
bcardosolopes Apr 10, 2024
ccd551b
[CIR][CIRGen] Add support for __attribute__((constructor))
bcardosolopes Apr 10, 2024
06cf3c3
[CIR][CIRGen][NFC] Rename globalCtor to global_ctor
bcardosolopes Apr 11, 2024
17c8db6
[CIR][CIRGen][NFC] More prep work before global dtors
bcardosolopes Apr 11, 2024
58b8bc7
[CIR][NFC] Fixup a few changes requested from upstream PRs
lanza Apr 11, 2024
90710ce
[CIR][NFC] Remove `SYSTEM` from MLIR include_directories calls
lanza Apr 11, 2024
a0e3c1c
[CIR][CIRGen] Add support for __attribute__((destructor))
bcardosolopes Apr 11, 2024
91685f8
[CIR][CIRGen][NFC] Simplify global ctor/dtor priority handling
bcardosolopes Apr 11, 2024
6233ee0
[CIR][CIRGen][NFC] Add more skeleton to VisitOpaqueValueExpr
bcardosolopes Apr 12, 2024
a1bc344
[CIR][CIRGen] Scalar handling for part of VisitOpaqueValueExpr
bcardosolopes Apr 12, 2024
906c314
[CIR][CIRGen] Add skeleton for AggExprEmitter::VisitCompoundLiteralExpr
bcardosolopes Apr 12, 2024
7865351
[CIR][CIRGen] Add more variations of compound literal support
bcardosolopes Apr 12, 2024
84ebc8c
[CIR][CIRGen] Add TLS codegen skeleton while building globals
bcardosolopes Apr 12, 2024
440f02e
[CIR][Codegen] IfOp flattening (#537)
gitoleg Apr 15, 2024
12fb4ed
[CIR] Add initial support for bit-precise integer types (#538)
Lancern Apr 15, 2024
7380a63
[CIR] Add TLS models to CIR and teach GlobalOp about them
bcardosolopes Apr 15, 2024
275f0e4
[CIR][CIRGen] Add initial __thread support
bcardosolopes Apr 15, 2024
267dd72
[CIR][CIRGen][LLVMLowering] Add support retrieving thread local globa…
bcardosolopes Apr 15, 2024
a53950f
[CIR][LLVMLowering] Lower cir.objectsize (#545)
ghehg Apr 16, 2024
62c6a86
[CIR][LLVMLowering] Fix handling of dense array conversions from cons…
bcardosolopes Apr 17, 2024
2db13d8
[CIR][Rebase] Stub out error handling for Pass option initialization
lanza Apr 17, 2024
730ffda
[CIR][CodeGen] Inline assembly: store the results (#512)
gitoleg Apr 17, 2024
8b4c7e0
Revert "[CIR][LLVMLowering] Lower cir.objectsize (#545)"
bcardosolopes Apr 17, 2024
5348562
Re-introduce [CIR][LLVMLowering] Lower cir.objectsize
bcardosolopes Apr 17, 2024
043f8dc
[CIR][NFC] Fix few compiler warnings
bcardosolopes Apr 17, 2024
7740a8d
[CIR][CodeGen] Flattening for ScopeOp and LoopOpInterface (#546)
gitoleg Apr 17, 2024
080f276
[CIR][Codegen] Fix union init with constant (#548)
gitoleg Apr 17, 2024
95e11a5
[CIR][CodeGen][Lowering] Support Integer overflow with fwrap (#539)
gitoleg Apr 17, 2024
4c07a3c
[CIR][CIRGen] Clean up call arrangement
bcardosolopes Apr 18, 2024
4361c2d
[CIR][CIRGen][NFC] Update atomic libcall skeleton to match upstream
bcardosolopes Apr 18, 2024
c1311f5
[CIR][CIRGen][NFC] Make createRuntimeFunction use proper function cre…
bcardosolopes Apr 18, 2024
dce1725
[CIR][CIRGen][NFC] Add entry points for later addition of more functi…
bcardosolopes Apr 18, 2024
c0061fc
[CIR][CIRGen][NFC] Update other remainig parts of buildAtomicExpr to …
bcardosolopes Apr 19, 2024
b5429f1
[CIR] Add `cir.dyn_cast` operation (#483)
Lancern Apr 19, 2024
73da668
[CIR][Codegen] TernaryOp flattening (#550)
gitoleg Apr 19, 2024
536d4c2
[CIR][CIRGen][NFC] Update buildPointerWithAlignment with LLVM upstrea…
bcardosolopes Apr 19, 2024
8daf005
[CIR] Add support for long double type (#536)
Lancern Apr 19, 2024
1c3cd0a
[CIR][CIRGen] Introduce initial support for ASTAllocaAddressSpace (#551)
orbiri Apr 19, 2024
9327912
[CIR] Introduce StructLayoutAttr
bcardosolopes Apr 20, 2024
8ef3b36
[CIR] Extend StructLayoutAttr to support querying offset for members
bcardosolopes Apr 20, 2024
9c305cb
[CIR][CodeGen] Adds SwitchOp flattening (#549)
gitoleg Apr 22, 2024
b51fcf7
[CIR][NFC] Improve verifier related error messages (#553)
gxsoar Apr 22, 2024
b64cb19
[CIR][NFC] Fix warnings, remove redudant comments and cleanup helpers
bcardosolopes Apr 22, 2024
5d9a961
[CIR][CIRGen][LLVMLowering] Support atomic exchange
bcardosolopes Apr 22, 2024
b61cf01
[CIR][CIRGen] Add support for more variations of __atomic_exchange
bcardosolopes Apr 23, 2024
77f4a0c
[CIR] Lower certain `cir.cmp3way` operations to LLVM intrinsics (#556)
Lancern Apr 23, 2024
da1dd0f
[CIR][CIRGen] Atomics: Add skeleton for compare and exchange
bcardosolopes Apr 23, 2024
68fe3ed
[CIR][CIRGen] Atomics: initial compare and exchange support
bcardosolopes Apr 24, 2024
9daae1b
[CIR][LLVMLowering][NFC] Refactor and share getLLVMAtomicOrder
bcardosolopes Apr 24, 2024
7402372
[CIR][CIRGen] Fix follow up stores for atomic loads
bcardosolopes Apr 25, 2024
96722f7
[CIR][CIRGen] Add dynamic builtin alloca intrinsics support (#547)
orbiri Apr 25, 2024
7cda6e9
[CIR[CIRGen][NFC] Refactor build switch op (#552)
wenpen Apr 25, 2024
116e184
[CIR][NFC] Create LLVM intrinsic calls through `createCallLLVMIntrins…
Lancern Apr 25, 2024
ded2fa7
[CIR][Lowering] Add MLIR lowering support for CIR cos operations (#565)
zhoujingya Apr 25, 2024
5718db5
[CIR] Remove redundant error from parseConstantValue (#567)
orbiri Apr 25, 2024
a1cb2c0
[CIR][CIRGen] Add more testcases for atomic xchg/cmp_xchg
bcardosolopes Apr 26, 2024
80f74eb
[CIR][CIRGen] Atomics: handle atomic_compare_exchange_strong
bcardosolopes Apr 26, 2024
26a5b07
[CIR][Lowering] Add long double types for cos operation lowering (#568)
zhoujingya Apr 26, 2024
67fa2b7
[CIR][CIRGen] Atomics: make cir.atomic.cmp_xchg a bit more lower level
bcardosolopes Apr 26, 2024
426233f
[CIR][CIRGen] Atomics: add one more testcase
bcardosolopes Apr 26, 2024
ccddaa4
[CIR][CIRGen] Atomics: improve docs and constraints
bcardosolopes Apr 26, 2024
e197d4e
[CIR][CodeGen] Fix a usage of volatile -> volatileQualified
lanza Apr 27, 2024
97b7280
[CIR] Support lowering GlobalOp and GetGlobalOp to memref (#574)
ShivaChen Apr 30, 2024
09c86ed
[CIR][NFC] Homogenize printing/parsing of CIR_PointerType (#575)
definelicht May 1, 2024
c9b4fdc
[CIR][OpenMP] Taskwait, Taskyield and Barrier implementation (#555)
eZWALT May 1, 2024
9da804f
[CIR][CIRGen][LLVMLowering] Initial support for GNU void* and func pt…
bcardosolopes May 1, 2024
35f6ea5
[CIR][LowerToLLVM][NFC] Refactor int cast creation
bcardosolopes May 2, 2024
bdfdb22
[CIR][LowerToLLVM] Generalize ptr_stride proper int casts
bcardosolopes May 2, 2024
64a6edb
[CIR][CIRGen][LowerToLLVM] Fix LLVM lowering for ptr arith extensions
bcardosolopes May 2, 2024
b361bbe
[CIR][CIRGen] One more variation of ptr arith extensions
bcardosolopes May 3, 2024
1efee91
[CIR][ThroughMLIR] Support lowering CastOp to arith (#577)
ShivaChen May 3, 2024
795925f
[CIR][LowerToLLVM] Fix ptrdiffs in face of !cir.void
bcardosolopes May 3, 2024
5961a8d
[CIR][Asm] Remove duplicated lambda & coroutine attributes (#580)
keryell May 3, 2024
f52e99e
[CIR][CIRGen] Add skeleton for AArch64 and x86/x86_64 builtin/instrin…
bcardosolopes May 3, 2024
981c976
[CIR] Remove redundant result type of cir.const operation (#581)
orbiri May 4, 2024
f9b1067
[CIR][CIRGen][LLVMLowering] Add support for checked arithmetic builti…
Lancern May 5, 2024
f690ca9
[CIR][NFC] remove redundant test in CIR/IR/data-member-ptr.cir (#582)
Lancern May 5, 2024
00c75fa
support single case and non-block statement
wenpen Apr 26, 2024
9ae5d1f
address
wenpen May 10, 2024
7a61b3c
address
wenpen May 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions clang/lib/CIR/CodeGen/CIRGenFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,8 @@ class CIRGenFunction : public CIRGenTypeCache {
buildSwitchCase(const clang::SwitchCase &S, mlir::Type condType,
SmallVector<mlir::Attribute, 4> &caseAttrs);

mlir::LogicalResult buildCaseNoneStmt(const Stmt *stmt);

mlir::LogicalResult
buildSwitchBody(const clang::Stmt *S, mlir::Type condType,
SmallVector<mlir::Attribute, 4> &caseAttrs);
Expand Down Expand Up @@ -1898,6 +1900,8 @@ class CIRGenFunction : public CIRGenTypeCache {

void setRetVal(mlir::Value v) { retVal = v; }

LexicalScope *getParentScope() { return ParentScope; }

void cleanup();
void restore() { CGF.currLexScope = ParentScope; }

Expand Down Expand Up @@ -2027,6 +2031,8 @@ class CIRGenFunction : public CIRGenTypeCache {
// Scope entry block tracking
mlir::Block *getEntryBlock() { return EntryBlock; }

bool IsInsideCaseNoneStmt = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this, reasons below.


mlir::Location BeginLoc, EndLoc;
};

Expand Down
53 changes: 31 additions & 22 deletions clang/lib/CIR/CodeGen/CIRGenStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,6 @@ using namespace cir;
using namespace clang;
using namespace mlir::cir;

namespace {

// Handle stmt that don't belong to any cases.
void checkCaseNoneStmt(const Stmt &S, bool checkCaseStmt = true) {
if (S.getStmtClass() == Stmt::LabelStmtClass)
llvm_unreachable("LabelStmtClass support NYI");

if (S.getStmtClass() == Stmt::CaseStmtClass ||
S.getStmtClass() == Stmt::DefaultStmtClass)
assert(!checkCaseStmt && "CaseStmtClass/DefaultStmtClass support NYI");

if (S.getStmtClass() == Stmt::SwitchStmtClass)
checkCaseStmt = false;

for (const Stmt *c : S.children())
checkCaseNoneStmt(*c, checkCaseStmt);
}

} // namespace

Address CIRGenFunction::buildCompoundStmtWithoutScope(const CompoundStmt &S,
bool getLast,
AggValueSlot slot) {
Expand Down Expand Up @@ -348,6 +328,14 @@ mlir::LogicalResult CIRGenFunction::buildLabelStmt(const clang::LabelStmt &S) {
// IsEHa: not implemented.
assert(!(getContext().getLangOpts().EHAsynch && S.isSideEntry()));

// TODO: After support case stmt crossing scopes, we should build LabelStmt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any TODO in CIRGen should be TODO(cir)

// and clean LexicalScope::IsInsideCaseNoneStmt.
for (auto *lexScope = currLexScope; lexScope;
lexScope = lexScope->getParentScope()) {
assert(!lexScope->IsInsideCaseNoneStmt &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if you remove this code? Also, why doesn't it work to just walk the scope up until you find a switch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firstly, we won't need this assert anymore if we could keep the case none stmt somehow as you suggested.

What happens if you remove this code?

Remove this code won't cause incorrect behavior currently (as we didn't support goto in that case yet), but I think it may produce strange error message in the future.

switch (int x) {
foo:
  x = 1;
  break;
case 2:
  goto foo;
}

We need to avoid erasing the CaseNoneStmt containing label foo.

why doesn't it work to just walk the scope up until you find a switch?

Refer to the below code, we need to guarantee the removed Stmt won't contain any LabelStmt, whether the LabelStmt is inside another nested switch or not.

switch(x) {
  switch(x) {
  case 1:
foo:
    break;
  }
  break;
case 1:
  goto foo;
}

"LabelStmt inside case none stmt NYI");
}

return buildStmt(S.getSubStmt(), /* useCurrentScope */ true);
}

Expand Down Expand Up @@ -479,6 +467,11 @@ mlir::LogicalResult CIRGenFunction::buildReturnStmt(const ReturnStmt &S) {
assert(!UnimplementedFeature::requiresReturnValueCheck());
auto loc = getLoc(S.getSourceRange());

// TODO: Rewrite the logic to handle ReturnStmt inside SwitchStmt, then
// clean up the code below.
if (currLexScope->IsInsideCaseNoneStmt)
return mlir::success();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found many sample code that failed due to incorrect terminator in block, e.g.

  switch(a) {
  case 0:
    break; 
    int x = 1;
  }
  switch(a) {
  case 0:
    return 0;
    return 1;
    int x = 1;
  }
for (;;) {
  break;
  int x = 1;
}

Looks like it's another large work, so I just skip ReturnStmt here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, can you file a new issue and list these?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm opposed to return mlir::success(); because it will just silently skips something we don't know how to handle, I rather these things fails or crash, so that it's clear that they aren't implemented? What happens when you remove this return?


// Emit the result value, even if unused, to evaluate the side effects.
const Expr *RV = S.getRetValue();

Expand Down Expand Up @@ -724,6 +717,22 @@ CIRGenFunction::buildSwitchCase(const SwitchCase &S, mlir::Type condType,
llvm_unreachable("expect case or default stmt");
}

mlir::LogicalResult CIRGenFunction::buildCaseNoneStmt(const Stmt *S) {
// Create orphan region to skip over the case none stmts.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because you are creating an orphan region, this mean that anything emitted inside a buildCaseNoneStmt will never execute, right? The problem if a orphan region is that it won't get attached to anything, so it really adds no value (not even for unrecheable code analysis). If so, better just to split the current basic block A into two: B and C. A should jump to C and you emit the code in B.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find a good place to hold the block of CaseNoneStmt.

For example

void f(int x) {
  switch(x) {
    break;
  }
}

There is no region inside SwitchOp, so we have to put the break block outside SwitchOp, which cause verification failed: 'cir.break' op must be within a loop or switch.

Did I misunderstand something? Looking forward to your suggestions~

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand your point, but if you go for the current approach you might as well skip this codegen entirely, because what you are emitting won't ever be attached to anything. I think it's safer to mimic the original codegen here, what is Clang currently doing for OG codegen?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should create a SwitchOp with at least one default region and delete that at the end if it ends up unused?

mlir::Region region;
auto *block = builder.createBlock(&region);
mlir::OpBuilder::InsertionGuard guard(builder);
builder.setInsertionPointToStart(block);

currLexScope->IsInsideCaseNoneStmt = true;

auto res = buildStmt(S, /*useCurrentScope=*/isa<CompoundStmt>(S));

currLexScope->IsInsideCaseNoneStmt = false;

return res;
}

mlir::LogicalResult
CIRGenFunction::buildCXXForRangeStmt(const CXXForRangeStmt &S,
ArrayRef<const Attr *> ForAttrs) {
Expand Down Expand Up @@ -1004,7 +1013,7 @@ mlir::LogicalResult CIRGenFunction::buildSwitchBody(
builder.setInsertionPointToEnd(lastCaseBlock);
res = buildStmt(c, /*useCurrentScope=*/!isa<CompoundStmt>(c));
} else {
checkCaseNoneStmt(*c);
buildCaseNoneStmt(c);
continue;
}

Expand All @@ -1016,7 +1025,7 @@ mlir::LogicalResult CIRGenFunction::buildSwitchBody(
return res;
}

checkCaseNoneStmt(*S);
buildCaseNoneStmt(S);
return mlir::success();
}

Expand Down
Loading