You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tested this on llvm 18 and 19.
For each function where addressof is generated for a global variable of struct type, mlir-translate also generates the body of the init region of the struct.
Take this program:
struct MyStruct {
char f0[20];
int f1;
int* f2;
};
int x, y;
struct MyStruct global = {"abcdefg", 20, &x};
int foo(struct MyStruct *S) {
return &global == S;
}
int main() {
int x = foo(&global);
struct MyStruct *P = &global;
return 0;
}
emitting LLVM IR with clang produces following code:
I have tested this on llvm 18 and 19.
For each function where
addressof
is generated for a global variable of struct type, mlir-translate also generates the body of the init region of the struct.Take this program:
emitting LLVM IR with clang produces following code:
Which is okay.
Loading this into mlir using
mlir-translate -import-llvm
produces following code:Both
foo
andmain
have the contents of the init region, even though it serves no purpose there.The text was updated successfully, but these errors were encountered: