From 8918cb42db786e097aca4542d9047985b6633838 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Mon, 2 Apr 2007 02:08:05 +0000 Subject: [PATCH] Upgrade the bit count intrinsics to have an i32 result. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35578 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-upgrade/UpgradeParser.y | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tools/llvm-upgrade/UpgradeParser.y b/tools/llvm-upgrade/UpgradeParser.y index 37373cfa6d5..9cc29fb61b4 100644 --- a/tools/llvm-upgrade/UpgradeParser.y +++ b/tools/llvm-upgrade/UpgradeParser.y @@ -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( + 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 Params; -- 2.34.1