This is an archive of the discontinued LLVM Phabricator instance.

Remove Colours array in -print-changed=dot-cfg
ClosedPublic

Authored by jamieschmeiser on Dec 6 2021, 12:01 PM.

Details

Summary

The Colours array is apparently the source of TSAN errors. It is
unnecessary and was there to ease readability of the code. Remove it to
clean up the TSAN errors.

Diff Detail

Event Timeline

jamieschmeiser created this revision.Dec 6 2021, 12:01 PM
jamieschmeiser requested review of this revision.Dec 6 2021, 12:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 6 2021, 12:01 PM
aeubanks added inline comments.Dec 6 2021, 12:35 PM
llvm/lib/Passes/StandardInstrumentations.cpp
1272

should this be a std::string? it looks like it's referencing a std::string in DisplayEdge::DisplayEdge() that goes out of scope

Thanks for the fix!
It's best if @aeubanks approves, I'm unfamiliar with this code.

jamieschmeiser added inline comments.Dec 7 2021, 11:15 AM
llvm/lib/Passes/StandardInstrumentations.cpp
1272

I don't think so. This is referring to the member of this class and this class is a base of DisplayEdge. The Colour value is sent in during base construction and is a StringRef. All of the colour values that are stored and passed around are StringRefs and ultimately all refer back to the strings in the 3 options for specifying the colours so they should all have values and be in scope.

aeubanks accepted this revision.Dec 7 2021, 11:22 AM
This revision is now accepted and ready to land.Dec 7 2021, 11:22 AM
jamieschmeiser updated this revision to Diff 392483.EditedDec 7 2021, 11:23 AM

I've updated the patch with some changes to same parameter names (V -> Value, etc) and corresponding comments. The only substantive change in the update is that I changed DotCfgDiffNode::getEdge to DotCfgDiffNode::getEdgeColour and had it return a StringRef to the colour instead of the std::pair it previously did since the only use just extracted the colour from the pair (lines 1496 and 1769).

This revision was automatically updated to reflect the committed changes.