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

Ahmed Bougacha via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 16 09:57:14 PST 2016


On Thu, Dec 15, 2016 at 3:32 PM, Quentin Colombet via llvm-commits
<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
- 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


More information about the llvm-commits mailing list