[llvm-dev] replace uses of loadInst with a value

Mohammad Norouzi via llvm-dev llvm-dev at lists.llvm.org
Fri Feb 5 02:06:50 PST 2016


Hi,

I need to replace all uses of load instructions with the value of its
operand. Here is an example:

%16 = load i32, i32* %x

%add = add i32 4, %16

In this case, i would like to have the result as:

%add = add i32 4, %x

and then delete the load instruction. I have tried replaceAllUsesWithValue
but i get a type problem.

"llvm::Value::replaceAllUsesWith(llvm::Value*): Assertion `New->getType()
== getType() && "replaceAllUses of value with new value of different
type!"' failed."

Best,
Mohammad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160205/d5209eff/attachment.html>


More information about the llvm-dev mailing list