This is an archive of the discontinued LLVM Phabricator instance.

[JumpThread] We want to fold (not thread) when all predecessor go to single BB's successor.
ClosedPublic

Authored by trentxintong on Apr 23 2017, 9:28 AM.

Details

Summary

In case all predecessor go to a single successor of current BB. We want to fold (not thread).

I failed to update the phi nodes properly in the last patch https://reviews.llvm.org/rL300657.

Phi nodes values are per predecessor in LLVM.

Event Timeline

trentxintong created this revision.Apr 23 2017, 9:28 AM
trentxintong edited the summary of this revision. (Show Details)Apr 23 2017, 9:29 AM

@sanjoy Appreciate it if you can take a quick look :).

sanjoy accepted this revision.Apr 23 2017, 1:18 PM

lgtm with minor nit

lib/Transforms/Scalar/JumpThreading.cpp
1298

The TheOnlyDest variable name threw me off a bit. How about being 100% explicit, and using a bool SeenFirstBranchToOnlyDest;?

This revision is now accepted and ready to land.Apr 23 2017, 1:18 PM

Address comment

This revision was automatically updated to reflect the committed changes.