This patch adds logic to deal with the following constructions:
%iv = phi i64 ... %trunc = trunc i64 %iv to i32 %cmp = icmp <pred> i32 %trunc, %invariant
Replacing it with
%iv = phi i64 ... %cmp = icmp <pred> i64 %iv, sext/zext(%invariant)
In case if it is legal. Specifically, if %iv has signed comparison users, it is
required that sext(trunc(%iv)) == %iv, and if it has unsigned comparison
uses then we require zext(trunc(%iv)) == %iv. The current implementation
bails if %trunc has other uses than icmp, but in theory we can handle more
cases here (e.g. if the user of trunc is bitcast).