diff options
author | Peter Smith <peter.smith@arm.com> | 2025-08-21 10:14:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-21 10:14:30 +0100 |
commit | bcf09c1bc7aaf6a298bf0ccab07c7e69c8a80577 (patch) | |
tree | acc1f570163228e413ffbd4339c582a3d0b21630 /llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp | |
parent | 26d4e56be81adbaa8aeed7f5cde39b779d959fc3 (diff) | |
download | llvm-bcf09c1bc7aaf6a298bf0ccab07c7e69c8a80577.zip llvm-bcf09c1bc7aaf6a298bf0ccab07c7e69c8a80577.tar.gz llvm-bcf09c1bc7aaf6a298bf0ccab07c7e69c8a80577.tar.bz2 |
[ARM][Disassembler] Advance IT State when instruction is unknown (#154531)
When an instruction that the disassembler does not recognize is in an IT
block, we should still advance the IT state otherwise the IT state
spills over into the next recognized instruction, which is incorrect.
We want to avoid disassembly like:
it eq
<unknown> // Often because disassembler has insufficient target info.
addeq r0,r0,r0 // eq spills over into add.
Fixes #150569
Diffstat (limited to 'llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp b/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp index 2e47cee..cbd31be 100644 --- a/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp +++ b/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp @@ -1264,6 +1264,10 @@ DecodeStatus ARMDisassembler::getThumbInstruction(MCInst &MI, uint64_t &Size, return Result; } + // Advance IT state to prevent next instruction inheriting + // the wrong IT state. + if (ITBlock.instrInITBlock()) + ITBlock.advanceITState(); Size = 0; return MCDisassembler::Fail; } |