[llvm] r289891 - [IRTranslator] Merge the entry and ABI lowering blocks.

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 10:22:58 PST 2016


> On Dec 16, 2016, at 9:57 AM, Ahmed Bougacha <ahmed.bougacha at gmail.com> wrote:
> 
> On Thu, Dec 15, 2016 at 3:32 PM, Quentin Colombet via llvm-commits
> <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
>> Author: qcolombet
>> Date: Thu Dec 15 17:32:25 2016
>> New Revision: 289891
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=289891&view=rev
>> Log:
>> [IRTranslator] Merge the entry and ABI lowering blocks.
>> 
>> The IRTranslator uses an additional block before the LLVM-IR entry block
>> to perform all the ABI lowering and the constant hoisting. Thus, this
>> block is the actual entry block and it falls through the LLVM-IR entry
>> block. However, with such representation, we end up with two basic
>> blocks that are not maximal.
>> 
>> Therefore, this patch adds a bit of canonicalization by merging both the
>> LLVM-IR entry block and the ABI lowering/constants hoisting into one
>> block, making the resulting block more likely to be maximal (indeed the
>> LLVM-IR entry block might not have been maximal).
>> 
>> Modified:
>>    llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp
>>    llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
>>    llvm/trunk/test/CodeGen/AArch64/GlobalISel/irtranslator-exceptions.ll
>>    llvm/trunk/test/CodeGen/X86/GlobalISel/irtranslator-call.ll
> 
> I find this quite awkward; why not:
> - use a single entry block

That’s what we did in the beginning then Tim convinced me that it is easier to understand and maintain to have two different blocks.
I am fine revisiting this if we can come up with a better solution, but it does sounds error-prone to deal with multiple insertion points.

> - initially (and during argument lowering): insert before EntryBB.end()
> - after that (for constant lowering): insert after
> std::prev(EntryBB.end())  (or after EntryBB.begin() if no the block is
> empty)
> 
> -Ahmed

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161219/a408ad8b/attachment.html>


More information about the llvm-commits mailing list