This is an archive of the discontinued LLVM Phabricator instance.

Fix a block color copying problem in LICM
ClosedPublic

Authored by andrew.w.kaylor on Mar 22 2018, 9:38 PM.

Details

Summary

This fixes a problem in LICM where copying the ColorVector in SafetyInfo::BlockColors from one block to another can cause a crash if creating the new entry forces the map to be re-allocated. I have seen this problem occur in a real-world situation, but I don't have a small reproducer.

Diff Detail

Repository
rL LLVM

Event Timeline

Sigh.
(a quick scan of things named Map in LLVM doesn't find any other obvious cases of this).

I wonder if we shouldn't have a debug/expensive checks mode where it moves all the memory on find and construct to make all these situations fail obviously and instantly so it could be found by bots.

dberlin accepted this revision.Mar 22 2018, 10:11 PM
This revision is now accepted and ready to land.Mar 22 2018, 10:11 PM

Sigh.
(a quick scan of things named Map in LLVM doesn't find any other obvious cases of this).

I wonder if we shouldn't have a debug/expensive checks mode where it moves all the memory on find and construct to make all these situations fail obviously and instantly so it could be found by bots.

There used to be a case exactly like this in WinEHPrepare::replaceUseWithLoad(), which is how I knew how to fix this when I saw it crash. The debug mode is a good idea. Could that trigger off of one of the sanitizers somehow?

Wow, thank you so much for fixing this.

This revision was automatically updated to reflect the committed changes.