[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-06-07 Thread Gabor Buella via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL334174: [CodeGen] Improve diagnostics related to target attributes (authored by GBuella, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D46541

[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-06-05 Thread Craig Topper via Phabricator via cfe-commits
craig.topper accepted this revision. craig.topper added a comment. This revision is now accepted and ready to land. LGTM https://reviews.llvm.org/D46541 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/li

[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-06-05 Thread Gabor Buella via Phabricator via cfe-commits
GBuella marked an inline comment as done. GBuella added inline comments. Comment at: test/CodeGen/target-features-error-2.c:39 __m128d need_avx(__m128d a, __m128d b) { return _mm_cmp_sd(a, b, 0); // expected-error {{'__builtin_ia32_cmpsd' needs target feature avx}} } --

[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-06-05 Thread Gabor Buella via Phabricator via cfe-commits
GBuella updated this revision to Diff 150018. https://reviews.llvm.org/D46541 Files: lib/CodeGen/CodeGenFunction.cpp lib/CodeGen/CodeGenModule.cpp lib/CodeGen/CodeGenModule.h test/CodeGen/target-features-error-2.c test/CodeGen/target-features-error.c Index: test/CodeGen/target-features

[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-06-05 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments. Comment at: test/CodeGen/target-features-error-2.c:39 __m128d need_avx(__m128d a, __m128d b) { return _mm_cmp_sd(a, b, 0); // expected-error {{'__builtin_ia32_cmpsd' needs target feature avx}} } GBuella wrote: > craig.top

[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-06-05 Thread Gabor Buella via Phabricator via cfe-commits
GBuella added inline comments. Comment at: test/CodeGen/target-features-error-2.c:39 __m128d need_avx(__m128d a, __m128d b) { return _mm_cmp_sd(a, b, 0); // expected-error {{'__builtin_ia32_cmpsd' needs target feature avx}} } craig.topper wrote: > The 4 com

[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-06-05 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments. Comment at: test/CodeGen/target-features-error-2.c:39 __m128d need_avx(__m128d a, __m128d b) { return _mm_cmp_sd(a, b, 0); // expected-error {{'__builtin_ia32_cmpsd' needs target feature avx}} } The 4 compare functions he

[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-05-22 Thread Gabor Buella via Phabricator via cfe-commits
GBuella added a comment. In https://reviews.llvm.org/D46541#1106743, @craig.topper wrote: > I think you can pass StringRef(F).substr(1). That won't create a temporary > string. It will just create a StringRef pointing into the middle of an > existing std::string stored in the parsed attributes.

[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-05-22 Thread Gabor Buella via Phabricator via cfe-commits
GBuella updated this revision to Diff 147984. https://reviews.llvm.org/D46541 Files: lib/CodeGen/CodeGenFunction.cpp lib/CodeGen/CodeGenModule.cpp lib/CodeGen/CodeGenModule.h test/CodeGen/target-features-error-2.c test/CodeGen/target-features-error.c Index: test/CodeGen/target-features

[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-05-21 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment. I think you can pass StringRef(F).substr(1). That won't create a temporary string. It will just create a StringRef pointing into the middle of an existing std::string stored in the parsed attributes. https://reviews.llvm.org/D46541 _

[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-05-21 Thread Gabor Buella via Phabricator via cfe-commits
GBuella updated this revision to Diff 147775. GBuella added a comment. Fixed a horrible bug in the patch. Adding a ref to temporary string is not a wise thing to do, so I had to remove this line: ReqFeatures.push_back(F.substr(1)); Now the ReqFeatures vector can also refer to strings starting

[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-05-21 Thread Eric Christopher via Phabricator via cfe-commits
echristo added a comment. I think this will work, one inline comment. Might also be good to get a few different test cases, e.g. one where we're not seeing the alphabetically first as the minimum :) Comment at: lib/CodeGen/CodeGenModule.h:1085 + TargetAttr::ParsedTargetAtt

[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-05-15 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment. Ping @echristo https://reviews.llvm.org/D46541 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-05-09 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment. This looks pretty good to me. @echristo what do you think? https://reviews.llvm.org/D46541 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-05-09 Thread Gabor Buella via Phabricator via cfe-commits
GBuella updated this revision to Diff 145876. https://reviews.llvm.org/D46541 Files: lib/CodeGen/CodeGenFunction.cpp lib/CodeGen/CodeGenModule.cpp lib/CodeGen/CodeGenModule.h test/CodeGen/target-features-error-2.c test/CodeGen/target-features-error.c Index: test/CodeGen/target-features

[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-05-08 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments. Comment at: lib/CodeGen/CodeGenFunction.cpp:2342 // Only positive features are "required". - if (F.getValue()) + if (F.getValue()) { +if (std::any_of(ParsedAttr.Features.begin(), ParsedAttr.Features.end(), -

[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-05-08 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments. Comment at: lib/CodeGen/CodeGenFunction.cpp:2346 + return Feat.substr(1) == F.getKey(); + })) +ReqFeatures.insert(ReqFeatures.begin(), F.getKey()); This and the next line a

[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-05-08 Thread Gabor Buella via Phabricator via cfe-commits
GBuella updated this revision to Diff 145680. https://reviews.llvm.org/D46541 Files: lib/CodeGen/CodeGenFunction.cpp lib/CodeGen/CodeGenModule.cpp lib/CodeGen/CodeGenModule.h test/CodeGen/target-features-error-2.c test/CodeGen/target-features-error.c Index: test/CodeGen/target-features

[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-05-07 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments. Comment at: lib/CodeGen/CodeGenFunction.cpp:2271 +static bool hasRequiredFeature(StringRef Feature, + llvm::StringMap& CallerFeatureMap, + std::string &Missing) { '&'

[PATCH] D46541: [CodeGen] Improve diagnostics related to target attributes

2018-05-07 Thread Gabor Buella via Phabricator via cfe-commits
GBuella created this revision. GBuella added reviewers: craig.topper, echristo, dblaikie. Herald added a subscriber: cfe-commits. When requirement imposed by __target__ attributes on functions are not satisfied, prefer printing those requirements, which are explicitly mentioned in the attributes.