New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid value numbering when morphing casts that change signedness after global morph #18850

Closed
jakobbotsch opened this Issue Jul 10, 2018 · 1 comment

Comments

Projects
None yet
3 participants
@jakobbotsch
Collaborator

jakobbotsch commented Jul 10, 2018

The example is

// Generated by Fuzzlyn on 2018-07-07 14:53:26
// Seed: 3545793482977672966
// Reduced from 5.7 KiB to 0.6 KiB
// Debug: Outputs 32779
// Release: Outputs 4294934539
struct S0
{
    public bool F0;
    public short F1;
    public S0(short f1): this()
    {
        F1 = f1;
    }
}

public class Program
{
    static S0 s_1;
    static sbyte s_2;
    public static void Main()
    {
        s_2 = 0;
        M3();
    }

    static sbyte M3()
    {
        char var0 = default(char);
        s_1 = new S0(-32767);
        var vr6 = s_1.F0;
        M4(var0, 0, (ushort)(10L | s_1.F1), vr6, s_1.F1);
        return s_2;
    }

    static byte[] M4(char arg0, long arg1, uint arg2, bool arg3, short arg4)
    {
        System.GC.KeepAlive(arg2);
        System.Console.WriteLine(arg2);
        return new byte[]{0};
    }
}

Details here: #18816 (comment)

@RussKeldorph RussKeldorph added this to the 3.0 milestone Jul 10, 2018

@erozenfeld erozenfeld self-assigned this Jul 11, 2018

erozenfeld added a commit to erozenfeld/coreclr that referenced this issue Jul 11, 2018

Fixes for bugs in fgMorphCast and optNarrowTree.
The fix under NARROW_IND prevents transformation of, e.g.,
CAST      int <- ushort <- int
    CLS_VAR byte

into

CLS_VAR byte.

With the fix the CAST is not removed.

The fix under GT_CAST prevents transformation of, e.g.,

CAST      int <- ushort <- long
    CAST      long <- int
       expr short

into

expt short.

With the fix it gets transformed into

CAST      int <- ushort <- int
    expr short

Block cast optimizations in fgMorphCast if the cast exression is an
active CSE candidate.

Update cast exression value numbers when a cast is removed.

Fixes #18238, #18850.

No diffs in frameworks and tests (pmi and crossgen, x64 and x86), except for the added test cases.

erozenfeld added a commit to erozenfeld/coreclr that referenced this issue Jul 11, 2018

Fixes for bugs in fgMorphCast and optNarrowTree.
The fix under NARROW_IND prevents transformation of, e.g.,
CAST      int <- ushort <- int
    CLS_VAR byte

into

CLS_VAR byte.

With the fix the CAST is not removed.

The fix under GT_CAST prevents transformation of, e.g.,

CAST      int <- ushort <- long
    CAST      long <- int
       expr short

into

expt short.

With the fix it gets transformed into

CAST      int <- ushort <- int
    expr short

Block cast optimizations in fgMorphCast if the cast expression is an
active CSE candidate.

Update cast expression value numbers when a cast is removed.

Fixes #18238, #18850.

No diffs in frameworks and tests (pmi and crossgen, x64 and x86), except for the added test cases.

erozenfeld added a commit to erozenfeld/coreclr that referenced this issue Jul 12, 2018

Fixes for bugs in fgMorphCast and optNarrowTree.
The fix under NARROW_IND prevents transformation of, e.g.,
CAST      int <- ushort <- int
    CLS_VAR byte

into

CLS_VAR byte.

With the fix the CAST is not removed.

The fix under GT_CAST prevents transformation of, e.g.,

CAST      int <- ushort <- long
    CAST      long <- int
       expr short

into

expt short.

With the fix it gets transformed into

CAST      int <- ushort <- int
    expr short

Block cast optimizations in fgMorphCast if the cast expression is an
active CSE candidate.

Update cast expression value numbers when a cast is removed.

Fixes #18238, #18850.

No diffs in frameworks and tests (pmi and crossgen, x64 and x86), except for the added test cases.

erozenfeld added a commit that referenced this issue Jul 12, 2018

Fixes for bugs in fgMorphCast and optNarrowTree. (#18816)
The fix under NARROW_IND prevents transformation of, e.g.,
CAST      int <- ushort <- int
    CLS_VAR byte

into

CLS_VAR byte.

With the fix the CAST is not removed.

The fix under GT_CAST prevents transformation of, e.g.,

CAST      int <- ushort <- long
    CAST      long <- int
       expr short

into

expt short.

With the fix it gets transformed into

CAST      int <- ushort <- int
    expr short

Block cast optimizations in fgMorphCast if the cast expression is an
active CSE candidate.

Update cast expression value numbers when a cast is removed.

Fixes #18238, #18850.

No diffs in frameworks and tests (pmi and crossgen, x64 and x86), except for the added test cases.
@erozenfeld

This comment has been minimized.

Show comment
Hide comment
@erozenfeld

erozenfeld Jul 12, 2018

Member

Fixed by #18816.

Member

erozenfeld commented Jul 12, 2018

Fixed by #18816.

@erozenfeld erozenfeld closed this Jul 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment