[LLVMdev] Question About Function Cloning

Johannes Doerfert johannes at jdoerfert.de
Fri Oct 25 09:50:55 PDT 2013


Hi Arnamoy,

in case the loop iteration variables are local (probably most of the times),
run the mem2reg pass before your cloning pass. In case they are not (or you don't
like the mem2reg solution), you could introduce loads in front of the
'original function' which then serve as input for the 'duplicated function'.
However, you have to consider loop variant upper bounds and strides too.

Best regards,
  Johannes

On Fri, Oct 25, 2013 at 04:35:20PM +0100, Tim Northover wrote:
> Hi Arnamoy,
> 
> > Any idea, why the output looks like -
> 
> > Hello World
> > Hello World
> > val is 58
> >
> > While the it should print 4 times?
> 
> Both your loops are sharing the counter variable (%i1) without
> resetting it to 0 in between calls. I think that accounts for the
> behaviour.
> 
> Cheers.
> 
> Tim.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 230 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131025/916b9ed0/attachment.sig>


More information about the llvm-dev mailing list