Commit 5cee472b authored by Henrich Lauko's avatar Henrich Lauko

lart: Erase lart helper intrinsics after successful abstraction.

parent 7e90eae7
......@@ -2,6 +2,7 @@
#include <lart/abstract/cleanup.h>
#include <lart/abstract/domain.h>
#include <lart/abstract/stash.h> // unpacked_argument
#include <lart/support/cleanup.h>
#include <lart/support/query.h>
......@@ -17,6 +18,23 @@ void Cleanup::run( llvm::Module &m ) {
for ( auto i : insts ) {
i->dropUnknownNonDebugMetadata();
}
// erase argument matching intrinsics
auto argintrs = unpacked_arguments( &m );
auto intrs = query::query( argintrs )
.map( query::llvmdyncast< llvm::CallInst > )
.map( [] ( auto call ) {
return call->getCalledFunction();
} )
.freeze();
std::set< llvm::Function * > unique( intrs.begin(), intrs.end() );
for ( auto i : argintrs )
i->eraseFromParent();
for ( auto u : unique )
u->eraseFromParent();
}
} // namespace abstract
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment