diff --git a/src/eval.c b/src/eval.c
index b1f7a86..e5c1dbf 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -3596,7 +3596,13 @@
 	    clear_tv(rettv);
 	    return FAIL;
 	}
-	return typval_compare(rettv, &var2, type, type_is, ic, evaluate);
+	if (evaluate)
+	{
+	    int ret = typval_compare(rettv, &var2, type, type_is, ic);
+
+	    clear_tv(&var2);
+	    return ret;
+	}
     }
 
     return OK;
@@ -9091,229 +9097,210 @@
     }
 }
 
-
+/*
+ * Compare "typ1" and "typ2".  Put the result in "typ1".
+ */
     int
 typval_compare(
     typval_T	*typ1,   /* first operand */
     typval_T	*typ2,   /* second operand */
     exptype_T	type,    /* operator */
     int		type_is, /* TRUE for "is" and "isnot" */
-    int		ic,      /* ignore case */
-    int		evaluate)
+    int		ic)      /* ignore case */
 {
     int		i;
     varnumber_T	n1, n2;
     char_u	*s1, *s2;
     char_u	buf1[NUMBUFLEN], buf2[NUMBUFLEN];
 
-    if (evaluate)
+    if (type_is && typ1->v_type != typ2->v_type)
     {
-	if (type_is && typ1->v_type != typ2->v_type)
+	/* For "is" a different type always means FALSE, for "notis"
+	    * it means TRUE. */
+	n1 = (type == TYPE_NEQUAL);
+    }
+    else if (typ1->v_type == VAR_LIST || typ2->v_type == VAR_LIST)
+    {
+	if (type_is)
 	{
-	    /* For "is" a different type always means FALSE, for "notis"
-		* it means TRUE. */
-	    n1 = (type == TYPE_NEQUAL);
-	}
-	else if (typ1->v_type == VAR_LIST || typ2->v_type == VAR_LIST)
-	{
-	    if (type_is)
-	    {
-		n1 = (typ1->v_type == typ2->v_type
-				&& typ1->vval.v_list == typ2->vval.v_list);
-		if (type == TYPE_NEQUAL)
-		    n1 = !n1;
-	    }
-	    else if (typ1->v_type != typ2->v_type
-		    || (type != TYPE_EQUAL && type != TYPE_NEQUAL))
-	    {
-		if (typ1->v_type != typ2->v_type)
-		    EMSG(_("E691: Can only compare List with List"));
-		else
-		    EMSG(_("E692: Invalid operation for List"));
-		clear_tv(typ1);
-		clear_tv(typ2);
-		return FAIL;
-	    }
-	    else
-	    {
-		/* Compare two Lists for being equal or unequal. */
-		n1 = list_equal(typ1->vval.v_list, typ2->vval.v_list,
-								ic, FALSE);
-		if (type == TYPE_NEQUAL)
-		    n1 = !n1;
-	    }
-	}
-
-	else if (typ1->v_type == VAR_DICT || typ2->v_type == VAR_DICT)
-	{
-	    if (type_is)
-	    {
-		n1 = (typ1->v_type == typ2->v_type
-				&& typ1->vval.v_dict == typ2->vval.v_dict);
-		if (type == TYPE_NEQUAL)
-		    n1 = !n1;
-	    }
-	    else if (typ1->v_type != typ2->v_type
-		    || (type != TYPE_EQUAL && type != TYPE_NEQUAL))
-	    {
-		if (typ1->v_type != typ2->v_type)
-		    EMSG(_("E735: Can only compare Dictionary with Dictionary"));
-		else
-		    EMSG(_("E736: Invalid operation for Dictionary"));
-		clear_tv(typ1);
-		clear_tv(typ2);
-		return FAIL;
-	    }
-	    else
-	    {
-		/* Compare two Dictionaries for being equal or unequal. */
-		n1 = dict_equal(typ1->vval.v_dict, typ2->vval.v_dict,
-								ic, FALSE);
-		if (type == TYPE_NEQUAL)
-		    n1 = !n1;
-	    }
-	}
-
-	else if (typ1->v_type == VAR_FUNC || typ2->v_type == VAR_FUNC
-	    || typ1->v_type == VAR_PARTIAL || typ2->v_type == VAR_PARTIAL)
-	{
-	    if (type != TYPE_EQUAL && type != TYPE_NEQUAL)
-	    {
-		EMSG(_("E694: Invalid operation for Funcrefs"));
-		clear_tv(typ1);
-		clear_tv(typ2);
-		return FAIL;
-	    }
-	    if ((typ1->v_type == VAR_PARTIAL
-					    && typ1->vval.v_partial == NULL)
-		    || (typ2->v_type == VAR_PARTIAL
-					    && typ2->vval.v_partial == NULL))
-		/* when a partial is NULL assume not equal */
-		n1 = FALSE;
-	    else if (type_is)
-	    {
-		if (typ1->v_type == VAR_FUNC && typ2->v_type == VAR_FUNC)
-		    /* strings are considered the same if their value is
-			* the same */
-		    n1 = tv_equal(typ1, typ2, ic, FALSE);
-		else if (typ1->v_type == VAR_PARTIAL
-					    && typ2->v_type == VAR_PARTIAL)
-		    n1 = (typ1->vval.v_partial == typ2->vval.v_partial);
-		else
-		    n1 = FALSE;
-	    }
-	    else
-		n1 = tv_equal(typ1, typ2, ic, FALSE);
+	    n1 = (typ1->v_type == typ2->v_type
+			    && typ1->vval.v_list == typ2->vval.v_list);
 	    if (type == TYPE_NEQUAL)
 		n1 = !n1;
 	}
-
-#ifdef FEAT_FLOAT
-	/*
-	    * If one of the two variables is a float, compare as a float.
-	    * When using "=~" or "!~", always compare as string.
-	    */
-	else if ((typ1->v_type == VAR_FLOAT || typ2->v_type == VAR_FLOAT)
-		&& type != TYPE_MATCH && type != TYPE_NOMATCH)
+	else if (typ1->v_type != typ2->v_type
+		|| (type != TYPE_EQUAL && type != TYPE_NEQUAL))
 	{
-	    float_T f1, f2;
-
-	    if (typ1->v_type == VAR_FLOAT)
-		f1 = typ1->vval.v_float;
+	    if (typ1->v_type != typ2->v_type)
+		EMSG(_("E691: Can only compare List with List"));
 	    else
-		f1 = get_tv_number(typ1);
-	    if (typ2->v_type == VAR_FLOAT)
-		f2 = typ2->vval.v_float;
-	    else
-		f2 = get_tv_number(typ2);
-	    n1 = FALSE;
-	    switch (type)
-	    {
-		case TYPE_EQUAL:    n1 = (f1 == f2); break;
-		case TYPE_NEQUAL:   n1 = (f1 != f2); break;
-		case TYPE_GREATER:  n1 = (f1 > f2); break;
-		case TYPE_GEQUAL:   n1 = (f1 >= f2); break;
-		case TYPE_SMALLER:  n1 = (f1 < f2); break;
-		case TYPE_SEQUAL:   n1 = (f1 <= f2); break;
-		case TYPE_UNKNOWN:
-		case TYPE_MATCH:
-		case TYPE_NOMATCH:  break;  /* avoid gcc warning */
-	    }
-	}
-#endif
-
-	/*
-	    * If one of the two variables is a number, compare as a number.
-	    * When using "=~" or "!~", always compare as string.
-	    */
-	else if ((typ1->v_type == VAR_NUMBER || typ2->v_type == VAR_NUMBER)
-		&& type != TYPE_MATCH && type != TYPE_NOMATCH)
-	{
-	    n1 = get_tv_number(typ1);
-	    n2 = get_tv_number(typ2);
-	    switch (type)
-	    {
-		case TYPE_EQUAL:    n1 = (n1 == n2); break;
-		case TYPE_NEQUAL:   n1 = (n1 != n2); break;
-		case TYPE_GREATER:  n1 = (n1 > n2); break;
-		case TYPE_GEQUAL:   n1 = (n1 >= n2); break;
-		case TYPE_SMALLER:  n1 = (n1 < n2); break;
-		case TYPE_SEQUAL:   n1 = (n1 <= n2); break;
-		case TYPE_UNKNOWN:
-		case TYPE_MATCH:
-		case TYPE_NOMATCH:  break;  /* avoid gcc warning */
-	    }
+		EMSG(_("E692: Invalid operation for List"));
+	    clear_tv(typ1);
+	    return FAIL;
 	}
 	else
 	{
-	    s1 = get_tv_string_buf(typ1, buf1);
-	    s2 = get_tv_string_buf(typ2, buf2);
-	    if (type != TYPE_MATCH && type != TYPE_NOMATCH)
-		i = ic ? MB_STRICMP(s1, s2) : STRCMP(s1, s2);
-	    else
-		i = 0;
-	    n1 = FALSE;
-	    switch (type)
-	    {
-		case TYPE_EQUAL:    n1 = (i == 0); break;
-		case TYPE_NEQUAL:   n1 = (i != 0); break;
-		case TYPE_GREATER:  n1 = (i > 0); break;
-		case TYPE_GEQUAL:   n1 = (i >= 0); break;
-		case TYPE_SMALLER:  n1 = (i < 0); break;
-		case TYPE_SEQUAL:   n1 = (i <= 0); break;
-
-		case TYPE_MATCH:
-		case TYPE_NOMATCH:
-			n1 = pattern_match(s2, s1, ic);
-			if (type == TYPE_NOMATCH)
-			    n1 = !n1;
-			break;
-
-		case TYPE_UNKNOWN:  break;  /* avoid gcc warning */
-	    }
+	    /* Compare two Lists for being equal or unequal. */
+	    n1 = list_equal(typ1->vval.v_list, typ2->vval.v_list,
+							    ic, FALSE);
+	    if (type == TYPE_NEQUAL)
+		n1 = !n1;
 	}
-	clear_tv(typ1);
-	clear_tv(typ2);
-	typ1->v_type = VAR_NUMBER;
-	typ1->vval.v_number = n1;
     }
+
+    else if (typ1->v_type == VAR_DICT || typ2->v_type == VAR_DICT)
+    {
+	if (type_is)
+	{
+	    n1 = (typ1->v_type == typ2->v_type
+			    && typ1->vval.v_dict == typ2->vval.v_dict);
+	    if (type == TYPE_NEQUAL)
+		n1 = !n1;
+	}
+	else if (typ1->v_type != typ2->v_type
+		|| (type != TYPE_EQUAL && type != TYPE_NEQUAL))
+	{
+	    if (typ1->v_type != typ2->v_type)
+		EMSG(_("E735: Can only compare Dictionary with Dictionary"));
+	    else
+		EMSG(_("E736: Invalid operation for Dictionary"));
+	    clear_tv(typ1);
+	    return FAIL;
+	}
+	else
+	{
+	    /* Compare two Dictionaries for being equal or unequal. */
+	    n1 = dict_equal(typ1->vval.v_dict, typ2->vval.v_dict,
+							    ic, FALSE);
+	    if (type == TYPE_NEQUAL)
+		n1 = !n1;
+	}
+    }
+
+    else if (typ1->v_type == VAR_FUNC || typ2->v_type == VAR_FUNC
+	|| typ1->v_type == VAR_PARTIAL || typ2->v_type == VAR_PARTIAL)
+    {
+	if (type != TYPE_EQUAL && type != TYPE_NEQUAL)
+	{
+	    EMSG(_("E694: Invalid operation for Funcrefs"));
+	    clear_tv(typ1);
+	    return FAIL;
+	}
+	if ((typ1->v_type == VAR_PARTIAL
+					&& typ1->vval.v_partial == NULL)
+		|| (typ2->v_type == VAR_PARTIAL
+					&& typ2->vval.v_partial == NULL))
+	    /* when a partial is NULL assume not equal */
+	    n1 = FALSE;
+	else if (type_is)
+	{
+	    if (typ1->v_type == VAR_FUNC && typ2->v_type == VAR_FUNC)
+		/* strings are considered the same if their value is
+		    * the same */
+		n1 = tv_equal(typ1, typ2, ic, FALSE);
+	    else if (typ1->v_type == VAR_PARTIAL
+					&& typ2->v_type == VAR_PARTIAL)
+		n1 = (typ1->vval.v_partial == typ2->vval.v_partial);
+	    else
+		n1 = FALSE;
+	}
+	else
+	    n1 = tv_equal(typ1, typ2, ic, FALSE);
+	if (type == TYPE_NEQUAL)
+	    n1 = !n1;
+    }
+
+#ifdef FEAT_FLOAT
+    /*
+	* If one of the two variables is a float, compare as a float.
+	* When using "=~" or "!~", always compare as string.
+	*/
+    else if ((typ1->v_type == VAR_FLOAT || typ2->v_type == VAR_FLOAT)
+	    && type != TYPE_MATCH && type != TYPE_NOMATCH)
+    {
+	float_T f1, f2;
+
+	if (typ1->v_type == VAR_FLOAT)
+	    f1 = typ1->vval.v_float;
+	else
+	    f1 = get_tv_number(typ1);
+	if (typ2->v_type == VAR_FLOAT)
+	    f2 = typ2->vval.v_float;
+	else
+	    f2 = get_tv_number(typ2);
+	n1 = FALSE;
+	switch (type)
+	{
+	    case TYPE_EQUAL:    n1 = (f1 == f2); break;
+	    case TYPE_NEQUAL:   n1 = (f1 != f2); break;
+	    case TYPE_GREATER:  n1 = (f1 > f2); break;
+	    case TYPE_GEQUAL:   n1 = (f1 >= f2); break;
+	    case TYPE_SMALLER:  n1 = (f1 < f2); break;
+	    case TYPE_SEQUAL:   n1 = (f1 <= f2); break;
+	    case TYPE_UNKNOWN:
+	    case TYPE_MATCH:
+	    case TYPE_NOMATCH:  break;  /* avoid gcc warning */
+	}
+    }
+#endif
+
+    /*
+	* If one of the two variables is a number, compare as a number.
+	* When using "=~" or "!~", always compare as string.
+	*/
+    else if ((typ1->v_type == VAR_NUMBER || typ2->v_type == VAR_NUMBER)
+	    && type != TYPE_MATCH && type != TYPE_NOMATCH)
+    {
+	n1 = get_tv_number(typ1);
+	n2 = get_tv_number(typ2);
+	switch (type)
+	{
+	    case TYPE_EQUAL:    n1 = (n1 == n2); break;
+	    case TYPE_NEQUAL:   n1 = (n1 != n2); break;
+	    case TYPE_GREATER:  n1 = (n1 > n2); break;
+	    case TYPE_GEQUAL:   n1 = (n1 >= n2); break;
+	    case TYPE_SMALLER:  n1 = (n1 < n2); break;
+	    case TYPE_SEQUAL:   n1 = (n1 <= n2); break;
+	    case TYPE_UNKNOWN:
+	    case TYPE_MATCH:
+	    case TYPE_NOMATCH:  break;  /* avoid gcc warning */
+	}
+    }
+    else
+    {
+	s1 = get_tv_string_buf(typ1, buf1);
+	s2 = get_tv_string_buf(typ2, buf2);
+	if (type != TYPE_MATCH && type != TYPE_NOMATCH)
+	    i = ic ? MB_STRICMP(s1, s2) : STRCMP(s1, s2);
+	else
+	    i = 0;
+	n1 = FALSE;
+	switch (type)
+	{
+	    case TYPE_EQUAL:    n1 = (i == 0); break;
+	    case TYPE_NEQUAL:   n1 = (i != 0); break;
+	    case TYPE_GREATER:  n1 = (i > 0); break;
+	    case TYPE_GEQUAL:   n1 = (i >= 0); break;
+	    case TYPE_SMALLER:  n1 = (i < 0); break;
+	    case TYPE_SEQUAL:   n1 = (i <= 0); break;
+
+	    case TYPE_MATCH:
+	    case TYPE_NOMATCH:
+		    n1 = pattern_match(s2, s1, ic);
+		    if (type == TYPE_NOMATCH)
+			n1 = !n1;
+		    break;
+
+	    case TYPE_UNKNOWN:  break;  /* avoid gcc warning */
+	}
+    }
+    clear_tv(typ1);
+    typ1->v_type = VAR_NUMBER;
+    typ1->vval.v_number = n1;
+
     return OK;
 }
 
-    int
-typval_copy(typ1, typ2)
-    typval_T	*typ1;
-    typval_T	*typ2;
-{
-    if (typ2 == NULL)
-	rettv_list_alloc(typ2);
-
-    if (typ1 != NULL && typ2 != NULL)
-	return item_copy(typ1, typ2, TRUE, 0);
-
-    return FAIL;
-}
-
     char_u *
 typval_tostring(arg)
     typval_T	*arg;
