[StandardInstrumentations] Handle case where block order changes
authorArthur Eubanks <aeubanks@google.com>
Tue, 26 Jul 2022 20:03:53 +0000 (13:03 -0700)
committerArthur Eubanks <aeubanks@google.com>
Mon, 8 Aug 2022 14:41:39 +0000 (07:41 -0700)
commit81c4e58e2adae7f9711253c07bc0c96dbc6d1b0b
treee5fcc10064cb0e3c3e832822afa75c46d1f0fbe8
parent0f5385b70eddfbcb26fed973a4d6e4cc01260930
[StandardInstrumentations] Handle case where block order changes

Previously we'd go off the end of the BI iterator because we expected
that the relative positions of common blocks before and after were
consistent. That's not always true though, for example with
jump-threading.

Reviewed By: jamieschmeiser

Differential Revision: https://reviews.llvm.org/D130596
llvm/lib/Passes/StandardInstrumentations.cpp
llvm/test/Other/ChangePrinters/print-changed-diff-block-ordering-changed.ll [new file with mode: 0644]