fix #6068, invalid IR for constant conditions in some cases