[PATCH] D121970: [Verify] check that BlockAddresses don't refer to functions with certain linkages which wont be emitted
Nick Desaulniers via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 17 15:47:26 PDT 2022
nickdesaulniers added a comment.
whoops, forgot to add my test!
================
Comment at: llvm/lib/IR/Verifier.cpp:2746-2754
+ // maybe use a set, too?
+ SmallVector<const User *, 4> Worklist(BA.user_begin(), BA.user_end());
+ while (!Worklist.empty()) {
+ const User *U = Worklist.pop_back_val();
+
+ Assert(!isa<GlobalValue>(U),
+ "BlockAddress refers to BasicBlock that will not be emitted");
----------------
So for ConstantExpr, I think we'll want a new SmallPtrSet<ConstantExpr*> member for Verifier, akin to `ConstantExprVisited` because theoretically, two different BlockAddresses could appear in the same ConstantExpr...oh, but we will need to revist the ConstantExpr each time for each BlockAddress, so nvm. Guess I should delete my comment above.
================
Comment at: llvm/test/Verifier/blockaddress.ll:42
+;--- e.ll
+; Test Instruction and ConstandExpr.
+; CHECK: BlockAddress refers to BasicBlock that will not be emitted
----------------
ConstantExpr
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121970/new/
https://reviews.llvm.org/D121970
More information about the llvm-commits
mailing list