Index: llvm/lib/IR/AutoUpgrade.cpp =================================================================== --- llvm/lib/IR/AutoUpgrade.cpp +++ llvm/lib/IR/AutoUpgrade.cpp @@ -915,21 +915,21 @@ break; } - case 'c': { - if (Name.startswith("ctlz.") && F->arg_size() == 1) { - rename(F); - NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::ctlz, - F->arg_begin()->getType()); - return true; - } - if (Name.startswith("cttz.") && F->arg_size() == 1) { - rename(F); - NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::cttz, - F->arg_begin()->getType()); - return true; + case 'c': + // cttz & ctlz intrinsics had another argument added. + if (F->arg_size() == 1) { + Intrinsic::ID ID = StringSwitch(Name) + .StartsWith("ctlz.", Intrinsic::ctlz) + .StartsWith("cttz.", Intrinsic::cttz) + .Default(Intrinsic::not_intrinsic); + if (ID != Intrinsic::not_intrinsic) { + rename(F); + NewFn = Intrinsic::getDeclaration(F->getParent(), ID, + F->arg_begin()->getType()); + return true; + } } break; - } case 'd': if (Name.consume_front("dbg.")) { if (Name == "addr" || (Name == "value" && F->arg_size() == 4)) {