IRTranslator's method runOnMachineFunction is used to translate from IR to MIR when using GlobalISel as an instruction selector.
When all IR instructions are translated, we move all the instructions from the current entry block to it's only successor, which leaves the current entry block empty and useless, we then delete it from the machine function.
The only issue is that the surviving entry block's number is greater by 1 than the minimal entry block number, which is fixed by assigning the number of the deleted entry block to the surviving entry block's number.
Entry blocks should be serialized (starting from 0) so that an entry block's number wouldn't be greater than the size of the machine function (number of entry blocks in the MF) in which it resides.
Specifically an error will occur in MIRParserImpl::initializeCallSiteInfo when asked if the call site's block number (1 without this patch, 0 with this patch) is greater or equal to the number of entry blocks (1, because the second entry block has been removed).
Details
Details
Diff Detail
Diff Detail
Unit Tests
Unit Tests
Event Timeline
Comment Actions
Why is a new entry block added in the first place?
llvm/test/CodeGen/X86/rename-new-entry.ll | ||
---|---|---|
3 | stop-after=irtranslator. This also doesn't need to use a temporary file and should directly pipe to FIleCheck | |
12–15 | Remove these and move triple to llc argument list | |
24 | Remove these comments | |
45–49 | Don't need this metadata |
stop-after=irtranslator. This also doesn't need to use a temporary file and should directly pipe to FIleCheck