diff --git a/llvm/lib/Passes/StandardInstrumentations.cpp b/llvm/lib/Passes/StandardInstrumentations.cpp --- a/llvm/lib/Passes/StandardInstrumentations.cpp +++ b/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); }); } diff --git a/llvm/test/Other/ChangePrinters/print-changed-D107989.ll b/llvm/test/Other/ChangePrinters/print-changed-D107989.ll new file mode 100644 --- /dev/null +++ b/llvm/test/Other/ChangePrinters/print-changed-D107989.ll @@ -0,0 +1,13 @@ +; 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 +}