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 @@ -2573,6 +2573,10 @@ class FunctionDecl : public DeclaratorDecl,
2573
2573
// / the target functionality.
2574
2574
bool isTargetMultiVersion () const ;
2575
2575
2576
+ // / True if this function is the default version of a multiversioned dispatch
2577
+ // / function as a part of the target functionality.
2578
+ bool isTargetMultiVersionDefault () const ;
2579
+
2576
2580
// / True if this function is a multiversioned dispatch function as a part of
2577
2581
// / the target-clones functionality.
2578
2582
bool isTargetClonesMultiVersion () const ;
Original file line number Diff line number Diff line change @@ -3484,6 +3484,11 @@ bool FunctionDecl::isTargetMultiVersion() const {
3484
3484
(hasAttr<TargetAttr>() || hasAttr<TargetVersionAttr>());
3485
3485
}
3486
3486
3487
+ bool FunctionDecl::isTargetMultiVersionDefault () const {
3488
+ return isMultiVersion () && hasAttr<TargetVersionAttr>() &&
3489
+ getAttr<TargetVersionAttr>()->isDefaultVersion ();
3490
+ }
3491
+
3487
3492
bool FunctionDecl::isTargetClonesMultiVersion () const {
3488
3493
return isMultiVersion () && hasAttr<TargetClonesAttr>();
3489
3494
}
Original file line number Diff line number Diff line change @@ -1372,7 +1372,8 @@ void Sema::ActOnEndOfTranslationUnit() {
1372
1372
Diag (DiagD->getLocation (), diag::warn_unneeded_internal_decl)
1373
1373
<< /* function=*/ 0 << DiagD << DiagRange;
1374
1374
}
1375
- } else {
1375
+ } else if (!FD->isTargetMultiVersion () ||
1376
+ FD->isTargetMultiVersionDefault ()) {
1376
1377
if (FD->getDescribedFunctionTemplate ())
1377
1378
Diag (DiagD->getLocation (), diag::warn_unused_template)
1378
1379
<< /* 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