Hi owen, Can you please elaborate as to what should I do? Find all the instruction which have r2 in it and replace all of them with r1 and then remove the load instruction? Thanks Abhinav ----- Original Message ----- From: "Owen Anderson" <resistor at mac.com> To: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu> Sent: Friday, November 14, 2008 11:22:32 PM GMT -06:00 US/Canada Central Subject: Re: [LLVMdev] Move instruction On Nov 14, 2008, at 9:13 PM, Karhu, Abhinav R wrote:> Hi Eli, > I want to do redundant load elimination. A simple example for that > would be > > load (a1) , r1; > --- > --- > --- > load (a2) , r2; > > Now if a1 and a2 are alias of each other and the value stored in a1 > and a2 remains the same then I can say that the second load is > redundant. > I can replace the second load with these instructions > > mov r0 r1; > mov r0 r2; and remove the load instruction. >You don't need to copy r1. Just replace all uses of r2 with r1, and get rid of the definition of r2. --Owen _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -- Abhinav Karhu MS Computer Science Georgia Institute of Technology
r2->replaceAllUsesWith(r1); r2->eraseFromParent(); LLVM makes it easy! ;-) --Owen On Nov 15, 2008, at 11:02 PM, Karhu, Abhinav R wrote:> Hi owen, > Can you please elaborate as to what should I do? Find all the > instruction which have r2 in it and replace all of them with r1 and > then remove the load instruction? > Thanks > Abhinav > ----- Original Message ----- > From: "Owen Anderson" <resistor at mac.com> > To: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu> > Sent: Friday, November 14, 2008 11:22:32 PM GMT -06:00 US/Canada > Central > Subject: Re: [LLVMdev] Move instruction > > > On Nov 14, 2008, at 9:13 PM, Karhu, Abhinav R wrote: > >> Hi Eli, >> I want to do redundant load elimination. A simple example for that >> would be >> >> load (a1) , r1; >> --- >> --- >> --- >> load (a2) , r2; >> >> Now if a1 and a2 are alias of each other and the value stored in a1 >> and a2 remains the same then I can say that the second load is >> redundant. >> I can replace the second load with these instructions >> >> mov r0 r1; >> mov r0 r2; and remove the load instruction. >> > > You don't need to copy r1. Just replace all uses of r2 with r1, and > get rid of the definition of r2. > > --Owen > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > -- > Abhinav Karhu > MS Computer Science > Georgia Institute of Technology > _______________________________________________ > 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: smime.p7s Type: application/pkcs7-signature Size: 2624 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20081116/ee4786ad/attachment.bin>
oh thanks oven, that is ultimately cool :) ----- Original Message ----- From: "Owen Anderson" <resistor at mac.com> To: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu> Sent: Sunday, November 16, 2008 3:44:09 AM GMT -05:00 US/Canada Eastern Subject: Re: [LLVMdev] Move instruction r2->replaceAllUsesWith(r1); r2->eraseFromParent(); LLVM makes it easy! ;-) --Owen On Nov 15, 2008, at 11:02 PM, Karhu, Abhinav R wrote:> Hi owen, > Can you please elaborate as to what should I do? Find all the > instruction which have r2 in it and replace all of them with r1 and > then remove the load instruction? > Thanks > Abhinav > ----- Original Message ----- > From: "Owen Anderson" <resistor at mac.com> > To: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu> > Sent: Friday, November 14, 2008 11:22:32 PM GMT -06:00 US/Canada > Central > Subject: Re: [LLVMdev] Move instruction > > > On Nov 14, 2008, at 9:13 PM, Karhu, Abhinav R wrote: > >> Hi Eli, >> I want to do redundant load elimination. A simple example for that >> would be >> >> load (a1) , r1; >> --- >> --- >> --- >> load (a2) , r2; >> >> Now if a1 and a2 are alias of each other and the value stored in a1 >> and a2 remains the same then I can say that the second load is >> redundant. >> I can replace the second load with these instructions >> >> mov r0 r1; >> mov r0 r2; and remove the load instruction. >> > > You don't need to copy r1. Just replace all uses of r2 with r1, and > get rid of the definition of r2. > > --Owen > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > -- > Abhinav Karhu > MS Computer Science > Georgia Institute of Technology > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev_______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -- Abhinav Karhu MS Computer Science Georgia Institute of Technology