[LLVMdev] Label address (taken with blockaddress) not exported to .s

Will Dietz willdtz at gmail.com
Mon Sep 17 11:15:43 PDT 2012


On Mon, Sep 17, 2012 at 12:06 PM, Joshua Cranmer <pidgeot18 at gmail.com> wrote:
> On 9/17/2012 11:59 AM, Yiannis Tsiouris wrote:
>>
>> Hi all,
>>
>> I recently updated my LLVM tree and I have a strange issue with the use
>> of blockaddress. The LLVM file that I try to compile is [1].
>
>
> Taking the address of a block by itself has zero guarantees about whether or
> not that block will exist by the time the code is emitted. If the block no
> longer exists by the end, it gets replaced with a constant 1.
>

To add on to this, take a look at the LLVM blog post on this,
particularly the end:
http://blog.llvm.org/2010/01/address-of-label-and-indirect-branches.html
.

In short, BlockAddress values that aren't used in an indirectbr are
not something LLVM will make any effort to preserve for you.

When the underlying block is merged/removed/etc what Joshua said above
comes into play: the address is replaced with a constant 1. Check the
BasicBlock destructor for the source of this behavior.

Hope this helps,

~Will



More information about the llvm-dev mailing list