[LLVMdev] global variable uses

Tim Northover t.p.northover at gmail.com
Mon May 25 08:42:10 PDT 2015


Hi Tehila,

On 25 May 2015 at 02:38, Tehila Mayzels <tehila at cs.technion.ac.il> wrote:
> Why? Isn't the meaning of use here is where @a is used?

Each element you're iterating through is an llvm::Use, which records
both what is being used and the user. Possibly confusingly, what you
get when you simply dereference it is the thing being used. You should
either call U->getUser() or iterate using user_begin/user_end instead.

Though there's actually a function Value::ReplaceAllUsesWith which
might mean you don't need the loop at all, depending on how complex
your change is.

Cheers.

Tim.



More information about the llvm-dev mailing list