This is an archive of the discontinued LLVM Phabricator instance.

[Scalarizer] Fix potential for stale data in Scattered across invocations
ClosedPublic

Authored by wala on Jun 12 2015, 3:10 PM.

Details

Summary

Scalarizer has two data structures that hold information about changes
to the function, Gathered and Scattered. These are cleared in finish()
at the end of runOnFunction() if finish() detects any changes to the
function.

However, finish() was checking for changes by only checking if
Gathered was non-empty. The function visitStore() only modifies
Scattered without touching Gathered. As a result, Scattered could have
ended up having stale data if Scalarizer only scalarized store
instructions. Since the data in Scattered is used during the execution
of the pass, this introduced dangling pointer errors.

The fix is to check whether both Scattered and Gathered are empty
before deciding what to do in finish().

Diff Detail

Event Timeline

wala updated this revision to Diff 27608.Jun 12 2015, 3:10 PM
wala retitled this revision from to [Scalarizer] Fix potential for stale data in Scattered across invocations.
wala updated this object.
wala edited the test plan for this revision. (Show Details)
wala added a subscriber: Unknown Object (MLST).
srhines accepted this revision.Jun 12 2015, 3:51 PM
srhines added a reviewer: srhines.
This revision is now accepted and ready to land.Jun 12 2015, 3:51 PM
wala closed this revision.Jun 12 2015, 3:53 PM