[LLVMdev] Move instruction

Karhu, Abhinav R akarhu3 at gatech.edu
Sat Nov 15 23:02:38 PST 2008

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? 
----- 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.

LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu

Abhinav Karhu
MS Computer Science
Georgia Institute of Technology

More information about the llvm-dev mailing list