diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-01-15 19:00:20 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-01-15 19:00:20 +0000 |
commit | 257a35368ff898d9f6f61ca86fa8ca5cc942385c (patch) | |
tree | 0baac849283f62ce74bb5c3ceac29bf25212d4d1 /llvm/tools/llvm-extract/llvm-extract.cpp | |
parent | d4a0d188996d9bd0293b80826bc6fbc2a34d5d5b (diff) | |
download | bcm5719-llvm-257a35368ff898d9f6f61ca86fa8ca5cc942385c.tar.gz bcm5719-llvm-257a35368ff898d9f6f61ca86fa8ca5cc942385c.zip |
Bring back "Assert that we have all use/users in the getters."
This reverts commit r257751, bringing back r256105.
The problem the assert found was fixed in r257915.
Original commit message:
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: 257920
Diffstat (limited to 'llvm/tools/llvm-extract/llvm-extract.cpp')
-rw-r--r-- | llvm/tools/llvm-extract/llvm-extract.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/llvm/tools/llvm-extract/llvm-extract.cpp b/llvm/tools/llvm-extract/llvm-extract.cpp index de4288dd6ad..1da456d33f5 100644 --- a/llvm/tools/llvm-extract/llvm-extract.cpp +++ b/llvm/tools/llvm-extract/llvm-extract.cpp @@ -242,13 +242,22 @@ int main(int argc, char **argv) { } } + { + std::vector<GlobalValue *> Gvs(GVs.begin(), GVs.end()); + legacy::PassManager Extract; + Extract.add(createGVExtractionPass(Gvs, DeleteFn)); + Extract.run(*M); + + // Now that we have all the GVs we want, mark the module as fully + // materialized. + // FIXME: should the GVExtractionPass handle this? + M->materializeAll(); + } + // In addition to deleting all other functions, we also want to spiff it // up a little bit. Do this now. legacy::PassManager Passes; - std::vector<GlobalValue*> Gvs(GVs.begin(), GVs.end()); - - Passes.add(createGVExtractionPass(Gvs, DeleteFn)); if (!DeleteFn) Passes.add(createGlobalDCEPass()); // Delete unreachable globals Passes.add(createStripDeadDebugInfoPass()); // Remove dead debug info |