Stream: git-cranelift

Topic: cranelift / Issue #1383 ineg instruction on ssa values: r...


view this post on Zulip GitHub (Feb 08 2020 at 23:50):

peterdelevoryas opened Issue #1383:

Thanks for opening a bug report on Cranelift! Please answer the questions below
if they're relevant and delete this text before submitting.

function u0:0(i32, i64) -> i32 system_v {
    gv0 = symbol colocated u1:0
    sig0 = (i64, i64, i64, i64) -> i32 system_v
    fn0 = u0:1 sig0

block0(v0: i32, v1: i64):
    v2 = iconst.i32 1
    v3 = ineg v2
    return v3
}

error defining function "main": Compilation(
    Verifier(
        VerifierErrors(
            [
                VerifierError {
                    location: inst2,
                    context: None,
                    message: "v3 is a ghost value used by a real [Op1ret#c3] instruction",
                },
            ],
        ),
    ),
)

view this post on Zulip GitHub (Feb 08 2020 at 23:50):

peterdelevoryas labeled Issue #1383:

Thanks for opening a bug report on Cranelift! Please answer the questions below
if they're relevant and delete this text before submitting.

function u0:0(i32, i64) -> i32 system_v {
    gv0 = symbol colocated u1:0
    sig0 = (i64, i64, i64, i64) -> i32 system_v
    fn0 = u0:1 sig0

block0(v0: i32, v1: i64):
    v2 = iconst.i32 1
    v3 = ineg v2
    return v3
}

error defining function "main": Compilation(
    Verifier(
        VerifierErrors(
            [
                VerifierError {
                    location: inst2,
                    context: None,
                    message: "v3 is a ghost value used by a real [Op1ret#c3] instruction",
                },
            ],
        ),
    ),
)

view this post on Zulip GitHub (Feb 08 2020 at 23:54):

peterdelevoryas commented on Issue #1383:

Oh also, this isn't really a big deal, cause I guess you can always just construct an equivalent isub 0, v2 instruction or something

view this post on Zulip GitHub (Feb 10 2020 at 16:25):

bnjbvr commented on Issue #1383:

Hi! Thanks for opening an issue. Indeed, that's what the legalization in cranelift-codegen/src/isa/x86/enc_tables.rs does in convert_ineg. It could and should be done for non-vector types too. This is a good bug to learn about manipulating Cranelift's IR, if somebody wants to chime in!

view this post on Zulip GitHub (Feb 10 2020 at 16:26):

bnjbvr labeled Issue #1383:

Thanks for opening a bug report on Cranelift! Please answer the questions below
if they're relevant and delete this text before submitting.

function u0:0(i32, i64) -> i32 system_v {
    gv0 = symbol colocated u1:0
    sig0 = (i64, i64, i64, i64) -> i32 system_v
    fn0 = u0:1 sig0

block0(v0: i32, v1: i64):
    v2 = iconst.i32 1
    v3 = ineg v2
    return v3
}

error defining function "main": Compilation(
    Verifier(
        VerifierErrors(
            [
                VerifierError {
                    location: inst2,
                    context: None,
                    message: "v3 is a ghost value used by a real [Op1ret#c3] instruction",
                },
            ],
        ),
    ),
)

view this post on Zulip GitHub (Feb 11 2020 at 09:45):

peterdelevoryas commented on Issue #1383:

Hey I really appreciate the quick response! I looked into making the change: unfortunately, when I added a case in convert_ineg for scalar integer types, it doesn't seem to actually run. It seems like this legalization function is only applied to SIMD types: is there something somewhere that specifies that? I was unable to find it. I mean, something outside of convert_ineg. I am aware the the current implementation of convert_ineg only applies the transformation on int vector types. But I'm wondering if there's something _outside_ of convert_ineg that makes it only run on SIMD types.

view this post on Zulip GitHub (Feb 11 2020 at 09:57):

bjorn3 commented on Issue #1383:

convert_neg is called from https://github.com/bytecodealliance/cranelift/blob/98c818c129979e98a3db150f8f9698f6451b7ef7/cranelift-codegen/meta/src/isa/x86/legalize.rs#L612. Adding copies of that line with widen and expand instead of narrow may work. Please also add a test for both i8/i16 (widen) and i32/i64 (expand).

view this post on Zulip GitHub (Feb 14 2020 at 21:16):

abrown closed Issue #1383:

Thanks for opening a bug report on Cranelift! Please answer the questions below
if they're relevant and delete this text before submitting.

function u0:0(i32, i64) -> i32 system_v {
    gv0 = symbol colocated u1:0
    sig0 = (i64, i64, i64, i64) -> i32 system_v
    fn0 = u0:1 sig0

block0(v0: i32, v1: i64):
    v2 = iconst.i32 1
    v3 = ineg v2
    return v3
}

error defining function "main": Compilation(
    Verifier(
        VerifierErrors(
            [
                VerifierError {
                    location: inst2,
                    context: None,
                    message: "v3 is a ghost value used by a real [Op1ret#c3] instruction",
                },
            ],
        ),
    ),
)

Last updated: Nov 22 2024 at 16:03 UTC