This is an archive of the discontinued LLVM Phabricator instance.

Fix a crash in Dependency Analysis
ClosedPublic

Authored by karthikthecool on Mar 4 2015, 7:49 AM.

Details

Summary

Hi All,
This crash is observed in Polybench/linear-algebra/solvers/dynprog in llvm lnt. The crash seems to be because of invalid memory access.

Memory corruption occurs when we access elements of Result->DV[SJ - 1]. This is because the ConstrainedLevels is based on Max Nesting Level and DVEntry in Result is based on Common Nesting levels between the 2 memory instructions which are being analyzed.
Memory corruption occurs when MaxLevels>CommonLevels and we access Result->DV[SJ - 1] to update direction based on constraints.
This patch adds a check to avoid memory corruption and conservatively exits the loop updating the direction when the above mentioned scenario occurs.

Please let me know your inputs on this patch.

Thanks and Regards
Karthik Bhat

Diff Detail

Repository
rL LLVM

Event Timeline

karthikthecool retitled this revision from to Fix a crash in Dependency Analysis.
karthikthecool updated this object.
karthikthecool edited the test plan for this revision. (Show Details)
karthikthecool added reviewers: hfinkel, dblaikie, spop.
karthikthecool set the repository for this revision to rL LLVM.
karthikthecool added a subscriber: Unknown Object (MLST).
hfinkel accepted this revision.Mar 10 2015, 7:21 AM
hfinkel edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Mar 10 2015, 7:21 AM

Thanks comitted as r231788.