[m-rev.] diff: Slightly relax tailcall marking

Paul Bone paul at bone.id.au
Thu Oct 29 21:01:46 AEDT 2015


Slightly relax tailcall marking

A label does not affect if the call before it is in a tail call position.

compiler/ml_tailcall.m:
    As above.
---
 compiler/ml_tailcall.m | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/compiler/ml_tailcall.m b/compiler/ml_tailcall.m
index 16caa37..71f0057 100644
--- a/compiler/ml_tailcall.m
+++ b/compiler/ml_tailcall.m
@@ -343,9 +343,7 @@ mark_tailcalls_in_stmt(TCallInfo, Context, Warnings, AtTailAfter,
         AtTailBefore = no(have_not_seen_reccall),
         Stmt = ml_stmt_try_commit(Ref, Statement, Handler)
     ;
-        % XXX: Maybe not true for some of these.
-        ( Stmt0 = ml_stmt_label(_)
-        ; Stmt0 = ml_stmt_goto(_)
+        ( Stmt0 = ml_stmt_goto(_)
         ; Stmt0 = ml_stmt_computed_goto(_, _)
         ; Stmt0 = ml_stmt_do_commit(_Ref)
         ; Stmt0 = ml_stmt_atomic(_)
@@ -354,6 +352,11 @@ mark_tailcalls_in_stmt(TCallInfo, Context, Warnings, AtTailAfter,
         not_at_tail(AtTailAfter, AtTailBefore),
         Stmt = Stmt0
     ;
+        Stmt0 = ml_stmt_label(_),
+        Warnings = [],
+        AtTailBefore = AtTailAfter,
+        Stmt = Stmt0
+    ;
         Stmt0 = ml_stmt_return(ReturnVals),
         % The statement before a return statement is in a tail position.
         Warnings = [],
-- 
2.6.1




More information about the reviews mailing list