This is an archive of the discontinued LLVM Phabricator instance.

[MemorySSA] Pass DT to the upward iterator for proper PhiTranslation.
ClosedPublic

Authored by asbirlea on Apr 28 2020, 11:42 PM.

Details

Summary

A valid DominatorTree is needed to do PhiTranslation.
Before this patch, a MemoryUse could be optimized to an access outside a loop, while the address it loads from is modified in the loop.
This can lead to a miscompile.

Diff Detail

Event Timeline

asbirlea created this revision.Apr 28 2020, 11:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 28 2020, 11:42 PM

oof. thanks for this!

lgtm once a few nits are addressed.

llvm/include/llvm/Analysis/MemorySSA.h
726

nit: unless style around auto has changed, please spell out const DominatorTree &

(dunno offhand if const is possible here necessary, but ...)

secondary nit: since MSSA is a pretty big class with a fair few users, can we call this getDomTree() instead?

This revision is now accepted and ready to land.Apr 29 2020, 12:10 AM
This revision was automatically updated to reflect the committed changes.