[PATCH] D15272: [Verifier] Verifier that a GlobalValue is only used in this Module

Keno Fischer via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 23 10:05:49 PST 2015

loladiro 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)
rafael wrote:
> 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);
rafael wrote:
> How about having a single callback that takes a Value and do the cast in the callback?
My concern was that I already have to check for the type here in order to see whether to call the callback or recurse, so I thought it was cleaner to have two callbacks, but I don't feel very strongly about that.


More information about the llvm-commits mailing list