[LLVMdev] byval attr for base+range parameters

Yuanfang Chen cyfmxc at gmail.com
Thu Jan 23 20:49:14 PST 2014


On Thu, Jan 23, 2014 at 10:57 PM, Reid Kleckner <rnk at google.com> wrote:
> That is not what byval does.  byval implicitly copies the pointee into the
> argument slots used for the call or registers on some architectures.

Thanks Reid.  I looked into the argpromotion code and  you are right.
'byval' does not work for this case. I think I'll stick to my
workaround for now. But I don't  quite understand why argpromotion
does not check for readonly use other than (GEPorNonGEP) LoadInst.
For case like

define void @checksum_(i32* noalias %i) {
  . . .  load %i
  call void @_gfortran_transfer_integer_write(%xx, %i, 4)
}

If type of
@_gfortran_transfer_integer_write(%struct.__st_parameter_dt*, i8*,
i32)  is changed to
@_gfortran_transfer_integer_write(%struct.__st_parameter_dt*, i8* byval, i32)

It makes sense to argpro %i of checksum_ , right?



More information about the llvm-dev mailing list