-
Notifications
You must be signed in to change notification settings - Fork 136
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] Refactor StructType
with TableGen
#1504
base: main
Are you sure you want to change the base?
Conversation
This patch currently causes the test struct Foo {
void m1(int);
virtual void m2(int);
virtual void m3(int);
};
void call(Foo* obj, void (Foo::*func)(int), int arg)
{
(obj->*func)(arg);
} I have been debugging for some time, but haven't been able to resolve this issue. Any help would be appreciated. The backtrace is attached below:
|
This should be considered a bug in the clangir/clang/include/clang/CIR/Dialect/IR/CIROps.td Lines 2897 to 2949 in dec9a17
Simply put, the introduction of To mitigate this problem, preserve the old definition of - def CIR_StructType : Type<CPred<"::mlir::isa<::cir::StructType>($_self)">,
- "CIR struct type">;
+ def Struct : Type<CPred<"::mlir::isa<::cir::StructType>($_self)">, "CIR struct type">; And then update the definition of - let arguments = (ins CIR_StructType:$record, IndexAttr:$index_attr);
+ let arguments = (ins Struct:$record, IndexAttr:$index_attr); Btw, you could build the code with |
Thank you for your assistance. I noticed that |
Yes. |
Amazing catch @Lancern |
Before renaming to |
I see unrelated changes in this PR (e.g. changes to STD ops), perhaps some bad merging on your end? You need to fix your branch somehow so that the diff we see only has the relevant bits. |
Lower vcales_f32
This PR adds an insertion guard for the try body scope for try-catch. Currently, the following code snippet fails during CodeGen: ``` void foo() { int r = 1; try { ++r; return; } catch (...) { } } ``` The insertion point doesn't get reset properly and the cleanup is being ran for a wrong/deleted block causing a segmentation fault. I also added a test.
The comments suggested that we should use TableGen to generate the recognizing functions. However, I think templates might be more suitable for generating them -- and I can't find any existing TableGen backends that let us generate arbitrary functions. My choice of design is to offer a template to match standard library functions: ```cpp // matches std::find with 3 arguments, and raise it into StdFindOp StdRecognizer<3, StdFindOp, StdFuncsID::Find> ``` I have to use a TableGen'd enum to map names to IDs, as we can't pass string literals to template arguments easily in C++17. This also constraints design of future `StdXXXOp`s: they must take operands the same way of StdFindOp, where the first one is the original function, and the rest are function arguments. I'm not sure if this approach is the best way. Please tell me if you have concerns or any alternative ways.
…was set explicitly (llvm#1482) This is backported from a change made in llvm/llvm-project#131181 --------- Co-authored-by: Morris Hafner <mhafner@nvidia.com>
…R attribute. (llvm#1467) Started decorating CUDA shadow variables with the shadow_name CIR attribute which will be used for registering the globals.
Lower neon vcaltd_f64
… target was set explicitly" (llvm#1509) Reverts llvm#1482 @mmha this is crashing on macos on asserts build: ``` FAIL: Clang :: CIR/Tools/cir-translate/warn-default-triple.cir (472 of 552) ******************** TEST 'Clang :: CIR/Tools/cir-translate/warn-default-triple.cir' FAILED ******************** Exit Code: 134 Command Output (stdout): -- Assertion failed: (!DataLayoutString.empty() && "Uninitialized DataLayout!"), function getDataLayoutString, file TargetInfo.h, line 1282. ``` Perhaps besides picking a default you maybe need to do some missing datalayout init?
b35d074
to
fc3b818
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after nit
} | ||
|
||
// Note CIRStructType is used instead of CIR_StructType because of tablegen conflicts | ||
def CIRStructType : Type<CPred<"::mlir::isa<::cir::StructType>($_self)">, "CIR struct type">; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last nit: we should be bound to 80-col in tablegen files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you confirmed the rest of the diff is also bound? I see some suspect entries
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My apologies, I didn't check carefully enough... Everything should be in bounds now.
edit: oops, i forgot to push
03f8fa3
to
0a7facc
Compare
Closes #1367