//===-- AutoUpgrade.cpp - Implement auto-upgrade helper functions ---------===////// The LLVM Compiler Infrastructure//// This file is distributed under the University of Illinois Open Source// License. See LICENSE.TXT for details.////===----------------------------------------------------------------------===////// This file implements the auto-upgrade helper functions ////===----------------------------------------------------------------------===//#include"llvm/AutoUpgrade.h"#include"llvm/Constants.h"#include"llvm/Function.h"#include"llvm/LLVMContext.h"#include"llvm/Module.h"#include"llvm/IntrinsicInst.h"#include"llvm/ADT/SmallVector.h"#include"llvm/Support/CallSite.h"#include"llvm/Support/ErrorHandling.h"#include"llvm/Support/IRBuilder.h"#include<cstring>usingnamespacellvm;staticboolUpgradeIntrinsicFunction1(Function*F,Function*&NewFn){assert(F&&"Illegal to upgrade a non-existent Function.");// Get the Function's name.conststd::string&Name=F->getName();// ConvenienceconstFunctionType*FTy=F->getFunctionType();// Quickly eliminate it, if it's not a candidate.if(Name.length()<=8||Name[0]!='l'||Name[1]!='l'||Name[2]!='v'||Name[3]!='m'||Name[4]!='.')returnfalse;Module*M=F->getParent();switch(Name[5]){default:break;case'a':