[Mips][AsmPrinter] Fix for assembler not printing a label #80666
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a fix for a bug that manifests in rust-lang/rust#108835.
rustc-demangle couldn't compile due to an undefined temporary symbol error which arises when the assembly code is branching to a basic block whose label is not emitted.
One of the reasons not to emit the label of a basic block is when that block is only reachable by fallthrough. If a block has only one predecessor and that predecessor is immediately before it, the block is reachable only by fallthrough. The problem is that the MipsAsmPrinter didn't take it into account what if that predecessor also branches to this basic block, which in this case happens. In that case, we need a label for the block.
The solution is to check if the predecessor branches to this basic block.