Skip to content

Treat data definitions in the middle of functions as "strong" - #2792

Merged
mattgodbolt merged 2 commits into
mainfrom
mg/fix_jump_tables
Jul 22, 2021
Merged

mattgodbolt merged 2 commits into
mainfrom
mg/fix_jump_tables

Conversation

@mattgodbolt

Copy link
Copy Markdown
Member

Things like ARM jump tables put important data inline within a function. Such
data should be treated as a "strong" reference (e.g. a root use). For example:

        sub     r3, r0, #65
        cmp     r3, #19
        ldrls   pc, [pc, r3, asl #2]
        b       .L7
        .word   .L8
        .word   .L7
        .word   .L6
        .word   .L7
        ....etc...
.L7: some things
.L8: some other things

Without this change, the .L8 label would be dropped as unused. But it's implicitly used
by the sequence of .words in the middle of the function.

Closes #2788

Things like ARM jump tables put important data inline within a function. Such
data should be treated as a "strong" reference (e.g. a root use). For example:

```
        sub     r3, r0, #65
        cmp     r3, #19
        ldrls   pc, [pc, r3, asl #2]
        b       .L7
        .word   .L8
        .word   .L7
        .word   .L6
        .word   .L7
        ....etc...
.L7: some things
.L8: some other things
```

Without this change, the `.L8` label would be dropped as unused. But it's implicitly used
by the sequence of `.word`s in the middle of the function.

Closes #2788

@partouf partouf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you remove the .binary testresults, those aren't needed for this

@mattgodbolt

Copy link
Copy Markdown
Member Author

I think I'm missing something - since we changed to use acceptance tests there's no way to not include binary tests: each permutation of "comments only", "comments and labels", "directives and comments" etc is always tested. This is a mixed blessing: I didn't look too hard to keep old behaviour as it was a little ad hoc at the time anyway, and I'm sure some permutations weren't being well tested.

Or did I misunderstand? Sorry, coffee still being drunk here :)

@partouf

partouf commented Jul 20, 2021

Copy link
Copy Markdown
Member

I think I'm missing something - since we changed to use acceptance tests there's no way to not include binary tests: each permutation of "comments only", "comments and labels", "directives and comments" etc is always tested. This is a mixed blessing: I didn't look too hard to keep old behaviour as it was a little ad hoc at the time anyway, and I'm sure some permutations weren't being well tested.

Or did I misunderstand? Sorry, coffee still being drunk here :)

oh maybe I remember using the rewrite of the tests to only do binary when it's actually an objdump, nevermind then, will remove them in a later PR when tests are changed

@mattgodbolt

Copy link
Copy Markdown
Member Author

Sounds great. Can you OK the change if it's ok now? I'm trying to do the PR thing a bit more properly now :)

@mattgodbolt
mattgodbolt merged commit d52a131 into main Jul 22, 2021
@mattgodbolt
mattgodbolt deleted the mg/fix_jump_tables branch July 22, 2021 19:12
mattgodbolt added a commit that referenced this pull request Aug 2, 2021
* Treat data definitions in the middle of functions as "strong"

Things like ARM jump tables put important data inline within a function. Such
data should be treated as a "strong" reference (e.g. a root use). For example:

```
        sub     r3, r0, #65
        cmp     r3, #19
        ldrls   pc, [pc, r3, asl #2]
        b       .L7
        .word   .L8
        .word   .L7
        .word   .L6
        .word   .L7
        ....etc...
.L7: some things
.L8: some other things
```

Without this change, the `.L8` label would be dropped as unused. But it's implicitly used
by the sequence of `.word`s in the middle of the function.

Closes #2788

* Keep curly bracket style of existing if-else block

Co-authored-by: RabsRincon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Used branches mistakenly filtered out

3 participants