Skip to content

DependenceAnalysis is not access size aware. #16183

Closed
@etherzhhb

Description

@etherzhhb
Bugzilla Link 15811
Version trunk
OS All
Attachments The patch to add the fail case.
CC @etherzhhb

Extended Description

Consider the following function:

define i64 @​alias(i32* nocapture %A) nounwind uwtable {
entry:
%arrayidx = getelementptr inbounds i32* %A, i64 1
store i32 2, i32* %arrayidx, align 4
%0 = bitcast i32* %A to i64*
%1 = load i64* %0, align 8
ret i64 %1
}

Ignoring size of the memory location accessed in
store i32 2, i32* %arrayidx, align 4
and
%1 = load i64* %0, align 8,

The addresses pointed by %arrayidx and %0 doesn't alias each other, and hence DependenceAnalysis claims there is not dependencies from the store to the load, and gives the following output:
da analyze - none!
da analyze - none!
da analyze - none!

However, the above result is incorrect (at least for x86), there should be a dependency from from the store to the load, because the memory location written by the store overlap with the memory location read by the load.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions