[LLVMdev] global variable uses

Tehila Mayzels tehila at cs.technion.ac.il
Mon May 25 11:02:56 PDT 2015


Thanks a lot for the explanation, Tim!
Tehila.

-----Original Message-----
From: Tim Northover [mailto:t.p.northover at gmail.com] 
Sent: Monday, May 25, 2015 6:42 PM
To: Tehila Mayzels
Cc: LLVM Developers Mailing List
Subject: Re: [LLVMdev] global variable uses

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