mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 09:23:52 -05:00
Remove dangling empty braces in PTX (#7960)
After directive filtering, there will be dangling `{}` spanning two
lines. This PR attempts to remove them.
For example,
```
.section .debug_abbrev
{
.b8 1
}
.section .debug_info
{
.b32 70
.b32 .debug_abbrev
}
```
The above assembly used to become the following text after filtering
directive
```
{
}
{
}
```
This commit is contained in:
@@ -209,6 +209,28 @@ vprintf,
|
||||
expect(lines[7]).toBe('}');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Directive filter', () => {
|
||||
it('should remove directives when directive filter is enabled', () => {
|
||||
const input = `
|
||||
.file 1 "/tmp/compiler-explorer-compilerk2brih/example.py"
|
||||
.section .debug_abbrev
|
||||
{
|
||||
.b8 1
|
||||
}
|
||||
.section .debug_info
|
||||
{
|
||||
.b32 70
|
||||
.b32 .debug_abbrev
|
||||
}
|
||||
.section .debug_macinfo { }
|
||||
`;
|
||||
const result = parser.processAsm(input, {directives: true});
|
||||
const lines = result.asm.map(line => line.text);
|
||||
expect(lines.length).toBe(1);
|
||||
expect(lines[0]).toBe('');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('MlirAsmParser tests', () => {
|
||||
|
||||
Reference in New Issue
Block a user