[llvm-dev] What constitutes a replaceable use?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[llvm-dev] What constitutes a replaceable use?

George Karpenkov via llvm-dev
I am creating a temporary ValueRef (call it %temp) that I need to build uses of before
there is enough information  tocreate the value it really needs to be, (call it %real).
After I create %real, I am calling LLVMReplaceAllUsesWith(%temp, %real).

Uses that were created by passing %temp as one of the actual parameters to LLVMBuildCall
are getting replaced.  A use created by building a bitcast of %temp, then passing
that to the source value of a store are not.

Any advice on how to get the replace to happen?

This is llvm 3.6.1, using the Core C bindings for building llvm IR.  Also, the
values I have tried for %temp are constants, just to avoid having unnecessary
stuff remaining.


--
Rodney Bates
[hidden email]
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [llvm-dev] What constitutes a replaceable use?

George Karpenkov via llvm-dev
I discovered a way to get around this experimentally.  I tried using an alloca for %temp,
then got rid of it with LLVMInstructionEraseFromParent.  It got replaced, as expected.

But that's only an anecdotal answer.

On 08/09/2017 01:18 PM, Rodney M. Bates via llvm-dev wrote:

> I am creating a temporary ValueRef (call it %temp) that I need to build uses of before
> there is enough information  tocreate the value it really needs to be, (call it %real).
> After I create %real, I am calling LLVMReplaceAllUsesWith(%temp, %real).
>
> Uses that were created by passing %temp as one of the actual parameters to LLVMBuildCall
> are getting replaced.  A use created by building a bitcast of %temp, then passing
> that to the source value of a store are not.
>
> Any advice on how to get the replace to happen?
>
> This is llvm 3.6.1, using the Core C bindings for building llvm IR.  Also, the
> values I have tried for %temp are constants, just to avoid having unnecessary
> stuff remaining.
>
>

--
Rodney Bates
[hidden email]
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Loading...