about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
authorMartin Nowack <martin@se.inf.tu-dresden.de>2012-11-19 22:00:19 +0100
committerMartin Nowack <martin@se.inf.tu-dresden.de>2013-08-15 14:29:24 +0200
commit6118766b35316702d7a360e6081558162584356e (patch)
treed3a5cdd5881d20ff15dbce1ce5c7d7a0440e0332 /lib
parent39616bca565f1d3f958dc7e0e071ac5dc64f5439 (diff)
downloadklee-6118766b35316702d7a360e6081558162584356e.tar.gz
Implemented llvm.umul.with.overflow
Diffstat (limited to 'lib')
-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 =