File tree Expand file tree Collapse file tree 4 files changed +27
-1
lines changed Expand file tree Collapse file tree 4 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -2615,6 +2615,10 @@ class FunctionDecl : public DeclaratorDecl,
2615
2615
// / the target functionality.
2616
2616
bool isTargetMultiVersion () const ;
2617
2617
2618
+ // / True if this function is the default version of a multiversioned dispatch
2619
+ // / function as a part of the target functionality.
2620
+ bool isTargetMultiVersionDefault () const ;
2621
+
2618
2622
// / True if this function is a multiversioned dispatch function as a part of
2619
2623
// / the target-clones functionality.
2620
2624
bool isTargetClonesMultiVersion () const ;
Original file line number Diff line number Diff line change @@ -3537,6 +3537,11 @@ bool FunctionDecl::isTargetMultiVersion() const {
3537
3537
(hasAttr<TargetAttr>() || hasAttr<TargetVersionAttr>());
3538
3538
}
3539
3539
3540
+ bool FunctionDecl::isTargetMultiVersionDefault () const {
3541
+ return isMultiVersion () && hasAttr<TargetVersionAttr>() &&
3542
+ getAttr<TargetVersionAttr>()->isDefaultVersion ();
3543
+ }
3544
+
3540
3545
bool FunctionDecl::isTargetClonesMultiVersion () const {
3541
3546
return isMultiVersion () && hasAttr<TargetClonesAttr>();
3542
3547
}
Original file line number Diff line number Diff line change @@ -1393,7 +1393,8 @@ void Sema::ActOnEndOfTranslationUnit() {
1393
1393
Diag (DiagD->getLocation (), diag::warn_unneeded_internal_decl)
1394
1394
<< /* function=*/ 0 << DiagD << DiagRange;
1395
1395
}
1396
- } else {
1396
+ } else if (!FD->isTargetMultiVersion () ||
1397
+ FD->isTargetMultiVersionDefault ()) {
1397
1398
if (FD->getDescribedFunctionTemplate ())
1398
1399
Diag (DiagD->getLocation (), diag::warn_unused_template)
1399
1400
<< /* function=*/ 0 << DiagD << DiagRange;
Original file line number Diff line number Diff line change @@ -236,4 +236,20 @@ constexpr int constexpr4() { return 2; }
236
236
#endif
237
237
}
238
238
239
+ __attribute__ ((target_version(" fp16" )))
240
+ static int not_used_fmv(void ) { return 1 ; }
241
+ __attribute__ ((target_version(" fp16fml" )))
242
+ static int not_used_fmv(void ) { return 2 ; }
243
+ __attribute__ ((target_version(" default" )))
244
+ static int not_used_fmv(void ) { return 0 ; } // expected-warning {{unused function 'not_used_fmv'}}
245
+
246
+
247
+ __attribute__ ((target_version(" fp16" )))
248
+ static int definitely_used_fmv(void ) { return 1 ; }
249
+ __attribute__ ((target_version(" fp16fml" )))
250
+ static int definitely_used_fmv(void ) { return 2 ; }
251
+ __attribute__ ((target_version(" default" )))
252
+ static int definitely_used_fmv(void ) { return 0 ; }
253
+ int definite_user (void ) { return definitely_used_fmv (); }
254
+
239
255
#endif
You can’t perform that action at this time.
0 commit comments