[LLVMdev] How can I remove these redundant copy between registers?

zan jyu Wong zyfwong at gmail.com
Thu May 21 06:21:33 PDT 2015


Hi,

I've been working on a Blackfin backend (llvm-3.6.0) based on the previous
one that was removed in llvm-3.1.
llc generates codes like this:

 29     p1 = r2;
 30     r5 = [p1];
 31     p1 = r2;
 32     r6 = [p1 + 4];
 33     r5 = r6 + r5;
 34     r6 = [p0 + -4];
 35     r5 *= r6;
 36     p1 = r2;
 37     r6 = [p1 + 8];
 38     p1 = r2;

p1 and r2 are in different register classes.
A p* register can be used for load/stroe values from memory while a r*
register can not.

As we can see, line 31, 36, 38 can be deleted. How can I configure llc to
do this? Or do I have to write a custom pass to do this optimization? Any
suggestion is welcome.

Thanks,

Huang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150521/3f5110e8/attachment.html>


More information about the llvm-dev mailing list