Skip to content

Source info does not get propagated during inlining #5331

Open
@kfcripps

Description

@kfcripps

Building the following program:

control C(out bit<64> v64) {
    action a2(in bit<1> value) {
        v64 = (bit<64>)(int<64>)(int<1>)value;
    }

    action a() {
        a2(1);
    }

    table t {
        actions = { a; }
        default_action = a;
    }

    apply {
        t.apply();
    }
}

control proto(out bit<64> v64);
package top(proto p);

top(C()) main;

results in (note no source info):

[--Wwarn=overflow] warning: 1s1: signed value does not fit in 1 bits
[--Wwarn=mismatch] warning: -64w1: negative value with unsigned type

After the first LocalCopyPropagation pass, the IR looks like:

    @name("C.a") action a() {
        v64 = (bit<64>)(int<64>)(int<1>)1w1;
    }

and the ConstantFolding pass emits the warning.

I also noticed that, in the following IR generated by the ActionsInliner pass:

    @name("a2") action a2_0(@name("value") in bit<1> value_0) {
        v64 = (bit<64>)(int<64>)(int<1>)value_0;
    }
    @name("a") action a_0() {
        @inlinedFrom("a2") {
            @name("value") bit<1> value = 1w1;
            v64 = (bit<64>)(int<64>)(int<1>)value;
        }
    }

The PathExpression value in (bit<64>)(int<64>)(int<1>)value has no source info.

@ChrisDodd @asl Should ActionsInliner be propagating source info here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreTopics concerning the core segments of the compiler (frontend, midend, parser)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions