This is an archive of the discontinued LLVM Phabricator instance.

Allows scalable vectors in ComputeNumSignBits and isKnownNonNull
ClosedPublic

Authored by reames on Oct 30 2022, 1:06 PM.

Details

Summary

This is a follow up to D136470 which extends the same scheme used there to ComputeNumSignBits and isKnownNonNull. As a reminder, for scalable vectors we track a single bit which is implicitly broadcast to all lanes. We do not know how many lanes there are statically, and thus have to be conservative along paths which require exact sizes.

(Note: This patch is pending rebase over a couple new tests to demonstrate the change better - expect that Monday.)

Diff Detail

Event Timeline

reames created this revision.Oct 30 2022, 1:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 30 2022, 1:06 PM
reames requested review of this revision.Oct 30 2022, 1:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 30 2022, 1:06 PM
reames planned changes to this revision.Oct 30 2022, 1:12 PM

Tests needed.

And it looks like I missed a required bailout in IntToPtr and PtrToInt handling. (They both expect fixed sizes.) This also needs test coverage.

reames updated this revision to Diff 472092.Oct 31 2022, 12:21 PM

Rebase over tests, and be conservative about inttoptr or ptrtoint involving scalable types. These require a bit of care - and tests - to handle, so simply exclude them from the initial patch.

This revision is now accepted and ready to land.Oct 31 2022, 9:19 PM
This revision was landed with ongoing or failed builds.Nov 1 2022, 9:30 AM
This revision was automatically updated to reflect the committed changes.
paulwalker-arm added inline comments.Nov 1 2022, 9:55 AM
llvm/lib/Analysis/ValueTracking.cpp
2567

Minor quibble but this is implied by the following !isa<ScalableVectorType>(I->getType()) check.

reames added inline comments.Nov 1 2022, 1:26 PM
llvm/lib/Analysis/ValueTracking.cpp
2567

I agree. This isn't checked by castIsValid which is what I'd expected, but the verifier does directly compare the element counts which should fail if only one is scalable. Will remove in a follow up commit.

reames marked an inline comment as done.Nov 1 2022, 1:37 PM
reames added inline comments.
llvm/lib/Analysis/ValueTracking.cpp
2567

Done. 9472a81