It's a fairly common issue that the generating code incorrectly marks
instructions as narrow or wide; check that the instruction lengths
add up to the expected value, and abort if it doesn't. This allows
catching code generation bugs.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
llvm/lib/Target/ARM/MCTargetDesc/ARMWinCOFFStreamer.cpp | ||
---|---|---|
270 | I don't like changing whether we emit a label based on NDEBUG; that will affect the actual assembler text. (The actual checking is also probably cheap enough we could just leave it on, but I'll leave that up to you.) |
llvm/lib/Target/ARM/MCTargetDesc/ARMWinCOFFStreamer.cpp | ||
---|---|---|
270 | No, this isn't a regular label - the CFI labels are no-ops in assembly output: MCSymbol *MCStreamer::emitCFILabel() { // Return a dummy non-null value so that label fields appear filled in when // generating textual assembly. return (MCSymbol *)1; } Yeah, the checking is cheap anyway though so it's no problem to leave it on. |
Updated and rebased. Made the instruction length checking always enabled, outside of NDEBUG, and changed the error into a proper user level error instead of a printout and std::abort(). Added a testcase for the error message too.
Added checks to make sure that prologs and epilogs are properly terminated, and epilog start/end are paired correctly. This gives clearer indication if there were issues in code generation (like epilogs being mangled by tail merging).
I don't like changing whether we emit a label based on NDEBUG; that will affect the actual assembler text. (The actual checking is also probably cheap enough we could just leave it on, but I'll leave that up to you.)