Skip to content

Placement of deref attribute on cir.load #1674

Closed
@Arthur-Chang016

Description

@Arthur-Chang016

by definition of deref attribute in LifetimeCheckPass::checkLoad

// Only interested in checking deference on top of pointer types.
// Note that usually the use of the invalid address happens at the
// load or store using the result of this loadOp.

given the c++ code:

int simple = *p;

we get cir:

%11 = cir.load deref align(8) %0 : !cir.ptr<!cir.ptr<!s32i>>, !cir.ptr<!s32i>
%12 = cir.load align(4) %11 : !cir.ptr<!s32i>, !s32i
cir.store align(4) %12, %3 : !s32i, !cir.ptr<!s32i>

however the %0 is actually the address storing p but not the p itself.
Shouldn't the deref be placed on statement %12 where the dereference actually happens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions