[LLVMdev] Move instruction

Karhu, Abhinav R akarhu3 at gatech.edu
Fri Nov 14 21:13:35 PST 2008

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.

This is the thing I want to achieve. How can I achieve this at the IR level? Please any suggestions.
Thanks Eli for replying.
----- Original Message -----
From: "Eli Friedman" <eli.friedman at gmail.com>
To: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu>
Sent: Friday, November 14, 2008 7:06:30 PM GMT -06:00 US/Canada Central
Subject: Re: [LLVMdev] Move instruction

On Fri, Nov 14, 2008 at 2:13 PM, Karhu, Abhinav R <akarhu3 at gatech.edu> wrote:
> Hi all,
> Can anybody tell me how to generate a mov instruction in llvm. I found out there is a MemMove Inst but I dont think that is what I want.
> I want to bypass a load instruction. So i need to generate a mov instruction which will help me remove the redundant load.

At the LLVM IL level, you generally don't generate move instructions;
they're at a lower level.  What are you really trying to do?

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