diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-12-19 20:03:23 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-12-19 20:03:23 +0000 |
commit | e01e363fd9c5a93fe0a584a47a00703ae18090f4 (patch) | |
tree | c6bbd3bb4b1db671119ef34cb58afd2aa4f7d972 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | 0334a047df7a1b9592221ac345e6c0663e56891d (diff) | |
download | bcm5719-llvm-e01e363fd9c5a93fe0a584a47a00703ae18090f4.tar.gz bcm5719-llvm-e01e363fd9c5a93fe0a584a47a00703ae18090f4.zip |
Assert that we have all use/users in the getters.
An error that is pretty easy to make is to use the lazy bitcode reader
and then do something like
if (V.use_empty())
The problem is that uses in unmaterialized functions are not accounted
for.
This patch adds asserts that all uses are known.
llvm-svn: 256105
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index d1f102704d6..7872a7b5849 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -3028,7 +3028,7 @@ std::error_code BitcodeReader::parseUseLists() { V = ValueList[ID]; unsigned NumUses = 0; SmallDenseMap<const Use *, unsigned, 16> Order; - for (const Use &U : V->uses()) { + for (const Use &U : V->materialized_uses()) { if (++NumUses > Record.size()) break; Order[&U] = Record[NumUses - 1]; @@ -5266,7 +5266,8 @@ std::error_code BitcodeReader::materialize(GlobalValue *GV) { // Upgrade any old intrinsic calls in the function. for (auto &I : UpgradedIntrinsics) { - for (auto UI = I.first->user_begin(), UE = I.first->user_end(); UI != UE;) { + for (auto UI = I.first->materialized_user_begin(), UE = I.first->user_end(); + UI != UE;) { User *U = *UI; ++UI; if (CallInst *CI = dyn_cast<CallInst>(U)) |