This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Resolve a few bugs in RISCVVIntrinsicUtils.cpp
ClosedPublic

Authored by 4vtomat on Jul 25 2023, 3:37 AM.

Details

Summary

This patch does a few things:

  1. Add a new type called Undefined to ScalarTypeKind.
  2. Make RVVType::applyModifier early return when encounter invalid ScalarType, otherwise it could be modified to "non-invalid" type in the following code.
  3. When FixedLMULType::SmallerThan is applied, the lmul should be "<" than specified one, so lmuls which are ">=" should be marked as invalid.

Diff Detail

Event Timeline

4vtomat created this revision.Jul 25 2023, 3:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 25 2023, 3:37 AM
4vtomat requested review of this revision.Jul 25 2023, 3:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 25 2023, 3:37 AM

Does it possible to add a precommit test case to show that we accept unexpected combination of the type?

eopXD added inline comments.Jul 26 2023, 12:31 AM
clang/lib/Sema/SemaRISCVVectorLookup.cpp
136

Could we just reuse Invalid?

4vtomat updated this revision to Diff 544254.Jul 26 2023, 1:25 AM

Add a test case for invalid example.

4vtomat added inline comments.Jul 26 2023, 1:31 AM
clang/lib/Sema/SemaRISCVVectorLookup.cpp
136

We can't reuse Invalid, since ScalarType in RVVType class is default to Invalid, we are not able to determine whether it's really invalid or not during applyModifier function, so that's the reason why I added Undefined to differentiate between default and really invalid.

kito-cheng accepted this revision.Aug 3 2023, 12:41 AM

LGTM

clang/lib/Sema/SemaRISCVVectorLookup.cpp
136

I has some question before too :P thanks for explanation!

This revision is now accepted and ready to land.Aug 3 2023, 12:41 AM
This revision was landed with ongoing or failed builds.Aug 3 2023, 1:48 AM
This revision was automatically updated to reflect the committed changes.