[LLVMdev] Calls to functions with signext/zeroext return values

Ken Dyck kd at kendyck.com
Wed Mar 16 11:43:08 PDT 2011


On Wed, Mar 16, 2011 at 12:35 PM, Cameron Zwarich <zwarich at apple.com> wrote:
> On Mar 16, 2011, at 9:31 AM, Cameron Zwarich wrote:
>
>> Promoting the return value is unsafe for bool returns on x86-64, which
>> in the latest revision of the ABI only guarantees that the top 7 bits of
>> the 8-bit register are 0.
>
> My comment is a bit off, because the question of what type to make
> the return value is somewhat orthogonal to the question of which zext
> assert we should add.

I'm not sure I follow. Won't a zeroext attribute on a bool return
value ensure that it will be zero-extended to 32 bits by the callee?
Or does the X86 backend consider such functions unlowerable (via
TargetLowering::CanLowerReturn()) and thereby bypass the extension to
32 bits in SelectionDAGBuilder::visitRet() making a promotion in the
caller unnecessary?

-Ken



More information about the llvm-dev mailing list