regarding r221377

Jingyue Wu jingyue at
Fri May 29 11:07:47 PDT 2015

Hi Justin,

I am looking at this patch you submitted last year. Sorry for bringing up
something cache-cold :)

Author: Justin Holewinski <jholewinski at>
Date:   Wed Nov 5 18:19:30 2014 +0000

    [NVPTX] Add NVPTXLowerStructArgs pass

    This works around the limitation that PTX does not allow .param space
    loads/stores with arbitrary pointers.

    If a function has a by-val struct ptr arg, say foo(%struct.x *byval
%d), then
    add the following instructions to the first basic block :

    %temp = alloca %struct.x, align 8
    %tt1 = bitcast %struct.x * %d to i8 *
    %tt2 = %tt2
    %tempd = bitcast i8 addrspace(101) * to %struct.x addrspace(101) *
    %tv = load %struct.x addrspace(101) * %tempd
    store %struct.x %tv, %struct.x * %temp, align 8

    The above code allocates some space in the stack and copies the incoming
    struct from param space to local space. Then replace all occurences of
    by %temp.

    Fixes PR21465.

Can you remind me why this pass is not enabled in NVPTX's backend pipeline,
e.g., NVPTXTargetPassConfig::addIRPass? We might have discussed this at
some point, but I forgot.

Thank you,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the llvm-commits mailing list