Browse Source

* fixed optimised form of a_cmp_const_reg_label(): when inverting the branch, we still
have to emit the label we originally allocated for the fallthrough path (otherwise
the branch is not inverted at all, and moreover the caller will also emit the
original target label somewhere so it will be doubly defined)

git-svn-id: branches/hlcgllvm@28367 -

Jonas Maebe 11 years ago
parent
commit
53e1d5c26f
1 changed files with 3 additions and 2 deletions
  1. 3 2
      compiler/llvm/hlcgllvm.pas

+ 3 - 2
compiler/llvm/hlcgllvm.pas

@@ -769,7 +769,7 @@ implementation
     var
     var
       tmpreg : tregister;
       tmpreg : tregister;
       invert: boolean;
       invert: boolean;
-      falselab, tmplab: tasmlabel;
+      fallthroughlab, falselab, tmplab: tasmlabel;
     begin
     begin
       { since all comparisons return their results in a register, we'll often
       { since all comparisons return their results in a register, we'll often
         get comparisons against true/false -> optimise }
         get comparisons against true/false -> optimise }
@@ -783,6 +783,7 @@ implementation
               invert:=a=1;
               invert:=a=1;
             end;
             end;
           current_asmdata.getjumplabel(falselab);
           current_asmdata.getjumplabel(falselab);
+          fallthroughlab:=falselab;
           if invert then
           if invert then
             begin
             begin
               tmplab:=l;
               tmplab:=l;
@@ -790,7 +791,7 @@ implementation
               falselab:=tmplab;
               falselab:=tmplab;
             end;
             end;
           list.concat(taillvm.op_size_reg_lab_lab(la_br,pasbool8type,reg,l,falselab));
           list.concat(taillvm.op_size_reg_lab_lab(la_br,pasbool8type,reg,l,falselab));
-          a_label(list,falselab);
+          a_label(list,fallthroughlab);
           exit;
           exit;
         end;
         end;
       tmpreg:=getregisterfordef(list,size);
       tmpreg:=getregisterfordef(list,size);