This is an archive of the discontinued LLVM Phabricator instance.

Fix mergefunc infinite loop
ClosedPublic

Authored by jrkoenig on Jul 14 2015, 5:45 PM.

Details

Summary

Self-referential constants containing references to a merged function
no longer cause the MergeFunctions pass to infinite loop. Also adds a
reproduction IR which would otherwise fail, which was isolated from a similar
issue in Chromium.

Diff Detail

Repository
rL LLVM

Event Timeline

jrkoenig retitled this revision from to Fix mergefunc infinite loop.
jrkoenig updated this object.
jrkoenig added a reviewer: jfb.
jrkoenig added subscribers: jfb, nlewycky, llvm-commits.
nlewycky added inline comments.Jul 14 2015, 6:19 PM
lib/Transforms/IPO/MergeFunctions.cpp
1517–1520 ↗(On Diff #29738)

Just FYI as an optional alternative. You could use a single SetVector for both, call insert() to insert into it, track your position with an increasing integer, and never remove from it.

The way you've written it here is more common in llvm, I think.

1520 ↗(On Diff #29738)

"Variable names should be nouns (as they represent state). The name should be camel case, and start with an upper case letter (e.g. Leader or Boats)." - http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly

Fix variable name case

jfb accepted this revision.Jul 15 2015, 2:35 PM
jfb edited edge metadata.

lgtm, assuming @nlewycky is OK with the fix not using SetVector.

This revision is now accepted and ready to land.Jul 15 2015, 2:35 PM
nlewycky accepted this revision.Jul 15 2015, 2:39 PM
nlewycky added a reviewer: nlewycky.

No need to use SetVector.

This revision was automatically updated to reflect the committed changes.