[PATCH] D15272: [Verifier] Verifier that a GlobalValue is only used in this Module
Rafael Ávila de Espíndola via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 23 09:47:33 PST 2015
rafael added inline comments.
================
Comment at: lib/IR/Verifier.cpp:455
@@ +454,3 @@
+ llvm::function_ref<void(Function *)> FuncCallback) {
+ Value *User = TheUse.getUser();
+ if (!Visited.insert(User).second)
----------------
The user is the only thing this function uses.
Can you pass a "Value *User" instead and in the recursive call iterate over users() instead of uses()?
Can you add a comment describing what the function does (recursively wall every indirect user)?
================
Comment at: lib/IR/Verifier.cpp:460
@@ +459,3 @@
+ InstCallback(I);
+ else if (Function *F = dyn_cast<Function>(User))
+ FuncCallback(F);
----------------
How about having a single callback that takes a Value and do the cast in the callback?
================
Comment at: lib/IR/Verifier.cpp:492
@@ +491,3 @@
+ SmallPtrSet<const Value *, 32> Visited;
+ for (const Use &TheUse : GV.materialized_uses())
+ forEachInstructionAndFunctionUser(
----------------
This can also iterate over users, no?
http://reviews.llvm.org/D15272
More information about the llvm-commits
mailing list