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 @@ -677,7 +677,23 @@ return Res; } } - return 0; + + if (isa(L)) { + // Binary operation instructions and logical operation instructions have + // already been compared for opcode, number of operands, operation types, + // subclass optional data, operand types + return 0; + } + if (isa(L) || isa(L)) { + // InsertElement and ExtractElement instructions have already been compared + // for opcode, number of operands, operation types, subclass optional data, + // operand types + return 0; + } + + // Return left operation to be greater in case of instructions which are + // not seen. + return 1; } // Determine whether two GEP operations perform the same underlying arithmetic.