This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Add Sema checks for MMA types
ClosedPublic

Authored by bsaleil on Jun 17 2020, 11:28 AM.

Details

Reviewers
nemanjai
saghir
lei
rsmith
amyk
Group Reviewers
Restricted Project
Commits
rGf976ba613958: [PowerPC] Add Sema checks for MMA types
Summary

The use of the new types introduced for PowerPC MMA instructions need to be restricted.
We add a PowerPC function to SemaChecking.cpp checking that the given type is valid in a context in which we don't allow MMA types.
This function is called from various places in Sema where we want to prevent the use of these types.

Depends on D81748

Diff Detail

Event Timeline

bsaleil created this revision.Jun 17 2020, 11:28 AM
bsaleil created this object with visibility "bsaleil (Baptiste Saleil)".
bsaleil created this object with edit policy "bsaleil (Baptiste Saleil)".
Herald added a project: Restricted Project. · View Herald TranscriptJun 17 2020, 11:28 AM
bsaleil added a reviewer: Restricted Project.Jun 19 2020, 6:14 PM
bsaleil changed the visibility from "bsaleil (Baptiste Saleil)" to "Public (No Login Required)".
bsaleil changed the edit policy from "bsaleil (Baptiste Saleil)" to "All Users".
bsaleil added a project: Restricted Project.Jun 19 2020, 6:16 PM
bsaleil updated this revision to Diff 301010.Oct 27 2020, 8:47 AM
bsaleil added reviewers: nemanjai, saghir, lei, rsmith.

Rebasing patch

amyk added a subscriber: amyk.Oct 28 2020, 10:27 AM
amyk added inline comments.
clang/lib/Sema/SemaChecking.cpp
3117

Would this be a better comment for this function (since it may be confusing to say return true if the type is invalid but the function name is CheckPPCValidType?

// Check if the given type is a non-pointer PPC MMA type. This function is used
// in Sema to prevent invalid uses of restricted PPC MMA types.
amyk added inline comments.Nov 2 2020, 9:39 AM
clang/lib/Sema/SemaChecking.cpp
3119

Would CheckPPCMMAType be a better name?

bsaleil updated this revision to Diff 302918.Nov 4 2020, 11:16 AM

Change function name and improve comment

amyk accepted this revision as: amyk.Nov 4 2020, 11:57 AM

Overall LGTM, thanks for addressing comments Baptiste!

This revision is now accepted and ready to land.Nov 4 2020, 11:57 AM
This revision was landed with ongoing or failed builds.Nov 4 2020, 3:02 PM
This revision was automatically updated to reflect the committed changes.
NeHuang added a subscriber: NeHuang.Nov 4 2020, 3:21 PM
NeHuang added inline comments.
clang/lib/Sema/SemaChecking.cpp
9966

CheckPPCMMAType returns bool value. Do we need add it in the if condition (similar as CheckNonNullExpr above) and execute a Diag()? or I may miss something here.

bsaleil added inline comments.Nov 4 2020, 3:34 PM
clang/lib/Sema/SemaChecking.cpp
9966

CheckPPCMMAType already emits the Diag if the type is invalid. That function also returns a bool in case the caller needs to do additional work when the type is invalid. It is not the case here, the Diag is enough so we do nothing with the result.