How to check if a variable is updated inside a loop?

If there is a variable outside a loop, and if it is used inside a loop. How can I check in the LLVM analysis if the variable is getting modified inside a loop iteration.
Ex: int i = 0;
When there is i++, the load instruction updates existing i. How can I identify if the load instruction is part of a loop.

If you only want to see if a specific instruction is part of a loop, `llvm::Loop` can give you a list of enclosing basic blocks.
Also, I believe this question is more suitable in the llvm-dev mailing list (Cc-ed)