Index: llvm/lib/Passes/StandardInstrumentations.cpp =================================================================== --- llvm/lib/Passes/StandardInstrumentations.cpp +++ llvm/lib/Passes/StandardInstrumentations.cpp @@ -647,13 +647,12 @@ ChangedIRData::report( Before, After, [&](const ChangedFuncData *B, const ChangedFuncData *A) { + assert((B || A) && "Both functions cannot be missing."); ChangedFuncData Missing; if (!B) B = &Missing; else if (!A) A = &Missing; - assert(B != &Missing && A != &Missing && - "Both functions cannot be missing."); handleFunctionCompare(Name, Prefix, PassID, true, *B, *A); }); } Index: llvm/test/Other/print-changed-diff.ll =================================================================== --- /dev/null +++ llvm/test/Other/print-changed-diff.ll @@ -0,0 +1,15 @@ +; D107989 This triggered an assert + +; RUN: opt -passes=globalopt < %s -disable-output -print-changed=diff-quiet + +define signext i32 @main() { +entry: + ret i32 0 +} + +define internal void @f() { +entry: + ret void +} + +