This is an archive of the discontinued LLVM Phabricator instance.

[SCEVExpander] Remember phi nodes inserted by LCSSA construction
ClosedPublic

Authored by nikic on May 16 2023, 8:16 AM.

Details

Summary

SCEVExpander keeps track of all instructions it inserted. However, it currently misses some phi nodes created during LCSSA construction. Fix this by collecting these into another argument.

This also removes the IRBuilder argument, which was added for essentially the same purpose, but only handles the root LCSSA nodes, not those inserted by SSAUpdater.

This was reported as a regression on D149344, but the reduced test case also reproduces without it.

Diff Detail

Event Timeline

nikic created this revision.May 16 2023, 8:16 AM
nikic requested review of this revision.May 16 2023, 8:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 16 2023, 8:16 AM

@fhahn Maybe it would be better to drop the IRBuilder argument and insert all phis into the vector? You added it in https://github.com/llvm/llvm-project/commit/a9b06a2c14f9a38ba16165f0343faaa9ae713fec specifically for the SCEVExpander use case, but as it is not sufficient, it might make sense to drop it again in this patch.

fhahn added a comment.May 24 2023, 1:12 AM

@fhahn Maybe it would be better to drop the IRBuilder argument and insert all phis into the vector? You added it in https://github.com/llvm/llvm-project/commit/a9b06a2c14f9a38ba16165f0343faaa9ae713fec specifically for the SCEVExpander use case, but as it is not sufficient, it might make sense to drop it again in this patch.

Sounds good to me, thanks for looking into this!

nikic updated this revision to Diff 525106.May 24 2023, 4:16 AM
nikic edited the summary of this revision. (Show Details)

Drop IRBuilder argument.

fhahn accepted this revision.May 24 2023, 7:39 AM

LGTM, thanks!

This revision is now accepted and ready to land.May 24 2023, 7:39 AM