Upgrade the bit count intrinsics to have an i32 result.

llvm-svn: 35578
This commit is contained in:
Reid Spencer 2007-04-02 02:08:05 +00:00
parent ff0b24925c
commit ad1ee4e65a

View File

@ -1466,6 +1466,25 @@ upgradeIntrinsicCall(const Type* RetTy, const ValID &ID,
return new CallInst(F, Args[0]);
}
break;
case 'c':
if ((Name.length() <= 14 && !memcmp(&Name[5], "ctpop.i", 7)) ||
(Name.length() <= 13 && !memcmp(&Name[5], "ctlz.i", 6)) ||
(Name.length() <= 13 && !memcmp(&Name[5], "cttz.i", 6))) {
// These intrinsics changed their result type.
const Type* ArgTy = Args[0]->getType();
Function *OldF = CurModule.CurrentModule->getFunction(Name);
if (OldF)
OldF->setName("upgrd.rm." + Name);
Function *NewF = cast<Function>(
CurModule.CurrentModule->getOrInsertFunction(Name, Type::Int32Ty,
ArgTy, (void*)0));
Instruction *Call = new CallInst(NewF, Args[0], "", CurBB);
return CastInst::createIntegerCast(Call, RetTy, false);
}
break;
case 'v' : {
const Type* PtrTy = PointerType::get(Type::Int8Ty);
std::vector<const Type*> Params;