[PATCH] D15272: [Verifier] Verifier that a GlobalValue is only used in this Module
Rafael EspĂndola via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 24 07:52:24 PST 2015
On 24 December 2015 at 09:38, Keno Fischer <kfischer at college.harvard.edu> wrote:
> Say you use a global in a function in some other module. If I understand
> your patch correctly it would recursively complain about all the
> instructions which have some use relation to the one that uses the bad
> global as opposed to just the first one.
I see, but can still use the general user walker by allowing the
callback to stop the recursion, no:
static void forEachUser(const Value *V, SmallPtrSet<const Value *, 32> &Visited,
llvm::function_ref<void(const Value *)> Callback) {
if (!Visited.insert(V).second)
return;
for (const Value *U : V->materialized_users()) {
if (Callback(U))
forEachUser(U, Visited, Callback);
}
}
Cheers,
Rafael
More information about the llvm-commits
mailing list