Use getZExtOrTrunc instead of repeating the same logic.