This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Extend GetSignedVectorType to deal with non ExtVector types
ClosedPublic

Authored by sdardis on Apr 4 2017, 6:05 AM.

Details

Summary

This improves some error messages which would otherwise refer to
ext_vector_type types in contexts where there are no such types.

Factored out from D25866 at reviewer's request.

Diff Detail

Repository
rL LLVM

Event Timeline

bruno edited edge metadata.Apr 4 2017, 9:57 AM

Great! Thanks for improving this.

include/clang/Sema/Sema.h
9287 ↗(On Diff #94062)

Can you change WantExtVector to UseExtVector?

lib/Sema/SemaExpr.cpp
9719 ↗(On Diff #94062)

Do we really need to pass WantExtVector here? Why relying on V being ext_vector or generic isn't enough to define WantExtVector?

9803 ↗(On Diff #94062)

So in getLangOpts().OpenCL mode we want to get a ext_vec even if vType isn't ext_vec? Would that ever happen?

9821 ↗(On Diff #94062)

Same question applies here

11760 ↗(On Diff #94062)

Use the idiom ...(resultType, true/*WantExtVector*/);

test/Sema/vector-ops.c
16 ↗(On Diff #94062)

Can you also add a test for the CheckVectorLogicalOperands case?

sdardis updated this revision to Diff 94205.Apr 5 2017, 5:33 AM
sdardis marked 5 inline comments as done.

Addressed review comments, added more tests.

bruno accepted this revision.Apr 5 2017, 9:59 AM

Thanks Simon! LGTM

This revision is now accepted and ready to land.Apr 5 2017, 9:59 AM
ahatanak added inline comments.
lib/Sema/SemaExpr.cpp
9736 ↗(On Diff #94205)

This isn't particularly urgent, but can we use ASTContext ::getIntTypeForBitwidth here rather than calling getVectorType or getExtVectorType in many places?

sdardis marked an inline comment as done.Apr 6 2017, 3:49 AM
sdardis added inline comments.
lib/Sema/SemaExpr.cpp
9736 ↗(On Diff #94205)

Yeah, it appears we can. I'll commit the current version and post a refactoring patch.

This revision was automatically updated to reflect the committed changes.