Double check that passes correctly set their Modified status
authorserge-sans-paille <sguelton@redhat.com>
Thu, 28 May 2020 10:40:17 +0000 (12:40 +0200)
committerserge-sans-paille <sguelton@redhat.com>
Wed, 8 Jul 2020 15:36:13 +0000 (17:36 +0200)
commit37afd99c768b29c7df7c5f2eb645362fb61f9915
tree4de3ecb00aed7e3b892a2a57a28a3f499837dcc3
parenta15d798594ae340b037efec2cdba5ec77221e7e7
Double check that passes correctly set their Modified status

The approach is simple: if a pass reports that it's not modifying a
Function/Module, compute a loose hash of that Function/Module and compare it
with the original one. If we report no change but there's a hash change, then we
have an error.

This approach misses a lot of change but it's not super intrusive and can
detect most of the simple mistakes.

Differential Revision: https://reviews.llvm.org/D80916
llvm/lib/IR/LegacyPassManager.cpp
llvm/unittests/IR/LegacyPassManagerTest.cpp