This is an archive of the discontinued LLVM Phabricator instance.

[clang][dataflow][NFC] Remove LatticeJoinEffect from framework interfaces
AcceptedPublic

Authored by li.zhe.hua on Aug 11 2022, 9:02 AM.

Details

Summary

Though we request users implementing join to return a meaningful
LatticeJoinEffect, we never use the returned value. Requiring users
(and the framework) to continue calculating an unused value adds
unnecessary complexity.

Diff Detail

Event Timeline

li.zhe.hua created this revision.Aug 11 2022, 9:02 AM
Herald added a project: Restricted Project. · View Herald Transcript
li.zhe.hua requested review of this revision.Aug 11 2022, 9:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 11 2022, 9:02 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
xazax.hun accepted this revision.Aug 11 2022, 9:27 AM

Returning whether the lattice was changed can be a nice optimization when comparing lattice elements is expensive. On the other hand, it can be one more source of errors. I am fine with either approach, both can make sense depending on whether the goal is to make the interface easier to use or to have superb performance.

This revision is now accepted and ready to land.Aug 11 2022, 9:27 AM
gribozavr2 accepted this revision.Aug 11 2022, 4:22 PM

Returning whether the lattice was changed can be a nice optimization when comparing lattice elements is expensive. On the other hand, it can be one more source of errors. I am fine with either approach, both can make sense depending on whether the goal is to make the interface easier to use or to have superb performance.

Agreed and the performance consideration was the original motivation. But, then we never used it! Indeed, we'd have to rework the worklist algorithm to make use of return value so that, for each block, it saved the state immediately before the block (that is, after the join from incoming branches). Currently, we only save the state *after* the block.

That's why I suggested to Eric that we should remove it. We can revisit in the future: if it seems a valuable source of performance improvement, we can consider how best to modify the system at that point.