8000 [MLIR][mlir-link] Linkage tests by xlauko · Pull Request #13 · trailofbits/instafix-llvm · GitHub
[go: up one dir, main page]

Skip to content

[MLIR][mlir-link] Linkage tests #13

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

Merged
merged 3 commits into from
Feb 5, 2025
Merged

[MLIR][mlir-link] Linkage tests #13

merged 3 commits into from
Feb 5, 2025

Conversation

xlauko
Copy link
Member
@xlauko xlauko commented Feb 5, 2025

No description provided.

hbrodin and others added 3 commits February 5, 2025 14:18
Simple in this context are those that have a constant initializer
and not an initializer region.
Copy link
Collaborator
@hbrodin hbrodin left a comment

Choose a reason for hiding this comment

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

Looks good! This will give me something to work towards. Perfect!

@hbrodin hbrodin merged this pull request into mlir-link Feb 5, 2025
4 checks passed
@xlauko xlauko deleted the xlauko/linkage-test branch February 7, 2025 09:45
xlauko pushed a commit that referenced this pull request Mar 28, 2025
This PR introduces bitfelds support.  This now works:

```

typedef struct {
    int a1 : 4;
    int a2 : 28;
    int a3 : 16;
    int a4 : 3;
    int a5 : 17;
    int a6 : 25;
} A;

void init(A* a) {
    a->a1 = 1;
    a->a2 = 321;
    a->a3 = 15;
    a->a4 = -2;
    a->a5 = -123;
    a->a6 = 1234;
}

void print(A* a) {
    printf("%d %d %d %d %d %d\n",
        a->a1,
        a->a2,
        a->a3,
        a->a4,
        a->a5,
        a->a6
    );
}

int main() {
    A a;
    init(&a);
    print(&a);
    return 0;
}

```
the output is:
`1 321 15 -2 -123 1234`
xlauko pushed a commit that referenced this pull request Mar 28, 2025
…)"

Breaks ninja check-clang-cir

This reverts commit 471e568d8c75ea9320e201aecbd608f9633c7a63.
xlauko pushed a commit that referenced this pull request Mar 28, 2025
…m#268)

This is an updated PR for [PR
explained in [PR llvm#261](llvm/clangir#261) which
now can be safely closed.

First of all, let me introduce how do the bitfields looks like in CIR.
For the struct `S` defined as following:
```
typedef struct {
  int a : 4;
  int b : 27;
  int c : 17;
  int d : 2;
  int e : 15;
  unsigned f;
} S;
```
the CIR type is `!ty_22S22 = !cir.struct<struct "S" {!u32i, !u32i,
!u16i, !u32i} #cir.record.decl.ast>` where all the bitfields are packed
in the first three storages.

Also, the next bugs was fixed:
- type mismatch
- index out of bounds
- single bitfield of size < 8

The cases covered with tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0