diff --git a/llvm/include/llvm/Transforms/Utils/FunctionComparator.h b/llvm/include/llvm/Transforms/Utils/FunctionComparator.h --- a/llvm/include/llvm/Transforms/Utils/FunctionComparator.h +++ b/llvm/include/llvm/Transforms/Utils/FunctionComparator.h @@ -332,7 +332,7 @@ int cmpInlineAsm(const InlineAsm *L, const InlineAsm *R) const; int cmpAttrs(const AttributeList L, const AttributeList R) const; int cmpRangeMetadata(const MDNode *L, const MDNode *R) const; - int cmpOperandBundlesSchema(const Instruction *L, const Instruction *R) const; + int cmpOperandBundlesSchema(const CallBase &LCS, const CallBase &RCS) const; /// Compare two GEPs for equivalent pointer arithmetic. /// Parts to be compared for each comparison stage, diff --git a/llvm/lib/Transforms/Utils/FunctionComparator.cpp b/llvm/lib/Transforms/Utils/FunctionComparator.cpp --- a/llvm/lib/Transforms/Utils/FunctionComparator.cpp +++ b/llvm/lib/Transforms/Utils/FunctionComparator.cpp @@ -171,21 +171,17 @@ return 0; } -// FIXME(CallSite): the parameters should be CallBase -int FunctionComparator::cmpOperandBundlesSchema(const Instruction *L, - const Instruction *R) const { - const CallBase *LCS = cast(L); - const CallBase *RCS = cast(R); - - assert(LCS->getOpcode() == RCS->getOpcode() && "Can't compare otherwise!"); +int FunctionComparator::cmpOperandBundlesSchema(const CallBase &LCS, + const CallBase &RCS) const { + assert(LCS.getOpcode() == RCS.getOpcode() && "Can't compare otherwise!"); if (int Res = - cmpNumbers(LCS->getNumOperandBundles(), RCS->getNumOperandBundles())) + cmpNumbers(LCS.getNumOperandBundles(), RCS.getNumOperandBundles())) return Res; - for (unsigned i = 0, e = LCS->getNumOperandBundles(); i != e; ++i) { - auto OBL = LCS->getOperandBundleAt(i); - auto OBR = RCS->getOperandBundleAt(i); + for (unsigned I = 0, E = LCS.getNumOperandBundles(); I != E; ++I) { + auto OBL = LCS.getOperandBundleAt(I); + auto OBR = RCS.getOperandBundleAt(I); if (int Res = OBL.getTagName().compare(OBR.getTagName())) return Res; @@ -592,7 +588,7 @@ return Res; if (int Res = cmpAttrs(CBL->getAttributes(), CBR->getAttributes())) return Res; - if (int Res = cmpOperandBundlesSchema(L, R)) + if (int Res = cmpOperandBundlesSchema(*CBL, *CBR)) return Res; if (const CallInst *CI = dyn_cast(L)) if (int Res = cmpNumbers(CI->getTailCallKind(),