ScalarEvolution stores long lived raw pointers to objects owned by unique_ptrs in other passes. In ScalarEvolution, change addRequired() to addRequiredTransitive() to prevent required passes from being freed and thus preven dangling raw pointers.
IMHO, the current design needs a FIXME to eliminate the long lived raw pointers altogether. Barring that, some way to assert() if the raw pointers becomes dangling would help.