This is an archive of the discontinued LLVM Phabricator instance.

[LICM] Fix PR35342
ClosedPublic

Authored by junbuml on Nov 17 2017, 10:05 AM.

Details

Summary

This change fix PR35342 by rebuilding user_iterator which is invalidated after replacing users with undef in unreachable blocks.

Diff Detail

Event Timeline

junbuml created this revision.Nov 17 2017, 10:05 AM
efriedma added inline comments.Nov 17 2017, 11:54 AM
lib/Transforms/Scalar/LICM.cpp
909

Could we solve the problem by instead changing this call to replaceUsesOfWith with "U = UndefValue::get(I.getType());"? We shouldn't be resetting the iterators like this if we can avoid it.

junbuml updated this revision to Diff 123396.Nov 17 2017, 12:28 PM
junbuml marked an inline comment as done.
junbuml added inline comments.
lib/Transforms/Scalar/LICM.cpp
909

It seems to be a better fix.

Thanks Eli.

This revision is now accepted and ready to land.Nov 17 2017, 12:29 PM
This revision was automatically updated to reflect the committed changes.
junbuml marked an inline comment as done.