diff options
author | Gleb Popov <6yearold@gmail.com> | 2019-11-12 14:38:19 +0400 |
---|---|---|
committer | MartinNowack <martin.nowack@gmail.com> | 2019-11-15 15:43:11 +0000 |
commit | 3af34e6095ee64332c089c98128dcfbcccced65e (patch) | |
tree | 71f003c83f17a4c7bbd45f8b9436167dad8e7419 /lib/Module | |
parent | c33beaa330bc8917249575b285f4a083dfe81922 (diff) | |
download | klee-3af34e6095ee64332c089c98128dcfbcccced65e.tar.gz |
Implement @llvm.is.constant() intrinsic handling and add a test for it.
Diffstat (limited to 'lib/Module')
-rw-r--r-- | lib/Module/IntrinsicCleaner.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp index 2c86d56d..f59192c1 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp @@ -11,6 +11,7 @@ #include "klee/Config/Version.h" #include "llvm/Analysis/MemoryBuiltins.h" +#include "llvm/Analysis/ConstantFolding.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Function.h" @@ -324,6 +325,17 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { dirty = true; break; } +#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0) + case Intrinsic::is_constant: { + if(auto* constant = llvm::ConstantFoldInstruction(ii, ii->getModule()->getDataLayout())) + ii->replaceAllUsesWith(constant); + else + ii->replaceAllUsesWith(ConstantInt::getFalse(ii->getType())); + ii->eraseFromParent(); + dirty = true; + break; + } +#endif default: IL->LowerIntrinsicCall(ii); dirty = true; |