[llvm-dev] What constitutes a replaceable use?

Rodney M. Bates via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 9 17:16:55 PDT 2017


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
rodney.m.bates at acm.org


More information about the llvm-dev mailing list