aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/Module
diff options
context:
space:
mode:
authorCristian Cadar <c.cadar@imperial.ac.uk>2013-08-15 06:02:42 -0700
committerCristian Cadar <c.cadar@imperial.ac.uk>2013-08-15 06:02:42 -0700
commit93d8088ed4498c340b740834dca0a7fa45e7b7eb (patch)
treee625cae1e3532bcfbdd0fe590e6fe3808b8430d9 /lib/Module
parent084084f98824ae69f96822c5c08377e7059b934f (diff)
parent6118766b35316702d7a360e6081558162584356e (diff)
downloadklee-93d8088ed4498c340b740834dca0a7fa45e7b7eb.tar.gz
Merge pull request #18 from MartinNowack/FeatureUMulOverflow
Patch Set III (update) Implemented llvm.umul.with.overflow
Diffstat (limited to 'lib/Module')
-rw-r--r--lib/Module/IntrinsicCleaner.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp
index b897fcc7..2f18c17e 100644
--- a/lib/Module/IntrinsicCleaner.cpp
+++ b/lib/Module/IntrinsicCleaner.cpp
@@ -107,7 +107,8 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b) {
break;
}
- case Intrinsic::uadd_with_overflow: {
+ case Intrinsic::uadd_with_overflow:
+ case Intrinsic::umul_with_overflow: {
IRBuilder<> builder(ii->getParent(), ii);
#if LLVM_VERSION_CODE < LLVM_VERSION(2, 8)
@@ -118,7 +119,12 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b) {
Value *op2 = ii->getArgOperand(1);
#endif
- Value *result = builder.CreateAdd(op1, op2);
+ Value *result = 0;
+ if (ii->getIntrinsicID() == Intrinsic::uadd_with_overflow)
+ result = builder.CreateAdd(op1, op2);
+ else
+ result = builder.CreateMul(op1, op2);
+
Value *overflow = builder.CreateICmpULT(result, op1);
Value *resultStruct =