From 6118766b35316702d7a360e6081558162584356e Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Mon, 19 Nov 2012 22:00:19 +0100 Subject: Implemented llvm.umul.with.overflow --- lib/Module/IntrinsicCleaner.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib') 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 = -- cgit 1.4.1