This is an archive of the discontinued LLVM Phabricator instance.

[Attributor][Fix] Initialize the cache prior to using it
ClosedPublic

Authored by jdoerfert on Sep 5 2019, 10:21 AM.

Details

Summary

There were segfaults as we modified and iterated the instruction maps in
the cache at the same time. This was happening because we created new
instructions while we populated the cache. This fix changes the order
in which we perform these actions. First, the caches for the whole
module are created, then we start to create abstract attributes.

I don't have a unit test but the LLVM test suite exposes this problem.

Diff Detail

Repository
rL LLVM

Event Timeline

jdoerfert created this revision.Sep 5 2019, 10:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 5 2019, 10:21 AM
jdoerfert updated this revision to Diff 219007.Sep 5 2019, 5:05 PM

Update tests

xbolva00 added inline comments.
llvm/lib/Transforms/IPO/Attributor.cpp
3051 ↗(On Diff #219007)

Check ´LivenessAA´ before loop

sstefan1 added inline comments.Sep 6 2019, 12:04 AM
llvm/lib/Transforms/IPO/Attributor.cpp
3051 ↗(On Diff #219007)

I don't think that is practical. If LivenessAA is not null, we would still need a way to indicate it can be dereferenced. Pred should be executed even if LivenessAA is null.

jdoerfert marked an inline comment as done.Sep 7 2019, 6:16 PM
jdoerfert added inline comments.
llvm/lib/Transforms/IPO/Attributor.cpp
3051 ↗(On Diff #219007)

I would need to duplicate the loop (as @sstefan1 noted) which is a compiler task ;)

sstefan1 accepted this revision.Sep 11 2019, 1:38 PM
This revision is now accepted and ready to land.Sep 11 2019, 1:38 PM
This revision was automatically updated to reflect the committed changes.