This is an archive of the discontinued LLVM Phabricator instance.

[SCCP] Do not attempt to create constexpr for a scalable vector GEP
ClosedPublic

Authored by rahulana-quic on Aug 10 2023, 1:54 AM.

Details

Summary

Scalable vector GEPs are not constants and trying to create one for
these GEPs causes an assertion failure.

Diff Detail

Event Timeline

rahulana-quic created this revision.Aug 10 2023, 1:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2023, 1:54 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
rahulana-quic requested review of this revision.Aug 10 2023, 1:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2023, 1:54 AM
nikic added inline comments.Aug 10 2023, 2:15 AM
llvm/lib/Transforms/Utils/SCCPSolver.cpp
1542–1544

I think this would be cleaner. It should gracefully handle scalable vectors and also make the folding DL-aware.

llvm/test/Transforms/SCCP/vscale-gep.ll
3

verify is unnecessary.

Update the check to see if the GEP is constant-foldable.

rahulana-quic marked 2 inline comments as done.Aug 10 2023, 2:36 AM
paulwalker-arm accepted this revision.Aug 10 2023, 3:07 AM
This revision is now accepted and ready to land.Aug 10 2023, 3:07 AM
nikic accepted this revision.Aug 10 2023, 3:08 AM

LGTM as well.

@paulwalker-arm @nikic can one of you please commit this for me? The email is quic_rahulana@quicinc.com and the name is Rahul Anand Radhakrishnan. Thanks!

@paulwalker-arm @nikic can one of you please commit this for me? The email is quic_rahulana@quicinc.com and the name is Rahul Anand Radhakrishnan. Thanks!

Sure, I can commit it. Likely in the next hour or two.

@rahulana-quic : This patch as it stand is causing unit test failures. There may be others but I see at least:

Failed Tests (3):
  LLVM :: Transforms/FunctionSpecialization/function-specialization-constant-expression.ll
  LLVM :: Transforms/SCCP/2009-09-24-byval-ptr.ll
  LLVM :: Transforms/SCCP/apint-bigint2.ll

My guess it's likely down to extra optimisations gained by using the generic folder. Please update the review with full test coverage and assuming nobody sees an issue with the new output I'll try to land it tomorrow.

Fix failing tests

This revision was landed with ongoing or failed builds.Aug 11 2023, 4:08 AM
This revision was automatically updated to reflect the committed changes.