[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Bug target/35659] [4.3/4.4 Regression] Miscompiled code with -O2 (but not with -O2 -funroll-loops) on ia64




------- Comment #20 from maxim at codesourcery dot com  2008-06-26 09:21 -------
Subject: Re:  [4.3/4.4 Regression] Miscompiled code with
 -O2 (but not with -O2 -funroll-loops) on ia64

jakub at gcc dot gnu dot org wrote:
> ------- Comment #19 from jakub at gcc dot gnu dot org  2008-06-26 08:41 -------
> To be more precise, the problem is in speculating conditional store:
>         ld4.a r18 = [r44]
>         st4 [r59] = r14, -60
> ...
>         cmp4.ge p6, p7 = r22, r18
>         (p7) ld4 r14 = [r62]
> ...
>         (p7) st4 [r77] = r14
>         chk.a.clr r18, .L69
> .L70:
> ...
> .L69:
>         ld4 r18 = [r44]
>         ;;
>         cmp4.ge p6, p7 = r22, r18
>         ;;
>         (p7) ld4 r14 = [r62]
>         ;;
>         (p7) st4 [r77] = r14
>         br .L70
> 
> Now, ld4.a returns the stale value in r18 (0x20202020), $r22 is 2 and so in the
> code before chk.a.clr p7 is 1, so [r62] is loaded into r14 and stored into
> [r77]
> (i.e. MR = M in IF     (K.GT.M1)                 MR = M is executed).
> Then chk.a.clr realizes the [r44] memory changed, so branches to .L69 to do the
> speculated stuff again.  This time r18 is 1, so p7 will be 0 and MR = M is not
> done.  But this really doesn't and can't undo the st4 [r77] = r14 store that
> already happened before chk.a.clr and wasn't supposed to happen.

Oh, now I see the problem.  I need some time to check what the best fix 
would be.  Probably, the fix will be to exclude predicated instructions 
from speculation set, but I'd like to consider alternatives.


Thanks,

Maxim


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35659

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Reply to: