When a label is encountered while an open 'it' block is under construction (under construction because more conditional instructions can be added to it), the gathered block should be emitted before the label is emitted.
Due to the location from where the onLabelParsed function was being called, the label is emitted first and the 'it' block flushed after, resulting in incorrect code.
Details
- Reviewers
craig.topper javed.absar olista01
Diff Detail
Event Timeline
Verification
- Rebuilt with changes.
- Output of test noted in bug:
.text .p2align 1 .code 16 .globl f1 .globl f2f1:
.thumb_func cmp r0, #10 it pl movpl r0, #0f2:
.thumb_func movs r1, #0.Ltmp:
cmp r0, #0 ittt pl addpl r1, r1, r0 subpl r0, r0, #1 bpl .Ltmp mov r0, r1 bx lr
The label 'f2' is in the expected location now.
- make check (in progress)
lib/Target/ARM/AsmParser/ARMAsmParser.cpp | ||
---|---|---|
9457 | Can this call be removed now? doBeforeLabelEmit and onLabelParsed are only ever called in pairs before and after emitting the label, so there should never be anything to flush here, and as you've pointed out doing it here is incorrect. | |
test/MC/ARM/implicit-it-generation.s | ||
70 | I think this test already exposes the bug, we just need to add CHECK lines to make sure the labels are emitted in the correct place. That would be clearer than adding a second test to check the label locations. |
Can this call be removed now? doBeforeLabelEmit and onLabelParsed are only ever called in pairs before and after emitting the label, so there should never be anything to flush here, and as you've pointed out doing it here is incorrect.