r345840 slightly changed the way promotion happens which could result in zext and truncs having the same source and destination types. This fixes that issue.
We can now also remove the zext and trunc in the following case:
(zext (trunc (promoted op)), i32)
This means that we can no longer treat a value, that is only used by a sink, to be safe to promote.
I've also added in some extra asserts and replaced a cast for a dyn_cast.
Nit, instead of:
perhaps this?