Skip to content

Miscompile in GVN due to MemDepAnalysis caching #111585

@alinas

Description

@alinas

The following miscompile was uncovered in GVN, to reproduce:
opt --passes=gvn gvntest.ll on gvntest.ll.txt

The miscompiled output is:
testafterbad.ll.txt

It appears that if the cache entry is cleared at MemoryDependenceAnalysis.cpp:1060 with NonLocalPointerDeps.erase(CacheKey); before the insert, the test is correct.
The resulting IR with this change:
testaftergood.ll.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    llvm:analysisIncludes value tracking, cost tables and constant foldingmiscompilation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions