Index: llvm/lib/Transforms/Utils/FunctionComparator.cpp =================================================================== --- llvm/lib/Transforms/Utils/FunctionComparator.cpp +++ llvm/lib/Transforms/Utils/FunctionComparator.cpp @@ -787,6 +787,14 @@ if (ConstR) return -1; + if (auto LIL = dyn_cast(L), LIR = dyn_cast(R); + LIL && LIR) { + auto NNL = bool(LIL->getMetadata(LLVMContext::MD_nonnull)); + auto NNR = bool(LIR->getMetadata(LLVMContext::MD_nonnull)); + if (NNL != NNR) + return NNL - NNR; + } + const InlineAsm *InlineAsmL = dyn_cast(L); const InlineAsm *InlineAsmR = dyn_cast(R);