summaryrefslogtreecommitdiffstats
path: root/bcinfo/BitcodeTranslator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'bcinfo/BitcodeTranslator.cpp')
-rw-r--r--bcinfo/BitcodeTranslator.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/bcinfo/BitcodeTranslator.cpp b/bcinfo/BitcodeTranslator.cpp
index 5335eba..b3bce31 100644
--- a/bcinfo/BitcodeTranslator.cpp
+++ b/bcinfo/BitcodeTranslator.cpp
@@ -23,6 +23,8 @@
#include "BitWriter_3_2/ReaderWriter_3_2.h"
+#include "StripUnkAttr/strip_unknown_attributes.h"
+
#define LOG_TAG "bcinfo"
#include <log/log.h>
@@ -68,6 +70,11 @@ static const unsigned int kMinimumCompatibleVersion_LLVM_3_0 = 14;
static const unsigned int kMinimumCompatibleVersion_LLVM_2_7 = 11;
+static void stripUnknownAttributes(llvm::Module *M) {
+ for (llvm::Function &F : *M)
+ slang::stripUnknownAttributes(F);
+}
+
BitcodeTranslator::BitcodeTranslator(const char *bitcode, size_t bitcodeSize,
unsigned int version)
: mBitcode(bitcode), mBitcodeSize(bitcodeSize), mTranslatedBitcode(nullptr),
@@ -145,6 +152,8 @@ bool BitcodeTranslator::translate() {
// Module ownership is handled by the context, so we don't need to free it.
llvm::Module *module = MOrErr.get();
+ stripUnknownAttributes(module);
+
std::string Buffer;
llvm::raw_string_ostream OS(Buffer);