This is an archive of the discontinued LLVM Phabricator instance.

[RS4GC] Handle uses of extractelement for conversion from vector to scalar base
ClosedPublic

Authored by anna on Mar 5 2020, 11:03 AM.

Details

Summary

As mentioned in the comments, extractelement is special
since we actually want a scalar base for that element we extracted from
the vector (i.e. not a vector base).
This same logic should apply to uses of the extractelement such as phis
and selects which have the same BDV as the extractelement.

Added testcase showcases the problem where the BDV identification chokes
on the incorrect cast from vector to scalar for the phi use of
extractelement.

Tests-Run: make check

Diff Detail

Event Timeline

anna created this revision.Mar 5 2020, 11:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 5 2020, 11:03 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
anna marked an inline comment as done.Mar 5 2020, 2:59 PM
anna added inline comments.
llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
959

Just realized this won't work in all cases since the base ptr identified may not dominate the derived ptr. Needs fixing.

anna marked an inline comment as not done.Mar 5 2020, 3:00 PM
anna updated this revision to Diff 248643.Mar 5 2020, 6:38 PM

fixed dominator error.

dantrushin accepted this revision.Mar 6 2020, 5:12 AM

LGTM, but what about test failure? Please fix it

This revision is now accepted and ready to land.Mar 6 2020, 5:12 AM
anna added a comment.Mar 6 2020, 7:55 AM

LGTM, but what about test failure? Please fix it

will do, thanks! forgot to update the test once I tested the patch internally.

anna updated this revision to Diff 248740.Mar 6 2020, 8:21 AM

changed to early-return, updated comments and test.

anna updated this revision to Diff 248766.Mar 6 2020, 9:43 AM

removed extra line. cleaned up whiitespace. NFC w.r.t. prev diff.

This revision was automatically updated to reflect the committed changes.