sepavloff added a comment. I would propose to take some existing test, which fails with expensive checks enabled, and add `-enable-legalize-types-checking` to its RUN statement. Thus you can obtain a regression test 'for free'. https://reviews.llvm.org/D27113