This is an archive of the discontinued LLVM Phabricator instance.

[JumpThreading] NFC: Simplify ComputeValueKnownInPredecessorsImpl
ClosedPublic

Authored by kazu on Apr 7 2020, 5:58 PM.

Details

Summary

ComputeValueKnownInPredecessorsImpl is the main folding mechanism in
JumpThreading.cpp. To avoid potential infinite recursion while
chasing use-def chains, it uses:

DenseSet<std::pair<Value *, BasicBlock *>> &RecursionSet

to keep track of Value-BB pairs that we've processed.

Now, when ComputeValueKnownInPredecessorsImpl recursively calls
itself, it always passes BB as is, so the second element is always BB.

This patch simplifes the function by dropping "BasicBlock *" from
RecursionSet.

Diff Detail

Event Timeline

kazu created this revision.Apr 7 2020, 5:58 PM
efriedma accepted this revision.Apr 7 2020, 6:18 PM

LGTM

This revision is now accepted and ready to land.Apr 7 2020, 6:18 PM
This revision was automatically updated to reflect the committed changes.