You can use it to (mostly) validate small snippets are the same. See Alive2 for the application of Z3/formalization of programs as SMT for that [1]. As far as I'm aware there are some problems scaling up to arbitrarily sized programs due to a lack of formalization in higher level languages in addition to computational constraints. With a lot of time and effort it can be done though [2].
Yeah, this kind of thing is nice.
Alive had been used for years (almost a decade actually) by people to verify LLVM instcombine transforms.
Alive2 (https://github.com/AliveToolkit/alive2) makes it easier to do the same with most optimization passes.
Alive/Alive2 [1] is one of the most famous frameworks for compiler transformation verification using BitVec logic